diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2018-04-11 14:39:15 +0200 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2018-04-11 16:34:59 +0200 |
commit | 60866e0f8510be559f8fc629a5e43238846c145b (patch) | |
tree | 4c8441b2fa558e039f8b4189dc91fb5c52775423 /src | |
parent | 45c02645f337646475d00d97f24c7cac34df0aa4 (diff) | |
download | mutter-60866e0f8510be559f8fc629a5e43238846c145b.tar.gz |
native: Disable the use of KMS modifiers by default
Make it re-enable:able by a hidden "experimental feature". To enable,
add "kms-modifiers" to the org.gnome.mutter.experimental-features
GSettings entry.
https://gitlab.gnome.org/GNOME/mutter/issues/81
Diffstat (limited to 'src')
-rw-r--r-- | src/backends/meta-settings-private.h | 1 | ||||
-rw-r--r-- | src/backends/meta-settings.c | 2 | ||||
-rw-r--r-- | src/backends/native/meta-renderer-native.c | 28 |
3 files changed, 29 insertions, 2 deletions
diff --git a/src/backends/meta-settings-private.h b/src/backends/meta-settings-private.h index 874767f7d..a8cb6a549 100644 --- a/src/backends/meta-settings-private.h +++ b/src/backends/meta-settings-private.h @@ -33,6 +33,7 @@ typedef enum _MetaExperimentalFeature META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER = (1 << 0), META_EXPERIMENTAL_FEATURE_SCREEN_CAST = (1 << 1), META_EXPERIMENTAL_FEATURE_REMOTE_DESKTOP = (1 << 2), + META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS = (1 << 3), } MetaExperimentalFeature; #define META_TYPE_SETTINGS (meta_settings_get_type ()) diff --git a/src/backends/meta-settings.c b/src/backends/meta-settings.c index 5935c44f2..6f47c5f58 100644 --- a/src/backends/meta-settings.c +++ b/src/backends/meta-settings.c @@ -267,6 +267,8 @@ experimental_features_handler (GVariant *features_variant, features |= META_EXPERIMENTAL_FEATURE_SCREEN_CAST; else if (g_str_equal (feature, "remote-desktop")) features |= META_EXPERIMENTAL_FEATURE_REMOTE_DESKTOP; + else if (g_str_equal (feature, "kms-modifiers")) + features |= META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS; else g_info ("Unknown experimental feature '%s'\n", feature); } diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index 2717f7d2e..c9c3b2eb3 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -193,6 +193,8 @@ struct _MetaRendererNative MetaMonitorManagerKms *monitor_manager_kms; MetaGles3 *gles3; + gboolean use_modifiers; + GHashTable *gpu_datas; CoglClosure *swap_notify_idle; @@ -1586,6 +1588,7 @@ gbm_get_next_fb_id (MetaGpuKms *gpu_kms, struct gbm_bo **out_next_bo, uint32_t *out_next_fb_id) { + MetaRendererNative *renderer_native = meta_renderer_native_from_gpu (gpu_kms); struct gbm_bo *next_bo; uint32_t next_fb_id; int kms_fd; @@ -1608,7 +1611,8 @@ gbm_get_next_fb_id (MetaGpuKms *gpu_kms, kms_fd = meta_gpu_kms_get_fd (gpu_kms); - if (modifiers[0] != DRM_FORMAT_MOD_INVALID) + if (renderer_native->use_modifiers && + modifiers[0] != DRM_FORMAT_MOD_INVALID) { if (drmModeAddFB2WithModifiers (kms_fd, gbm_bo_get_width (next_bo), @@ -2006,7 +2010,10 @@ meta_renderer_native_create_surface_gbm (CoglOnscreen *onscreen, meta_renderer_native_get_gpu_data (renderer_native, onscreen_native->render_gpu); - modifiers = get_supported_modifiers (onscreen, format); + if (renderer_native->use_modifiers) + modifiers = get_supported_modifiers (onscreen, format); + else + modifiers = NULL; if (modifiers) { @@ -3391,6 +3398,22 @@ meta_renderer_native_finalize (GObject *object) } static void +meta_renderer_native_constructed (GObject *object) +{ + MetaRendererNative *renderer_native = META_RENDERER_NATIVE (object); + MetaMonitorManager *monitor_manager = + META_MONITOR_MANAGER (renderer_native->monitor_manager_kms); + MetaBackend *backend = meta_monitor_manager_get_backend (monitor_manager); + MetaSettings *settings = meta_backend_get_settings (backend); + + if (meta_settings_is_experimental_feature_enabled ( + settings, META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS)) + renderer_native->use_modifiers = TRUE; + + G_OBJECT_CLASS (meta_renderer_native_parent_class)->constructed (object); +} + +static void meta_renderer_native_init (MetaRendererNative *renderer_native) { renderer_native->gpu_datas = @@ -3408,6 +3431,7 @@ meta_renderer_native_class_init (MetaRendererNativeClass *klass) object_class->get_property = meta_renderer_native_get_property; object_class->set_property = meta_renderer_native_set_property; object_class->finalize = meta_renderer_native_finalize; + object_class->constructed = meta_renderer_native_constructed; renderer_class->create_cogl_renderer = meta_renderer_native_create_cogl_renderer; renderer_class->create_view = meta_renderer_native_create_view; |