va: remove GstVideoInfo parameter from _get_surface() functions
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 6 Oct 2020 17:54:26 +0000 (19:54 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Fri, 9 Oct 2020 14:34:56 +0000 (16:34 +0200)
There shouldn't be need to retrieve GstVideoInfo per buffer or memory since it
is the same for all the negotiated stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>

sys/va/gstvaallocator.c
sys/va/gstvaallocator.h
sys/va/gstvadecoder.c
sys/va/gstvavpp.c

index 60f4bbe..33cc494 100644 (file)
@@ -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);
 }
index d4f00c6..7040139 100644 (file)
@@ -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
index 4d5e6b0..2ff9c16 100644 (file)
@@ -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
index 5ddcd78..022c33f 100644 (file)
@@ -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)) {