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> <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*"/> <type name="GstVideo.VideoInfo" c:type="GstVideoInfo*"/>
</parameter> </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>
<parameter name="mem" transfer-ownership="none"> <parameter name="mem" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c">Memories. One <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"> <parameter name="fds" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c">array of <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c">array of
DMABuf file descriptors.</doc> 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"/> <type c:type="uintptr_t"/>
</array> </array>
</parameter> </parameter>

View file

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

View file

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

View file

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