From 67eb0a9440b72b7c4cdb559f0dde47370897c5af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Tue, 6 Oct 2020 19:54:26 +0200 Subject: [PATCH] va: remove GstVideoInfo parameter from _get_surface() functions There shouldn't be need to retrieve GstVideoInfo per buffer or memory since it is the same for all the negotiated stream. Part-of: --- sys/va/gstvaallocator.c | 21 ++++++++------------- sys/va/gstvaallocator.h | 6 ++---- sys/va/gstvadecoder.c | 2 +- sys/va/gstvavpp.c | 6 +++--- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/sys/va/gstvaallocator.c b/sys/va/gstvaallocator.c index 60f4bbef04..33cc4944bd 100644 --- a/sys/va/gstvaallocator.c +++ b/sys/va/gstvaallocator.c @@ -404,7 +404,7 @@ static gpointer gst_va_dmabuf_mem_map (GstMemory * gmem, gsize maxsize, GstMapFlags flags) { GstVaDmabufAllocator *self = GST_VA_DMABUF_ALLOCATOR (gmem->allocator); - VASurfaceID surface = gst_va_memory_get_surface (gmem, NULL); + VASurfaceID surface = gst_va_memory_get_surface (gmem); _sync_surface (self->display, surface); @@ -621,14 +621,14 @@ gst_va_dmabuf_allocator_prepare_buffer (GstAllocator * allocator, g_cond_wait (&self->buffer_cond, GST_OBJECT_GET_LOCK (self)); mem[0] = gst_atomic_queue_pop (self->available_mems); - surface = gst_va_memory_get_surface (mem[0], NULL); + surface = gst_va_memory_get_surface (mem[0]); do { pmem = gst_atomic_queue_peek (self->available_mems); if (!pmem) break; - psurface = gst_va_memory_get_surface (pmem, NULL); + psurface = gst_va_memory_get_surface (pmem); if (psurface != surface) break; @@ -1184,7 +1184,7 @@ gst_va_allocator_prepare_buffer (GstAllocator * allocator, GstBuffer * buffer) mem = gst_atomic_queue_pop (self->available_mems); GST_OBJECT_UNLOCK (self); - surface = gst_va_memory_get_surface (mem, NULL); + surface = gst_va_memory_get_surface (mem); gst_buffer_append_memory (buffer, mem); GST_TRACE_OBJECT (self, "Prepared surface %#x in buffer %p", surface, buffer); @@ -1218,7 +1218,7 @@ gst_va_allocator_try (GstAllocator * allocator, GstVaAllocationParams * params) /*============ Utilities =====================================================*/ VASurfaceID -gst_va_memory_get_surface (GstMemory * mem, GstVideoInfo * info) +gst_va_memory_get_surface (GstMemory * mem) { VASurfaceID surface = VA_INVALID_ID; @@ -1230,23 +1230,18 @@ gst_va_memory_get_surface (GstMemory * mem, GstVideoInfo * info) buf = gst_mini_object_get_qdata (GST_MINI_OBJECT (mem), gst_va_buffer_surface_quark ()); - if (buf) { - if (info) - *info = buf->info; + if (buf) surface = buf->surface; - } } else if (GST_IS_VA_ALLOCATOR (mem->allocator)) { GstVaMemory *va_mem = (GstVaMemory *) mem; surface = va_mem->surface; - if (info) - *info = va_mem->info; } return surface; } VASurfaceID -gst_va_buffer_get_surface (GstBuffer * buffer, GstVideoInfo * info) +gst_va_buffer_get_surface (GstBuffer * buffer) { GstMemory *mem; @@ -1254,5 +1249,5 @@ gst_va_buffer_get_surface (GstBuffer * buffer, GstVideoInfo * info) if (!mem) return VA_INVALID_ID; - return gst_va_memory_get_surface (mem, info); + return gst_va_memory_get_surface (mem); } diff --git a/sys/va/gstvaallocator.h b/sys/va/gstvaallocator.h index d4f00c65fa..7040139b92 100644 --- a/sys/va/gstvaallocator.h +++ b/sys/va/gstvaallocator.h @@ -73,9 +73,7 @@ void gst_va_allocator_flush (GstAllocator * alloca gboolean gst_va_allocator_try (GstAllocator * allocator, GstVaAllocationParams * params); -VASurfaceID gst_va_memory_get_surface (GstMemory * mem, - GstVideoInfo * info); -VASurfaceID gst_va_buffer_get_surface (GstBuffer * buffer, - GstVideoInfo * info); +VASurfaceID gst_va_memory_get_surface (GstMemory * mem); +VASurfaceID gst_va_buffer_get_surface (GstBuffer * buffer); G_END_DECLS diff --git a/sys/va/gstvadecoder.c b/sys/va/gstvadecoder.c index 4d5e6b07b3..2ff9c16a7b 100644 --- a/sys/va/gstvadecoder.c +++ b/sys/va/gstvadecoder.c @@ -714,7 +714,7 @@ gst_va_decode_picture_get_surface (GstVaDecodePicture * pic) g_return_val_if_fail (pic, VA_INVALID_ID); g_return_val_if_fail (pic->gstbuffer, VA_INVALID_ID); - return gst_va_buffer_get_surface (pic->gstbuffer, NULL); + return gst_va_buffer_get_surface (pic->gstbuffer); } void diff --git a/sys/va/gstvavpp.c b/sys/va/gstvavpp.c index 5ddcd78d9b..022c33f99b 100644 --- a/sys/va/gstvavpp.c +++ b/sys/va/gstvavpp.c @@ -997,7 +997,7 @@ _try_import_buffer_unlocked (GstVaVpp * self, GstBuffer * inbuf) { VASurfaceID surface; - surface = gst_va_buffer_get_surface (inbuf, NULL); + surface = gst_va_buffer_get_surface (inbuf); if (surface != VA_INVALID_ID) return TRUE; @@ -1080,8 +1080,8 @@ gst_va_vpp_transform (GstBaseTransform * trans, GstBuffer * inbuf, if (res != GST_FLOW_OK) return res; - in_surface = gst_va_buffer_get_surface (buf, NULL); - out_surface = gst_va_buffer_get_surface (outbuf, NULL); + in_surface = gst_va_buffer_get_surface (buf); + out_surface = gst_va_buffer_get_surface (outbuf); if (!gst_va_filter_convert_surface (self->filter, in_surface, &self->in_info, out_surface, &self->out_info)) {