From 24c3e0fcfa93592559e94a57aa898b9b57a3bc6a Mon Sep 17 00:00:00 2001 From: He Junyan Date: Wed, 10 Nov 2021 15:18:24 +0800 Subject: [PATCH] va: Delete the display lock/unlock when we call VA-API. According to the VA-API's description, they are MT-safe, we do not need to care about that in our middleware layer. The lock/unlock operations have overhead and make the performance lower. Part-of: --- .../gst-plugins-bad/gst-libs/gst/va/gstvadisplay.c | 48 ---------------------- .../gst-plugins-bad/gst-libs/gst/va/gstvadisplay.h | 4 -- subprojects/gst-plugins-bad/sys/va/gstvacaps.c | 10 ----- subprojects/gst-plugins-bad/sys/va/gstvadecoder.c | 28 ------------- .../gst-plugins-bad/sys/va/gstvadisplay_priv.c | 14 ------- subprojects/gst-plugins-bad/sys/va/gstvafilter.c | 38 ----------------- .../gst-plugins-bad/sys/va/gstvasurfacecopy.c | 2 - .../gst-plugins-bad/sys/va/vasurfaceimage.c | 26 ------------ 8 files changed, 170 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvadisplay.c b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvadisplay.c index 3b6d38c..db6a499 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvadisplay.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvadisplay.c @@ -49,7 +49,6 @@ GST_DEBUG_CATEGORY (gst_va_display_debug); typedef struct _GstVaDisplayPrivate GstVaDisplayPrivate; struct _GstVaDisplayPrivate { - GRecMutex lock; VADisplay display; gboolean foreign; @@ -191,10 +190,6 @@ gst_va_display_dispose (GObject * object) static void gst_va_display_finalize (GObject * object) { - GstVaDisplayPrivate *priv = GET_PRIV (object); - - g_rec_mutex_clear (&priv->lock); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -221,52 +216,9 @@ gst_va_display_init (GstVaDisplay * self) { GstVaDisplayPrivate *priv = GET_PRIV (self); - g_rec_mutex_init (&priv->lock); priv->impl = GST_VA_IMPLEMENTATION_INVALID; } -/** - * gst_va_display_lock: - * @self: a #GstVaDisplay - * - * Lock the display. It will be used before we call the - * VA API functions to serialize the VA commands. - * - * Since: 1.20 - **/ -void -gst_va_display_lock (GstVaDisplay * self) -{ - GstVaDisplayPrivate *priv; - - g_return_if_fail (GST_IS_VA_DISPLAY (self)); - - priv = GET_PRIV (self); - - g_rec_mutex_lock (&priv->lock); -} - -/** - * gst_va_display_unlock: - * @self: a #GstVaDisplay - * - * Unlock the display. It will be used after we call the - * VA API functions. - * - * Since: 1.20 - **/ -void -gst_va_display_unlock (GstVaDisplay * self) -{ - GstVaDisplayPrivate *priv; - - g_return_if_fail (GST_IS_VA_DISPLAY (self)); - - priv = GET_PRIV (self); - - g_rec_mutex_unlock (&priv->lock); -} - #ifndef GST_DISABLE_GST_DEBUG static gchar * _strip_msg (const char *message) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvadisplay.h b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvadisplay.h index ec8e933..e448755 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvadisplay.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvadisplay.h @@ -122,10 +122,6 @@ struct _GstVaDisplayClass GST_VA_API GType gst_va_display_get_type (void); GST_VA_API -void gst_va_display_lock (GstVaDisplay * self); -GST_VA_API -void gst_va_display_unlock (GstVaDisplay * self); -GST_VA_API gboolean gst_va_display_initialize (GstVaDisplay * self); GST_VA_API gpointer gst_va_display_get_va_dpy (GstVaDisplay * self); diff --git a/subprojects/gst-plugins-bad/sys/va/gstvacaps.c b/subprojects/gst-plugins-bad/sys/va/gstvacaps.c index 14724e9..481311f 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvacaps.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvacaps.c @@ -68,9 +68,7 @@ gst_va_get_surface_attribs (GstVaDisplay * display, VAConfigID config, dpy = gst_va_display_get_va_dpy (display); - gst_va_display_lock (display); status = vaQuerySurfaceAttributes (dpy, config, NULL, attrib_count); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (display, "vaQuerySurfaceAttributes: %s", vaErrorStr (status)); @@ -79,9 +77,7 @@ gst_va_get_surface_attribs (GstVaDisplay * display, VAConfigID config, attribs = g_new (VASurfaceAttrib, *attrib_count); - gst_va_display_lock (display); status = vaQuerySurfaceAttributes (dpy, config, attribs, attrib_count); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (display, "vaQuerySurfaceAttributes: %s", vaErrorStr (status)); @@ -248,9 +244,7 @@ gst_va_create_raw_caps (GstVaDisplay * display, VAProfile profile, dpy = gst_va_display_get_va_dpy (display); - gst_va_display_lock (display); status = vaCreateConfig (dpy, profile, entrypoint, &attrib, 1, &config); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (display, "vaCreateConfig: %s", vaErrorStr (status)); return NULL; @@ -258,9 +252,7 @@ gst_va_create_raw_caps (GstVaDisplay * display, VAProfile profile, caps = gst_va_create_raw_caps_from_config (display, config); - gst_va_display_lock (display); status = vaDestroyConfig (dpy, config); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (display, "vaDestroyConfig: %s", vaErrorStr (status)); return NULL; @@ -286,10 +278,8 @@ gst_va_create_coded_caps (GstVaDisplay * display, VAProfile profile, dpy = gst_va_display_get_va_dpy (display); - gst_va_display_lock (display); status = vaGetConfigAttributes (dpy, profile, entrypoint, attribs, G_N_ELEMENTS (attribs)); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (display, "vaGetConfigAttributes: %s", vaErrorStr (status)); diff --git a/subprojects/gst-plugins-bad/sys/va/gstvadecoder.c b/subprojects/gst-plugins-bad/sys/va/gstvadecoder.c index 2b80f72..aacf156 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvadecoder.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvadecoder.c @@ -238,9 +238,7 @@ gst_va_decoder_open (GstVaDecoder * self, VAProfile profile, guint rt_format) } dpy = gst_va_display_get_va_dpy (self->display); - gst_va_display_lock (self->display); status = vaCreateConfig (dpy, profile, VAEntrypointVLD, &attrib, 1, &config); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaCreateConfig: %s", vaErrorStr (status)); return FALSE; @@ -272,16 +270,12 @@ gst_va_decoder_close (GstVaDecoder * self) dpy = gst_va_display_get_va_dpy (self->display); if (self->context != VA_INVALID_ID) { - gst_va_display_lock (self->display); status = vaDestroyContext (dpy, self->context); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) GST_ERROR_OBJECT (self, "vaDestroyContext: %s", vaErrorStr (status)); } - gst_va_display_lock (self->display); status = vaDestroyConfig (dpy, self->config); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaDestroyConfig: %s", vaErrorStr (status)); return FALSE; @@ -329,10 +323,8 @@ gst_va_decoder_set_frame_size_with_surfaces (GstVaDecoder * self, dpy = gst_va_display_get_va_dpy (self->display); - gst_va_display_lock (self->display); status = vaCreateContext (dpy, self->config, coded_width, coded_height, VA_PROGRESSIVE, render_targets, num_render_targets, &context); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaDestroyConfig: %s", vaErrorStr (status)); @@ -555,9 +547,7 @@ gst_va_decoder_add_param_buffer (GstVaDecoder * self, GstVaDecodePicture * pic, g_return_val_if_fail (pic && data && size > 0, FALSE); dpy = gst_va_display_get_va_dpy (self->display); - gst_va_display_lock (self->display); status = vaCreateBuffer (dpy, self->context, type, size, 1, data, &buffer); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaCreateBuffer: %s", vaErrorStr (status)); return FALSE; @@ -582,19 +572,15 @@ gst_va_decoder_add_slice_buffer_with_n_params (GstVaDecoder * self, && params_data && params_size > 0, FALSE); dpy = gst_va_display_get_va_dpy (self->display); - gst_va_display_lock (self->display); status = vaCreateBuffer (dpy, self->context, VASliceParameterBufferType, params_size, params_num, params_data, ¶ms_buffer); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaCreateBuffer: %s", vaErrorStr (status)); return FALSE; } - gst_va_display_lock (self->display); status = vaCreateBuffer (dpy, self->context, VASliceDataBufferType, slice_size, 1, slice_data, &slice_buffer); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaCreateBuffer: %s", vaErrorStr (status)); return FALSE; @@ -642,19 +628,15 @@ gst_va_decoder_decode_with_aux_surface (GstVaDecoder * self, dpy = gst_va_display_get_va_dpy (self->display); - gst_va_display_lock (self->display); status = vaBeginPicture (dpy, self->context, surface); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_WARNING_OBJECT (self, "vaBeginPicture: %s", vaErrorStr (status)); goto fail_end_pic; } if (pic->buffers->len > 0) { - gst_va_display_lock (self->display); status = vaRenderPicture (dpy, self->context, (VABufferID *) pic->buffers->data, pic->buffers->len); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_WARNING_OBJECT (self, "vaRenderPicture: %s", vaErrorStr (status)); goto fail_end_pic; @@ -662,19 +644,15 @@ gst_va_decoder_decode_with_aux_surface (GstVaDecoder * self, } if (pic->slices->len > 0) { - gst_va_display_lock (self->display); status = vaRenderPicture (dpy, self->context, (VABufferID *) pic->slices->data, pic->slices->len); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_WARNING_OBJECT (self, "vaRenderPicture: %s", vaErrorStr (status)); goto fail_end_pic; } } - gst_va_display_lock (self->display); status = vaEndPicture (dpy, self->context); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) GST_WARNING_OBJECT (self, "vaEndPicture: %s", vaErrorStr (status)); else @@ -687,9 +665,7 @@ bail: fail_end_pic: { - gst_va_display_lock (self->display); status = vaEndPicture (dpy, self->context); - gst_va_display_unlock (self->display); goto bail; } } @@ -757,9 +733,7 @@ _destroy_buffers (GstVaDecodePicture * pic) if (pic->buffers) { for (i = 0; i < pic->buffers->len; i++) { buffer = g_array_index (pic->buffers, VABufferID, i); - gst_va_display_lock (pic->display); status = vaDestroyBuffer (dpy, buffer); - gst_va_display_unlock (pic->display); if (status != VA_STATUS_SUCCESS) { ret = FALSE; GST_WARNING ("Failed to destroy parameter buffer: %s", @@ -773,9 +747,7 @@ _destroy_buffers (GstVaDecodePicture * pic) if (pic->slices) { for (i = 0; i < pic->slices->len; i++) { buffer = g_array_index (pic->slices, VABufferID, i); - gst_va_display_lock (pic->display); status = vaDestroyBuffer (dpy, buffer); - gst_va_display_unlock (pic->display); if (status != VA_STATUS_SUCCESS) { ret = FALSE; GST_WARNING ("Failed to destroy slice buffer: %s", vaErrorStr (status)); diff --git a/subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.c b/subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.c index 7593f9e..1f64a88 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.c @@ -41,17 +41,13 @@ gst_va_display_get_profiles (GstVaDisplay * self, guint32 codec, dpy = gst_va_display_get_va_dpy (self); - gst_va_display_lock (self); num_profiles = vaMaxNumProfiles (dpy); num_entrypoints = vaMaxNumEntrypoints (dpy); - gst_va_display_unlock (self); profiles = g_new (VAProfile, num_profiles); entrypoints = g_new (VAEntrypoint, num_entrypoints); - gst_va_display_lock (self); status = vaQueryConfigProfiles (dpy, profiles, &num_profiles); - gst_va_display_unlock (self); if (status != VA_STATUS_SUCCESS) { GST_ERROR ("vaQueryConfigProfile: %s", vaErrorStr (status)); goto bail; @@ -61,10 +57,8 @@ gst_va_display_get_profiles (GstVaDisplay * self, guint32 codec, if (codec != gst_va_profile_codec (profiles[i])) continue; - gst_va_display_lock (self); status = vaQueryConfigEntrypoints (dpy, profiles[i], entrypoints, &num_entrypoints); - gst_va_display_unlock (self); if (status != VA_STATUS_SUCCESS) { GST_ERROR ("vaQueryConfigEntrypoints: %s", vaErrorStr (status)); goto bail; @@ -100,17 +94,13 @@ gst_va_display_get_image_formats (GstVaDisplay * self) dpy = gst_va_display_get_va_dpy (self); - gst_va_display_lock (self); max = vaMaxNumImageFormats (dpy); - gst_va_display_unlock (self); if (max == 0) return NULL; va_formats = g_new (VAImageFormat, max); - gst_va_display_lock (self); status = vaQueryImageFormats (dpy, va_formats, &num); - gst_va_display_unlock (self); gst_va_video_format_fix_map (va_formats, num); @@ -148,15 +138,11 @@ gst_va_display_has_vpp (GstVaDisplay * self) dpy = gst_va_display_get_va_dpy (self); - gst_va_display_lock (self); max = vaMaxNumEntrypoints (dpy); - gst_va_display_unlock (self); entrypoints = g_new (VAEntrypoint, max); - gst_va_display_lock (self); status = vaQueryConfigEntrypoints (dpy, VAProfileNone, entrypoints, &num); - gst_va_display_unlock (self); if (status != VA_STATUS_SUCCESS) { GST_ERROR ("vaQueryImageFormats: %s", vaErrorStr (status)); goto bail; diff --git a/subprojects/gst-plugins-bad/sys/va/gstvafilter.c b/subprojects/gst-plugins-bad/sys/va/gstvafilter.c index 83a0d9c..f74dc73 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvafilter.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvafilter.c @@ -203,10 +203,8 @@ gst_va_filter_ensure_config_attributes (GstVaFilter * self, dpy = gst_va_display_get_va_dpy (self->display); - gst_va_display_lock (self->display); status = vaGetConfigAttributes (dpy, VAProfileNone, VAEntrypointVideoProc, attribs, G_N_ELEMENTS (attribs)); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaGetConfigAttributes: %s", vaErrorStr (status)); return FALSE; @@ -332,10 +330,8 @@ gst_va_filter_ensure_pipeline_caps (GstVaFilter * self) dpy = gst_va_display_get_va_dpy (self->display); - gst_va_display_lock (self->display); status = vaQueryVideoProcPipelineCaps (dpy, self->context, NULL, 0, &self->pipeline_caps); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaQueryVideoProcPipelineCaps: %s", vaErrorStr (status)); @@ -372,10 +368,8 @@ gst_va_filter_open (GstVaFilter * self) dpy = gst_va_display_get_va_dpy (self->display); - gst_va_display_lock (self->display); status = vaCreateConfig (dpy, VAProfileNone, VAEntrypointVideoProc, &attrib, 1, &self->config); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaCreateConfig: %s", vaErrorStr (status)); return FALSE; @@ -384,10 +378,8 @@ gst_va_filter_open (GstVaFilter * self) if (!gst_va_filter_ensure_surface_attributes (self)) goto bail; - gst_va_display_lock (self->display); status = vaCreateContext (dpy, self->config, 0, 0, 0, NULL, 0, &self->context); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaCreateContext: %s", vaErrorStr (status)); goto bail; @@ -397,9 +389,7 @@ gst_va_filter_open (GstVaFilter * self) bail: { - gst_va_display_lock (self->display); status = vaDestroyConfig (dpy, self->config); - gst_va_display_unlock (self->display); return FALSE; } @@ -420,16 +410,12 @@ gst_va_filter_close (GstVaFilter * self) dpy = gst_va_display_get_va_dpy (self->display); if (self->context != VA_INVALID_ID) { - gst_va_display_lock (self->display); status = vaDestroyContext (dpy, self->context); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) GST_ERROR_OBJECT (self, "vaDestroyContext: %s", vaErrorStr (status)); } - gst_va_display_lock (self->display); status = vaDestroyConfig (dpy, self->config); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaDestroyConfig: %s", vaErrorStr (status)); return FALSE; @@ -520,14 +506,10 @@ gst_va_filter_ensure_filters (GstVaFilter * self) dpy = gst_va_display_get_va_dpy (self->display); - gst_va_display_lock (self->display); status = vaQueryVideoProcFilters (dpy, self->context, filter_types, &num); - gst_va_display_unlock (self->display); if (status == VA_STATUS_ERROR_MAX_NUM_EXCEEDED) { filter_types = g_try_realloc_n (filter_types, num, sizeof (*filter_types)); - gst_va_display_lock (self->display); status = vaQueryVideoProcFilters (dpy, self->context, filter_types, &num); - gst_va_display_unlock (self->display); } if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaQueryVideoProcFilters: %s", vaErrorStr (status)); @@ -544,10 +526,8 @@ gst_va_filter_ensure_filters (GstVaFilter * self) struct VaFilter filter = { filter_types[i], num_caps, {{{0,}}} }; if (num_caps > 0) { - gst_va_display_lock (self->display); status = vaQueryVideoProcFilterCaps (dpy, self->context, filter.type, &filter.caps, &filter.num_caps); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_WARNING_OBJECT (self, "vaQueryVideoProcFiltersCaps: %s", vaErrorStr (status)); @@ -1397,10 +1377,8 @@ _query_pipeline_caps (GstVaFilter * self, GArray * filters, dpy = gst_va_display_get_va_dpy (self->display); - gst_va_display_lock (self->display); status = vaQueryVideoProcPipelineCaps (dpy, self->context, va_filters, num_filters, caps); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaQueryVideoProcPipelineCaps: %s", @@ -1479,10 +1457,8 @@ gst_va_filter_add_filter_buffer (GstVaFilter * self, gpointer data, gsize size, return FALSE; dpy = gst_va_display_get_va_dpy (self->display); - gst_va_display_lock (self->display); status = vaCreateBuffer (dpy, self->context, VAProcFilterParameterBufferType, size, num, data, &buffer); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaCreateBuffer: %s", vaErrorStr (status)); return FALSE; @@ -1517,9 +1493,7 @@ _destroy_filters_unlocked (GstVaFilter * self) for (i = 0; i < self->filters->len; i++) { buffer = g_array_index (self->filters, VABufferID, i); - gst_va_display_lock (self->display); status = vaDestroyBuffer (dpy, buffer); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { ret = FALSE; GST_WARNING_OBJECT (self, "Failed to destroy filter buffer: %s", @@ -1644,10 +1618,8 @@ _create_pipeline_buffer (GstVaFilter * self, GstVaSample * src, GST_OBJECT_UNLOCK (self); dpy = gst_va_display_get_va_dpy (self->display); - gst_va_display_lock (self->display); status = vaCreateBuffer (dpy, self->context, VAProcPipelineParameterBufferType, sizeof (params), 1, ¶ms, buffer); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaCreateBuffer: %s", vaErrorStr (status)); return FALSE; @@ -1696,25 +1668,19 @@ gst_va_filter_process (GstVaFilter * self, GstVaSample * src, GstVaSample * dst) dpy = gst_va_display_get_va_dpy (self->display); - gst_va_display_lock (self->display); status = vaBeginPicture (dpy, self->context, dst->surface); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaBeginPicture: %s", vaErrorStr (status)); return FALSE; } - gst_va_display_lock (self->display); status = vaRenderPicture (dpy, self->context, &buffer, 1); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaRenderPicture: %s", vaErrorStr (status)); goto fail_end_pic; } - gst_va_display_lock (self->display); status = vaEndPicture (dpy, self->context); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "vaEndPicture: %s", vaErrorStr (status)); goto bail; @@ -1723,9 +1689,7 @@ gst_va_filter_process (GstVaFilter * self, GstVaSample * src, GstVaSample * dst) ret = TRUE; bail: - gst_va_display_lock (self->display); status = vaDestroyBuffer (dpy, buffer); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) { GST_WARNING_OBJECT (self, "Failed to destroy pipeline buffer: %s", vaErrorStr (status)); @@ -1735,9 +1699,7 @@ bail: fail_end_pic: { - gst_va_display_lock (self->display); status = vaEndPicture (dpy, self->context); - gst_va_display_unlock (self->display); if (status != VA_STATUS_SUCCESS) GST_ERROR_OBJECT (self, "vaEndPicture: %s", vaErrorStr (status)); goto bail; diff --git a/subprojects/gst-plugins-bad/sys/va/gstvasurfacecopy.c b/subprojects/gst-plugins-bad/sys/va/gstvasurfacecopy.c index 44fd6d9..9b897c9 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvasurfacecopy.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvasurfacecopy.c @@ -52,9 +52,7 @@ _has_copy (GstVaDisplay * display) dpy = gst_va_display_get_va_dpy (display); - gst_va_display_lock (display); status = vaGetDisplayAttributes (dpy, &attr, 1); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_INFO ("vaGetDisplayAttribures: %s", vaErrorStr (status)); return FALSE; diff --git a/subprojects/gst-plugins-bad/sys/va/vasurfaceimage.c b/subprojects/gst-plugins-bad/sys/va/vasurfaceimage.c index e8f324d..cb67a2e 100644 --- a/subprojects/gst-plugins-bad/sys/va/vasurfaceimage.c +++ b/subprojects/gst-plugins-bad/sys/va/vasurfaceimage.c @@ -32,9 +32,7 @@ va_destroy_surfaces (GstVaDisplay * display, VASurfaceID * surfaces, g_return_val_if_fail (num_surfaces > 0, FALSE); - gst_va_display_lock (display); status = vaDestroySurfaces (dpy, surfaces, num_surfaces); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_ERROR ("vaDestroySurfaces: %s", vaErrorStr (status)); return FALSE; @@ -96,10 +94,8 @@ va_create_surfaces (GstVaDisplay * display, guint rt_format, guint fourcc, /* *INDENT-ON* */ } - gst_va_display_lock (display); status = vaCreateSurfaces (dpy, rt_format, width, height, surfaces, num_surfaces, attrs, num_attrs); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_ERROR ("vaCreateSurfaces: %s", vaErrorStr (status)); return FALSE; @@ -115,10 +111,8 @@ va_export_surface_to_dmabuf (GstVaDisplay * display, VASurfaceID surface, VADisplay dpy = gst_va_display_get_va_dpy (display); VAStatus status; - gst_va_display_lock (display); status = vaExportSurfaceHandle (dpy, surface, VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2, flags, desc); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_ERROR ("vaExportSurfaceHandle: %s", vaErrorStr (status)); return FALSE; @@ -133,9 +127,7 @@ va_destroy_image (GstVaDisplay * display, VAImageID image_id) VADisplay dpy = gst_va_display_get_va_dpy (display); VAStatus status; - gst_va_display_lock (display); status = vaDestroyImage (dpy, image_id); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_ERROR ("vaDestroyImage: %s", vaErrorStr (status)); return FALSE; @@ -150,9 +142,7 @@ va_get_derive_image (GstVaDisplay * display, VASurfaceID surface, VADisplay dpy = gst_va_display_get_va_dpy (display); VAStatus status; - gst_va_display_lock (display); status = vaDeriveImage (dpy, surface, image); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_WARNING ("vaDeriveImage: %s", vaErrorStr (status)); return FALSE; @@ -173,10 +163,8 @@ va_create_image (GstVaDisplay * display, GstVideoFormat format, gint width, if (!va_format) return FALSE; - gst_va_display_lock (display); status = vaCreateImage (dpy, (VAImageFormat *) va_format, width, height, image); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_ERROR ("vaCreateImage: %s", vaErrorStr (status)); return FALSE; @@ -190,10 +178,8 @@ va_get_image (GstVaDisplay * display, VASurfaceID surface, VAImage * image) VADisplay dpy = gst_va_display_get_va_dpy (display); VAStatus status; - gst_va_display_lock (display); status = vaGetImage (dpy, surface, 0, 0, image->width, image->height, image->image_id); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_ERROR ("vaGetImage: %s", vaErrorStr (status)); return FALSE; @@ -208,9 +194,7 @@ va_sync_surface (GstVaDisplay * display, VASurfaceID surface) VADisplay dpy = gst_va_display_get_va_dpy (display); VAStatus status; - gst_va_display_lock (display); status = vaSyncSurface (dpy, surface); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_WARNING ("vaSyncSurface: %s", vaErrorStr (status)); return FALSE; @@ -224,9 +208,7 @@ va_map_buffer (GstVaDisplay * display, VABufferID buffer, gpointer * data) VADisplay dpy = gst_va_display_get_va_dpy (display); VAStatus status; - gst_va_display_lock (display); status = vaMapBuffer (dpy, buffer, data); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_WARNING ("vaMapBuffer: %s", vaErrorStr (status)); return FALSE; @@ -240,9 +222,7 @@ va_unmap_buffer (GstVaDisplay * display, VABufferID buffer) VADisplay dpy = gst_va_display_get_va_dpy (display); VAStatus status; - gst_va_display_lock (display); status = vaUnmapBuffer (dpy, buffer); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_WARNING ("vaUnmapBuffer: %s", vaErrorStr (status)); return FALSE; @@ -259,10 +239,8 @@ va_put_image (GstVaDisplay * display, VASurfaceID surface, VAImage * image) if (!va_sync_surface (display, surface)) return FALSE; - gst_va_display_lock (display); status = vaPutImage (dpy, surface, image->image_id, 0, 0, image->width, image->height, 0, 0, image->width, image->height); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_ERROR ("vaPutImage: %s", vaErrorStr (status)); return FALSE; @@ -299,9 +277,7 @@ va_check_surface (GstVaDisplay * display, VASurfaceID surface) VAStatus status; VASurfaceStatus state; - gst_va_display_lock (display); status = vaQuerySurfaceStatus (dpy, surface, &state); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) GST_ERROR ("vaQuerySurfaceStatus: %s", vaErrorStr (status)); @@ -338,9 +314,7 @@ va_copy_surface (GstVaDisplay * display, VASurfaceID dst, VASurfaceID src) /* *INDENT-ON* */ VAStatus status; - gst_va_display_lock (display); status = vaCopy (dpy, &obj_dst, &obj_src, option); - gst_va_display_unlock (display); if (status != VA_STATUS_SUCCESS) { GST_INFO ("vaCopy: %s", vaErrorStr (status)); return FALSE; -- 2.7.4