From 51619cbd2ac26624a50080b2a71aa30369d9fcd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Tue, 24 May 2022 12:54:08 +0200 Subject: [PATCH] plugin: Temporarily try to avoid direct DMABuf import on desktop This tries to avoid "scrambled" image on Linux with Intel GPUs that are mostly used together with x86 CPUs at the expense of using slightly slower non-direct DMABuf import, by not going with GLES by default on EGL. The "GST_GL_API" env can still be used to force one or another context type. We need for GStreamer to be aware of currently used DRM modifier first. On the other hand forcing GL everywhere would break most embedded systems that only work with GLES, so do it for x86 processors only... and pray for it to work. See: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1236 --- lib/gst/plugin/importers/gstclapperglbaseimporter.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/gst/plugin/importers/gstclapperglbaseimporter.c b/lib/gst/plugin/importers/gstclapperglbaseimporter.c index 795739dc..207fe0ce 100644 --- a/lib/gst/plugin/importers/gstclapperglbaseimporter.c +++ b/lib/gst/plugin/importers/gstclapperglbaseimporter.c @@ -504,6 +504,16 @@ gst_clapper_gl_base_importer_gdk_context_realize (GstClapperGLBaseImporter *self preferred_api = GDK_GL_API_GLES; #endif + /* FIXME: Remove once GStreamer can handle DRM modifiers. This tries to avoid + * "scrambled" image on Linux with Intel GPUs that are mostly used together with + * x86 CPUs at the expense of using slightly slower non-direct DMABuf import. + * See: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1236 */ +#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WAYLAND || GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_EGL +#if !defined(HAVE_GST_PATCHES) && (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64)) + preferred_api = GDK_GL_API_GL; +#endif +#endif + if (!(success = _realize_gdk_context_with_api (gdk_context, preferred_api))) { GdkGLAPI fallback_api;