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
This commit is contained in:
Pekka Paalanen 2018-12-10 15:46:56 +02:00 committed by Jonas Ådahl
parent 9182c8b801
commit 3d2ca9a67f

View File

@ -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,