[vlc-commits] vaapi: remove unused vlc_vaapi_FilterHoldInstance()

Steve Lhomme git at videolan.org
Mon Dec 2 13:43:00 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Nov  8 14:45:35 2019 +0100| [5b8a97e96fd7ccef0016690f78eb9ab68cca573a] | committer: Steve Lhomme

vaapi: remove unused vlc_vaapi_FilterHoldInstance()

And the instance holder.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5b8a97e96fd7ccef0016690f78eb9ab68cca573a
---

 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 31ba2257c7..907e588701 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 28133309b2..aafb1383f4 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 4db2a5d81b..8a4dc6023d 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[];
 };
@@ -532,8 +530,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;
@@ -550,15 +546,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 d6aff44e95..ffcf68205f 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



More information about the vlc-commits mailing list