meta-digi/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0075-waylandsink-match-drm-...

54 lines
1.8 KiB
Diff

From 50890a27e2333e3471fe37f05371b4959cf2a363 Mon Sep 17 00:00:00 2001
From: Hugues Fruchet <hugues.fruchet@foss.st.com>
Date: Tue, 8 Oct 2024 10:51:13 +0200
Subject: [PATCH 2/7] waylandsink: match drm kernel driver alignment
This workaround is needed to render not 128 bytes aligned YUV420
planar content.
For example:
$> gst-launch-1.0 videotestsrc ! video/x-raw, format=I420 ! waylandsink
This workaround may be dropped when switching to DRM modifier
implementation introduced in GStreamer-1.24.
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Upstream-Status: Pending
---
ext/wayland/gstwaylandsink.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
index d98c53f..9254b73 100644
--- a/ext/wayland/gstwaylandsink.c
+++ b/ext/wayland/gstwaylandsink.c
@@ -692,6 +692,8 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
GstWaylandSink *self = GST_WAYLAND_SINK (bsink);;
gboolean use_dmabuf;
GstVideoFormat format;
+ GstVideoAlignment alignment;
+ guint width;
GST_DEBUG_OBJECT (self, "set caps %" GST_PTR_FORMAT, caps);
@@ -699,6 +701,16 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
if (!gst_video_info_from_caps (&self->video_info, caps))
goto invalid_format;
+ /*
+ * stick to DRM kernel driver alignment (128 bytes) to avoid
+ * any board effects due to size mismatch when switching
+ * later-on with DRM dumb allocated buffers
+ */
+ gst_video_alignment_reset (&alignment);
+ width = GST_VIDEO_INFO_WIDTH (&self->video_info);
+ alignment.padding_right = GST_ROUND_UP_128 (width) - width;
+ gst_video_info_align (&self->video_info, &alignment);
+
format = GST_VIDEO_INFO_FORMAT (&self->video_info);
self->video_info_changed = TRUE;
self->skip_dumb_buffer_copy = FALSE;
--
2.25.1