From d04a03d176dcd7b0650d32af843bf8cc8fc1da17 Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Thu, 29 Aug 2024 20:58:04 +0200 Subject: [PATCH] kmssink: enumerate drm formats when IN_FORMATS not present Part-of: --- subprojects/gst-plugins-bad/sys/kms/gstkmssink.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/subprojects/gst-plugins-bad/sys/kms/gstkmssink.c b/subprojects/gst-plugins-bad/sys/kms/gstkmssink.c index 8c40d023de..d86f11d5e4 100644 --- a/subprojects/gst-plugins-bad/sys/kms/gstkmssink.c +++ b/subprojects/gst-plugins-bad/sys/kms/gstkmssink.c @@ -856,6 +856,20 @@ get_all_formats_and_modifiers (GstKMSSink * self, drmModePlane * plane, drmModeFreePropertyBlob (blob); } + if (formats->len == 0) { + /* IN_FORMATS not found. Fill the arrays from plane->formats, assuming + * only linear modifier. */ + const guint64 LINEAR_MODIFIER = DRM_FORMAT_MOD_LINEAR; + + for (i = 0; i < plane->count_formats; ++i) { + g_array_append_val (formats, plane->formats[i]); + g_array_append_val (modifiers, LINEAR_MODIFIER); + GST_DEBUG_OBJECT (self, "Plane id %d, get format/modifier pair %" + GST_FOURCC_FORMAT ":0x0", plane->plane_id, + GST_FOURCC_ARGS (plane->formats[i])); + } + } + if (formats->len == 0) goto out;