From d9ca938388ac4ae3f50d2e66ed6a4271ddb74f70 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Wed, 27 Mar 2024 20:07:51 +0000 Subject: [PATCH] import CS mutter-3.32.2-72.el8 --- .../mutter-screencast-dmabuf-i915-only.patch | 45 ++++++++++++ ...ter-screencast-negotiate-buffer-type.patch | 68 +++++++++++++++++++ SPECS/mutter.spec | 9 ++- 3 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 SOURCES/mutter-screencast-dmabuf-i915-only.patch create mode 100644 SOURCES/mutter-screencast-negotiate-buffer-type.patch diff --git a/SOURCES/mutter-screencast-dmabuf-i915-only.patch b/SOURCES/mutter-screencast-dmabuf-i915-only.patch new file mode 100644 index 0000000..c925164 --- /dev/null +++ b/SOURCES/mutter-screencast-dmabuf-i915-only.patch @@ -0,0 +1,45 @@ +diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c +index 2bf7f5e..1221c7b 100644 +--- a/src/backends/native/meta-backend-native.c ++++ b/src/backends/native/meta-backend-native.c +@@ -341,25 +341,30 @@ maybe_disable_screen_cast_dma_bufs (MetaBackendNative *native) + MetaGpuKms *primary_gpu; + const char *driver_name; + int i; +- static const char *disable_dma_buf_drivers[] = { +- "qxl", ++ static const char *enable_dma_buf_drivers[] = { ++ "i915", + }; ++ MetaScreenCast *screen_cast = meta_backend_get_screen_cast (backend); ++ gboolean enable_dma_buf = FALSE; + + primary_gpu = meta_renderer_native_get_primary_gpu (renderer_native); + driver_name = meta_gpu_kms_get_driver_name (primary_gpu); + +- for (i = 0; i < G_N_ELEMENTS (disable_dma_buf_drivers); i++) ++ for (i = 0; i < G_N_ELEMENTS (enable_dma_buf_drivers); i++) + { +- if (g_strcmp0 (driver_name, disable_dma_buf_drivers[i]) == 0) ++ if (g_strcmp0 (driver_name, enable_dma_buf_drivers[i]) == 0) + { +- MetaScreenCast *screen_cast = meta_backend_get_screen_cast (backend); ++ enable_dma_buf = TRUE; ++ break; ++ } ++ } + +- g_message ("The '%s' driver doesn't support DMA buffer screen sharing, disabling.", +- driver_name); ++ if (!enable_dma_buf) ++ { ++ g_message ("Not enabling DMA buffer screen sharing for driver '%s'.", ++ driver_name); + +- meta_screen_cast_disable_dma_bufs (screen_cast); +- return; +- } ++ meta_screen_cast_disable_dma_bufs (screen_cast); + } + } + #endif /* HAVE_REMOTE_DESKTOP */ diff --git a/SOURCES/mutter-screencast-negotiate-buffer-type.patch b/SOURCES/mutter-screencast-negotiate-buffer-type.patch new file mode 100644 index 0000000..a6cc8bc --- /dev/null +++ b/SOURCES/mutter-screencast-negotiate-buffer-type.patch @@ -0,0 +1,68 @@ +diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c +index f39d348..c1abc9b 100644 +--- a/src/backends/meta-screen-cast-stream-src.c ++++ b/src/backends/meta-screen-cast-stream-src.c +@@ -684,11 +684,18 @@ on_stream_param_changed (void *data, + MetaScreenCastStreamSrc *src = data; + MetaScreenCastStreamSrcPrivate *priv = + meta_screen_cast_stream_src_get_instance_private (src); ++ MetaScreenCastStream *stream = meta_screen_cast_stream_src_get_stream (src); ++ MetaScreenCastSession *session = meta_screen_cast_stream_get_session (stream); ++ MetaScreenCast *screen_cast = ++ meta_screen_cast_session_get_screen_cast (session); ++ + uint8_t params_buffer[1024]; + int32_t width, height, stride, size; + struct spa_pod_builder pod_builder; + const struct spa_pod *params[3]; + const int bpp = 4; ++ int buffer_types; ++ CoglDmaBufHandle *dmabuf_handle; + + if (!format || id != SPA_PARAM_Format) + return; +@@ -705,6 +712,16 @@ on_stream_param_changed (void *data, + + pod_builder = SPA_POD_BUILDER_INIT (params_buffer, sizeof (params_buffer)); + ++ buffer_types = 1 << SPA_DATA_MemFd; ++ dmabuf_handle = meta_screen_cast_create_dma_buf_handle (screen_cast, ++ priv->stream_width, ++ priv->stream_height); ++ if (dmabuf_handle) ++ { ++ buffer_types |= 1 << SPA_DATA_DmaBuf; ++ cogl_dma_buf_handle_free(dmabuf_handle); ++ } ++ + params[0] = spa_pod_builder_add_object ( + &pod_builder, + SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers, +@@ -712,7 +729,8 @@ on_stream_param_changed (void *data, + SPA_PARAM_BUFFERS_blocks, SPA_POD_Int (1), + SPA_PARAM_BUFFERS_size, SPA_POD_Int (size), + SPA_PARAM_BUFFERS_stride, SPA_POD_Int (stride), +- SPA_PARAM_BUFFERS_align, SPA_POD_Int (16)); ++ SPA_PARAM_BUFFERS_align, SPA_POD_Int (16), ++ SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int (buffer_types)); + + params[1] = spa_pod_builder_add_object ( + &pod_builder, +@@ -751,9 +769,16 @@ on_stream_add_buffer (void *data, + spa_data[0].mapoffset = 0; + spa_data[0].maxsize = stride * priv->video_format.size.height; + +- dmabuf_handle = meta_screen_cast_create_dma_buf_handle (screen_cast, ++ if (spa_data[0].type & (1 << SPA_DATA_DmaBuf)) ++ { ++ dmabuf_handle = meta_screen_cast_create_dma_buf_handle (screen_cast, + priv->stream_width, + priv->stream_height); ++ } ++ else ++ { ++ dmabuf_handle = NULL; ++ } + + if (dmabuf_handle) + { diff --git a/SPECS/mutter.spec b/SPECS/mutter.spec index dc9bc63..d3e45b1 100644 --- a/SPECS/mutter.spec +++ b/SPECS/mutter.spec @@ -8,7 +8,7 @@ Name: mutter Version: 3.32.2 -Release: 71%{?dist} +Release: 72%{?dist} Summary: Window and compositing manager based on Clutter License: GPLv2+ @@ -148,6 +148,8 @@ Patch407: 0004-screen-cast-Disable-DMA-buffer-based-screen-casting-.patch # https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1365 Patch408: cursor-move-only-screen-cast-fixes.patch Patch409: mutter-bump-screencast-api-version.patch +Patch410: mutter-screencast-dmabuf-i915-only.patch +Patch411: mutter-screencast-negotiate-buffer-type.patch # Only treat WM_PROTOCOLS messages as WM_PROTOCOL messages (#1847203) Patch500: 0001-stage-x11-Check-that-message-is-WM_PROTOCOLS-before-.patch @@ -356,6 +358,11 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop %{_datadir}/mutter-%{mutter_api_version}/tests %changelog +* Mon Oct 02 2023 Jan Grulich - 3.32.2-72 +- Do not use DMA buffers for screencast when the client doesn't support it +- Use DMA buffers only for i195 drivers + Resolves: RHEL-4405 + * Thu Aug 17 2023 Carlos Garnacho - 3.32.2-71 - Fix ordering of keyboard modifiers relative to other keyboard events Resolves: #2170830