1
0
Fork 0

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; 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 static void
meta_renderer_native_disconnect (CoglRenderer *cogl_renderer) 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); gboolean meta_renderer_native_use_modifiers (MetaRendererNative *renderer_native);
MetaRendererNativeMode meta_renderer_native_get_mode (MetaRendererNative *renderer_native);
#endif /* META_RENDERER_NATIVE_H */ #endif /* META_RENDERER_NATIVE_H */

View file

@ -51,6 +51,10 @@
#include "wayland/meta-xwayland-private.h" #include "wayland/meta-xwayland-private.h"
#include "wayland/meta-xwayland.h" #include "wayland/meta-xwayland.h"
#ifdef HAVE_NATIVE_BACKEND
#include "backends/native/meta-renderer-native.h"
#endif
static char *_display_name_override; static char *_display_name_override;
G_DEFINE_TYPE (MetaWaylandCompositor, meta_wayland_compositor, G_TYPE_OBJECT) G_DEFINE_TYPE (MetaWaylandCompositor, meta_wayland_compositor, G_TYPE_OBJECT)
@ -573,8 +577,25 @@ meta_wayland_compositor_new (MetaContext *context)
compositor); compositor);
#ifdef HAVE_WAYLAND_EGLSTREAM #ifdef HAVE_WAYLAND_EGLSTREAM
meta_wayland_eglstream_controller_init (compositor); {
#endif 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 /* HAVE_WAYLAND_EGLSTREAM */
x11_display_policy = x11_display_policy =
meta_context_get_x11_display_policy (compositor->context); meta_context_get_x11_display_policy (compositor->context);