diff --git a/src/backends/meta-monitor-manager-dummy.c b/src/backends/meta-monitor-manager-dummy.c index 5f1ec1d97..b0fbddca0 100644 --- a/src/backends/meta-monitor-manager-dummy.c +++ b/src/backends/meta-monitor-manager-dummy.c @@ -599,6 +599,12 @@ meta_monitor_manager_dummy_get_supported_scales (MetaMonitorManager *manager, *n_scales = G_N_ELEMENTS (supported_scales_dummy); } +static MetaMonitorManagerCapability +meta_monitor_manager_dummy_get_capabilities (MetaMonitorManager *manager) +{ + return META_MONITOR_MANAGER_CAPABILITY_MIRRORING; +} + static void meta_monitor_manager_dummy_class_init (MetaMonitorManagerDummyClass *klass) { @@ -611,6 +617,7 @@ meta_monitor_manager_dummy_class_init (MetaMonitorManagerDummyClass *klass) manager_class->is_transform_handled = meta_monitor_manager_dummy_is_transform_handled; manager_class->calculate_monitor_mode_scale = meta_monitor_manager_dummy_calculate_monitor_mode_scale; manager_class->get_supported_scales = meta_monitor_manager_dummy_get_supported_scales; + manager_class->get_capabilities = meta_monitor_manager_dummy_get_capabilities; } static void diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h index 5548cda0b..d5a98c20a 100644 --- a/src/backends/meta-monitor-manager-private.h +++ b/src/backends/meta-monitor-manager-private.h @@ -68,6 +68,12 @@ typedef struct _MetaCrtcInfo MetaCrtcInfo; typedef struct _MetaOutputInfo MetaOutputInfo; typedef struct _MetaTileInfo MetaTileInfo; +typedef enum _MetaMonitorManagerCapability +{ + META_MONITOR_MANAGER_CAPABILITY_NONE = 0, + META_MONITOR_MANAGER_CAPABILITY_MIRRORING = (1 << 0) +} MetaMonitorManagerCapability; + typedef enum { META_MONITOR_TRANSFORM_NORMAL, @@ -357,6 +363,8 @@ struct _MetaMonitorManagerClass void (*get_supported_scales) (MetaMonitorManager *, float **, int *); + + MetaMonitorManagerCapability (*get_capabilities) (MetaMonitorManager *); }; void meta_monitor_manager_rebuild (MetaMonitorManager *manager, diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c index 12fa394ef..1866c3801 100644 --- a/src/backends/native/meta-monitor-manager-kms.c +++ b/src/backends/native/meta-monitor-manager-kms.c @@ -1918,6 +1918,29 @@ meta_monitor_manager_kms_get_supported_scales (MetaMonitorManager *manager, *n_scales = G_N_ELEMENTS (supported_scales_kms); } +static MetaMonitorManagerCapability +meta_monitor_manager_kms_get_capabilities (MetaMonitorManager *manager) +{ + MetaBackend *backend = meta_get_backend (); + MetaRenderer *renderer = meta_backend_get_renderer (backend); + MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer); + MetaMonitorManagerCapability capabilities = + META_MONITOR_MANAGER_CAPABILITY_NONE; + + switch (meta_renderer_native_get_mode (renderer_native)) + { + case META_RENDERER_NATIVE_MODE_GBM: + capabilities |= META_MONITOR_MANAGER_CAPABILITY_MIRRORING; + break; +#ifdef HAVE_EGL_DEVICE + case META_RENDERER_NATIVE_MODE_EGL_DEVICE: + break; +#endif + } + + return capabilities; +} + static void meta_monitor_manager_kms_dispose (GObject *object) { @@ -1960,4 +1983,5 @@ meta_monitor_manager_kms_class_init (MetaMonitorManagerKmsClass *klass) manager_class->is_transform_handled = meta_monitor_manager_kms_is_transform_handled; manager_class->calculate_monitor_mode_scale = meta_monitor_manager_kms_calculate_monitor_mode_scale; manager_class->get_supported_scales = meta_monitor_manager_kms_get_supported_scales; + manager_class->get_capabilities = meta_monitor_manager_kms_get_capabilities; } diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c index 8507143f3..06d38cfa3 100644 --- a/src/backends/x11/meta-monitor-manager-xrandr.c +++ b/src/backends/x11/meta-monitor-manager-xrandr.c @@ -1596,6 +1596,12 @@ meta_monitor_manager_xrandr_get_supported_scales (MetaMonitorManager *manager, *n_scales = G_N_ELEMENTS (supported_scales_xrandr); } +static MetaMonitorManagerCapability +meta_monitor_manager_xrandr_get_capabilities (MetaMonitorManager *manager) +{ + return META_MONITOR_MANAGER_CAPABILITY_MIRRORING; +} + static void meta_monitor_manager_xrandr_init (MetaMonitorManagerXrandr *manager_xrandr) { @@ -1674,6 +1680,7 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass) manager_class->is_transform_handled = meta_monitor_manager_xrandr_is_transform_handled; manager_class->calculate_monitor_mode_scale = meta_monitor_manager_xrandr_calculate_monitor_mode_scale; manager_class->get_supported_scales = meta_monitor_manager_xrandr_get_supported_scales; + manager_class->get_capabilities = meta_monitor_manager_xrandr_get_capabilities; quark_meta_monitor_xrandr_data = g_quark_from_static_string ("-meta-monitor-xrandr-data"); diff --git a/src/tests/meta-monitor-manager-test.c b/src/tests/meta-monitor-manager-test.c index 0d4033db3..14afcd91a 100644 --- a/src/tests/meta-monitor-manager-test.c +++ b/src/tests/meta-monitor-manager-test.c @@ -374,6 +374,12 @@ meta_monitor_manager_test_get_supported_scales (MetaMonitorManager *manager, *n_scales = G_N_ELEMENTS (supported_scales_test); } +static MetaMonitorManagerCapability +meta_monitor_manager_test_get_capabilities (MetaMonitorManager *manager) +{ + return META_MONITOR_MANAGER_CAPABILITY_MIRRORING; +} + static void meta_monitor_manager_test_dispose (GObject *object) { @@ -408,4 +414,5 @@ meta_monitor_manager_test_class_init (MetaMonitorManagerTestClass *klass) manager_class->is_transform_handled = meta_monitor_manager_test_is_transform_handled; manager_class->calculate_monitor_mode_scale = meta_monitor_manager_test_calculate_monitor_mode_scale; manager_class->get_supported_scales = meta_monitor_manager_test_get_supported_scales; + manager_class->get_capabilities = meta_monitor_manager_test_get_capabilities; }