1
0
Fork 0

backend/native: Only disable dmabuf screen cast when not hw accelerated

We now only enable DMA buffer based PipeWire screen casting if a
format/modifier has been negotiated. This practically means a consumer
is aware about what is needed, and we should not try to predict that it
uses the DMA buffer the right way (i.e. not mmap:ing directly).

However, in case we're not hardware accelerated, we never want to
attempt to use DMA buffer screen sharing, as we want to avoid
compositing into a DMA buffer on such hardware as doing so can be very
slow.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2086>
This commit is contained in:
Jonas Ådahl 2021-11-11 09:28:25 +01:00 committed by Marge Bot
parent 169dd2fb7a
commit 52ce81657d
4 changed files with 6 additions and 40 deletions

View file

@ -4,8 +4,7 @@
<value nick="scale-monitor-framebuffer" value="1"/>
<value nick="kms-modifiers" value="2"/>
<value nick="rt-scheduler" value="4"/>
<value nick="dma-buf-screen-sharing" value="8"/>
<value nick="autoclose-xwayland" value="16"/>
<value nick="autoclose-xwayland" value="8"/>
</flags>
<schema id="org.gnome.mutter" path="/org/gnome/mutter/"
@ -139,11 +138,6 @@
• “rt-scheduler” — makes mutter request a low priority
real-time scheduling. Requires a restart.
• “dma-buf-screen-sharing” — enables DMA buffered screen sharing. This
is already enabled by default when using
the i915 driver, but disabled for
everything else. Requires a restart.
• “autoclose-xwayland” — automatically terminates Xwayland if all
relevant X11 clients are gone.
Requires a restart.

View file

@ -34,8 +34,7 @@ typedef enum _MetaExperimentalFeature
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER = (1 << 0),
META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS = (1 << 1),
META_EXPERIMENTAL_FEATURE_RT_SCHEDULER = (1 << 2),
META_EXPERIMENTAL_FEATURE_DMA_BUF_SCREEN_SHARING = (1 << 3),
META_EXPERIMENTAL_FEATURE_AUTOCLOSE_XWAYLAND = (1 << 4),
META_EXPERIMENTAL_FEATURE_AUTOCLOSE_XWAYLAND = (1 << 3),
} MetaExperimentalFeature;
typedef enum _MetaXwaylandExtension

View file

@ -294,8 +294,6 @@ experimental_features_handler (GVariant *features_variant,
feature = META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS;
else if (g_str_equal (feature_str, "rt-scheduler"))
feature = META_EXPERIMENTAL_FEATURE_RT_SCHEDULER;
else if (g_str_equal (feature_str, "dma-buf-screen-sharing"))
feature = META_EXPERIMENTAL_FEATURE_DMA_BUF_SCREEN_SHARING;
else if (g_str_equal (feature_str, "autoclose-xwayland"))
feature = META_EXPERIMENTAL_FEATURE_AUTOCLOSE_XWAYLAND;

View file

@ -158,40 +158,15 @@ 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);
MetaGpuKms *primary_gpu;
MetaKmsDevice *kms_device;
const char *driver_name;
static const char *enable_dma_buf_drivers[] = {
"i915",
NULL,
};
primary_gpu = meta_renderer_native_get_primary_gpu (renderer_native);
if (!primary_gpu)
if (!meta_renderer_is_hardware_accelerated (renderer))
{
g_message ("Disabling DMA buffer screen sharing (surfaceless)");
goto disable_dma_bufs;
g_message ("Disabling DMA buffer screen sharing "
"(not hardware accelerated)");
meta_screen_cast_disable_dma_bufs (screen_cast);
}
kms_device = meta_gpu_kms_get_kms_device (primary_gpu);
driver_name = meta_kms_device_get_driver_name (kms_device);
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);
disable_dma_bufs:
meta_screen_cast_disable_dma_bufs (screen_cast);
}
#endif /* HAVE_REMOTE_DESKTOP */