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.
This commit is contained in:
Jonas Ådahl 2018-04-11 14:39:15 +02:00
parent 01a0fa9437
commit f6cd87734d
3 changed files with 29 additions and 2 deletions

View File

@ -33,6 +33,7 @@ typedef enum _MetaExperimentalFeature
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER = (1 << 0), META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER = (1 << 0),
META_EXPERIMENTAL_FEATURE_SCREEN_CAST = (1 << 1), META_EXPERIMENTAL_FEATURE_SCREEN_CAST = (1 << 1),
META_EXPERIMENTAL_FEATURE_REMOTE_DESKTOP = (1 << 2), META_EXPERIMENTAL_FEATURE_REMOTE_DESKTOP = (1 << 2),
META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS = (1 << 3),
} MetaExperimentalFeature; } MetaExperimentalFeature;
#define META_TYPE_SETTINGS (meta_settings_get_type ()) #define META_TYPE_SETTINGS (meta_settings_get_type ())

View File

@ -267,6 +267,8 @@ experimental_features_handler (GVariant *features_variant,
features |= META_EXPERIMENTAL_FEATURE_SCREEN_CAST; features |= META_EXPERIMENTAL_FEATURE_SCREEN_CAST;
else if (g_str_equal (feature, "remote-desktop")) else if (g_str_equal (feature, "remote-desktop"))
features |= META_EXPERIMENTAL_FEATURE_REMOTE_DESKTOP; features |= META_EXPERIMENTAL_FEATURE_REMOTE_DESKTOP;
else if (g_str_equal (feature, "kms-modifiers"))
features |= META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS;
else else
g_info ("Unknown experimental feature '%s'\n", feature); g_info ("Unknown experimental feature '%s'\n", feature);
} }

View File

@ -193,6 +193,8 @@ struct _MetaRendererNative
MetaMonitorManagerKms *monitor_manager_kms; MetaMonitorManagerKms *monitor_manager_kms;
MetaGles3 *gles3; MetaGles3 *gles3;
gboolean use_modifiers;
GHashTable *gpu_datas; GHashTable *gpu_datas;
CoglClosure *swap_notify_idle; CoglClosure *swap_notify_idle;
@ -1586,6 +1588,7 @@ gbm_get_next_fb_id (MetaGpuKms *gpu_kms,
struct gbm_bo **out_next_bo, struct gbm_bo **out_next_bo,
uint32_t *out_next_fb_id) uint32_t *out_next_fb_id)
{ {
MetaRendererNative *renderer_native = meta_renderer_native_from_gpu (gpu_kms);
struct gbm_bo *next_bo; struct gbm_bo *next_bo;
uint32_t next_fb_id; uint32_t next_fb_id;
int kms_fd; int kms_fd;
@ -1608,7 +1611,8 @@ gbm_get_next_fb_id (MetaGpuKms *gpu_kms,
kms_fd = meta_gpu_kms_get_fd (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, if (drmModeAddFB2WithModifiers (kms_fd,
gbm_bo_get_width (next_bo), 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, meta_renderer_native_get_gpu_data (renderer_native,
onscreen_native->render_gpu); onscreen_native->render_gpu);
if (renderer_native->use_modifiers)
modifiers = get_supported_modifiers (onscreen, format); modifiers = get_supported_modifiers (onscreen, format);
else
modifiers = NULL;
if (modifiers) if (modifiers)
{ {
@ -3390,6 +3397,22 @@ meta_renderer_native_finalize (GObject *object)
G_OBJECT_CLASS (meta_renderer_native_parent_class)->finalize (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 static void
meta_renderer_native_init (MetaRendererNative *renderer_native) 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->get_property = meta_renderer_native_get_property;
object_class->set_property = meta_renderer_native_set_property; object_class->set_property = meta_renderer_native_set_property;
object_class->finalize = meta_renderer_native_finalize; 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_cogl_renderer = meta_renderer_native_create_cogl_renderer;
renderer_class->create_view = meta_renderer_native_create_view; renderer_class->create_view = meta_renderer_native_create_view;