[mutter] native: Disable the use of KMS modifiers by default
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] native: Disable the use of KMS modifiers by default
- Date: Mon, 16 Apr 2018 14:38:21 +0000 (UTC)
commit f6cd87734d01d911817ccabe284ae316cba19311
Author: Jonas Ådahl <jadahl gmail com>
Date: Wed Apr 11 14:39:15 2018 +0200
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.
src/backends/meta-settings-private.h | 1 +
src/backends/meta-settings.c | 2 ++
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..860deaa50 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)
{
@@ -3390,6 +3397,22 @@ meta_renderer_native_finalize (GObject *object)
G_OBJECT_CLASS (meta_renderer_native_parent_class)->finalize (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)
{
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]