Merge ~3v1n0/ubuntu/+source/mutter:ubuntu/bionic into ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/bionic

Proposed by Marco Trevisan (Treviño) on 2018-10-30
Status: Merged
Merged at revision: 6fe31f8979b732f4ce692b37e68c0587ef9344d4
Proposed branch: ~3v1n0/ubuntu/+source/mutter:ubuntu/bionic
Merge into: ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/bionic
Diff against target: 472 lines (+435/-0)
5 files modified
debian/changelog (+10/-0)
debian/patches/clutter-Do-not-latch-modifiers-on-modifier-keys.patch (+43/-0)
debian/patches/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch (+316/-0)
debian/patches/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch (+63/-0)
debian/patches/series (+3/-0)
Reviewer Review Type Date Requested Status
Iain Lane 2018-10-30 Approve on 2018-10-31
Review via email: mp+358007@code.launchpad.net

This proposal supersedes a proposal from 2018-10-30.

Commit message

Fix already in cosmic, no need to port there.

To post a comment you must log in.
Iain Lane (laney) wrote :

thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 9c9690f..3f8c8d8 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,13 @@
6+mutter (3.28.3-2~ubuntu18.04.2) UNRELEASED; urgency=medium
7+
8+ * d/p/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch:
9+ - Create back buffers in early intel GPU generations (LP: #1727356)
10+ * d/p/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch,
11+ d/p/clutter-Do-not-latch-modifiers-on-modifier-keys.patch
12+ - Fix typing capital letters when using OSD keyboard (LP: #1730211)
13+
14+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Tue, 30 Oct 2018 12:25:42 +0100
15+
16 mutter (3.28.3-2~ubuntu18.04.1) bionic; urgency=medium
17
18 * No-change backport from unstable to bionic
19diff --git a/debian/patches/clutter-Do-not-latch-modifiers-on-modifier-keys.patch b/debian/patches/clutter-Do-not-latch-modifiers-on-modifier-keys.patch
20new file mode 100644
21index 0000000..120171f
22--- /dev/null
23+++ b/debian/patches/clutter-Do-not-latch-modifiers-on-modifier-keys.patch
24@@ -0,0 +1,43 @@
25+From: Carlos Garnacho <carlosg@gnome.org>
26+Date: Wed, 3 Oct 2018 22:43:21 +0200
27+Subject: clutter: Do not latch modifiers on modifier keys
28+
29+If the user maps eg. Alt+F2 to a pad button, the MetaInputSettings will
30+send the full Alt press, F2 press, F2 release, Alt release sequence.
31+However the keycode corresponding to Alt is found in level 1, so the
32+Shift modifier gets unintendedly latched in addition to the Alt key
33+press/release pair.
34+
35+We could probably improve keycode lookup heuristics so level=0 (and
36+no modifier latching) is preferred, but we can do without it altogether
37+for modifier keys.
38+
39+Ubuntu-Bug: https://bugs.launchpad.net/oem-priority/+bug/1730211
40+Applied-Upstream: yes, 3.30.1
41+---
42+ clutter/clutter/x11/clutter-virtual-input-device-x11.c | 6 ++++--
43+ 1 file changed, 4 insertions(+), 2 deletions(-)
44+
45+diff --git a/clutter/clutter/x11/clutter-virtual-input-device-x11.c b/clutter/clutter/x11/clutter-virtual-input-device-x11.c
46+index b86ded0..e16ba3f 100644
47+--- a/clutter/clutter/x11/clutter-virtual-input-device-x11.c
48++++ b/clutter/clutter/x11/clutter-virtual-input-device-x11.c
49+@@ -147,14 +147,16 @@ clutter_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtu
50+ return;
51+ }
52+
53+- if (key_state == CLUTTER_KEY_STATE_PRESSED)
54++ if (!_clutter_keymap_x11_get_is_modifier (keymap, keycode) &&
55++ key_state == CLUTTER_KEY_STATE_PRESSED)
56+ clutter_keymap_x11_latch_modifiers (keymap, level, TRUE);
57+
58+ XTestFakeKeyEvent (clutter_x11_get_default_display (),
59+ (KeyCode) keycode,
60+ key_state == CLUTTER_KEY_STATE_PRESSED, 0);
61+
62+- if (key_state == CLUTTER_KEY_STATE_RELEASED)
63++ if (!_clutter_keymap_x11_get_is_modifier (keymap, keycode) &&
64++ key_state == CLUTTER_KEY_STATE_RELEASED)
65+ clutter_keymap_x11_latch_modifiers (keymap, level, FALSE);
66+ }
67+
68diff --git a/debian/patches/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch b/debian/patches/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch
69new file mode 100644
70index 0000000..ccb4263
71--- /dev/null
72+++ b/debian/patches/clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch
73@@ -0,0 +1,316 @@
74+From: Carlos Garnacho <carlosg@gnome.org>
75+Date: Fri, 29 Jun 2018 14:31:23 +0200
76+Subject: clutter/x11: Implement keycode lookup from keysyms on virtual key
77+ devices
78+
79+Unfortunately XKeysymToKeycode() falls short in that it coalesces keysyms
80+into keycodes pertaining to the first level (i.e. lowercase). Add a
81+ClutterKeymapX11 method (much alike its GdkKeymap counterpart) to look up
82+all matches for the given keysym.
83+
84+Two other helper methods have been added so the virtual device can fetch
85+the current keyboard group, and latch modifiers for key emission. Combining
86+all this, the virtual device is now able to handle keycodes in further
87+levels.
88+
89+Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/135
90+
91+(cherry picked from commit 85284acb000ddc70afcf716b6c198b4b5bf5741e)
92+
93+Ubuntu-Bug: https://bugs.launchpad.net/oem-priority/+bug/1730211
94+Applied-Upstream: yes, 3.28.4
95+---
96+ clutter/clutter/x11/clutter-keymap-x11.c | 178 ++++++++++++++++++++-
97+ clutter/clutter/x11/clutter-keymap-x11.h | 8 +
98+ .../clutter/x11/clutter-virtual-input-device-x11.c | 22 ++-
99+ 3 files changed, 204 insertions(+), 4 deletions(-)
100+
101+diff --git a/clutter/clutter/x11/clutter-keymap-x11.c b/clutter/clutter/x11/clutter-keymap-x11.c
102+index 914e314..c34e676 100644
103+--- a/clutter/clutter/x11/clutter-keymap-x11.c
104++++ b/clutter/clutter/x11/clutter-keymap-x11.c
105+@@ -38,6 +38,14 @@
106+
107+ typedef struct _ClutterKeymapX11Class ClutterKeymapX11Class;
108+ typedef struct _DirectionCacheEntry DirectionCacheEntry;
109++typedef struct _ClutterKeymapKey ClutterKeymapKey;
110++
111++struct _ClutterKeymapKey
112++{
113++ guint keycode;
114++ guint group;
115++ guint level;
116++};
117+
118+ struct _DirectionCacheEntry
119+ {
120+@@ -59,6 +67,7 @@ struct _ClutterKeymapX11
121+
122+ ClutterModifierType num_lock_mask;
123+ ClutterModifierType scroll_lock_mask;
124++ ClutterModifierType level3_shift_mask;
125+
126+ PangoDirection current_direction;
127+
128+@@ -69,6 +78,7 @@ struct _ClutterKeymapX11
129+ Atom current_group_atom;
130+ guint current_cache_serial;
131+ DirectionCacheEntry group_direction_cache[4];
132++ int current_group;
133+ #endif
134+
135+ guint caps_lock_state : 1;
136+@@ -198,6 +208,9 @@ get_xkb (ClutterKeymapX11 *keymap_x11)
137+ if (keymap_x11->scroll_lock_mask == 0)
138+ keymap_x11->scroll_lock_mask = XkbKeysymToModifiers (backend_x11->xdpy,
139+ XK_Scroll_Lock);
140++ if (keymap_x11->level3_shift_mask == 0)
141++ keymap_x11->level3_shift_mask = XkbKeysymToModifiers (backend_x11->xdpy,
142++ XK_ISO_Level3_Shift);
143+
144+ return keymap_x11->xkb_desc;
145+ }
146+@@ -469,6 +482,7 @@ static void
147+ clutter_keymap_x11_init (ClutterKeymapX11 *keymap)
148+ {
149+ keymap->current_direction = PANGO_DIRECTION_NEUTRAL;
150++ keymap->current_group = -1;
151+ }
152+
153+ static ClutterTranslateReturn
154+@@ -498,7 +512,8 @@ clutter_keymap_x11_translate_event (ClutterEventTranslator *translator,
155+ {
156+ case XkbStateNotify:
157+ CLUTTER_NOTE (EVENT, "Updating keyboard state");
158+- update_direction (keymap_x11, XkbStateGroup (&xkb_event->state));
159++ keymap_x11->current_group = XkbStateGroup (&xkb_event->state);
160++ update_direction (keymap_x11, keymap_x11->current_group);
161+ update_locked_mods (keymap_x11, xkb_event->state.locked_mods);
162+ retval = CLUTTER_TRANSLATE_REMOVE;
163+ break;
164+@@ -665,3 +680,164 @@ _clutter_keymap_x11_get_direction (ClutterKeymapX11 *keymap)
165+ #endif
166+ return PANGO_DIRECTION_NEUTRAL;
167+ }
168++
169++static gboolean
170++clutter_keymap_x11_get_entries_for_keyval (ClutterKeymapX11 *keymap_x11,
171++ guint keyval,
172++ ClutterKeymapKey **keys,
173++ gint *n_keys)
174++{
175++#ifdef HAVE_XKB
176++ if (CLUTTER_BACKEND_X11 (keymap_x11->backend)->use_xkb)
177++ {
178++ XkbDescRec *xkb = get_xkb (keymap_x11);
179++ GArray *retval;
180++ gint keycode;
181++
182++ keycode = keymap_x11->min_keycode;
183++ retval = g_array_new (FALSE, FALSE, sizeof (ClutterKeymapKey));
184++
185++ while (keycode <= keymap_x11->max_keycode)
186++ {
187++ gint max_shift_levels = XkbKeyGroupsWidth (xkb, keycode);
188++ gint group = 0;
189++ gint level = 0;
190++ gint total_syms = XkbKeyNumSyms (xkb, keycode);
191++ gint i = 0;
192++ KeySym *entry;
193++
194++ /* entry is an array with all syms for group 0, all
195++ * syms for group 1, etc. and for each group the
196++ * shift level syms are in order
197++ */
198++ entry = XkbKeySymsPtr (xkb, keycode);
199++
200++ while (i < total_syms)
201++ {
202++ g_assert (i == (group * max_shift_levels + level));
203++
204++ if (entry[i] == keyval)
205++ {
206++ ClutterKeymapKey key;
207++
208++ key.keycode = keycode;
209++ key.group = group;
210++ key.level = level;
211++
212++ g_array_append_val (retval, key);
213++
214++ g_assert (XkbKeySymEntry (xkb, keycode, level, group) ==
215++ keyval);
216++ }
217++
218++ ++level;
219++
220++ if (level == max_shift_levels)
221++ {
222++ level = 0;
223++ ++group;
224++ }
225++
226++ ++i;
227++ }
228++
229++ ++keycode;
230++ }
231++
232++ if (retval->len > 0)
233++ {
234++ *keys = (ClutterKeymapKey*) retval->data;
235++ *n_keys = retval->len;
236++ }
237++ else
238++ {
239++ *keys = NULL;
240++ *n_keys = 0;
241++ }
242++
243++ g_array_free (retval, retval->len > 0 ? FALSE : TRUE);
244++
245++ return *n_keys > 0;
246++ }
247++ else
248++#endif
249++ {
250++ return FALSE;
251++ }
252++}
253++
254++void
255++clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11,
256++ uint32_t level,
257++ gboolean enable)
258++{
259++#ifdef HAVE_XKB
260++ ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend);
261++ uint32_t modifiers[] = {
262++ 0,
263++ ShiftMask,
264++ keymap_x11->level3_shift_mask,
265++ keymap_x11->level3_shift_mask | ShiftMask,
266++ };
267++ uint32_t value = 0;
268++
269++ if (!backend_x11->use_xkb)
270++ return;
271++
272++ level = CLAMP (level, 0, G_N_ELEMENTS (modifiers) - 1);
273++
274++ if (enable)
275++ value = modifiers[level];
276++ else
277++ value = 0;
278++
279++ XkbLatchModifiers (clutter_x11_get_default_display (),
280++ XkbUseCoreKbd, modifiers[level],
281++ value);
282++#endif
283++}
284++
285++static uint32_t
286++clutter_keymap_x11_get_current_group (ClutterKeymapX11 *keymap_x11)
287++{
288++ ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (keymap_x11->backend);
289++ XkbStateRec state_rec;
290++
291++ if (keymap_x11->current_group >= 0)
292++ return keymap_x11->current_group;
293++
294++ XkbGetState (backend_x11->xdpy, XkbUseCoreKbd, &state_rec);
295++ return XkbStateGroup (&state_rec);
296++}
297++
298++gboolean
299++clutter_keymap_x11_keycode_for_keyval (ClutterKeymapX11 *keymap_x11,
300++ guint keyval,
301++ guint *keycode_out,
302++ guint *level_out)
303++{
304++ ClutterKeymapKey *keys;
305++ gint i, n_keys, group;
306++ gboolean found = FALSE;
307++
308++ g_return_val_if_fail (keycode_out != NULL, FALSE);
309++ g_return_val_if_fail (level_out != NULL, FALSE);
310++
311++ group = clutter_keymap_x11_get_current_group (keymap_x11);
312++
313++ if (!clutter_keymap_x11_get_entries_for_keyval (keymap_x11, keyval, &keys, &n_keys))
314++ return FALSE;
315++
316++ for (i = 0; i < n_keys && !found; i++)
317++ {
318++ if (keys[i].group == group)
319++ {
320++ *keycode_out = keys[i].keycode;
321++ *level_out = keys[i].level;
322++ found = TRUE;
323++ }
324++ }
325++
326++ g_free (keys);
327++ return found;
328++}
329+diff --git a/clutter/clutter/x11/clutter-keymap-x11.h b/clutter/clutter/x11/clutter-keymap-x11.h
330+index ad673a2..4b5b403 100644
331+--- a/clutter/clutter/x11/clutter-keymap-x11.h
332++++ b/clutter/clutter/x11/clutter-keymap-x11.h
333+@@ -51,6 +51,14 @@ gboolean _clutter_keymap_x11_get_is_modifier (ClutterKeymapX11 *keymap,
334+
335+ PangoDirection _clutter_keymap_x11_get_direction (ClutterKeymapX11 *keymap);
336+
337++gboolean clutter_keymap_x11_keycode_for_keyval (ClutterKeymapX11 *keymap_x11,
338++ guint keyval,
339++ guint *keycode_out,
340++ guint *level_out);
341++void clutter_keymap_x11_latch_modifiers (ClutterKeymapX11 *keymap_x11,
342++ uint32_t level,
343++ gboolean enable);
344++
345+ G_END_DECLS
346+
347+ #endif /* __CLUTTER_KEYMAP_X11_H__ */
348+diff --git a/clutter/clutter/x11/clutter-virtual-input-device-x11.c b/clutter/clutter/x11/clutter-virtual-input-device-x11.c
349+index 416c944..b86ded0 100644
350+--- a/clutter/clutter/x11/clutter-virtual-input-device-x11.c
351++++ b/clutter/clutter/x11/clutter-virtual-input-device-x11.c
352+@@ -32,6 +32,8 @@
353+
354+ #include "clutter-virtual-input-device.h"
355+ #include "x11/clutter-virtual-input-device-x11.h"
356++#include "x11/clutter-backend-x11.h"
357++#include "x11/clutter-keymap-x11.h"
358+
359+ struct _ClutterVirtualInputDeviceX11
360+ {
361+@@ -135,11 +137,25 @@ clutter_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtu
362+ uint32_t keyval,
363+ ClutterKeyState key_state)
364+ {
365+- KeyCode keycode;
366++ ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
367++ ClutterKeymapX11 *keymap = backend_x11->keymap;
368++ uint32_t keycode, level;
369++
370++ if (!clutter_keymap_x11_keycode_for_keyval (keymap, keyval, &keycode, &level))
371++ {
372++ g_warning ("No keycode found for keyval %x in current group", keyval);
373++ return;
374++ }
375++
376++ if (key_state == CLUTTER_KEY_STATE_PRESSED)
377++ clutter_keymap_x11_latch_modifiers (keymap, level, TRUE);
378+
379+- keycode = XKeysymToKeycode (clutter_x11_get_default_display (), keyval);
380+ XTestFakeKeyEvent (clutter_x11_get_default_display (),
381+- keycode, key_state == CLUTTER_KEY_STATE_PRESSED, 0);
382++ (KeyCode) keycode,
383++ key_state == CLUTTER_KEY_STATE_PRESSED, 0);
384++
385++ if (key_state == CLUTTER_KEY_STATE_RELEASED)
386++ clutter_keymap_x11_latch_modifiers (keymap, level, FALSE);
387+ }
388+
389+ static void
390diff --git a/debian/patches/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch b/debian/patches/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch
391new file mode 100644
392index 0000000..a25fca3
393--- /dev/null
394+++ b/debian/patches/renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch
395@@ -0,0 +1,63 @@
396+From: =?utf-8?q?Alex_Villac=C3=ADs_Lasso?= <a_villacis@palosanto.com>
397+Date: Fri, 27 Jul 2018 16:08:52 +0000
398+Subject: renderer/native: Fallback to non-planar API if
399+ gbm_bo_get_handle_for_plane fails
400+
401+Commit c0d9b08ef9bf2be865aad9bf1bc74ba24c655d9f replaced the old GBM API calls
402+with the multi-plane GBM API. However, the call to gbm_bo_get_handle_for_plane
403+fails for some DRI drivers (in particular i915). Due to missing error checks,
404+the subsequent call to drmModeAddFB[2] fails and the screen output locks up.
405+
406+This commit adds the missing error checks and falls back to the old GBM API
407+(non-planar) if necessary.
408+
409+v5: test success of gbm_bo_get_handle_for_plane instead of errno
410+
411+This commit adopts solution proposed by Daniel van Vugt to check the return
412+value of gbm_bo_get_handle_for_plane on plane 0 and fall back to old
413+non-planar method if the call fails. This removes the errno check (for
414+ENOSYS) that could abort if mesa ever sets a different value.
415+
416+Related to: https://gitlab.gnome.org/GNOME/mutter/issues/127
417+
418+(cherry picked from commit f7af32a3eaefabbea3ebbda3a93eff98dd105ab9)
419+
420+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1727356
421+Applied-Upstream: yes, 3.28.4
422+---
423+ src/backends/native/meta-renderer-native.c | 21 ++++++++++++++++-----
424+ 1 file changed, 16 insertions(+), 5 deletions(-)
425+
426+diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
427+index fc6b223..59003b3 100644
428+--- a/src/backends/native/meta-renderer-native.c
429++++ b/src/backends/native/meta-renderer-native.c
430+@@ -1607,12 +1607,23 @@ gbm_get_next_fb_id (MetaGpuKms *gpu_kms,
431+ return FALSE;
432+ }
433+
434+- for (i = 0; i < gbm_bo_get_plane_count (next_bo); i++)
435++ if (gbm_bo_get_handle_for_plane (next_bo, 0).s32 == -1)
436+ {
437+- strides[i] = gbm_bo_get_stride_for_plane (next_bo, i);
438+- handles[i] = gbm_bo_get_handle_for_plane (next_bo, i).u32;
439+- offsets[i] = gbm_bo_get_offset (next_bo, i);
440+- modifiers[i] = gbm_bo_get_modifier (next_bo);
441++ /* Failed to fetch handle to plane, falling back to old method */
442++ strides[0] = gbm_bo_get_stride (next_bo);
443++ handles[0] = gbm_bo_get_handle (next_bo).u32;
444++ offsets[0] = 0;
445++ modifiers[0] = DRM_FORMAT_MOD_INVALID;
446++ }
447++ else
448++ {
449++ for (i = 0; i < gbm_bo_get_plane_count (next_bo); i++)
450++ {
451++ strides[i] = gbm_bo_get_stride_for_plane (next_bo, i);
452++ handles[i] = gbm_bo_get_handle_for_plane (next_bo, i).u32;
453++ offsets[i] = gbm_bo_get_offset (next_bo, i);
454++ modifiers[i] = gbm_bo_get_modifier (next_bo);
455++ }
456+ }
457+
458+ kms_fd = meta_gpu_kms_get_fd (gpu_kms);
459diff --git a/debian/patches/series b/debian/patches/series
460index 860ee4c..5bd9ae6 100644
461--- a/debian/patches/series
462+++ b/debian/patches/series
463@@ -10,6 +10,9 @@ theme-load-icons-as-Gtk-does-with-fallback-and-RTL-suppor.patch
464 clutter-Smooth-out-master-clock-to-smooth-visuals.patch
465 core-Return-1-if-meta_window_get_monitor-is-called-on-an-.patch
466 bgo768531_workaround-startup-notifications.patch
467+renderer-native-Fallback-to-non-planar-API-if-gbm_bo_get_.patch
468+clutter-x11-Implement-keycode-lookup-from-keysyms-on-virt.patch
469+clutter-Do-not-latch-modifiers-on-modifier-keys.patch
470 debian/synaptics-support.patch
471 debian/skip-failing-tests.patch
472 debian/skip-failing-tests-325.patch

Subscribers

People subscribed via source and target branches