meta-digi/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0076-gtkwaylandsink-match-d...

54 lines
1.8 KiB
Diff

From 924ff90f6a62112db1eadbcb6808cdbbc6fcfa27 Mon Sep 17 00:00:00 2001
From: Hugues Fruchet <hugues.fruchet@foss.st.com>
Date: Tue, 8 Oct 2024 17:55:17 +0200
Subject: [PATCH 3/7] gtkwaylandsink: 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 ! gtkwaylandsink
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/gtk/gstgtkwaylandsink.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/ext/gtk/gstgtkwaylandsink.c b/ext/gtk/gstgtkwaylandsink.c
index b55fc3e..1497a11 100644
--- a/ext/gtk/gstgtkwaylandsink.c
+++ b/ext/gtk/gstgtkwaylandsink.c
@@ -949,6 +949,8 @@ gst_gtk_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
gst_gtk_wayland_sink_get_instance_private (self);
gboolean use_dmabuf;
GstVideoFormat format;
+ GstVideoAlignment alignment;
+ guint width;
GST_DEBUG_OBJECT (self, "set caps %" GST_PTR_FORMAT, caps);
@@ -956,6 +958,16 @@ gst_gtk_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
if (!gst_video_info_from_caps (&priv->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 (&priv->video_info);
+ alignment.padding_right = GST_ROUND_UP_128 (width) - width;
+ gst_video_info_align (&priv->video_info, &alignment);
+
format = GST_VIDEO_INFO_FORMAT (&priv->video_info);
priv->video_info_changed = TRUE;
priv->skip_dumb_buffer_copy = FALSE;
--
2.25.1