From 3d2ca9a67f6d2c7399f50f89c54d6ea4f86c58f0 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Mon, 10 Dec 2018 15:46:56 +0200 Subject: [PATCH] renderer/native: Count devices on EGLDevice check create_renderer_gpu_data_egl_device () relied on the primary GPU being already chosen for the "EGLDevice currently only works with single GPU systems" error message. A future patch will choose the primary GPU after this, not before, so this check needs to be rewritten before the initialization order is changed. The new check is implemented exactly as the error message says: there must be exactly one GPU, otherwise fail. https://gitlab.gnome.org/GNOME/mutter/merge_requests/271 --- src/backends/native/meta-renderer-native.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index 4a514dce9..553e79b69 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -3447,6 +3447,15 @@ get_egl_device_display (MetaRendererNative *renderer_native, error); } +static int +count_drm_devices (MetaRendererNative *renderer_native) +{ + MetaMonitorManager *monitor_manager = + META_MONITOR_MANAGER (renderer_native->monitor_manager_kms); + + return g_list_length (meta_monitor_manager_get_gpus (monitor_manager)); +} + static MetaRendererNativeGpuData * create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native, MetaGpuKms *gpu_kms, @@ -3458,7 +3467,7 @@ create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native, EGLDisplay egl_display; MetaRendererNativeGpuData *renderer_gpu_data; - if (gpu_kms != renderer_native->primary_gpu) + if (count_drm_devices (renderer_native) != 1) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,