gstreamer1.0-plugins-good: v4l2bufferpool: Set Video Meta to Imported Buffers
PATCH 1/1 gstreamer1.0-plugins-good: v4l2bufferpool: Set Video Meta to Imported Buffers
From: Sidraya <[email protected]>
When importing dmabufs, the video meta is set on the dest buffer, but not on the src buffer. In this case, the src buffer is not made aware of the stride of the video buffer, which is needed to properly display the buffer.
This is a result of the v4l2 plugin creating it's own empty dmabuf pool of GstBuffers, and then assigning the memory from the downstream GstBuffer. We then update the video meta of the buffer in our pool, but not the downstream pool.
The downstream pool buffer should be updated as well.
---
changes in v2: Add upstreme link
...l-Set-Video-Meta-to-Imported-Buffers.patch | 58 +++++++++++++++++++ .../gstreamer1.0-plugins-good_1.16.%.bbappend | 1 + 2 files changed, 59 insertions(+) create mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0001-v4l2bufferpool-Set-Video-Meta-to-Imported-Buffers.patch
meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0001-v4l2bufferpool-Set-Video-Meta-to-Imported-Buffers.patch new file +58 -0
@@ -0,0 +1,58 @@ +From e677028494081f93558d24b1f72da9e6835ef954 Mon Sep 17 00:00:00 2001 +From: Sidraya <[email protected]> +Date: Mon, 18 Oct 2021 13:35:09 +0530 +Subject: [PATCH] v4l2bufferpool: Set Video Meta to Imported Buffers + +When importing dmabufs, the video meta is set on the dest +buffer, but not on the src buffer. In this case, the src +buffer is not made aware of the stride of the video buffer, +which is needed to properly display the buffer. + +This is a result of the v4l2 plugin creating it's own +empty dmabuf pool of GstBuffers, and then assigning the +memory from the downstream GstBuffer. We then update the +video meta of the buffer in our pool, but not the downstream +pool. + +The downstream pool buffer should be updated as well. + +Upstream-Status: Submitted +https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1723#note_1266433 + +Signed-off-by: Sidraya <[email protected]> +--- + sys/v4l2/gstv4l2bufferpool.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c +index 49f222b6e..f4d964b9e 100644 +--- a/sys/v4l2/gstv4l2bufferpool.c ++++ b/sys/v4l2/gstv4l2bufferpool.c +@@ -330,6 +330,10 @@ gst_v4l2_buffer_pool_import_dmabuf (GstV4l2BufferPool * pool, + GstMemory *dma_mem[GST_VIDEO_MAX_PLANES] = { 0 }; + guint n_mem = gst_buffer_n_memory (src); + gint i; ++ GstV4l2Object *obj; ++ GstVideoInfo *info; ++ obj = pool->obj; ++ info = &obj->info; + + GST_LOG_OBJECT (pool, "importing dmabuf"); + +@@ -346,6 +350,13 @@ gst_v4l2_buffer_pool_import_dmabuf (GstV4l2BufferPool * pool, + dma_mem)) + goto import_failed; + ++ /* add metadata to raw video buffers */ ++ if (pool->add_videometa) ++ gst_buffer_add_video_meta_full (src, GST_VIDEO_FRAME_FLAG_NONE, ++ GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info), ++ GST_VIDEO_INFO_HEIGHT (info), GST_VIDEO_INFO_N_PLANES (info), ++ info->offset, info->stride); ++ + gst_mini_object_set_qdata (GST_MINI_OBJECT (dest), GST_V4L2_IMPORT_QUARK, + gst_buffer_ref (src), (GDestroyNotify) gst_buffer_unref); + +-- +2.17.1 +
meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.16.%.bbappend +1 -0
@@ -10,6 +10,7 @@ SRC_URI += " \ file://0001-qmlglsink-fix-build-on-EGL-platform-without-X11-head.patch \ file://0001-gst-plugins-good-1.16.3-v4l2h264enc-Add-Extended-con.patch \ file://0001-Avoiding-Failure-to-allocate-required-memory.patch \ + file://0001-v4l2bufferpool-Set-Video-Meta-to-Imported-Buffers.patch \ " PR_append = ".arago3"
Signature · 30 lines
2.17.1 -- This message contains confidential information and is intended only for the individual(s) named. If you are not the intended recipient, you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this mail and attached file/s is strictly prohibited. Please notify the sender immediately and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.
Quoted 103 lines · On Tue, Feb 22, 2022 at 12:01:39PM +0530, [email protected] wrote:
From: Sidraya <[email protected]>
When importing dmabufs, the video meta is set on the dest buffer, but not on the src buffer. In this case, the src buffer is not made aware of the stride of the video buffer, which is needed to properly display the buffer.
This is a result of the v4l2 plugin creating it's own empty dmabuf pool of GstBuffers, and then assigning the memory from the downstream GstBuffer. We then update the video meta of the buffer in our pool, but not the downstream pool.
The downstream pool buffer should be updated as well.
Signed-off-by Sidraya <[email protected]>---
changes in v2: Add upstreme link...l-Set-Video-Meta-to-Imported-Buffers.patch | 58 +++++++++++++++++++ .../gstreamer1.0-plugins-good_1.16.%.bbappend | 1 + 2 files changed, 59 insertions(+) create mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0001-v4l2bufferpool-Set-Video-Meta-to-Imported-Buffers.patchmeta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0001-v4l2bufferpool-Set-Video-Meta-to-Imported-Buffers.patch new file +58
-0@@ -0,0 +1,58 @@ +From e677028494081f93558d24b1f72da9e6835ef954 Mon Sep 17 00:00:00 2001 +From: Sidraya <[email protected]> +Date: Mon, 18 Oct 2021 13:35:09 +0530 +Subject: [PATCH] v4l2bufferpool: Set Video Meta to Imported Buffers + +When importing dmabufs, the video meta is set on the dest +buffer, but not on the src buffer. In this case, the src +buffer is not made aware of the stride of the video buffer, +which is needed to properly display the buffer. + +This is a result of the v4l2 plugin creating it's own +empty dmabuf pool of GstBuffers, and then assigning the +memory from the downstream GstBuffer. We then update the +video meta of the buffer in our pool, but not the downstream +pool. + +The downstream pool buffer should be updated as well. + +Upstream-Status: Submitted +https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1723#note_1266433 + +Signed-off-by: Sidraya <[email protected]> +--- + sys/v4l2/gstv4l2bufferpool.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c +index 49f222b6e..f4d964b9e 100644 +--- a/sys/v4l2/gstv4l2bufferpool.c ++++ b/sys/v4l2/gstv4l2bufferpool.c +@@ -330,6 +330,10 @@ gst_v4l2_buffer_pool_import_dmabuf (GstV4l2BufferPool * pool, + GstMemory *dma_mem[GST_VIDEO_MAX_PLANES] = { 0 }; + guint n_mem = gst_buffer_n_memory (src); + gint i; ++ GstV4l2Object *obj; ++ GstVideoInfo *info; ++ obj = pool->obj; ++ info = &obj->info; + + GST_LOG_OBJECT (pool, "importing dmabuf"); + +@@ -346,6 +350,13 @@ gst_v4l2_buffer_pool_import_dmabuf (GstV4l2BufferPool * pool, + dma_mem)) + goto import_failed; + ++ /* add metadata to raw video buffers */ ++ if (pool->add_videometa) ++ gst_buffer_add_video_meta_full (src, GST_VIDEO_FRAME_FLAG_NONE, ++ GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info), ++ GST_VIDEO_INFO_HEIGHT (info), GST_VIDEO_INFO_N_PLANES (info), ++ info->offset, info->stride); ++ + gst_mini_object_set_qdata (GST_MINI_OBJECT (dest), GST_V4L2_IMPORT_QUARK, + gst_buffer_ref (src), (GDestroyNotify) gst_buffer_unref); + +-- +2.17.1 +meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.16.%.bbappend +1
-0@@ -10,6 +10,7 @@ SRC_URI += " \ file://0001-qmlglsink-fix-build-on-EGL-platform-without-X11-head.patch \ file://0001-gst-plugins-good-1.16.3-v4l2h264enc-Add-Extended-con.patch \ file://0001-Avoiding-Failure-to-allocate-required-memory.patch \ + file://0001-v4l2bufferpool-Set-Video-Meta-to-Imported-Buffers.patch \ " PR_append = ".arago3"Signature · 1 line
2.17.1
Please ignore this patch, I will be sending a v2 of this patch.
Signature · 20 lines
This message contains confidential information and is intended only for the individual(s) named. If you are not the intended recipient, you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this mail and attached file/s is strictly prohibited. Please notify the sender immediately and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.