From af9df1e5b62b253e5f1d5f6eff89e45e3bed81b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 14 Sep 2020 18:23:10 +0200 Subject: [PATCH] screen-cast: Add 'dma-buf-screen-sharing' experimental feature It's enabled by default when using the i915 driver, but disabled everywhere else until it can be made reliably an improvement. Until then, for anyone want to force-enable it, add the string 'dma-buf-screen-sharing' to the experimental features list in GSettings. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1442 --- src/backends/meta-settings-private.h | 1 + src/backends/meta-settings.c | 2 ++ src/backends/native/meta-backend-native.c | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/src/backends/meta-settings-private.h b/src/backends/meta-settings-private.h index 91b3eb17a..c0621cb08 100644 --- a/src/backends/meta-settings-private.h +++ b/src/backends/meta-settings-private.h @@ -35,6 +35,7 @@ typedef enum _MetaExperimentalFeature META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS = (1 << 1), META_EXPERIMENTAL_FEATURE_RT_SCHEDULER = (1 << 2), META_EXPERIMENTAL_FEATURE_AUTOSTART_XWAYLAND = (1 << 3), + META_EXPERIMENTAL_FEATURE_DMA_BUF_SCREEN_SHARING = (1 << 4), } MetaExperimentalFeature; typedef enum _MetaXwaylandExtension diff --git a/src/backends/meta-settings.c b/src/backends/meta-settings.c index f14dbfae6..553e2cd1c 100644 --- a/src/backends/meta-settings.c +++ b/src/backends/meta-settings.c @@ -273,6 +273,8 @@ experimental_features_handler (GVariant *features_variant, feature = META_EXPERIMENTAL_FEATURE_RT_SCHEDULER; else if (g_str_equal (feature_str, "autostart-xwayland")) feature = META_EXPERIMENTAL_FEATURE_AUTOSTART_XWAYLAND; + else if (g_str_equal (feature_str, "dma-buf-screen-sharing")) + feature = META_EXPERIMENTAL_FEATURE_DMA_BUF_SCREEN_SHARING; if (feature) g_message ("Enabling experimental feature '%s'", feature_str); diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c index 1b7c8e058..73723ace9 100644 --- a/src/backends/native/meta-backend-native.c +++ b/src/backends/native/meta-backend-native.c @@ -347,6 +347,7 @@ static void maybe_disable_screen_cast_dma_bufs (MetaBackendNative *native) { MetaBackend *backend = META_BACKEND (native); + MetaSettings *settings = meta_backend_get_settings (backend); MetaRenderer *renderer = meta_backend_get_renderer (backend); MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer); MetaScreenCast *screen_cast = meta_backend_get_screen_cast (backend); @@ -365,6 +366,10 @@ maybe_disable_screen_cast_dma_bufs (MetaBackendNative *native) if (g_strv_contains (enable_dma_buf_drivers, driver_name)) return; + if (meta_settings_is_experimental_feature_enabled (settings, + META_EXPERIMENTAL_FEATURE_DMA_BUF_SCREEN_SHARING)) + return; + g_message ("Disabling DMA buffer screen sharing for driver '%s'.", driver_name);