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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
This commit is contained in:
Víctor Manuel Jáquez Leal 2020-10-06 19:54:26 +02:00
parent 895fe44154
commit 67eb0a9440
4 changed files with 14 additions and 21 deletions

View File

@ -404,7 +404,7 @@ static gpointer
gst_va_dmabuf_mem_map (GstMemory * gmem, gsize maxsize, GstMapFlags flags) gst_va_dmabuf_mem_map (GstMemory * gmem, gsize maxsize, GstMapFlags flags)
{ {
GstVaDmabufAllocator *self = GST_VA_DMABUF_ALLOCATOR (gmem->allocator); 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); _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)); g_cond_wait (&self->buffer_cond, GST_OBJECT_GET_LOCK (self));
mem[0] = gst_atomic_queue_pop (self->available_mems); 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 { do {
pmem = gst_atomic_queue_peek (self->available_mems); pmem = gst_atomic_queue_peek (self->available_mems);
if (!pmem) if (!pmem)
break; break;
psurface = gst_va_memory_get_surface (pmem, NULL); psurface = gst_va_memory_get_surface (pmem);
if (psurface != surface) if (psurface != surface)
break; break;
@ -1184,7 +1184,7 @@ gst_va_allocator_prepare_buffer (GstAllocator * allocator, GstBuffer * buffer)
mem = gst_atomic_queue_pop (self->available_mems); mem = gst_atomic_queue_pop (self->available_mems);
GST_OBJECT_UNLOCK (self); 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_buffer_append_memory (buffer, mem);
GST_TRACE_OBJECT (self, "Prepared surface %#x in buffer %p", surface, buffer); 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 =====================================================*/ /*============ Utilities =====================================================*/
VASurfaceID VASurfaceID
gst_va_memory_get_surface (GstMemory * mem, GstVideoInfo * info) gst_va_memory_get_surface (GstMemory * mem)
{ {
VASurfaceID surface = VA_INVALID_ID; 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), buf = gst_mini_object_get_qdata (GST_MINI_OBJECT (mem),
gst_va_buffer_surface_quark ()); gst_va_buffer_surface_quark ());
if (buf) { if (buf)
if (info)
*info = buf->info;
surface = buf->surface; surface = buf->surface;
}
} else if (GST_IS_VA_ALLOCATOR (mem->allocator)) { } else if (GST_IS_VA_ALLOCATOR (mem->allocator)) {
GstVaMemory *va_mem = (GstVaMemory *) mem; GstVaMemory *va_mem = (GstVaMemory *) mem;
surface = va_mem->surface; surface = va_mem->surface;
if (info)
*info = va_mem->info;
} }
return surface; return surface;
} }
VASurfaceID VASurfaceID
gst_va_buffer_get_surface (GstBuffer * buffer, GstVideoInfo * info) gst_va_buffer_get_surface (GstBuffer * buffer)
{ {
GstMemory *mem; GstMemory *mem;
@ -1254,5 +1249,5 @@ gst_va_buffer_get_surface (GstBuffer * buffer, GstVideoInfo * info)
if (!mem) if (!mem)
return VA_INVALID_ID; return VA_INVALID_ID;
return gst_va_memory_get_surface (mem, info); return gst_va_memory_get_surface (mem);
} }

View File

@ -73,9 +73,7 @@ void gst_va_allocator_flush (GstAllocator * alloca
gboolean gst_va_allocator_try (GstAllocator * allocator, gboolean gst_va_allocator_try (GstAllocator * allocator,
GstVaAllocationParams * params); GstVaAllocationParams * params);
VASurfaceID gst_va_memory_get_surface (GstMemory * mem, VASurfaceID gst_va_memory_get_surface (GstMemory * mem);
GstVideoInfo * info); VASurfaceID gst_va_buffer_get_surface (GstBuffer * buffer);
VASurfaceID gst_va_buffer_get_surface (GstBuffer * buffer,
GstVideoInfo * info);
G_END_DECLS G_END_DECLS

View 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, VA_INVALID_ID);
g_return_val_if_fail (pic->gstbuffer, 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 void

View File

@ -997,7 +997,7 @@ _try_import_buffer_unlocked (GstVaVpp * self, GstBuffer * inbuf)
{ {
VASurfaceID surface; VASurfaceID surface;
surface = gst_va_buffer_get_surface (inbuf, NULL); surface = gst_va_buffer_get_surface (inbuf);
if (surface != VA_INVALID_ID) if (surface != VA_INVALID_ID)
return TRUE; return TRUE;
@ -1080,8 +1080,8 @@ gst_va_vpp_transform (GstBaseTransform * trans, GstBuffer * inbuf,
if (res != GST_FLOW_OK) if (res != GST_FLOW_OK)
return res; return res;
in_surface = gst_va_buffer_get_surface (buf, NULL); in_surface = gst_va_buffer_get_surface (buf);
out_surface = gst_va_buffer_get_surface (outbuf, NULL); out_surface = gst_va_buffer_get_surface (outbuf);
if (!gst_va_filter_convert_surface (self->filter, in_surface, &self->in_info, if (!gst_va_filter_convert_surface (self->filter, in_surface, &self->in_info,
out_surface, &self->out_info)) { out_surface, &self->out_info)) {