wayland: Only init EGLStream controller if we didn't end up with gbm

When we use gbm together with the NVIDIA driver, we want the EGL/Vulkan
clients to do the same, instead of using the EGLStream paths. To achieve
that, make sure to only initialize the EGLStream controller when we
didn't end up using gbm as the renderer backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2052>
This commit is contained in:
Jonas Ådahl 2021-10-14 18:36:43 +02:00 committed by Marge Bot
parent 3b6f9111c7
commit ac907119ae
3 changed files with 36 additions and 2 deletions

View File

@ -239,6 +239,17 @@ meta_renderer_native_has_pending_mode_set (MetaRendererNative *renderer_native)
return renderer_native->pending_mode_set;
}
MetaRendererNativeMode
meta_renderer_native_get_mode (MetaRendererNative *renderer_native)
{
MetaGpuKms *primary_gpu = renderer_native->primary_gpu_kms;
MetaRendererNativeGpuData *primary_gpu_data;
primary_gpu_data = meta_renderer_native_get_gpu_data (renderer_native,
primary_gpu);
return primary_gpu_data->mode;
}
static void
meta_renderer_native_disconnect (CoglRenderer *cogl_renderer)
{

View File

@ -68,4 +68,6 @@ void meta_renderer_native_reset_modes (MetaRendererNative *renderer_native);
gboolean meta_renderer_native_use_modifiers (MetaRendererNative *renderer_native);
MetaRendererNativeMode meta_renderer_native_get_mode (MetaRendererNative *renderer_native);
#endif /* META_RENDERER_NATIVE_H */

View File

@ -51,6 +51,10 @@
#include "wayland/meta-xwayland-private.h"
#include "wayland/meta-xwayland.h"
#ifdef HAVE_NATIVE_BACKEND
#include "backends/native/meta-renderer-native.h"
#endif
static char *_display_name_override;
G_DEFINE_TYPE (MetaWaylandCompositor, meta_wayland_compositor, G_TYPE_OBJECT)
@ -573,8 +577,25 @@ meta_wayland_compositor_new (MetaContext *context)
compositor);
#ifdef HAVE_WAYLAND_EGLSTREAM
{
gboolean should_enable_eglstream_controller = TRUE;
#if defined(HAVE_EGL_DEVICE) && defined(HAVE_NATIVE_BACKEND)
MetaRenderer *renderer = meta_backend_get_renderer (backend);
if (META_IS_RENDERER_NATIVE (renderer))
{
MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer);
if (meta_renderer_native_get_mode (renderer_native) ==
META_RENDERER_NATIVE_MODE_GBM)
should_enable_eglstream_controller = FALSE;
}
#endif /* defined(HAVE_EGL_DEVICE) && defined(HAVE_NATIVE_BACKEND) */
if (should_enable_eglstream_controller)
meta_wayland_eglstream_controller_init (compositor);
#endif
}
#endif /* HAVE_WAYLAND_EGLSTREAM */
x11_display_policy =
meta_context_get_x11_display_policy (compositor->context);