vallocator: remove n_planes argument in dmabuf_memories_setup()

Instead of passing the number of planes to process, take that number from the
passed GstVideoInfo.

This is an API breakage, but since the plugin is still in stage, it's still
allowed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5264>
This commit is contained in:
Víctor Manuel Jáquez Leal 2023-08-30 21:25:41 +02:00 committed by GStreamer Marge Bot
parent 2d358cb22a
commit 76115528ac
4 changed files with 10 additions and 16 deletions

View file

@ -1020,9 +1020,6 @@ VASurfaceID and it's attached into every @mem.</doc>
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c">a #GstVideoInfo</doc>
<type name="GstVideo.VideoInfo" c:type="GstVideoInfo*"/>
</parameter>
<parameter name="n_planes" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c">number of planes</doc>
<type name="guint" c:type="guint"/>
</parameter>
<parameter name="mem" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c">Memories. One
@ -1034,7 +1031,7 @@ VASurfaceID and it's attached into every @mem.</doc>
<parameter name="fds" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c">array of
DMABuf file descriptors.</doc>
<array length="2" zero-terminated="0" c:type="uintptr_t*">
<array zero-terminated="0" c:type="uintptr_t*" fixed-size="4">
<type c:type="uintptr_t"/>
</array>
</parameter>

View file

@ -1048,10 +1048,9 @@ gst_va_dmabuf_allocator_get_format (GstAllocator * allocator,
* gst_va_dmabuf_memories_setup:
* @display: a #GstVaDisplay
* @info: a #GstVideoInfo
* @n_planes: number of planes
* @mem: (array fixed-size=4) (element-type GstMemory): Memories. One
* per plane.
* @fds: (array length=n_planes) (element-type uintptr_t): array of
* @fds: (array fixed-size=4) (element-type uintptr_t): array of
* DMABuf file descriptors.
* @offset: (array fixed-size=4) (element-type gsize): array of memory
* offsets.
@ -1066,11 +1065,10 @@ gst_va_dmabuf_allocator_get_format (GstAllocator * allocator,
* Since: 1.22
*/
/* XXX: use a surface pool to control the created surfaces */
/* XXX: remove n_planes argument and use GST_VIDEO_INFO_N_PLANES (info) */
gboolean
gst_va_dmabuf_memories_setup (GstVaDisplay * display, GstVideoInfo * info,
guint n_planes, GstMemory * mem[GST_VIDEO_MAX_PLANES],
uintptr_t * fds, gsize offset[GST_VIDEO_MAX_PLANES], guint usage_hint)
GstMemory * mem[GST_VIDEO_MAX_PLANES], uintptr_t fds[GST_VIDEO_MAX_PLANES],
gsize offset[GST_VIDEO_MAX_PLANES], guint usage_hint)
{
GstVideoFormat format;
GstVaBufferSurface *buf;
@ -1086,12 +1084,12 @@ gst_va_dmabuf_memories_setup (GstVaDisplay * display, GstVideoInfo * info,
/* *INDENT-ON* */
VASurfaceID surface;
guint32 fourcc, rt_format;
guint i;
guint i, n_planes;
gboolean ret;
g_return_val_if_fail (GST_IS_VA_DISPLAY (display), FALSE);
g_return_val_if_fail (n_planes > 0
&& n_planes <= GST_VIDEO_MAX_PLANES, FALSE);
n_planes = GST_VIDEO_INFO_N_PLANES (info);
format = GST_VIDEO_INFO_FORMAT (info);
if (format == GST_VIDEO_FORMAT_UNKNOWN)

View file

@ -59,9 +59,8 @@ gboolean gst_va_dmabuf_allocator_get_format (GstAllocator * alloca
GST_VA_API
gboolean gst_va_dmabuf_memories_setup (GstVaDisplay * display,
GstVideoInfo * info,
guint n_planes,
GstMemory * mem[GST_VIDEO_MAX_PLANES],
uintptr_t * fds,
uintptr_t fds[GST_VIDEO_MAX_PLANES],
gsize offset[GST_VIDEO_MAX_PLANES],
guint usage_hint);

View file

@ -102,8 +102,8 @@ _try_import_dmabuf_unlocked (GstVaBufferImporter * importer, GstBuffer * inbuf)
importer->entrypoint, GST_PAD_SINK, TRUE);
/* Now create a VASurfaceID for the buffer */
return gst_va_dmabuf_memories_setup (importer->display, &in_info, n_planes,
mems, fd, offset, usage_hint);
return gst_va_dmabuf_memories_setup (importer->display, &in_info, mems, fd,
offset, usage_hint);
}
static gboolean