monitor-manager: Add per backend capabilities
Add a private API for querying backend capabilities. For now, only mirroring capability is reported. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
9003a42df3
commit
d050fdb17f
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user