From 7564c2f2e41cff1c3ea4354fb7bef59ee3af1722 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Sat, 1 Aug 2020 13:25:31 +0200 Subject: [PATCH] kms: Skip displays with 'non-desktop' property set Detect displays marked as 'non-desktop' by the kernel and skip them when creating the outputs. Mutter is not able to render images that are shown properly on those devices anyway. This avoids lighting up attached VR HMDs and showing the GDM login screen between the eyes in a VR HMD instead of on the monitor. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1393 --- src/backends/native/meta-gpu-kms.c | 2 +- src/backends/native/meta-kms-connector.c | 3 +++ src/backends/native/meta-kms-connector.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c index fa50c98a8..65eece375 100644 --- a/src/backends/native/meta-gpu-kms.c +++ b/src/backends/native/meta-gpu-kms.c @@ -506,7 +506,7 @@ init_outputs (MetaGpuKms *gpu_kms) GError *error = NULL; connector_state = meta_kms_connector_get_current_state (kms_connector); - if (!connector_state) + if (!connector_state || connector_state->non_desktop) continue; old_output = diff --git a/src/backends/native/meta-kms-connector.c b/src/backends/native/meta-kms-connector.c index ce8d28ae0..4eee7522e 100644 --- a/src/backends/native/meta-kms-connector.c +++ b/src/backends/native/meta-kms-connector.c @@ -206,6 +206,9 @@ state_set_properties (MetaKmsConnectorState *state, else if ((prop->flags & DRM_MODE_PROP_ENUM) && strcmp (prop->name, "panel orientation") == 0) set_panel_orientation (state, prop, drm_connector->prop_values[i]); + if ((prop->flags & DRM_MODE_PROP_RANGE) && + strcmp (prop->name, "non-desktop") == 0) + state->non_desktop = drm_connector->prop_values[i]; drmModeFreeProperty (prop); } diff --git a/src/backends/native/meta-kms-connector.h b/src/backends/native/meta-kms-connector.h index b6198b467..2547dc16d 100644 --- a/src/backends/native/meta-kms-connector.h +++ b/src/backends/native/meta-kms-connector.h @@ -49,6 +49,7 @@ typedef struct _MetaKmsConnectorState GBytes *edid_data; gboolean has_scaling; + gboolean non_desktop; CoglSubpixelOrder subpixel_order;