import mutter-3.32.2-48.el8

This commit is contained in:
CentOS Sources 2020-11-03 06:49:22 -05:00 committed by Andrew Lukoshko
parent 2b8c83921d
commit c0e83e5f4d
19 changed files with 8444 additions and 23 deletions

View File

@ -1,4 +1,4 @@
From 8d7356fd7439f94f163438d55f2b2d3d918de96d Mon Sep 17 00:00:00 2001
From 6108e0175932f74733c46ebe13db06998f26d4ba Mon Sep 17 00:00:00 2001
From: "Owen W. Taylor" <otaylor@fishsoup.net>
Date: Thu, 8 May 2014 18:44:15 -0400
Subject: [PATCH] Add support for quad-buffer stereo
@ -21,7 +21,7 @@ texture_from_pixmap.
src/compositor/compositor-private.h | 9 ++
src/compositor/compositor.c | 125 +++++++++++++++
src/compositor/meta-shaped-texture-private.h | 5 +-
src/compositor/meta-shaped-texture.c | 84 +++++++++-
src/compositor/meta-shaped-texture.c | 85 +++++++++-
src/compositor/meta-surface-actor-wayland.c | 2 +-
src/compositor/meta-surface-actor-x11.c | 54 ++++++-
src/compositor/meta-surface-actor-x11.h | 5 +
@ -32,7 +32,7 @@ texture_from_pixmap.
src/core/stereo.h | 28 ++++
src/meson.build | 2 +
src/wayland/meta-wayland-surface.c | 2 +-
14 files changed, 481 insertions(+), 20 deletions(-)
14 files changed, 482 insertions(+), 20 deletions(-)
create mode 100644 src/core/stereo.c
create mode 100644 src/core/stereo.h
@ -265,7 +265,7 @@ index a86a2bff0..d0efdd4dc 100644
gboolean is_y_inverted);
void meta_shaped_texture_set_snippet (MetaShapedTexture *stex,
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index d64e214e5..e77a32109 100644
index d64e214e5..332b4c814 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -88,8 +88,10 @@ struct _MetaShapedTexture
@ -287,7 +287,7 @@ index d64e214e5..e77a32109 100644
stex->texture = NULL;
stex->mask_texture = NULL;
@@ -297,6 +300,9 @@ meta_shaped_texture_dispose (GObject *object)
@@ -297,7 +300,11 @@ meta_shaped_texture_dispose (GObject *object)
meta_texture_tower_free (stex->paint_tower);
stex->paint_tower = NULL;
@ -295,9 +295,11 @@ index d64e214e5..e77a32109 100644
+ g_clear_pointer (&stex->paint_tower_right, meta_texture_tower_free);
+
g_clear_pointer (&stex->texture, cogl_object_unref);
+ g_clear_pointer (&stex->texture_right, cogl_object_unref);
g_clear_pointer (&stex->opaque_region, cairo_region_destroy);
@@ -507,8 +513,9 @@ paint_clipped_rectangle (MetaShapedTexture *stex,
meta_shaped_texture_set_mask_texture (stex, NULL);
@@ -507,8 +514,9 @@ paint_clipped_rectangle (MetaShapedTexture *stex,
}
static void
@ -309,7 +311,7 @@ index d64e214e5..e77a32109 100644
{
int width, height;
@@ -516,8 +523,11 @@ set_cogl_texture (MetaShapedTexture *stex,
@@ -516,8 +524,11 @@ set_cogl_texture (MetaShapedTexture *stex,
if (stex->texture)
cogl_object_unref (stex->texture);
@ -321,7 +323,7 @@ index d64e214e5..e77a32109 100644
if (cogl_tex != NULL)
{
@@ -531,6 +541,9 @@ set_cogl_texture (MetaShapedTexture *stex,
@@ -531,6 +542,9 @@ set_cogl_texture (MetaShapedTexture *stex,
height = 0;
}
@ -331,7 +333,7 @@ index d64e214e5..e77a32109 100644
if (stex->tex_width != width ||
stex->tex_height != height)
{
@@ -544,8 +557,23 @@ set_cogl_texture (MetaShapedTexture *stex,
@@ -544,8 +558,23 @@ set_cogl_texture (MetaShapedTexture *stex,
* previous buffer. We only queue a redraw in response to surface
* damage. */
@ -356,7 +358,7 @@ index d64e214e5..e77a32109 100644
}
static gboolean
@@ -779,7 +807,9 @@ meta_shaped_texture_paint (ClutterActor *actor)
@@ -779,7 +808,9 @@ meta_shaped_texture_paint (ClutterActor *actor)
{
MetaShapedTexture *stex = META_SHAPED_TEXTURE (actor);
CoglTexture *paint_tex;
@ -366,7 +368,7 @@ index d64e214e5..e77a32109 100644
if (!stex->texture)
return;
@@ -841,7 +871,32 @@ meta_shaped_texture_paint (ClutterActor *actor)
@@ -841,7 +872,32 @@ meta_shaped_texture_paint (ClutterActor *actor)
return;
fb = cogl_get_draw_framebuffer ();
@ -400,7 +402,7 @@ index d64e214e5..e77a32109 100644
}
static void
@@ -915,6 +970,12 @@ meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex,
@@ -915,6 +971,12 @@ meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex,
stex->create_mipmaps = create_mipmaps;
base_texture = create_mipmaps ? stex->texture : NULL;
meta_texture_tower_set_base_texture (stex->paint_tower, base_texture);
@ -413,7 +415,7 @@ index d64e214e5..e77a32109 100644
}
}
@@ -1046,6 +1107,12 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
@@ -1046,6 +1108,12 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
clip.y,
clip.width,
clip.height);
@ -426,7 +428,7 @@ index d64e214e5..e77a32109 100644
stex->prev_invalidation = stex->last_invalidation;
stex->last_invalidation = g_get_monotonic_time ();
@@ -1092,17 +1159,18 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
@@ -1092,17 +1160,18 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
}
/**
@ -901,5 +903,5 @@ index da0acfcbb..ddad1a45c 100644
meta_shaped_texture_set_is_y_inverted (stex, is_y_inverted);
g_clear_pointer (&snippet, cogl_object_unref);
--
2.25.1
2.28.0

View File

@ -0,0 +1,49 @@
From 967d8236d81c8689f2fe60621ec7e66d88b43dea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 17 Jun 2020 17:46:25 +0200
Subject: [PATCH 1/4] backend: Add getter for MetaScreenCast
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1318
---
src/backends/meta-backend-private.h | 2 ++
src/backends/meta-backend.c | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/src/backends/meta-backend-private.h b/src/backends/meta-backend-private.h
index 81ec81e5f1..77f4da77c4 100644
--- a/src/backends/meta-backend-private.h
+++ b/src/backends/meta-backend-private.h
@@ -138,6 +138,8 @@ MetaEgl * meta_backend_get_egl (MetaBackend *backend);
#ifdef HAVE_REMOTE_DESKTOP
MetaRemoteDesktop * meta_backend_get_remote_desktop (MetaBackend *backend);
+
+MetaScreenCast * meta_backend_get_screen_cast (MetaBackend *backend);
#endif
gboolean meta_backend_grab_device (MetaBackend *backend,
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index 750a9248a8..b498b7aa44 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -965,6 +965,17 @@ meta_backend_get_remote_desktop (MetaBackend *backend)
return priv->remote_desktop;
}
+
+/**
+ * meta_backend_get_screen_cast: (skip)
+ */
+MetaScreenCast *
+meta_backend_get_screen_cast (MetaBackend *backend)
+{
+ MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
+
+ return priv->screen_cast;
+}
#endif /* HAVE_REMOTE_DESKTOP */
/**
--
2.26.2

View File

@ -0,0 +1,53 @@
From 4c1c3541efa37acf3a03822289a8ab8705cbbc4e Mon Sep 17 00:00:00 2001
From: Christian Hergert <chergert@redhat.com>
Date: Sun, 23 Feb 2020 17:27:08 -0800
Subject: [PATCH 1/3] clutter: avoid redundant _clutter_paint_node_init_types()
This only needs to be initialized once but is in the hot path of creating
new paint nodes (for which we create many). Instead, do this as part of
the clutter_init() workflow to keep it out of the hot path.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1087
---
clutter/clutter/clutter-main.c | 4 ++++
clutter/clutter/clutter-paint-node.c | 2 --
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index 71ec0d80c..645c8bceb 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -61,6 +61,7 @@
#include "clutter-main.h"
#include "clutter-master-clock.h"
#include "clutter-mutter.h"
+#include "clutter-paint-node-private.h"
#include "clutter-private.h"
#include "clutter-settings-private.h"
#include "clutter-stage-manager.h"
@@ -1366,6 +1367,9 @@ clutter_init_real (GError **error)
if (clutter_enable_accessibility)
cally_accessibility_init ();
+ /* Initialize types required for paint nodes */
+ _clutter_paint_node_init_types ();
+
return CLUTTER_INIT_SUCCESS;
}
diff --git a/clutter/clutter/clutter-paint-node.c b/clutter/clutter/clutter-paint-node.c
index e731ca60a..73765a4e9 100644
--- a/clutter/clutter/clutter-paint-node.c
+++ b/clutter/clutter/clutter-paint-node.c
@@ -1177,8 +1177,6 @@ _clutter_paint_node_create (GType gtype)
{
g_return_val_if_fail (g_type_is_a (gtype, CLUTTER_TYPE_PAINT_NODE), NULL);
- _clutter_paint_node_init_types ();
-
return (gpointer) g_type_create_instance (gtype);
}
--
2.26.0

View File

@ -0,0 +1,41 @@
From 9f8564ce066aeb704341d6f926daec0045243b70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 25 Jun 2020 10:06:38 +0200
Subject: [PATCH 1/2] monitor-manager-kms: Trigger hotplug processing on gpu
removal
---
src/backends/native/meta-monitor-manager-kms.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c
index 9a0364441a..2819881576 100644
--- a/src/backends/native/meta-monitor-manager-kms.c
+++ b/src/backends/native/meta-monitor-manager-kms.c
@@ -470,12 +470,18 @@ on_uevent (GUdevClient *client,
if (!g_strcmp0 (seat_id, device_seat))
handle_gpu_hotplug (manager_kms, device);
- }
-
- if (!g_udev_device_get_property_as_boolean (device, "HOTPLUG"))
- return;
- handle_hotplug_event (manager);
+ handle_hotplug_event (manager);
+ }
+ else if (g_str_equal (action, "remove") &&
+ g_udev_device_get_device_file (device) != NULL)
+ {
+ handle_hotplug_event (manager);
+ }
+ else if (g_udev_device_get_property_as_boolean (device, "HOTPLUG"))
+ {
+ handle_hotplug_event (manager);
+ }
}
static void
--
2.26.2

View File

@ -0,0 +1,108 @@
From d107b52939ca0acb1f8dacf1275278edba64eebe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Tue, 1 Oct 2019 11:53:57 +0200
Subject: [PATCH] renderer: Add API to check whether renderer is hardware
accelerated
Also expose an introspected variant via the MetaBackend.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/838
---
src/backends/meta-backend.c | 15 +++++++++++++++
src/backends/meta-renderer.c | 27 +++++++++++++++++++++++++++
src/backends/meta-renderer.h | 2 ++
src/meta/meta-backend.h | 3 +++
4 files changed, 47 insertions(+)
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index 72cfbdaf3..e61181f9a 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -985,6 +985,21 @@ meta_backend_get_remote_access_controller (MetaBackend *backend)
#endif
}
+/**
+ * meta_backend_is_rendering_hardware_accelerated:
+ * @backend: A #MetaBackend
+ *
+ * Returns: %TRUE if the rendering is hardware accelerated, otherwise
+ * %FALSE.
+ */
+gboolean
+meta_backend_is_rendering_hardware_accelerated (MetaBackend *backend)
+{
+ MetaRenderer *renderer = meta_backend_get_renderer (backend);
+
+ return meta_renderer_is_hardware_accelerated (renderer);
+}
+
/**
* meta_backend_grab_device: (skip)
*/
diff --git a/src/backends/meta-renderer.c b/src/backends/meta-renderer.c
index 87ba9f9f0..470220fc8 100644
--- a/src/backends/meta-renderer.c
+++ b/src/backends/meta-renderer.c
@@ -166,6 +166,33 @@ meta_renderer_get_view_from_logical_monitor (MetaRenderer *renderer,
return NULL;
}
+gboolean
+meta_renderer_is_hardware_accelerated (MetaRenderer *renderer)
+{
+ MetaRendererPrivate *priv = meta_renderer_get_instance_private (renderer);
+ MetaBackend *backend = meta_get_backend ();
+ ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
+ CoglContext *cogl_context =
+ clutter_backend_get_cogl_context (clutter_backend);
+ CoglGpuInfo *info = &cogl_context->gpu;
+
+ switch (info->architecture)
+ {
+ case COGL_GPU_INFO_ARCHITECTURE_UNKNOWN:
+ case COGL_GPU_INFO_ARCHITECTURE_SANDYBRIDGE:
+ case COGL_GPU_INFO_ARCHITECTURE_SGX:
+ case COGL_GPU_INFO_ARCHITECTURE_MALI:
+ return TRUE;
+ case COGL_GPU_INFO_ARCHITECTURE_LLVMPIPE:
+ case COGL_GPU_INFO_ARCHITECTURE_SOFTPIPE:
+ case COGL_GPU_INFO_ARCHITECTURE_SWRAST:
+ return FALSE;
+ }
+
+ g_assert_not_reached ();
+ return FALSE;
+}
+
static void
meta_renderer_finalize (GObject *object)
{
diff --git a/src/backends/meta-renderer.h b/src/backends/meta-renderer.h
index 478baee91..97bf36860 100644
--- a/src/backends/meta-renderer.h
+++ b/src/backends/meta-renderer.h
@@ -59,4 +59,6 @@ GList * meta_renderer_get_views (MetaRenderer *renderer);
MetaRendererView * meta_renderer_get_view_from_logical_monitor (MetaRenderer *renderer,
MetaLogicalMonitor *logical_monitor);
+gboolean meta_renderer_is_hardware_accelerated (MetaRenderer *renderer);
+
#endif /* META_RENDERER_H */
diff --git a/src/meta/meta-backend.h b/src/meta/meta-backend.h
index aaa6aae97..8edc0bf2c 100644
--- a/src/meta/meta-backend.h
+++ b/src/meta/meta-backend.h
@@ -64,6 +64,9 @@ MetaSettings *meta_backend_get_settings (MetaBackend *backend);
META_EXPORT
MetaRemoteAccessController * meta_backend_get_remote_access_controller (MetaBackend *backend);
+META_EXPORT
+gboolean meta_backend_is_rendering_hardware_accelerated (MetaBackend *backend);
+
META_EXPORT
void meta_clutter_init (void);
--
2.26.2

View File

@ -0,0 +1,40 @@
From b32ae04c122f4f76ffad296c15ba00a13800db57 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Tue, 2 Jun 2020 16:33:05 +0000
Subject: [PATCH 1/2] screen-cast-src: Destroy hash dmabuf table after stream
The stream will clean up the buffers, so let it do that before we
destroy them under its feet. Note that it'll only do this after the
following PipeWire commit:
commit fbaa4ddedd84afdffca16f090dcc4b0db8ccfc29
Author: Wim Taymans <wtaymans@redhat.com>
Date: Mon Jun 1 15:36:09 2020 +0200
stream: allow NULL param and 0 buffers in disconnect
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1283
(cherry picked from commit 97175f8fa14171606ecb95d0bf107ef8b2d71b74)
---
src/backends/meta-screen-cast-stream-src.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c
index 0500bfec5..ff4af440c 100644
--- a/src/backends/meta-screen-cast-stream-src.c
+++ b/src/backends/meta-screen-cast-stream-src.c
@@ -988,8 +988,8 @@ meta_screen_cast_stream_src_finalize (GObject *object)
if (meta_screen_cast_stream_src_is_enabled (src))
meta_screen_cast_stream_src_disable (src);
- g_clear_pointer (&priv->dmabuf_handles, g_hash_table_destroy);
g_clear_pointer (&priv->pipewire_stream, pw_stream_destroy);
+ g_clear_pointer (&priv->dmabuf_handles, g_hash_table_destroy);
g_clear_pointer (&priv->pipewire_core, pw_core_disconnect);
g_clear_pointer (&priv->pipewire_context, pw_context_destroy);
g_source_destroy (&priv->pipewire_source->base);
--
2.26.2

View File

@ -0,0 +1,101 @@
From 639b7ba7f2729a95593c0b85d4789f76152e6099 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 18 Jun 2020 21:17:29 +0200
Subject: [PATCH] stage/x11: Check that message is WM_PROTOCOLS before assuming
so
When a touch sequence was rejected, we'd update the event timestamps of
incoming touch events to help with implementing grabs. This was done by
sending a ClientMessage with a counter, and comparing the counter to
decide whether we're seing a replayed event or not.
This had the unforseen consequence that we would potentially end up
destroying all actors including the stage, since, when mutter receives a
ClientMessage event, it would assume that it's a WM_PROTOCOLS event, and
handle it as such. The problem with this approach is that it would
ignore fact that there might be other ClientMessage types sent to it,
for example the touch synchronization one. What could happen is that the
touch count value would match up with the value of the WM_DELETE_WINDOW
atom, clutter would treat this as WM_PROTOCOLS:WM_DELETE_WINDOW, which
it'd translate to clutter_actor_destroy(stage).
Destroying the stage in such a way is not expected, and caused wierd
crashes in different places depending on what was going on.
This commit make sure we only treat WM_PROTOCOLS client messages as
WM_PROTOCOLS client messages effectively avoiding the issue.
This fixes crashes such as:
#0 meta_window_get_buffer_rect (window=0x0, rect=rect@entry=0x7ffd7fc62e40) at core/window.c:4396
#1 0x00007f1e2634837f in get_top_visible_window_actor (compositor=0x297d700, compositor=0x297d700) at compositor/compositor.c:1059
#2 meta_compositor_sync_stack (compositor=0x297d700, stack=<optimized out>, stack@entry=0x26e3140) at compositor/compositor.c:1176
#3 0x00007f1e263757ac in meta_stack_tracker_sync_stack (tracker=0x297dbc0) at core/stack-tracker.c:871
#4 0x00007f1e26375899 in stack_tracker_sync_stack_later (data=<optimized out>) at core/stack-tracker.c:881
#5 0x00007f1e26376914 in run_repaint_laters (laters_list=0x7f1e2663b7d8 <laters+24>) at core/util.c:809
#6 run_all_repaint_laters (data=<optimized out>) at core/util.c:826
#7 0x00007f1e26b18325 in _clutter_run_repaint_functions (flags=flags@entry=CLUTTER_REPAINT_FLAGS_PRE_PAINT) at clutter-main.c:3448
#8 0x00007f1e26b18fc5 in master_clock_update_stages (master_clock=0x32d6a80, stages=0x4e5a740) at clutter-master-clock-default.c:437
#9 clutter_clock_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at clutter-master-clock-default.c:567
#10 0x00007f1e27e48049 in g_main_dispatch (context=0x225b8d0) at gmain.c:3175
#11 g_main_context_dispatch (context=context@entry=0x225b8d0) at gmain.c:3828
#12 0x00007f1e27e483a8 in g_main_context_iterate (context=0x225b8d0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3901
#13 0x00007f1e27e4867a in g_main_loop_run (loop=0x24e29f0) at gmain.c:4097
#14 0x00007f1e2636a3dc in meta_run () at core/main.c:666
#15 0x000000000040219c in main (argc=1, argv=0x7ffd7fc63238) at ../src/main.c:534
and
#0 0x00007f93943c1f25 in raise () at /usr/lib/libc.so.6
#1 0x00007f93943ab897 in abort () at /usr/lib/libc.so.6
#2 0x00007f9393e1e062 in g_assertion_message (domain=<optimized out>, file=<optimized out>, line=<optimized out>, func=0x7f93933e6860 <__func__.116322> "meta_x11_get_stage_window",
#3 0x00007f9393e4ab1d in g_assertion_message_expr ()
#4 0x00007f939338ecd7 in meta_x11_get_stage_window (stage=<optimized out>) at ../mutter/src/backends/x11/meta-stage-x11.c:923
#5 0x00007f939339e599 in meta_backend_x11_cm_translate_device_event (x11=<optimized out>, device_event=0x55bc8bcfd6b0) at ../mutter/src/backends/x11/cm/meta-backend-x11-cm.c:381
#6 0x00007f939339f2e2 in meta_backend_x11_translate_device_event (device_event=0x55bc8bcfd6b0, x11=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:179
#7 0x00007f939339f2e2 in translate_device_event (device_event=0x55bc8bcfd6b0, x11=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:208
#8 0x00007f939339f2e2 in maybe_spoof_event_as_stage_event (input_event=0x55bc8bcfd6b0, x11=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:284
#9 0x00007f939339f2e2 in handle_input_event (event=0x7fff62d60490, x11=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:309
#10 0x00007f939339f2e2 in handle_host_xevent (event=0x7fff62d60490, backend=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:413
#11 0x00007f939339f2e2 in x_event_source_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at ../mutter/src/backends/x11/meta-backend-x11.c:467
#12 0x00007f9393e6c39e in g_main_dispatch (context=0x55bc89dd03e0) at ../glib/glib/gmain.c:3179
#13 0x00007f9393e6c39e in g_main_context_dispatch (context=context@entry=0x55bc89dd03e0) at ../glib/glib/gmain.c:3844
#14 0x00007f9393e6e1b1 in g_main_context_iterate (context=0x55bc89dd03e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:3917
#15 0x00007f9393e6f0c3 in g_main_loop_run (loop=0x55bc8a042640) at ../glib/glib/gmain.c:4111
#16 0x00007f9393369a0c in meta_run () at ../mutter/src/core/main.c:676
#17 0x000055bc880f2426 in main (argc=<optimized out>, argv=<optimized out>) at ../gnome-shell/src/main.c:552
Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/338
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/951
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1317
---
clutter/clutter/x11/clutter-stage-x11.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/clutter/clutter/x11/clutter-stage-x11.c b/clutter/clutter/x11/clutter-stage-x11.c
index d043bcf31d..123078fc22 100644
--- a/clutter/clutter/x11/clutter-stage-x11.c
+++ b/clutter/clutter/x11/clutter-stage-x11.c
@@ -1306,11 +1306,14 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
_clutter_actor_get_debug_name (CLUTTER_ACTOR (stage)),
stage,
(unsigned int) stage_xwindow);
- if (handle_wm_protocols_event (backend_x11, stage_x11, xevent))
+ if (xevent->xclient.message_type == backend_x11->atom_WM_PROTOCOLS)
{
- event->any.type = CLUTTER_DELETE;
- event->any.stage = stage;
- res = CLUTTER_TRANSLATE_QUEUE;
+ if (handle_wm_protocols_event (backend_x11, stage_x11, xevent))
+ {
+ event->any.type = CLUTTER_DELETE;
+ event->any.stage = stage;
+ res = CLUTTER_TRANSLATE_QUEUE;
+ }
}
break;
--
2.26.2

View File

@ -0,0 +1,35 @@
From 24ddf60768412fd3f5f7b432449b9ed2ea0d18b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Tue, 18 Feb 2020 23:01:28 +0100
Subject: [PATCH] window-actor: Don't show actor until meta_window_actor_show()
By default clutter will show an actor as it is added to a parent. This
means that after we create the window actor, when it's added to the
window group, we implicitly show it. What we really want is to not show
it until the window is supposed to be shown, which happens when
meta_window_actor_show() is called, as showing prior to that, could
cause issues.
Avoid the implicit show by setting the "show-on-set-parent" property on
the window actor to `FALSE` on window actor construction.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1066
---
src/compositor/compositor.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index a6ae55abb9..ce2c1b8a3b 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -810,6 +810,7 @@ meta_compositor_add_window (MetaCompositor *compositor,
window_actor = g_object_new (window_actor_type,
"meta-window", window,
+ "show-on-set-parent", FALSE,
NULL);
if (window->layer == META_LAYER_OVERRIDE_REDIRECT)
--
2.26.2

View File

@ -0,0 +1,192 @@
From 6881aa5ca235ee0737c2a409ffab966a10e5971e Mon Sep 17 00:00:00 2001
From: Christian Hergert <christian@hergert.me>
Date: Mon, 24 Feb 2020 22:36:27 +0000
Subject: [PATCH 2/3] clutter: avoid g_signal_emit_by_name() from ClutterActor
g_signal_emit_by_name() is used to emit signals on ClutterContainer when
actors are removed or added. It happens to do various interface lookups
which are a bit unneccessary and can allocate memory.
Simply using emission wrappers makes all of that go away.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1083
---
clutter/clutter/cally/cally-actor.c | 5 +--
clutter/clutter/clutter-actor.c | 17 ++++++++--
clutter/clutter/clutter-actor.h | 5 ++-
clutter/clutter/clutter-container-private.h | 36 +++++++++++++++++++++
clutter/clutter/clutter-container.c | 21 ++++++++++++
5 files changed, 78 insertions(+), 6 deletions(-)
create mode 100644 clutter/clutter/clutter-container-private.h
diff --git a/clutter/clutter/cally/cally-actor.c b/clutter/clutter/cally/cally-actor.c
index 548615f48..517969625 100644
--- a/clutter/clutter/cally/cally-actor.c
+++ b/clutter/clutter/cally/cally-actor.c
@@ -604,10 +604,11 @@ cally_actor_real_remove_actor (ClutterActor *container,
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
atk_parent = ATK_OBJECT (data);
- atk_child = clutter_actor_get_accessible (actor);
- if (atk_child)
+ if (clutter_actor_has_accessible (actor))
{
+ atk_child = clutter_actor_get_accessible (actor);
+
g_value_init (&values.old_value, G_TYPE_POINTER);
g_value_set_pointer (&values.old_value, atk_parent);
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 803f76aae..93d0a93ef 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -624,7 +624,7 @@
#include "clutter-color-static.h"
#include "clutter-color.h"
#include "clutter-constraint-private.h"
-#include "clutter-container.h"
+#include "clutter-container-private.h"
#include "clutter-content-private.h"
#include "clutter-debug.h"
#include "clutter-easing.h"
@@ -4372,7 +4372,7 @@ clutter_actor_remove_child_internal (ClutterActor *self,
/* we need to emit the signal before dropping the reference */
if (emit_actor_removed)
- g_signal_emit_by_name (self, "actor-removed", child);
+ _clutter_container_emit_actor_removed (CLUTTER_CONTAINER (self), child);
if (notify_first_last)
{
@@ -13060,7 +13060,7 @@ clutter_actor_add_child_internal (ClutterActor *self,
}
if (emit_actor_added)
- g_signal_emit_by_name (self, "actor-added", child);
+ _clutter_container_emit_actor_added (CLUTTER_CONTAINER (self), child);
if (notify_first_last)
{
@@ -21448,3 +21448,14 @@ clutter_actor_create_texture_paint_node (ClutterActor *self,
return node;
}
+
+gboolean
+clutter_actor_has_accessible (ClutterActor *actor)
+{
+ g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
+
+ if (CLUTTER_ACTOR_GET_CLASS (actor)->has_accessible)
+ return CLUTTER_ACTOR_GET_CLASS (actor)->has_accessible (actor);
+
+ return TRUE;
+}
diff --git a/clutter/clutter/clutter-actor.h b/clutter/clutter/clutter-actor.h
index 7d2168af1..d286f2843 100644
--- a/clutter/clutter/clutter-actor.h
+++ b/clutter/clutter/clutter-actor.h
@@ -296,10 +296,11 @@ struct _ClutterActorClass
gboolean (* touch_event) (ClutterActor *self,
ClutterTouchEvent *event);
+ gboolean (* has_accessible) (ClutterActor *self);
/*< private >*/
/* padding for future expansion */
- gpointer _padding_dummy[26];
+ gpointer _padding_dummy[25];
};
/**
@@ -369,6 +370,8 @@ CLUTTER_EXPORT
const gchar * clutter_actor_get_name (ClutterActor *self);
CLUTTER_EXPORT
AtkObject * clutter_actor_get_accessible (ClutterActor *self);
+CLUTTER_EXPORT
+gboolean clutter_actor_has_accessible (ClutterActor *self);
CLUTTER_EXPORT
gboolean clutter_actor_is_visible (ClutterActor *self);
diff --git a/clutter/clutter/clutter-container-private.h b/clutter/clutter/clutter-container-private.h
new file mode 100644
index 000000000..d619a6531
--- /dev/null
+++ b/clutter/clutter/clutter-container-private.h
@@ -0,0 +1,36 @@
+/*
+ * Clutter.
+ *
+ * An OpenGL based 'interactive canvas' library.
+ *
+ * Copyright 2020 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __CLUTTER_CONTAINER_PRIVATE_H__
+#define __CLUTTER_CONTAINER_PRIVATE_H__
+
+#include <clutter/clutter-container.h>
+
+G_BEGIN_DECLS
+
+void _clutter_container_emit_actor_added (ClutterContainer *container,
+ ClutterActor *actor);
+void _clutter_container_emit_actor_removed (ClutterContainer *container,
+ ClutterActor *actor);
+
+G_END_DECLS
+
+#endif /* __CLUTTER_CONTAINER_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-container.c b/clutter/clutter/clutter-container.c
index 0f611ae55..79abb5b4f 100644
--- a/clutter/clutter/clutter-container.c
+++ b/clutter/clutter/clutter-container.c
@@ -37,6 +37,7 @@
#include "clutter-actor-private.h"
#include "clutter-child-meta.h"
+#include "clutter-container-private.h"
#include "clutter-debug.h"
#include "clutter-main.h"
#include "clutter-marshal.h"
@@ -1446,3 +1447,23 @@ clutter_container_child_notify (ClutterContainer *container,
child,
pspec);
}
+
+void
+_clutter_container_emit_actor_added (ClutterContainer *container,
+ ClutterActor *actor)
+{
+ g_return_if_fail (CLUTTER_IS_CONTAINER (container));
+ g_return_if_fail (CLUTTER_IS_ACTOR (actor));
+
+ g_signal_emit (container, container_signals[ACTOR_ADDED], 0, actor);
+}
+
+void
+_clutter_container_emit_actor_removed (ClutterContainer *container,
+ ClutterActor *actor)
+{
+ g_return_if_fail (CLUTTER_IS_CONTAINER (container));
+ g_return_if_fail (CLUTTER_IS_ACTOR (actor));
+
+ g_signal_emit (container, container_signals[ACTOR_REMOVED], 0, actor);
+}
--
2.26.0

View File

@ -0,0 +1,28 @@
From a192b9abd77aa14ae794850e41d210472f86b9b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 25 Jun 2020 10:09:48 +0200
Subject: [PATCH 2/2] gpu-kms: Reset CRTC, mode and output list if no resources
On device removal, the next resource retrieval will fail; handle this by
just clearing the CRTC, mode and outputs.
---
src/backends/native/meta-gpu-kms.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c
index 93e509def5..dc93abb7b1 100644
--- a/src/backends/native/meta-gpu-kms.c
+++ b/src/backends/native/meta-gpu-kms.c
@@ -871,6 +871,9 @@ meta_gpu_kms_read_current (MetaGpu *gpu,
local_error->message);
gpu_kms->resources_init_failed_before = TRUE;
}
+ meta_gpu_take_outputs (gpu, NULL);
+ meta_gpu_take_modes (gpu, NULL);
+ meta_gpu_take_crtcs (gpu, NULL);
return TRUE;
}
--
2.26.2

View File

@ -0,0 +1,46 @@
From 63455680096e015eaf023760466593b6f42f9cf5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 12 Sep 2019 11:50:34 +0200
Subject: [PATCH 2/4] renderer/native: Add API to get primary GPU
Will be used when acquiring scanouts from Wayland buffers.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/798
---
src/backends/native/meta-renderer-native.c | 6 ++++++
src/backends/native/meta-renderer-native.h | 2 ++
2 files changed, 8 insertions(+)
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index dbb88edb8e..25833b6cf6 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -317,6 +317,12 @@ meta_gbm_device_from_gpu (MetaGpuKms *gpu_kms)
return renderer_gpu_data->gbm.device;
}
+MetaGpuKms *
+meta_renderer_native_get_primary_gpu (MetaRendererNative *renderer_native)
+{
+ return renderer_native->primary_gpu_kms;
+}
+
static MetaRendererNativeGpuData *
meta_create_renderer_native_gpu_data (MetaGpuKms *gpu_kms)
{
diff --git a/src/backends/native/meta-renderer-native.h b/src/backends/native/meta-renderer-native.h
index 9eecdead1c..b59366e267 100644
--- a/src/backends/native/meta-renderer-native.h
+++ b/src/backends/native/meta-renderer-native.h
@@ -53,6 +53,8 @@ struct gbm_device * meta_gbm_device_from_gpu (MetaGpuKms *gpu_kms);
gboolean meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_native);
+MetaGpuKms * meta_renderer_native_get_primary_gpu (MetaRendererNative *renderer_native);
+
void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native);
int64_t meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native);
--
2.26.2

View File

@ -0,0 +1,44 @@
From 2e4d3e22aff7cc8e41fa08d798c55a39a542476c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Tue, 2 Jun 2020 18:34:57 +0200
Subject: [PATCH 2/2] renderer-native: Don't leak DMA buffer CoglFramebuffer
When we created the DMA buffer backed CoglFramebuffer, we handed it over
to CoglDmaBufHandle which took its own reference. What we failed to do
was to release our own reference to it, effectively leaking it.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1283
(cherry picked from commit c823b5ddba18d30e1fdb74d6764cd40637dc4054)
---
src/backends/native/meta-renderer-native.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index ba98de650..dbb88edb8 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -2633,6 +2633,7 @@ meta_renderer_native_create_dma_buf (CoglRenderer *cogl_renderer,
case META_RENDERER_NATIVE_MODE_GBM:
{
CoglFramebuffer *dmabuf_fb;
+ CoglDmaBufHandle *dmabuf_handle;
struct gbm_bo *new_bo;
int dmabuf_fd = -1;
@@ -2669,8 +2670,11 @@ meta_renderer_native_create_dma_buf (CoglRenderer *cogl_renderer,
if (!dmabuf_fb)
return NULL;
- return cogl_dma_buf_handle_new (dmabuf_fb, dmabuf_fd, new_bo,
- (GDestroyNotify) gbm_bo_destroy);
+ dmabuf_handle =
+ cogl_dma_buf_handle_new (dmabuf_fb, dmabuf_fd, new_bo,
+ (GDestroyNotify) gbm_bo_destroy);
+ cogl_object_unref (dmabuf_fb);
+ return dmabuf_handle;
}
break;
#ifdef HAVE_EGL_DEVICE
--
2.26.2

View File

@ -0,0 +1,167 @@
From df565fcb681a50aac5046981c5aba04073d14856 Mon Sep 17 00:00:00 2001
From: Christian Hergert <christian@hergert.me>
Date: Fri, 21 Feb 2020 22:36:31 +0000
Subject: [PATCH 3/3] clutter: fix hole in ClutterPaintNode
Fixing the missalignment takes the structure from 80 bytes down to 72.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1081
---
clutter/clutter/clutter-actor.c | 8 +++----
clutter/clutter/clutter-canvas.c | 2 +-
clutter/clutter/clutter-image.c | 2 +-
clutter/clutter/clutter-paint-node-private.h | 6 ++---
clutter/clutter/clutter-paint-node.c | 23 +++++++++++++++-----
clutter/clutter/clutter-paint-node.h | 3 +++
6 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 93d0a93ef..ff5c4a69d 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -3758,7 +3758,7 @@ clutter_actor_paint_node (ClutterActor *actor,
clear_flags |= COGL_BUFFER_BIT_COLOR;
node = clutter_root_node_new (fb, &bg_color, clear_flags);
- clutter_paint_node_set_name (node, "stageClear");
+ clutter_paint_node_set_static_name (node, "stageClear");
clutter_paint_node_add_rectangle (node, &box);
clutter_paint_node_add_child (root, node);
clutter_paint_node_unref (node);
@@ -3773,7 +3773,7 @@ clutter_actor_paint_node (ClutterActor *actor,
/ 255;
node = clutter_color_node_new (&bg_color);
- clutter_paint_node_set_name (node, "backgroundColor");
+ clutter_paint_node_set_static_name (node, "backgroundColor");
clutter_paint_node_add_rectangle (node, &box);
clutter_paint_node_add_child (root, node);
clutter_paint_node_unref (node);
@@ -4069,7 +4069,7 @@ clutter_actor_continue_paint (ClutterActor *self)
* virtual function can then be called directly.
*/
dummy = _clutter_dummy_node_new (self);
- clutter_paint_node_set_name (dummy, "Root");
+ clutter_paint_node_set_static_name (dummy, "Root");
/* XXX - for 1.12, we use the return value of paint_node() to
* decide whether we should emit the ::paint signal.
@@ -21427,7 +21427,7 @@ clutter_actor_create_texture_paint_node (ClutterActor *self,
color.alpha = clutter_actor_get_paint_opacity_internal (self);
node = clutter_texture_node_new (texture, &color, priv->min_filter, priv->mag_filter);
- clutter_paint_node_set_name (node, "Texture");
+ clutter_paint_node_set_static_name (node, "Texture");
if (priv->content_repeat == CLUTTER_REPEAT_NONE)
clutter_paint_node_add_rectangle (node, &box);
diff --git a/clutter/clutter/clutter-canvas.c b/clutter/clutter/clutter-canvas.c
index b0f1f080c..89c031be2 100644
--- a/clutter/clutter/clutter-canvas.c
+++ b/clutter/clutter/clutter-canvas.c
@@ -351,7 +351,7 @@ clutter_canvas_paint_content (ClutterContent *content,
return;
node = clutter_actor_create_texture_paint_node (actor, priv->texture);
- clutter_paint_node_set_name (node, "Canvas Content");
+ clutter_paint_node_set_static_name (node, "Canvas Content");
clutter_paint_node_add_child (root, node);
clutter_paint_node_unref (node);
diff --git a/clutter/clutter/clutter-image.c b/clutter/clutter/clutter-image.c
index 266c68799..790e09521 100644
--- a/clutter/clutter/clutter-image.c
+++ b/clutter/clutter/clutter-image.c
@@ -129,7 +129,7 @@ clutter_image_paint_content (ClutterContent *content,
return;
node = clutter_actor_create_texture_paint_node (actor, priv->texture);
- clutter_paint_node_set_name (node, "Image Content");
+ clutter_paint_node_set_static_name (node, "Image Content");
clutter_paint_node_add_child (root, node);
clutter_paint_node_unref (node);
}
diff --git a/clutter/clutter/clutter-paint-node-private.h b/clutter/clutter/clutter-paint-node-private.h
index d61b89951..720df1458 100644
--- a/clutter/clutter/clutter-paint-node-private.h
+++ b/clutter/clutter/clutter-paint-node-private.h
@@ -48,11 +48,11 @@ struct _ClutterPaintNode
ClutterPaintNode *next_sibling;
ClutterPaintNode *last_child;
- guint n_children;
-
GArray *operations;
- gchar *name;
+ const gchar *name;
+
+ guint n_children;
volatile int ref_count;
};
diff --git a/clutter/clutter/clutter-paint-node.c b/clutter/clutter/clutter-paint-node.c
index 73765a4e9..1f9451a43 100644
--- a/clutter/clutter/clutter-paint-node.c
+++ b/clutter/clutter/clutter-paint-node.c
@@ -171,8 +171,6 @@ clutter_paint_node_real_finalize (ClutterPaintNode *node)
{
ClutterPaintNode *iter;
- g_free (node->name);
-
if (node->operations != NULL)
{
guint i;
@@ -294,7 +292,8 @@ clutter_paint_node_get_type (void)
*
* The @name will be used for debugging purposes.
*
- * The @node will copy the passed string.
+ * The @node will intern @name using g_intern_string(). If you have access to a
+ * static string, use clutter_paint_node_set_static_name() instead.
*
* Since: 1.10
*/
@@ -304,8 +303,22 @@ clutter_paint_node_set_name (ClutterPaintNode *node,
{
g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
- g_free (node->name);
- node->name = g_strdup (name);
+ node->name = g_intern_string (name);
+}
+
+/**
+ * clutter_paint_node_set_static_name: (skip)
+ *
+ * Like clutter_paint_node_set_name() but uses a static or interned string
+ * containing the name.
+ */
+void
+clutter_paint_node_set_static_name (ClutterPaintNode *node,
+ const char *name)
+{
+ g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
+
+ node->name = name;
}
/**
diff --git a/clutter/clutter/clutter-paint-node.h b/clutter/clutter/clutter-paint-node.h
index c42abbc3d..7d25f1681 100644
--- a/clutter/clutter/clutter-paint-node.h
+++ b/clutter/clutter/clutter-paint-node.h
@@ -55,6 +55,9 @@ void clutter_paint_node_paint (Clutter
CLUTTER_EXPORT
void clutter_paint_node_set_name (ClutterPaintNode *node,
const char *name);
+CLUTTER_EXPORT
+void clutter_paint_node_set_static_name (ClutterPaintNode *node,
+ const char *name);
CLUTTER_EXPORT
void clutter_paint_node_add_child (ClutterPaintNode *node,
--
2.26.0

View File

@ -0,0 +1,108 @@
From 914fd2bec65c2e9928b03d5bc94930bc0151f998 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 17 Jun 2020 17:48:05 +0200
Subject: [PATCH 3/4] screen-cast: Move DMA buffer allocation to MetaScreenCast
The aim with centralizing it is to be able to apply global policy to DMA
buffer allocations, e.g. disabling due to various hueristics.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1318
---
src/backends/meta-screen-cast-stream-src.c | 18 ++++++--------
src/backends/meta-screen-cast.c | 28 ++++++++++++++++++++++
src/backends/meta-screen-cast.h | 4 ++++
3 files changed, 39 insertions(+), 11 deletions(-)
diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c
index ff4af440c1..b77186415f 100644
--- a/src/backends/meta-screen-cast-stream-src.c
+++ b/src/backends/meta-screen-cast-stream-src.c
@@ -649,10 +649,10 @@ on_stream_add_buffer (void *data,
MetaScreenCastStreamSrc *src = data;
MetaScreenCastStreamSrcPrivate *priv =
meta_screen_cast_stream_src_get_instance_private (src);
- CoglContext *context =
- clutter_backend_get_cogl_context (clutter_get_default_backend ());
- CoglRenderer *renderer = cogl_context_get_renderer (context);
- g_autoptr (GError) error = NULL;
+ 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);
CoglDmaBufHandle *dmabuf_handle;
struct spa_buffer *spa_buffer = buffer->buffer;
struct spa_data *spa_data = spa_buffer->datas;
@@ -664,13 +664,9 @@ on_stream_add_buffer (void *data,
spa_data[0].mapoffset = 0;
spa_data[0].maxsize = stride * priv->video_format.size.height;
- dmabuf_handle = cogl_renderer_create_dma_buf (renderer,
- priv->stream_width,
- priv->stream_height,
- &error);
-
- if (error)
- g_debug ("Error exporting DMA buffer handle: %s", error->message);
+ dmabuf_handle = meta_screen_cast_create_dma_buf_handle (screen_cast,
+ priv->stream_width,
+ priv->stream_height);
if (dmabuf_handle)
{
diff --git a/src/backends/meta-screen-cast.c b/src/backends/meta-screen-cast.c
index 46bc268389..5f1ca8b5ca 100644
--- a/src/backends/meta-screen-cast.c
+++ b/src/backends/meta-screen-cast.c
@@ -94,6 +94,34 @@ meta_screen_cast_get_backend (MetaScreenCast *screen_cast)
return screen_cast->backend;
}
+CoglDmaBufHandle *
+meta_screen_cast_create_dma_buf_handle (MetaScreenCast *screen_cast,
+ int width,
+ int height)
+{
+ ClutterBackend *clutter_backend =
+ meta_backend_get_clutter_backend (screen_cast->backend);
+ CoglContext *cogl_context =
+ clutter_backend_get_cogl_context (clutter_backend);
+ CoglRenderer *cogl_renderer = cogl_context_get_renderer (cogl_context);
+ g_autoptr (GError) error = NULL;
+ CoglDmaBufHandle *dmabuf_handle;
+
+ dmabuf_handle = cogl_renderer_create_dma_buf (cogl_renderer,
+ width, height,
+ &error);
+ if (!dmabuf_handle)
+ {
+ g_warning ("Failed to allocate DMA buffer, "
+ "disabling DMA buffer based screen casting: %s",
+ error->message);
+ screen_cast->disable_dma_bufs = TRUE;
+ return NULL;
+ }
+
+ return dmabuf_handle;
+}
+
static gboolean
register_remote_desktop_screen_cast_session (MetaScreenCastSession *session,
const char *remote_desktop_session_id,
diff --git a/src/backends/meta-screen-cast.h b/src/backends/meta-screen-cast.h
index a3b650cd80..fb5a38f34f 100644
--- a/src/backends/meta-screen-cast.h
+++ b/src/backends/meta-screen-cast.h
@@ -50,6 +50,10 @@ GDBusConnection * meta_screen_cast_get_connection (MetaScreenCast *screen_cast);
MetaBackend * meta_screen_cast_get_backend (MetaScreenCast *screen_cast);
+CoglDmaBufHandle * meta_screen_cast_create_dma_buf_handle (MetaScreenCast *screen_cast,
+ int width,
+ int height);
+
MetaScreenCast * meta_screen_cast_new (MetaBackend *backend,
MetaDbusSessionWatcher *session_watcher);
--
2.26.2

View File

@ -0,0 +1,209 @@
From a239886e159e6609c3e298effbd0243af8d0e333 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Tue, 16 Jun 2020 11:30:11 +0200
Subject: [PATCH 4/4] screen-cast: Disable DMA buffer based screen casting for
QXL
QXL doesn't support mmap():ing a DMA buffer allocated in mutter inside
the PipeWire stream consumer process. To make screen casting work again
on QXL, disable DMA buffer based screen casting for QXL.
Eventually, it should be the client that renegotiates the supported
buffer types, but until then we need this list.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1318
---
src/backends/meta-screen-cast.c | 11 ++++++
src/backends/meta-screen-cast.h | 2 ++
src/backends/native/meta-backend-native.c | 41 +++++++++++++++++++++++
src/backends/native/meta-gpu-kms.c | 26 ++++++++++++++
src/backends/native/meta-gpu-kms.h | 2 ++
5 files changed, 82 insertions(+)
diff --git a/src/backends/meta-screen-cast.c b/src/backends/meta-screen-cast.c
index 5f1ca8b5ca..268155e7b3 100644
--- a/src/backends/meta-screen-cast.c
+++ b/src/backends/meta-screen-cast.c
@@ -46,6 +46,8 @@ struct _MetaScreenCast
MetaDbusSessionWatcher *session_watcher;
MetaBackend *backend;
+
+ gboolean disable_dma_bufs;
};
static void
@@ -94,6 +96,12 @@ meta_screen_cast_get_backend (MetaScreenCast *screen_cast)
return screen_cast->backend;
}
+void
+meta_screen_cast_disable_dma_bufs (MetaScreenCast *screen_cast)
+{
+ screen_cast->disable_dma_bufs = TRUE;
+}
+
CoglDmaBufHandle *
meta_screen_cast_create_dma_buf_handle (MetaScreenCast *screen_cast,
int width,
@@ -107,6 +115,9 @@ meta_screen_cast_create_dma_buf_handle (MetaScreenCast *screen_cast,
g_autoptr (GError) error = NULL;
CoglDmaBufHandle *dmabuf_handle;
+ if (screen_cast->disable_dma_bufs)
+ return NULL;
+
dmabuf_handle = cogl_renderer_create_dma_buf (cogl_renderer,
width, height,
&error);
diff --git a/src/backends/meta-screen-cast.h b/src/backends/meta-screen-cast.h
index fb5a38f34f..fa54be729f 100644
--- a/src/backends/meta-screen-cast.h
+++ b/src/backends/meta-screen-cast.h
@@ -50,6 +50,8 @@ GDBusConnection * meta_screen_cast_get_connection (MetaScreenCast *screen_cast);
MetaBackend * meta_screen_cast_get_backend (MetaScreenCast *screen_cast);
+void meta_screen_cast_disable_dma_bufs (MetaScreenCast *screen_cast);
+
CoglDmaBufHandle * meta_screen_cast_create_dma_buf_handle (MetaScreenCast *screen_cast,
int width,
int height);
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index c473681cb0..2bf7f5e7e2 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -57,6 +57,10 @@
#include "core/meta-border.h"
#include "meta/main.h"
+#ifdef HAVE_REMOTE_DESKTOP
+#include "backends/meta-screen-cast.h"
+#endif
+
struct _MetaBackendNative
{
MetaBackend parent;
@@ -327,6 +331,39 @@ meta_backend_native_create_clutter_backend (MetaBackend *backend)
return g_object_new (META_TYPE_CLUTTER_BACKEND_NATIVE, NULL);
}
+#ifdef HAVE_REMOTE_DESKTOP
+static void
+maybe_disable_screen_cast_dma_bufs (MetaBackendNative *native)
+{
+ MetaBackend *backend = META_BACKEND (native);
+ MetaRenderer *renderer = meta_backend_get_renderer (backend);
+ MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer);
+ MetaGpuKms *primary_gpu;
+ const char *driver_name;
+ int i;
+ static const char *disable_dma_buf_drivers[] = {
+ "qxl",
+ };
+
+ 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++)
+ {
+ if (g_strcmp0 (driver_name, disable_dma_buf_drivers[i]) == 0)
+ {
+ MetaScreenCast *screen_cast = meta_backend_get_screen_cast (backend);
+
+ g_message ("The '%s' driver doesn't support DMA buffer screen sharing, disabling.",
+ driver_name);
+
+ meta_screen_cast_disable_dma_bufs (screen_cast);
+ return;
+ }
+ }
+}
+#endif /* HAVE_REMOTE_DESKTOP */
+
static void
meta_backend_native_post_init (MetaBackend *backend)
{
@@ -338,6 +375,10 @@ meta_backend_native_post_init (MetaBackend *backend)
NULL, NULL);
clutter_evdev_set_relative_motion_filter (manager, relative_motion_filter,
meta_backend_get_monitor_manager (backend));
+
+#ifdef HAVE_REMOTE_DESKTOP
+ maybe_disable_screen_cast_dma_bufs (META_BACKEND_NATIVE (backend));
+#endif
}
static MetaMonitorManager *
diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c
index c569b948ef..93e509def5 100644
--- a/src/backends/native/meta-gpu-kms.c
+++ b/src/backends/native/meta-gpu-kms.c
@@ -66,6 +66,8 @@ struct _MetaGpuKms
char *file_path;
GSource *source;
+ char *driver_name;
+
clockid_t clock_id;
drmModeConnector **connectors;
@@ -790,6 +792,27 @@ init_outputs (MetaGpuKms *gpu_kms,
setup_output_clones (gpu);
}
+static void
+init_info (MetaGpuKms *gpu_kms)
+{
+ drmVersion *drm_version;
+
+ drm_version = drmGetVersion (gpu_kms->fd);
+ if (!drm_version)
+ return;
+
+ gpu_kms->driver_name = g_strndup (drm_version->name,
+ drm_version->name_len);
+
+ drmFreeVersion (drm_version);
+}
+
+const char *
+meta_gpu_kms_get_driver_name (MetaGpuKms *gpu_kms)
+{
+ return gpu_kms->driver_name;
+}
+
static gboolean
meta_kms_resources_init (MetaKmsResources *resources,
int fd,
@@ -865,6 +888,7 @@ meta_gpu_kms_read_current (MetaGpu *gpu,
init_crtcs (gpu_kms, &resources);
init_outputs (gpu_kms, &resources);
init_frame_clock (gpu_kms);
+ init_info (gpu_kms);
meta_kms_resources_release (&resources);
@@ -940,6 +964,8 @@ meta_gpu_kms_finalize (GObject *object)
free_resources (gpu_kms);
+ g_free (gpu_kms->driver_name);
+
G_OBJECT_CLASS (meta_gpu_kms_parent_class)->finalize (object);
}
diff --git a/src/backends/native/meta-gpu-kms.h b/src/backends/native/meta-gpu-kms.h
index 1f7a939e27..6096e58341 100644
--- a/src/backends/native/meta-gpu-kms.h
+++ b/src/backends/native/meta-gpu-kms.h
@@ -108,4 +108,6 @@ MetaGpuKmsFlipClosureContainer * meta_gpu_kms_wrap_flip_closure (MetaGpuKms *gpu
void meta_gpu_kms_flip_closure_container_free (MetaGpuKmsFlipClosureContainer *closure_container);
+const char * meta_gpu_kms_get_driver_name (MetaGpuKms *gpu_kms);
+
#endif /* META_GPU_KMS_H */
--
2.26.2

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
diff --git a/src/backends/meta-screen-cast.c b/src/backends/meta-screen-cast.c
index 268155e..18fc779 100644
--- a/src/backends/meta-screen-cast.c
+++ b/src/backends/meta-screen-cast.c
@@ -32,7 +32,7 @@
#define META_SCREEN_CAST_DBUS_SERVICE "org.gnome.Mutter.ScreenCast"
#define META_SCREEN_CAST_DBUS_PATH "/org/gnome/Mutter/ScreenCast"
-#define META_SCREEN_CAST_API_VERSION 2
+#define META_SCREEN_CAST_API_VERSION 3
struct _MetaScreenCast
{

File diff suppressed because it is too large Load Diff

View File

@ -3,12 +3,12 @@
%global gsettings_desktop_schemas_version 3.21.4
%global json_glib_version 0.12.0
%global libinput_version 1.4
%global pipewire_version 0.2.2
%global pipewire_version 0.3.0
%global mutter_api_version 4
Name: mutter
Version: 3.32.2
Release: 36%{?dist}
Release: 48%{?dist}
Summary: Window and compositing manager based on Clutter
License: GPLv2+
@ -111,8 +111,53 @@ Patch281: 0001-crtc-xrandr-Respect-configured-RANDR-panning.patch
# gnome-shell core dump after connection to docking station (#1809079)
Patch282: handle-hotplug-better.patch
# Fix corrupted background after suspend (#1829261)
Patch283: 0001-background-Reload-when-GPU-memory-is-invalidated.patch
# Improve performance under load (#1820760)
Patch290: 0001-clutter-avoid-redundant-_clutter_paint_node_init_typ.patch
Patch291: 0002-clutter-avoid-g_signal_emit_by_name-from-ClutterActo.patch
Patch292: 0003-clutter-fix-hole-in-ClutterPaintNode.patch
# Fix corrupted background after suspend (#1828162)
Patch300: 0001-background-Reload-when-GPU-memory-is-invalidated.patch
# Backport screen cast and remote desktop improvements (#1837381)
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/623
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/752
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/976
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1022
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1062
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/687
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1086
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1115
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1106
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1129
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1251
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1174
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1258
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1212
Patch400: screen-cast-remote-desktop-improvements.patch
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1283
Patch401: 0001-screen-cast-src-Destroy-hash-dmabuf-table-after-stre.patch
Patch402: 0002-renderer-native-Don-t-leak-DMA-buffer-CoglFramebuffe.patch
Patch403: 0001-renderer-Add-API-to-check-whether-renderer-is-hardwa.patch
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1318 (#1847062)
Patch404: 0001-backend-Add-getter-for-MetaScreenCast.patch
Patch405: 0002-renderer-native-Add-API-to-get-primary-GPU.patch
Patch406: 0003-screen-cast-Move-DMA-buffer-allocation-to-MetaScreen.patch
Patch407: 0004-screen-cast-Disable-DMA-buffer-based-screen-casting-.patch
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1351
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1365
Patch408: cursor-move-only-screen-cast-fixes.patch
Patch409: mutter-bump-screencast-api-version.patch
# Only treat WM_PROTOCOLS messages as WM_PROTOCOL messages (#1847203)
Patch500: 0001-stage-x11-Check-that-message-is-WM_PROTOCOLS-before-.patch
# Don't show widow actor until explictly shown (#1719937)
Patch501: 0001-window-actor-Don-t-show-actor-until-meta_window_acto.patch
# Handle GPU unplug gracefully (#1846191)
Patch502: 0001-monitor-manager-kms-Trigger-hotplug-processing-on-gp.patch
Patch503: 0002-gpu-kms-Reset-CRTC-mode-and-output-list-if-no-resour.patch
BuildRequires: chrpath
BuildRequires: pango-devel
@ -255,13 +300,61 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
%{_datadir}/mutter-%{mutter_api_version}/tests
%changelog
* Wed May 06 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-36
* Mon Sep 21 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-48
- Fix GLX stereo buffer rebase error
Resolves: #1880339
* Thu Sep 03 2020 Florian Müllner <fmuellner@redhat.com> - 3.32.2-47
- Fix screen sharing on wayland
Resolves: #1873963
* Wed Jul 15 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-46
- Handle cursor only screen cast frames better
Related: #1837381
* Thu Jul 02 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-45
- Handle GPU unplug gracefully
Resolves: #1846191
* Thu Jun 25 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-44
- Don't show widow actor until explictly shown
Resolves: #1719937
* Thu Jun 25 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-43
- Only treat WM_PROTOCOLS messages as WM_PROTOCOL messages
Resolves: #1847203
* Tue Jun 16 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-42
- Don't pass DMA buffers if they can't be mmap():ed
Related: #1847062
* Wed Jun 10 2020 Florian Müllner <fmuellner@redhat.com> - 3.32.2-41
- Backport is_rendering_hardware_acclerated() API
Related: #1837381
* Wed Jun 03 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-40
- Fix DMA buffer memory leak
Related: #1837381
* Mon May 25 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-39
- Fix incorrect pipewire dependency version
Related: #1837381
* Mon May 25 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-38
- Backport screen cast and remote desktop improvements
Resolves: #1837381
* Tue May 19 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-37
- Fix corrupted background after suspend
Resolves: #1829261
Resolves: #1828162
* Wed Apr 08 2020 Florian Müllner <fmuellner@redhat.com> - 3.32.2-36
- Improve performance under IO load
Resolves: #1820760
* Mon Mar 23 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-35
- Drop EGLStream robustness patches
Resolves: #1821198
Resolves: #1815430
* Thu Mar 05 2020 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-34
- gnome-shell core dump after connection to docking station
@ -319,7 +412,7 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
- Fix mode switch pad buttons without LEDs
Resolves: #1666070
* Mon Dec 01 2019 Tomas Pelka <tpelka@redhat.com> - 3.32.2-20
* Mon Dec 02 2019 Tomas Pelka <tpelka@redhat.com> - 3.32.2-20
- Need rebuild in correct build target
Resolves: #1730891