Compare commits

...

No commits in common. "imports/c8s/mutter-3.32.2-60.el8" and "c8" have entirely different histories.

14 changed files with 3656 additions and 49 deletions

View File

@ -1 +0,0 @@
5068f43514a6212e4b5b5f7f856b7713cbc3d420 SOURCES/mutter-3.32.2.tar.xz

View File

@ -1,4 +1,4 @@
From 471174ba6cf517baf8ff73e903202e1c73b6ec74 Mon Sep 17 00:00:00 2001
From 01803de944153694501cb64bb4250ba76ed945f5 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 19 Jan 2017 15:03:41 +0100
Subject: [PATCH] backends/x11: Support synaptics configuration
@ -6,11 +6,11 @@ Subject: [PATCH] backends/x11: Support synaptics configuration
The code is taken mostly as-is from g-s-d, so we can drag the
dead horse a bit longer.
---
src/backends/x11/meta-input-settings-x11.c | 268 +++++++++++++++++++++
1 file changed, 268 insertions(+)
src/backends/x11/meta-input-settings-x11.c | 267 +++++++++++++++++++++
1 file changed, 267 insertions(+)
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 89f07ee1f..051a1c605 100644
index 89f07ee1f..b2f5ca060 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -26,6 +26,7 @@
@ -21,7 +21,7 @@ index 89f07ee1f..051a1c605 100644
#include <string.h>
#include <X11/Xatom.h>
#include <X11/extensions/XInput2.h>
@@ -162,6 +163,180 @@ change_property (ClutterInputDevice *device,
@@ -162,6 +163,179 @@ change_property (ClutterInputDevice *device,
meta_XFree (data_ret);
}
@ -45,7 +45,6 @@ index 89f07ee1f..051a1c605 100644
+ gboolean left_handed)
+{
+ MetaDisplay *display = meta_get_display ();
+ MetaX11Display *x11_display = display ? display->x11_display : NULL;
+ MetaBackend *backend = meta_get_backend ();
+ Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
+ XDevice *xdevice;
@ -69,8 +68,7 @@ index 89f07ee1f..051a1c605 100644
+ XA_INTEGER, 8, tap_action, 7);
+ meta_XFree (tap_action);
+
+ if (x11_display)
+ meta_x11_error_trap_push (x11_display);
+ clutter_x11_trap_x_errors();
+ buttons = g_new (guchar, buttons_capacity);
+ n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice,
+ buttons, buttons_capacity);
@ -90,7 +88,7 @@ index 89f07ee1f..051a1c605 100644
+ XSetDeviceButtonMapping (xdisplay, xdevice, buttons, n_buttons);
+ g_free (buttons);
+
+ if (x11_display && meta_x11_error_trap_pop_with_return (x11_display))
+ if (clutter_x11_untrap_x_errors())
+ {
+ g_warning ("Could not set synaptics touchpad left-handed for %s",
+ clutter_input_device_get_device_name (device));
@ -105,7 +103,6 @@ index 89f07ee1f..051a1c605 100644
+ gdouble speed)
+{
+ MetaDisplay *display = meta_get_display ();
+ MetaX11Display *x11_display = display ? display->x11_display : NULL;
+ MetaBackend *backend = meta_get_backend ();
+ Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
+ XDevice *xdevice;
@ -118,7 +115,10 @@ index 89f07ee1f..051a1c605 100644
+ if (!xdevice)
+ return;
+ /* Get the list of feedbacks for the device */
+ clutter_x11_trap_x_errors();
+ states = XGetFeedbackControl (xdisplay, xdevice, &num_feedbacks);
+ if (clutter_x11_untrap_x_errors())
+ return;
+ if (!states)
+ return;
+
@ -163,8 +163,7 @@ index 89f07ee1f..051a1c605 100644
+ denominator = -1;
+ }
+
+ if (x11_display)
+ meta_x11_error_trap_push (x11_display);
+ clutter_x11_trap_x_errors();
+
+ state = (XFeedbackState *) states;
+
@ -189,7 +188,7 @@ index 89f07ee1f..051a1c605 100644
+ state = (XFeedbackState *) ((char *) state + state->length);
+ }
+
+ if (x11_display && meta_x11_error_trap_pop_with_return (x11_display))
+ if (clutter_x11_untrap_x_errors())
+ {
+ g_warning ("Could not set synaptics touchpad acceleration for %s",
+ clutter_input_device_get_device_name (device));
@ -202,7 +201,7 @@ index 89f07ee1f..051a1c605 100644
static void
meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -170,6 +345,13 @@ meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
@@ -170,6 +344,13 @@ meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
guchar values[2] = { 0 }; /* disabled, disabled-on-external-mouse */
guchar *available;
@ -216,7 +215,7 @@ index 89f07ee1f..051a1c605 100644
available = get_property (device, "libinput Send Events Modes Available",
XA_INTEGER, 8, 2);
if (!available)
@@ -222,6 +404,12 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
@@ -222,6 +403,12 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gfloat value = speed;
@ -229,7 +228,7 @@ index 89f07ee1f..051a1c605 100644
change_property (device, "libinput Accel Speed",
XInternAtom (xdisplay, "FLOAT", False),
32, &value, 1);
@@ -248,6 +436,19 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
@@ -248,6 +435,19 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
else
{
value = enabled ? 1 : 0;
@ -249,7 +248,7 @@ index 89f07ee1f..051a1c605 100644
change_property (device, "libinput Left Handed Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -271,6 +472,20 @@ meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings,
@@ -271,6 +471,20 @@ meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings,
{
guchar value = (enabled) ? 1 : 0;
@ -270,7 +269,7 @@ index 89f07ee1f..051a1c605 100644
change_property (device, "libinput Tapping Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -293,6 +508,27 @@ meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings,
@@ -293,6 +507,27 @@ meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings,
{
guchar value = (inverted) ? 1 : 0;
@ -298,7 +297,7 @@ index 89f07ee1f..051a1c605 100644
change_property (device, "libinput Natural Scrolling Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -306,6 +542,22 @@ meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings,
@@ -306,6 +541,22 @@ meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings,
guchar *current = NULL;
guchar *available = NULL;
@ -321,7 +320,7 @@ index 89f07ee1f..051a1c605 100644
available = get_property (device, "libinput Scroll Methods Available",
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[SCROLL_METHOD_FIELD_EDGE])
@@ -335,6 +587,22 @@ meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *set
@@ -335,6 +586,22 @@ meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *set
guchar *current = NULL;
guchar *available = NULL;
@ -345,5 +344,5 @@ index 89f07ee1f..051a1c605 100644
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[SCROLL_METHOD_FIELD_2FG])
--
2.21.0
2.36.1

View File

@ -0,0 +1,265 @@
From b0f3604cdb653ef133f9684adffeb6b93f6906f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 26 Jan 2022 10:51:07 +0100
Subject: [PATCH] compositor: Make sure _NET_WM_FRAME_DRAWN timestamp has the
right scope
The timestamp sent with _NET_WM_FRAME_DRAWN should be in "high
resolution X server timestamps", meaning they should have the same scope
as the built in X11 32 bit unsigned integer timestamps, i.e. overflow at
the same time.
This was not done correctly when mutter had determined the X server used
the monotonic clock, where it'd just forward the monotonic clock,
confusing any client using _NET_WM_FRAME_DRAWN and friends.
Fix this by 1) splitting the timestamp conversiot into an X11 case and a
display server case, where the display server case simply clamps the
monotonic clock, as it is assumed Xwayland is always usign the monotonic
clock, and 2) if we're a X11 compositing manager, if the X server is
using the monotonic clock, apply the same semantics as the display
server case and always just clamp, or if not, calculate the offset every
10 seconds, and offset the monotonic clock timestamp with the calculated
X server timestamp offset.
This fixes an issue that would occur if mutter (or rather GNOME Shell)
would have been started before a X11 timestamp overflow, after the
overflow happened. In this case, GTK3 clients would get unclamped
timestamps, and get very confused, resulting in frames queued several
weeks into the future.
---
src/compositor/compositor-private.h | 9 +-
src/compositor/compositor.c | 117 +++++++++++++++++++------
src/compositor/meta-window-actor-x11.c | 12 +--
3 files changed, 104 insertions(+), 34 deletions(-)
diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h
index f7008751215d..4588a8af7f2f 100644
--- a/src/compositor/compositor-private.h
+++ b/src/compositor/compositor-private.h
@@ -49,6 +49,10 @@ struct _MetaCompositor
gboolean frame_has_updated_xsurfaces;
gboolean have_x11_sync_object;
+
+ gboolean xserver_uses_monotonic_clock;
+ int64_t xserver_time_query_time_us;
+ int64_t xserver_time_offset_us;
};
/* Wait 2ms after vblank before starting to draw next frame */
@@ -64,8 +68,9 @@ void meta_end_modal_for_plugin (MetaCompositor *compositor,
MetaPlugin *plugin,
guint32 timestamp);
-gint64 meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
- gint64 monotonic_time);
+int64_t
+meta_compositor_monotonic_to_high_res_xserver_time (MetaDisplay *display,
+ int64_t monotonic_time_us);
gboolean meta_compositor_window_is_stereo (MetaDisplay *display,
Window xwindow);
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index ce2c1b8a3bc1..a3fbe5d888f9 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -88,6 +88,40 @@
#include "wayland/meta-wayland-private.h"
#endif
+static inline int64_t
+us (int64_t us)
+{
+ return us;
+}
+
+static inline int64_t
+ms2us (int64_t ms)
+{
+ return us (ms * 1000);
+}
+
+static inline int64_t
+s2us (int64_t s)
+{
+ return ms2us(s * 1000);
+}
+
+/*
+ * This function takes a 64 bit time stamp from the monotonic clock, and clamps
+ * it to the scope of the X server clock, without losing the granularity.
+ */
+static inline int64_t
+meta_translate_to_high_res_xserver_time (int64_t time_us)
+{
+ int64_t us;
+ int64_t ms;
+
+ us = time_us % 1000;
+ ms = time_us / 1000;
+
+ return ms2us (ms & 0xffffffff) + us;
+}
+
static void
on_presented (ClutterStage *stage,
CoglFrameEvent event,
@@ -612,6 +646,37 @@ meta_compositor_select_stereo_notify (MetaDisplay *display,
}
}
+static void
+determine_server_clock_source (MetaCompositor *compositor)
+{
+ MetaDisplay *display = compositor->display;
+ MetaX11Display *x11_display = display->x11_display;
+ uint32_t server_time_ms;
+ int64_t server_time_us;
+ int64_t translated_monotonic_now_us;
+
+ if (meta_is_wayland_compositor ())
+ {
+ compositor->xserver_uses_monotonic_clock = TRUE;
+ return;
+ }
+
+ server_time_ms = meta_x11_display_get_current_time_roundtrip (x11_display);
+ server_time_us = ms2us (server_time_ms);
+ translated_monotonic_now_us =
+ meta_translate_to_high_res_xserver_time (g_get_monotonic_time ());
+
+ /* If the server time offset is within a second of the monotonic time, we
+ * assume that they are identical. This seems like a big margin, but we want
+ * to be as robust as possible even if the system is under load and our
+ * processing of the server response is delayed.
+ */
+ if (ABS (server_time_us - translated_monotonic_now_us) < s2us (1))
+ compositor->xserver_uses_monotonic_clock = TRUE;
+ else
+ compositor->xserver_uses_monotonic_clock = FALSE;
+}
+
void
meta_compositor_manage (MetaCompositor *compositor)
{
@@ -622,6 +687,9 @@ meta_compositor_manage (MetaCompositor *compositor)
if (display->x11_display)
{
xdisplay = display->x11_display->xdisplay;
+
+ determine_server_clock_source (compositor);
+
meta_x11_display_set_cm_selection (display->x11_display);
compositor->stereo_tree_ext = display_has_stereo_tree_ext (display->x11_display);
@@ -1593,7 +1661,7 @@ meta_compositor_flash_window (MetaCompositor *compositor,
}
/**
- * meta_compositor_monotonic_time_to_server_time:
+ * meta_compositor_monotonic_to_high_res_xserver_time:
* @display: a #MetaDisplay
* @monotonic_time: time in the units of g_get_monotonic_time()
*
@@ -1606,38 +1674,35 @@ meta_compositor_flash_window (MetaCompositor *compositor,
* a time representation with high accuracy. If there is not a common
* time source, then the time synchronization will be less accurate.
*/
-gint64
-meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
- gint64 monotonic_time)
+int64_t
+meta_compositor_monotonic_to_high_res_xserver_time (MetaDisplay *display,
+ int64_t monotonic_time_us)
{
MetaCompositor *compositor = display->compositor;
+ int64_t now_us;
+
+ if (compositor->xserver_uses_monotonic_clock)
+ return meta_translate_to_high_res_xserver_time (monotonic_time_us);
- if (compositor->server_time_query_time == 0 ||
- (!compositor->server_time_is_monotonic_time &&
- monotonic_time > compositor->server_time_query_time + 10*1000*1000)) /* 10 seconds */
+ now_us = g_get_monotonic_time ();
+
+ if (compositor->xserver_time_query_time_us == 0 ||
+ now_us > (compositor->xserver_time_query_time_us + s2us (10)))
{
- guint32 server_time = meta_display_get_current_time_roundtrip (display);
- gint64 server_time_usec = (gint64)server_time * 1000;
- gint64 current_monotonic_time = g_get_monotonic_time ();
- compositor->server_time_query_time = current_monotonic_time;
-
- /* If the server time is within a second of the monotonic time,
- * we assume that they are identical. This seems like a big margin,
- * but we want to be as robust as possible even if the system
- * is under load and our processing of the server response is
- * delayed.
- */
- if (server_time_usec > current_monotonic_time - 1000*1000 &&
- server_time_usec < current_monotonic_time + 1000*1000)
- compositor->server_time_is_monotonic_time = TRUE;
+ MetaDisplay *display = compositor->display;
+ MetaX11Display *x11_display = display->x11_display;
+ uint32_t xserver_time_ms;
+ int64_t xserver_time_us;
- compositor->server_time_offset = server_time_usec - current_monotonic_time;
+ compositor->xserver_time_query_time_us = now_us;
+
+ xserver_time_ms =
+ meta_x11_display_get_current_time_roundtrip (x11_display);
+ xserver_time_us = ms2us (xserver_time_ms);
+ compositor->xserver_time_offset_us = xserver_time_us - now_us;
}
- if (compositor->server_time_is_monotonic_time)
- return monotonic_time;
- else
- return monotonic_time + compositor->server_time_offset;
+ return monotonic_time_us + compositor->xserver_time_offset_us;
}
void
diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c
index a364323fe057..2b9c25510dc9 100644
--- a/src/compositor/meta-window-actor-x11.c
+++ b/src/compositor/meta-window-actor-x11.c
@@ -105,8 +105,8 @@ do_send_frame_drawn (MetaWindowActorX11 *actor_x11,
XClientMessageEvent ev = { 0, };
frame->frame_drawn_time =
- meta_compositor_monotonic_time_to_server_time (display,
- g_get_monotonic_time ());
+ meta_compositor_monotonic_to_high_res_xserver_time (display,
+ g_get_monotonic_time ());
actor_x11->frame_drawn_time = frame->frame_drawn_time;
ev.type = ClientMessage;
@@ -147,8 +147,8 @@ do_send_frame_timings (MetaWindowActorX11 *actor_x11,
if (presentation_time != 0)
{
int64_t presentation_time_server =
- meta_compositor_monotonic_time_to_server_time (display,
- presentation_time);
+ meta_compositor_monotonic_to_high_res_xserver_time (display,
+ presentation_time);
int64_t presentation_time_offset = presentation_time_server - frame->frame_drawn_time;
if (presentation_time_offset == 0)
presentation_time_offset = 1;
@@ -246,8 +246,8 @@ queue_send_frame_messages_timeout (MetaWindowActorX11 *actor_x11)
}
current_time =
- meta_compositor_monotonic_time_to_server_time (display,
- g_get_monotonic_time ());
+ meta_compositor_monotonic_to_high_res_xserver_time (display,
+ g_get_monotonic_time ());
interval = (int) (1000000 / refresh_rate) * 6;
offset = MAX (0, actor_x11->frame_drawn_time + interval - current_time) / 1000;
--
2.33.1

View File

@ -0,0 +1,163 @@
From bfd49687aa862a7e69d0d7fe76f803ae180d40c2 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 7 Jun 2023 11:04:15 +0200
Subject: [PATCH] core: Change MetaWaylandTextInput event forwarding to IMs
We need to juggle with some things here to keep key event ordering
and accounting consistent.
The keyboard internal state changes (and maybe modifier event emission)
happening through meta_wayland_seat_update() should ideally happen
from the same key events that reach the client through wl_keyboard.key,
so that wl_keyboard.modifier events are emitted in the right relative
order to other key events.
In order to fix this, we need to decide at an earlier point whether
the event will get processed through IM (and maybe be reinjected),
thus ignored in wait of IM-postprocessed events.
This means we pay less attention to whether events are first-hand
hardware events for some things and go with the event that does
eventually reach to us (hardware or IM).
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5890
---
src/core/events.c | 8 ++++++++
src/wayland/meta-wayland-keyboard.c | 8 --------
src/wayland/meta-wayland-seat.c | 30 ++++++++++++++++++++++-------
src/wayland/meta-wayland-seat.h | 3 +++
src/wayland/meta-wayland.c | 7 +++++++
src/wayland/meta-wayland.h | 4 ++++
6 files changed, 45 insertions(+), 15 deletions(-)
diff --git a/src/core/events.c b/src/core/events.c
index 5b8e49fc79..19d701779b 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -207,6 +207,14 @@ meta_display_handle_event (MetaDisplay *display,
if (meta_is_wayland_compositor ())
{
compositor = meta_wayland_compositor_get_default ();
+
+ if (display->event_route == META_EVENT_ROUTE_NORMAL &&
+ meta_wayland_compositor_handle_text_input_event (compositor, event))
+ {
+ bypass_wayland = bypass_clutter = TRUE;
+ goto out;
+ }
+
meta_wayland_compositor_update (compositor, event);
}
#endif
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index 8b23d76ce7..84f46bcf8e 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -753,14 +753,6 @@ meta_wayland_keyboard_update (MetaWaylandKeyboard *keyboard,
{
gboolean is_press = event->type == CLUTTER_KEY_PRESS;
- /* Only handle real, non-synthetic, events here. The IM is free to reemit
- * key events (incl. modifiers), handling those additionally will result
- * in doubly-pressed keys.
- */
- if ((event->flags &
- (CLUTTER_EVENT_FLAG_SYNTHETIC | CLUTTER_EVENT_FLAG_INPUT_METHOD)) != 0)
- return;
-
/* If we get a key event but still have pending modifier state
* changes from a previous event that didn't get cleared, we need to
* send that state right away so that the new key event can be
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index 91fe376ffe..dcf420201f 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -362,6 +362,29 @@ meta_wayland_seat_update (MetaWaylandSeat *seat,
}
}
+gboolean
+meta_wayland_seat_handle_text_input_event (MetaWaylandSeat *seat,
+ const ClutterEvent *event)
+{
+ switch (event->type)
+ {
+ case CLUTTER_KEY_PRESS:
+ case CLUTTER_KEY_RELEASE:
+ if (meta_wayland_text_input_handle_event (seat->text_input, event))
+ return TRUE;
+
+ if (meta_wayland_gtk_text_input_handle_event (seat->gtk_text_input,
+ event))
+ return TRUE;
+
+ break;
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
gboolean
meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
const ClutterEvent *event)
@@ -384,13 +407,6 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
break;
case CLUTTER_KEY_PRESS:
case CLUTTER_KEY_RELEASE:
- if (meta_wayland_text_input_handle_event (seat->text_input, event))
- return TRUE;
-
- if (meta_wayland_gtk_text_input_handle_event (seat->gtk_text_input,
- event))
- return TRUE;
-
if (meta_wayland_seat_has_keyboard (seat))
return meta_wayland_keyboard_handle_event (seat->keyboard,
(const ClutterKeyEvent *) event);
diff --git a/src/wayland/meta-wayland-seat.h b/src/wayland/meta-wayland-seat.h
index 3a744d0580..da20e69d8d 100644
--- a/src/wayland/meta-wayland-seat.h
+++ b/src/wayland/meta-wayland-seat.h
@@ -82,4 +82,7 @@ gboolean meta_wayland_seat_has_pointer (MetaWaylandSeat *seat);
gboolean meta_wayland_seat_has_touch (MetaWaylandSeat *seat);
+gboolean meta_wayland_seat_handle_text_input_event (MetaWaylandSeat *seat,
+ const ClutterEvent *event);
+
#endif /* META_WAYLAND_SEAT_H */
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index a593f0a7b7..24a68f1e06 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -565,3 +565,10 @@ meta_wayland_compositor_notify_surface_id (MetaWaylandCompositor *compositor,
meta_wayland_compositor_remove_surface_association (compositor, id);
}
}
+
+gboolean
+meta_wayland_compositor_handle_text_input_event (MetaWaylandCompositor *compositor,
+ const ClutterEvent *event)
+{
+ return meta_wayland_seat_handle_text_input_event (compositor->seat, event);
+}
diff --git a/src/wayland/meta-wayland.h b/src/wayland/meta-wayland.h
index 2a0aa11400..b5281d2014 100644
--- a/src/wayland/meta-wayland.h
+++ b/src/wayland/meta-wayland.h
@@ -87,6 +87,10 @@ META_EXPORT_TEST
void meta_wayland_compositor_schedule_surface_association (MetaWaylandCompositor *compositor,
int id,
MetaWindow *window);
+
+gboolean meta_wayland_compositor_handle_text_input_event (MetaWaylandCompositor *compositor,
+ const ClutterEvent *event);
+
META_EXPORT_TEST
void meta_wayland_compositor_notify_surface_id (MetaWaylandCompositor *compositor,
int id,
--
2.40.1

View File

@ -0,0 +1,26 @@
From 65ffd7e4df42cd62633f93107644f87208881578 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 14 Apr 2022 18:07:41 +0200
Subject: [PATCH] events: Pass CurrentTime to XIAllowEvents() when unfreezing
pointer
---
src/core/events.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/events.c b/src/core/events.c
index 0dc3a73222..dd9b4ec981 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -205,7 +205,7 @@ maybe_unfreeze_pointer_events (MetaBackend *backend,
}
xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
- XIAllowEvents (xdisplay, device_id, event_mode, event->button.time);
+ XIAllowEvents (xdisplay, device_id, event_mode, CurrentTime);
}
static gboolean
--
2.34.1

View File

@ -0,0 +1,81 @@
From cf16c0d16b42215f35dcede6163235ad5ec1734b Mon Sep 17 00:00:00 2001
From: Mario Limonciello <mario.limonciello@amd.com>
Date: Thu, 18 Aug 2022 13:36:20 -0500
Subject: [PATCH] output/kms: Add more heuristics to decide when to offer
fallback modes
If the panel is connected via eDP and supports more than one mode
at different resolutions don't try to add more.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2586>
(cherry picked from commit 96aa0fb8536eca579ceb1b17d83e19cf9e3e9e81)
---
src/backends/native/meta-output-kms.c | 45 ++++++++++++++++++++++-----
1 file changed, 38 insertions(+), 7 deletions(-)
diff --git a/src/backends/native/meta-output-kms.c b/src/backends/native/meta-output-kms.c
index f3cc543c4d..44c25c5648 100644
--- a/src/backends/native/meta-output-kms.c
+++ b/src/backends/native/meta-output-kms.c
@@ -505,6 +505,43 @@ compare_modes (const void *one,
return g_strcmp0 (b->name, a->name);
}
+static gboolean
+are_all_modes_equally_sized (MetaOutput *output)
+{
+ MetaCrtcMode *base = output->modes[0];
+ int i;
+
+ for (i = 1; i < output->n_modes; i++)
+ {
+ MetaCrtcMode *crtc_mode = output->modes[i];
+
+ if (base->width != crtc_mode->width ||
+ base->height != crtc_mode->height)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+maybe_add_fallback_modes (MetaOutput *output,
+ MetaGpuKms *gpu_kms)
+{
+ MetaOutputKms *output_kms = output->driver_private;
+
+ if (!output_kms->has_scaling)
+ return;
+
+ if (output->n_modes == 0)
+ return;
+
+ if (output_kms->connector->connector_type == DRM_MODE_CONNECTOR_eDP &&
+ !are_all_modes_equally_sized (output))
+ return;
+
+ add_common_modes (output, gpu_kms);
+}
+
static gboolean
init_output_modes (MetaOutput *output,
MetaGpuKms *gpu_kms,
@@ -528,13 +565,7 @@ init_output_modes (MetaOutput *output,
output->preferred_mode = output->modes[i];
}
- /* FIXME: MSC feature bit? */
- /* Presume that if the output supports scaling, then we have
- * a panel fitter capable of adjusting any mode to suit.
- */
- if (output_kms->has_scaling)
- add_common_modes (output, gpu_kms);
-
+ maybe_add_fallback_modes (output, gpu_kms);
if (!output->modes)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--
2.37.1

View File

@ -0,0 +1,172 @@
From 66e2e438b8796351a72bfec2024ee41bbde77780 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 6 Apr 2023 18:40:41 +0200
Subject: [PATCH] renderer-native: Queue fail safe callbacks when mode set
failed
This allows to recover, e.g. Ctrl-Alt-F# and using any other monitor
that managed to turn on.
---
src/backends/native/meta-crtc-kms.c | 19 ++++++++++
src/backends/native/meta-crtc-kms.h | 5 +++
src/backends/native/meta-gpu-kms.c | 10 +++++
src/backends/native/meta-renderer-native.c | 43 ++++++++++++++++++++++
4 files changed, 77 insertions(+)
diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c
index 8374376d5..44f271eb5 100644
--- a/src/backends/native/meta-crtc-kms.c
+++ b/src/backends/native/meta-crtc-kms.c
@@ -52,6 +52,8 @@ typedef struct _MetaCrtcKms
* value: owned GArray* (uint64_t modifier), or NULL
*/
GHashTable *formats_modifiers;
+
+ gboolean is_active;
} MetaCrtcKms;
/**
@@ -540,3 +542,20 @@ meta_create_kms_crtc (MetaGpuKms *gpu_kms,
return crtc;
}
+
+void
+meta_crtc_kms_set_active (MetaCrtc *crtc,
+ gboolean is_active)
+{
+ MetaCrtcKms *crtc_kms = crtc->driver_private;
+
+ crtc_kms->is_active = is_active;
+}
+
+gboolean
+meta_crtc_kms_is_active (MetaCrtc *crtc)
+{
+ MetaCrtcKms *crtc_kms = crtc->driver_private;
+
+ return crtc_kms->is_active;
+}
diff --git a/src/backends/native/meta-crtc-kms.h b/src/backends/native/meta-crtc-kms.h
index 456f4400a..666aebcaf 100644
--- a/src/backends/native/meta-crtc-kms.h
+++ b/src/backends/native/meta-crtc-kms.h
@@ -58,4 +58,9 @@ MetaCrtc * meta_create_kms_crtc (MetaGpuKms *gpu_kms,
drmModeCrtc *drm_crtc,
unsigned int crtc_index);
+void meta_crtc_kms_set_active (MetaCrtc *crtc,
+ gboolean is_active);
+
+gboolean meta_crtc_kms_is_active (MetaCrtc *crtc);
+
#endif /* META_CRTC_KMS_H */
diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c
index dc93abb7b..5f7a48730 100644
--- a/src/backends/native/meta-gpu-kms.c
+++ b/src/backends/native/meta-gpu-kms.c
@@ -169,9 +169,12 @@ meta_gpu_kms_apply_crtc_mode (MetaGpuKms *gpu_kms,
else
g_warning ("Failed to disable CRTC");
g_free (connectors);
+ meta_crtc_kms_set_active (crtc, FALSE);
return FALSE;
}
+ meta_crtc_kms_set_active (crtc, !!mode);
+
g_free (connectors);
return TRUE;
@@ -278,6 +281,13 @@ meta_gpu_kms_flip_crtc (MetaGpuKms *gpu_kms,
g_assert (meta_monitor_manager_get_power_save_mode (monitor_manager) ==
META_POWER_SAVE_ON);
+ if (!meta_crtc_kms_is_active (crtc))
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+ "CRTC is not active");
+ return FALSE;
+ }
+
get_crtc_drm_connectors (gpu, crtc, &connectors, &n_connectors);
g_assert (n_connectors > 0);
g_free (connectors);
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 62ca4bcbd..76e311508 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -217,6 +217,9 @@ struct _MetaRendererNative
GList *power_save_page_flip_closures;
guint power_save_page_flip_source_id;
+
+ GList *fail_safe_page_flip_closures;
+ guint fail_safe_page_flip_source_id;
};
static void
@@ -2048,6 +2051,34 @@ flip_crtc (MetaLogicalMonitor *logical_monitor,
}
}
+static gboolean
+fail_safe_page_flip_cb (gpointer user_data)
+{
+ MetaRendererNative *renderer_native = user_data;
+
+ g_list_free_full (renderer_native->fail_safe_page_flip_closures,
+ (GDestroyNotify) g_closure_unref);
+ renderer_native->fail_safe_page_flip_closures = NULL;
+ renderer_native->fail_safe_page_flip_source_id = 0;
+
+ return G_SOURCE_REMOVE;
+}
+
+static void
+queue_fail_safe_page_flip (MetaRendererNative *renderer_native,
+ GClosure *flip_closure)
+{
+ if (!renderer_native->fail_safe_page_flip_source_id)
+ {
+ renderer_native->fail_safe_page_flip_source_id =
+ g_idle_add (fail_safe_page_flip_cb, renderer_native);
+ }
+
+ renderer_native->fail_safe_page_flip_closures =
+ g_list_prepend (renderer_native->fail_safe_page_flip_closures,
+ g_closure_ref (flip_closure));
+}
+
static void
meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen)
{
@@ -2093,6 +2124,11 @@ meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen)
*/
if (!data.did_flip && data.did_mode_set)
meta_onscreen_native_swap_drm_fb (onscreen);
+ else if (!data.did_flip)
+ {
+ meta_onscreen_native_swap_drm_fb (onscreen);
+ queue_fail_safe_page_flip (renderer_native, flip_closure);
+ }
}
else
{
@@ -4549,6 +4585,13 @@ meta_renderer_native_finalize (GObject *object)
g_source_remove (renderer_native->power_save_page_flip_source_id);
}
+ if (renderer_native->fail_safe_page_flip_closures)
+ {
+ g_list_free_full (renderer_native->fail_safe_page_flip_closures,
+ (GDestroyNotify) g_closure_unref);
+ g_source_remove (renderer_native->fail_safe_page_flip_source_id);
+ }
+
g_hash_table_destroy (renderer_native->gpu_datas);
g_clear_object (&renderer_native->gles3);
--
2.39.2

View File

@ -0,0 +1,33 @@
From d33a244603d1dd63e2e25255af98f489c65645f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 29 Aug 2022 16:01:48 +0200
Subject: [PATCH] workspace: Downgrade assert to warning when adding window
An extension can by accident cause us to end up in a state where we try
to add the same window to a workspace twice. When this happens we
shouldn't crash, but instead complain loudly.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/992
Related: https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/157
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1692>
---
src/core/workspace.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 58fcfa78c5..ed16a83098 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -370,7 +370,8 @@ void
meta_workspace_add_window (MetaWorkspace *workspace,
MetaWindow *window)
{
- g_assert (g_list_find (workspace->mru_list, window) == NULL);
+ g_return_if_fail (g_list_find (workspace->mru_list, window) == NULL);
+
workspace->mru_list = g_list_prepend (workspace->mru_list, window);
workspace->windows = g_list_prepend (workspace->windows, window);
--
2.37.1

View File

@ -1,4 +1,4 @@
From 3f7ba6739773f43a3ad2a5d26cb8c3365f77cc00 Mon Sep 17 00:00:00 2001
From 08734c2df6bee5426cf75cdf1fa3013af1664d94 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 9 Oct 2017 18:39:52 +0200
Subject: [PATCH 1/3] backends/x11: Add a synaptics check for two finger scroll
@ -13,10 +13,10 @@ isn't.
1 file changed, 11 insertions(+)
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 051a1c605..887bc8b42 100644
index 16a3ff33d..7ad304704 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -630,6 +630,17 @@ meta_input_settings_x11_has_two_finger_scroll (MetaInputSettings *settings,
@@ -626,6 +626,17 @@ meta_input_settings_x11_has_two_finger_scroll (MetaInputSettings *settings,
guchar *available = NULL;
gboolean has_two_finger = TRUE;
@ -35,10 +35,9 @@ index 051a1c605..887bc8b42 100644
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[SCROLL_METHOD_FIELD_2FG])
--
2.21.0
2.36.1
From 717561b28f35e05d40fb941baba781436a0abf68 Mon Sep 17 00:00:00 2001
From 11a8b8b33582a68e037e7b9e8396af0748bba67a Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 9 Oct 2017 18:55:56 +0200
Subject: [PATCH 2/3] backends/x11: Add disable while typing support for
@ -51,7 +50,7 @@ syndaemon when the synaptics driver is being used.
1 file changed, 112 insertions(+)
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 887bc8b42..12a592c75 100644
index 7ad304704..743f4a7ce 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -35,6 +35,9 @@
@ -73,7 +72,7 @@ index 887bc8b42..12a592c75 100644
} MetaInputSettingsX11Private;
G_DEFINE_TYPE_WITH_PRIVATE (MetaInputSettingsX11, meta_input_settings_x11,
@@ -337,6 +342,107 @@ change_synaptics_speed (ClutterInputDevice *device,
@@ -333,6 +338,107 @@ change_synaptics_speed (ClutterInputDevice *device,
XCloseDevice (xdisplay, xdevice);
}
@ -181,7 +180,7 @@ index 887bc8b42..12a592c75 100644
static void
meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -461,6 +567,12 @@ meta_input_settings_x11_set_disable_while_typing (MetaInputSettings *settings,
@@ -457,6 +563,12 @@ meta_input_settings_x11_set_disable_while_typing (MetaInputSettings *settings,
{
guchar value = (enabled) ? 1 : 0;
@ -195,10 +194,9 @@ index 887bc8b42..12a592c75 100644
XA_INTEGER, 8, &value, 1);
}
--
2.21.0
2.36.1
From 0afa6d0940ca4f5ffafd24effd2c414963a44277 Mon Sep 17 00:00:00 2001
From fd2923d5c79a60bbd80bf231adf5e1ae7f83d264 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Tue, 10 Oct 2017 19:07:27 +0200
Subject: [PATCH 3/3] backends/x11: Support plain old X device configuration
@ -210,10 +208,10 @@ bits specific for xorg-x11-drv-evdev devices.
1 file changed, 74 insertions(+), 23 deletions(-)
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 12a592c75..80e5ed10e 100644
index 743f4a7ce..85f24e92b 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -182,36 +182,36 @@ is_device_synaptics (ClutterInputDevice *device)
@@ -182,35 +182,35 @@ is_device_synaptics (ClutterInputDevice *device)
return TRUE;
}
@ -239,7 +237,6 @@ index 12a592c75..80e5ed10e 100644
+ gboolean left_handed)
{
MetaDisplay *display = meta_get_display ();
MetaX11Display *x11_display = display ? display->x11_display : NULL;
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
XDevice *xdevice;
@ -264,12 +261,12 @@ index 12a592c75..80e5ed10e 100644
- XA_INTEGER, 8, tap_action, 7);
- meta_XFree (tap_action);
-
if (x11_display)
meta_x11_error_trap_push (x11_display);
clutter_x11_trap_x_errors();
buttons = g_new (guchar, buttons_capacity);
@@ -235,17 +235,39 @@ change_synaptics_tap_left_handed (ClutterInputDevice *device,
n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice,
@@ -233,17 +233,39 @@ change_synaptics_tap_left_handed (ClutterInputDevice *device,
if (x11_display && meta_x11_error_trap_pop_with_return (x11_display))
if (clutter_x11_untrap_x_errors())
{
- g_warning ("Could not set synaptics touchpad left-handed for %s",
+ g_warning ("Could not set left-handed for %s",
@ -310,8 +307,8 @@ index 12a592c75..80e5ed10e 100644
+ gdouble speed)
{
MetaDisplay *display = meta_get_display ();
MetaX11Display *x11_display = display ? display->x11_display : NULL;
@@ -342,6 +364,23 @@ change_synaptics_speed (ClutterInputDevice *device,
MetaBackend *backend = meta_get_backend ();
@@ -338,6 +360,23 @@ change_synaptics_speed (ClutterInputDevice *device,
XCloseDevice (xdisplay, xdevice);
}
@ -335,7 +332,7 @@ index 12a592c75..80e5ed10e 100644
/* Ensure that syndaemon dies together with us, to avoid running several of
* them */
static void
@@ -510,9 +549,10 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
@@ -506,9 +545,10 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gfloat value = speed;
@ -348,7 +345,7 @@ index 12a592c75..80e5ed10e 100644
return;
}
@@ -554,6 +594,11 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
@@ -550,6 +590,11 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
g_object_unref (settings);
return;
}
@ -360,7 +357,7 @@ index 12a592c75..80e5ed10e 100644
change_property (device, "libinput Left Handed Enabled",
XA_INTEGER, 8, &value, 1);
@@ -767,6 +812,12 @@ meta_input_settings_x11_set_scroll_button (MetaInputSettings *settings,
@@ -763,6 +808,12 @@ meta_input_settings_x11_set_scroll_button (MetaInputSettings *settings,
ClutterInputDevice *device,
guint button)
{
@ -374,5 +371,5 @@ index 12a592c75..80e5ed10e 100644
XA_INTEGER, 32, &button, 1);
}
--
2.21.0
2.36.1

View File

@ -0,0 +1,333 @@
From 529eb8fa3a15e0ae5bf131b1855a117c8a1a026e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Tue, 8 Feb 2022 17:14:06 +0100
Subject: [PATCH 1/2] shaped-texture: Pass along the snippet to the texture
tower
The snippet is used make sure the right source is sampled in the shader.
This wasn't done in the texture tower, meaning the textures from the
tower were not correct.
Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/528
---
src/compositor/meta-shaped-texture.c | 2 ++
src/compositor/meta-texture-tower.c | 27 +++++++++++++++++++++++++++
src/compositor/meta-texture-tower.h | 3 +++
3 files changed, 32 insertions(+)
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index 9cae4df07d74..32af6bdc19d7 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -1204,6 +1204,8 @@ meta_shaped_texture_set_snippet (MetaShapedTexture *stex,
g_clear_pointer (&stex->snippet, cogl_object_unref);
if (snippet)
stex->snippet = cogl_object_ref (snippet);
+
+ meta_texture_tower_set_snippet (stex->paint_tower, snippet);
}
/**
diff --git a/src/compositor/meta-texture-tower.c b/src/compositor/meta-texture-tower.c
index a41cdc89dd94..374e1af151ad 100644
--- a/src/compositor/meta-texture-tower.c
+++ b/src/compositor/meta-texture-tower.c
@@ -63,6 +63,7 @@ struct _MetaTextureTower
CoglOffscreen *fbos[MAX_TEXTURE_LEVELS];
Box invalid[MAX_TEXTURE_LEVELS];
CoglPipeline *pipeline_template;
+ CoglSnippet *snippet;
};
/**
@@ -98,6 +99,7 @@ meta_texture_tower_free (MetaTextureTower *tower)
cogl_object_unref (tower->pipeline_template);
meta_texture_tower_set_base_texture (tower, NULL);
+ cogl_clear_object (&tower->snippet);
g_slice_free (MetaTextureTower, tower);
}
@@ -226,6 +228,28 @@ meta_texture_tower_update_area (MetaTextureTower *tower,
}
}
+void
+meta_texture_tower_set_snippet (MetaTextureTower *tower,
+ CoglSnippet *snippet)
+{
+ int i;
+
+ if (tower->snippet == snippet)
+ return;
+
+ g_clear_pointer (&tower->snippet, cogl_object_unref);
+
+ if (snippet)
+ tower->snippet = cogl_object_ref (snippet);
+
+ for (i = 1; i < tower->n_levels; i++)
+ {
+ cogl_clear_object (&tower->textures[i]);
+ g_clear_object (&tower->fbos[i]);
+ }
+ cogl_clear_object (&tower->pipeline_template);
+}
+
/* It generally looks worse if we scale up a window texture by even a
* small amount than if we scale it down using bilinear filtering, so
* we always pick the *larger* adjacent level. */
@@ -420,6 +444,9 @@ texture_tower_revalidate (MetaTextureTower *tower,
pipeline = cogl_pipeline_copy (tower->pipeline_template);
cogl_pipeline_set_layer_texture (pipeline, 0, tower->textures[level - 1]);
+ if (tower->snippet && level == 1)
+ cogl_pipeline_add_layer_snippet (pipeline, 0, tower->snippet);
+
cogl_framebuffer_draw_textured_rectangle (fb, pipeline,
invalid->x1, invalid->y1,
invalid->x2, invalid->y2,
diff --git a/src/compositor/meta-texture-tower.h b/src/compositor/meta-texture-tower.h
index 6a39e4184200..e3cfe3608b8f 100644
--- a/src/compositor/meta-texture-tower.h
+++ b/src/compositor/meta-texture-tower.h
@@ -62,6 +62,9 @@ void meta_texture_tower_update_area (MetaTextureTower *tower,
int height);
CoglTexture *meta_texture_tower_get_paint_texture (MetaTextureTower *tower);
+void meta_texture_tower_set_snippet (MetaTextureTower *tower,
+ CoglSnippet *snippet);
+
G_END_DECLS
#endif /* __META_TEXTURE_TOWER_H__ */
--
2.34.1
From 4827e201b341ac4dd0b4ca697df46946b19ae14c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 21 Feb 2022 18:12:25 +0100
Subject: [PATCH 2/2] shaped-texture: Paint with the right layer snippet
When we get passed a "snippet" to the shaped texture, it's added as a
pipeline layer snippet to change how the source texture is sampled. When
we draw from a texture tower however we have allocated regular textures
which doesn't need any special layer snippet, so create separate
pipelines for those that doesn't use that snippet.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/528
---
src/compositor/meta-shaped-texture.c | 135 +++++++++++++++++++++------
1 file changed, 104 insertions(+), 31 deletions(-)
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index 32af6bdc19d7..705d27d5b842 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -96,8 +96,12 @@ struct _MetaShapedTexture
CoglSnippet *snippet;
CoglPipeline *base_pipeline;
+ CoglPipeline *unmasked_pipeline;
+ CoglPipeline *unmasked_tower_pipeline;
CoglPipeline *masked_pipeline;
+ CoglPipeline *masked_tower_pipeline;
CoglPipeline *unblended_pipeline;
+ CoglPipeline *unblended_tower_pipeline;
gboolean is_y_inverted;
@@ -281,8 +285,12 @@ static void
meta_shaped_texture_reset_pipelines (MetaShapedTexture *stex)
{
g_clear_pointer (&stex->base_pipeline, cogl_object_unref);
+ g_clear_pointer (&stex->unmasked_pipeline, cogl_object_unref);
+ g_clear_pointer (&stex->unmasked_tower_pipeline, cogl_object_unref);
g_clear_pointer (&stex->masked_pipeline, cogl_object_unref);
+ g_clear_pointer (&stex->masked_tower_pipeline, cogl_object_unref);
g_clear_pointer (&stex->unblended_pipeline, cogl_object_unref);
+ g_clear_pointer (&stex->unblended_tower_pipeline, cogl_object_unref);
}
static void
@@ -385,9 +393,6 @@ get_base_pipeline (MetaShapedTexture *stex,
cogl_pipeline_set_layer_matrix (pipeline, 1, &matrix);
}
- if (stex->snippet)
- cogl_pipeline_add_layer_snippet (pipeline, 0, stex->snippet);
-
stex->base_pipeline = pipeline;
return stex->base_pipeline;
@@ -395,50 +400,118 @@ get_base_pipeline (MetaShapedTexture *stex,
static CoglPipeline *
get_unmasked_pipeline (MetaShapedTexture *stex,
- CoglContext *ctx)
+ CoglContext *ctx,
+ CoglTexture *tex)
{
- return get_base_pipeline (stex, ctx);
+ if (stex->texture == tex)
+ {
+ CoglPipeline *pipeline;
+
+ if (stex->unmasked_pipeline)
+ return stex->unmasked_pipeline;
+
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
+ if (stex->snippet)
+ cogl_pipeline_add_layer_snippet (pipeline, 0, stex->snippet);
+
+ stex->unmasked_pipeline = pipeline;
+ return pipeline;
+ }
+ else
+ {
+ CoglPipeline *pipeline;
+
+ if (stex->unmasked_tower_pipeline)
+ return stex->unmasked_tower_pipeline;
+
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
+ stex->unmasked_tower_pipeline = pipeline;
+ return pipeline;
+ }
}
static CoglPipeline *
get_masked_pipeline (MetaShapedTexture *stex,
- CoglContext *ctx)
+ CoglContext *ctx,
+ CoglTexture *tex)
{
- CoglPipeline *pipeline;
+ if (stex->texture == tex)
+ {
+ CoglPipeline *pipeline;
- if (stex->masked_pipeline)
- return stex->masked_pipeline;
+ if (stex->masked_pipeline)
+ return stex->masked_pipeline;
- pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
- cogl_pipeline_set_layer_combine (pipeline, 1,
- "RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
- NULL);
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
+ cogl_pipeline_set_layer_combine (pipeline, 1,
+ "RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
+ NULL);
+ if (stex->snippet)
+ cogl_pipeline_add_layer_snippet (pipeline, 0, stex->snippet);
- stex->masked_pipeline = pipeline;
+ stex->masked_pipeline = pipeline;
+ return pipeline;
+ }
+ else
+ {
+ CoglPipeline *pipeline;
+
+ if (stex->masked_tower_pipeline)
+ return stex->masked_tower_pipeline;
- return pipeline;
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
+ cogl_pipeline_set_layer_combine (pipeline, 1,
+ "RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
+ NULL);
+
+ stex->masked_tower_pipeline = pipeline;
+ return pipeline;
+ }
}
static CoglPipeline *
get_unblended_pipeline (MetaShapedTexture *stex,
- CoglContext *ctx)
+ CoglContext *ctx,
+ CoglTexture *tex)
{
- CoglPipeline *pipeline;
- CoglColor color;
+ if (stex->texture == tex)
+ {
+ CoglPipeline *pipeline;
+ CoglColor color;
- if (stex->unblended_pipeline)
- return stex->unblended_pipeline;
+ if (stex->unblended_pipeline)
+ return stex->unblended_pipeline;
- pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
- cogl_color_init_from_4ub (&color, 255, 255, 255, 255);
- cogl_pipeline_set_blend (pipeline,
- "RGBA = ADD (SRC_COLOR, 0)",
- NULL);
- cogl_pipeline_set_color (pipeline, &color);
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
+ cogl_color_init_from_4ub (&color, 255, 255, 255, 255);
+ cogl_pipeline_set_blend (pipeline,
+ "RGBA = ADD (SRC_COLOR, 0)",
+ NULL);
+ cogl_pipeline_set_color (pipeline, &color);
+ if (stex->snippet)
+ cogl_pipeline_add_layer_snippet (pipeline, 0, stex->snippet);
- stex->unblended_pipeline = pipeline;
+ stex->unblended_pipeline = pipeline;
+ return pipeline;
+ }
+ else
+ {
+ CoglPipeline *pipeline;
+ CoglColor color;
- return pipeline;
+ if (stex->unblended_tower_pipeline)
+ return stex->unblended_tower_pipeline;
+
+ pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
+ cogl_color_init_from_4ub (&color, 255, 255, 255, 255);
+ cogl_pipeline_set_blend (pipeline,
+ "RGBA = ADD (SRC_COLOR, 0)",
+ NULL);
+ cogl_pipeline_set_color (pipeline, &color);
+
+ stex->unblended_tower_pipeline = pipeline;
+ return pipeline;
+ }
}
static void
@@ -714,7 +787,7 @@ do_paint (MetaShapedTexture *stex,
if (!cairo_region_is_empty (region))
{
- opaque_pipeline = get_unblended_pipeline (stex, ctx);
+ opaque_pipeline = get_unblended_pipeline (stex, ctx, paint_tex);
cogl_pipeline_set_layer_texture (opaque_pipeline, 0, paint_tex);
cogl_pipeline_set_layer_filters (opaque_pipeline, 0, filter, filter);
@@ -750,11 +823,11 @@ do_paint (MetaShapedTexture *stex,
if (stex->mask_texture == NULL)
{
- blended_pipeline = get_unmasked_pipeline (stex, ctx);
+ blended_pipeline = get_unmasked_pipeline (stex, ctx, paint_tex);
}
else
{
- blended_pipeline = get_masked_pipeline (stex, ctx);
+ blended_pipeline = get_masked_pipeline (stex, ctx, paint_tex);
cogl_pipeline_set_layer_texture (blended_pipeline, 1, stex->mask_texture);
cogl_pipeline_set_layer_filters (blended_pipeline, 1, filter, filter);
}
--
2.34.1

File diff suppressed because it is too large Load Diff

View File

@ -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 */

View File

@ -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)
{

View File

@ -8,7 +8,7 @@
Name: mutter
Version: 3.32.2
Release: 60%{?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
@ -192,6 +194,29 @@ Patch522: wayland-frame-callback-rework.patch
Patch523: 0001-wayland-Move-check-for-present-window-out-of-the-act.patch
Patch524: 0002-wayland-dnd-surface-Propagate-commit-to-parent-class.patch
# Backport monitor configuration policy feature (#2001655)
Patch525: monitor-config-policy.patch
# Backport EGLStream overview fixes (#1977721)
Patch526: eglstream-overview-fixes.patch
# Backport fix for stuck _NET_WM_FRAME_DRAWN handling (#2060305)
Patch527: 0001-compositor-Make-sure-_NET_WM_FRAME_DRAWN-timestamp-h.patch
# Fix race condition causing stuck pointer grabs (#2090168)
Patch528: 0001-events-Pass-CurrentTime-to-XIAllowEvents-when-unfree.patch
# Downgrade assert to warning (#2089311)
Patch529: 0001-workspace-Downgrade-assert-to-warning-when-adding-wi.patch
# Don't add common modes if panel already has (#2125031)
Patch530: 0001-output-kms-Add-more-heuristics-to-decide-when-to-off.patch
# Queue fail safe page flip callbacks (#2172057)
Patch531: 0001-renderer-native-Queue-fail-safe-callbacks-when-mode-.patch
Patch532: 0001-core-Change-MetaWaylandTextInput-event-forwarding-to.patch
BuildRequires: chrpath
BuildRequires: pango-devel
BuildRequires: startup-notification-devel
@ -333,9 +358,54 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
%{_datadir}/mutter-%{mutter_api_version}/tests
%changelog
* Mon Oct 02 2023 Jan Grulich <jgrulich@redhat.com> - 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 <cgarnach@redhat.com> - 3.32.2-71
- Fix ordering of keyboard modifiers relative to other keyboard events
Resolves: #2170830
* Thu Apr 06 2023 Jonas Ådahl <jadahl@redhat.com>) - 3.32.2-69
- Queue fail safe page flip callbacks
Resolves: #2172057
* Wed Dec 21 2022 Olivier Fourdan <ofourdan@redhat.com> - 3.32.2-68
- Fix downstream synaptics patches breaking xdmcp
Resolves: #2092450
* Thu Oct 20 2022 Jonas Ådahl <jadahl@redhat.com>) - 3.32.2-67
- Don't add common modes if panel already has
Resolves: #2125031
* Mon Aug 29 2022 Jonas Ådahl <jadahl@redhat.com>) - 3.32.2-66
- Downgrade assert to warning
Resolves: #2089311
* Mon Jun 27 2022 Jonas Ådahl <jadahl@redhat.com>) - 3.32.2-65
- Fix race condition causing stuck pointer grabs
Resolves: #2090168
* Fri Mar 18 2022 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-64
- Backport fix for stuck _NET_WM_FRAME_DRAWN handling
Resolves: #2060305
* Thu Feb 24 2022 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-63
- Fix EGLStream overview fixes backport
Related: #1977721
* Mon Feb 21 2022 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-62
- Backport EGLStream overview fixes
Resolves: #1977721
* Fri Feb 04 2022 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-61
- Backport monitor configuration policy feature
Resolves: #2001655
* Mon Aug 30 2021 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-60
- Backport fix avoiding DND regression
Resolves: #1999120
Resolves: #2000905
* Fri Aug 06 2021 Jonas Ådahl <jadahl@redhat.com> - 3.32.2-59
- Backport fixes avoiding frozen partly off-screen clients