[vlc-devel] [PATCH 26/36] vaapi: remove unused vlc_vaapi_FilterHoldInstance()

Steve Lhomme robux4 at ycbcr.xyz
Thu Nov 21 15:14:17 CET 2019


And the instance holder.
---
 modules/hw/vaapi/filters.c   | 64 ------------------------------------
 modules/hw/vaapi/filters.h   |  8 -----
 modules/hw/vaapi/vlc_vaapi.c | 13 --------
 modules/hw/vaapi/vlc_vaapi.h |  4 ---
 4 files changed, 89 deletions(-)

diff --git a/modules/hw/vaapi/filters.c b/modules/hw/vaapi/filters.c
index 31ba2257c7f..907e5887011 100644
--- a/modules/hw/vaapi/filters.c
+++ b/modules/hw/vaapi/filters.c
@@ -32,70 +32,6 @@
 #include <vlc_plugin.h>
 #include "filters.h"
 
-/*******************
- * Instance holder *
- *******************/
-
-/* XXX: Static filters (like deinterlace) may not have access to a picture
- * allocated by the vout if it's not the first filter in the chain. That vout
- * picture is needed to get the VADisplay instance. Therefore, we store the
- * fist vaapi instance set by a filter so that it can be re-usable by others
- * filters. The instance is ref-counted, so there is no problem if the main
- * filter is destroyed before the other ones. */
-static struct {
-    vlc_mutex_t lock;
-    vlc_decoder_device *dec_device;
-    filter_t *owner;
-} holder = { VLC_STATIC_MUTEX, NULL, NULL };
-
-vlc_decoder_device *
-vlc_vaapi_FilterHoldInstance(filter_t *filter, VADisplay *dpy)
-{
-
-    picture_t *pic = filter_NewPicture(filter);
-    if (!pic)
-        return NULL;
-
-    if (!vlc_vaapi_IsChromaOpaque(pic->format.i_chroma))
-    {
-        picture_Release(pic);
-        return NULL;
-    }
-
-    vlc_decoder_device *dec_device = NULL;
-
-    vlc_mutex_lock(&holder.lock);
-    if (holder.dec_device != NULL)
-    {
-        dec_device = vlc_decoder_device_Hold(holder.dec_device);
-        *dpy = dec_device->opaque;
-    }
-    else
-    {
-        holder.owner = filter;
-        holder.dec_device = dec_device = pic->p_sys ?
-            vlc_vaapi_PicSysHoldInstance(pic->p_sys, dpy) : NULL;
-        assert(dec_device == NULL || dec_device->type == VLC_DECODER_DEVICE_VAAPI);
-    }
-    vlc_mutex_unlock(&holder.lock);
-    picture_Release(pic);
-
-    return dec_device;
-}
-
-void
-vlc_vaapi_FilterReleaseInstance(filter_t *filter,
-                                vlc_decoder_device *dec_device)
-{
-    vlc_decoder_device_Release(dec_device);
-    vlc_mutex_lock(&holder.lock);
-    if (filter == holder.owner)
-    {
-        holder.dec_device = NULL;
-        holder.owner = NULL;
-    }
-    vlc_mutex_unlock(&holder.lock);
-}
 /********************************
  * Common structures and macros *
  ********************************/
diff --git a/modules/hw/vaapi/filters.h b/modules/hw/vaapi/filters.h
index 28133309b22..aafb1383f49 100644
--- a/modules/hw/vaapi/filters.h
+++ b/modules/hw/vaapi/filters.h
@@ -31,12 +31,4 @@
 int  vlc_vaapi_OpenChroma(vlc_object_t *obj);
 void vlc_vaapi_CloseChroma(vlc_object_t *obj);
 
-/* Get and hold the VADisplay instance from a filter */
-vlc_decoder_device *
-vlc_vaapi_FilterHoldInstance(filter_t *filter, VADisplay *dpy);
-
-void
-vlc_vaapi_FilterReleaseInstance(filter_t *filter,
-                                vlc_decoder_device *dec_device);
-
 #endif /* VLC_VAAPI_FILTERS_H */
diff --git a/modules/hw/vaapi/vlc_vaapi.c b/modules/hw/vaapi/vlc_vaapi.c
index bf87cf0668e..cb81c5b3c30 100644
--- a/modules/hw/vaapi/vlc_vaapi.c
+++ b/modules/hw/vaapi/vlc_vaapi.c
@@ -410,8 +410,6 @@ struct vaapi_pic_ctx
 struct pic_sys_vaapi_instance
 {
     atomic_int pic_refcount;
-    VADisplay va_dpy;
-    vlc_video_context *vctx;
     unsigned num_render_targets;
     VASurfaceID render_targets[];
 };
@@ -533,8 +531,6 @@ vlc_vaapi_PoolNew(vlc_object_t *o, vlc_video_context *vctx,
         goto error_pic;
 
     atomic_store(&instance->pic_refcount, count);
-    instance->va_dpy = dpy;
-    instance->vctx = vctx;
 
     *render_targets = instance->render_targets;
     return pool;
@@ -551,15 +547,6 @@ error:
     return NULL;
 }
 
-vlc_decoder_device *
-vlc_vaapi_PicSysHoldInstance(void *_sys, VADisplay *dpy)
-{
-    picture_sys_t *sys = (picture_sys_t *)_sys;
-    assert(sys->instance != NULL);
-    *dpy = sys->instance->va_dpy;
-    return vlc_video_context_HoldDevice(sys->instance->vctx);
-}
-
 #define ASSERT_VAAPI_CHROMA(pic) do { \
     assert(vlc_vaapi_IsChromaOpaque(pic->format.i_chroma)); \
 } while(0)
diff --git a/modules/hw/vaapi/vlc_vaapi.h b/modules/hw/vaapi/vlc_vaapi.h
index d6aff44e95d..ffcf68205f4 100644
--- a/modules/hw/vaapi/vlc_vaapi.h
+++ b/modules/hw/vaapi/vlc_vaapi.h
@@ -173,10 +173,6 @@ vlc_vaapi_PoolNew(vlc_object_t *o, vlc_video_context *vctx,
                   VADisplay dpy, unsigned count, VASurfaceID **render_targets,
                   const video_format_t *restrict fmt);
 
-/* Get and hold the VADisplay instance attached to the picture sys */
-vlc_decoder_device *
-vlc_vaapi_PicSysHoldInstance(void *sys, VADisplay *dpy);
-
 /* Attachs the VASurface to the picture context, the picture must be allocated
  * by a vaapi pool (see vlc_vaapi_PoolNew()) */
 void
-- 
2.17.1



More information about the vlc-devel mailing list