Compare commits

...

No commits in common. "c8" and "a9-beta" have entirely different histories.
c8 ... a9-beta

104 changed files with 4444 additions and 28223 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/mutter-3.32.2.tar.xz
SOURCES/mutter-40.8.tar.xz

1
.mutter.metadata Normal file
View File

@ -0,0 +1 @@
68d490f395c64f470105e3fb5b75878ce6e80640 SOURCES/mutter-40.8.tar.xz

View File

@ -1,907 +0,0 @@
From fd67e75df470b50510b68ccf0f52b0b98d05c63f 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
Track the stereo status of windows using the new EXT_stereo_tree
GLX extension.
When stereo is enabled or disabled, a restart is triggered via
meta_restart() after a timeout, setting a _META_ENABLE_STEREO
property on the root window to indicate whether we should
turn on a stereo stage for clutter. The property avoids a loop,
since we need to enable stereo *before* initializing Clutter and GL,
but we need GL to figure out whether we have stereo windows.
Stereo windows are drawn to the stage using new functionality
in Cogl to setup a stereo context, select which buffer to draw
to, and draw either the left or right buffer of a stereo
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 | 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 +
src/compositor/meta-window-actor-private.h | 5 +
src/compositor/meta-window-actor.c | 22 +++
src/core/main.c | 4 +
src/core/stereo.c | 154 +++++++++++++++++++
src/core/stereo.h | 28 ++++
src/meson.build | 2 +
src/wayland/meta-wayland-surface.c | 2 +-
14 files changed, 482 insertions(+), 20 deletions(-)
create mode 100644 src/core/stereo.c
create mode 100644 src/core/stereo.h
diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h
index 6ab33416c..f70087512 100644
--- a/src/compositor/compositor-private.h
+++ b/src/compositor/compositor-private.h
@@ -24,6 +24,10 @@ struct _MetaCompositor
gint64 server_time_query_time;
gint64 server_time_offset;
+ int glx_opcode;
+ guint stereo_tree_ext : 1;
+ guint have_stereo_windows : 1;
+
guint server_time_is_monotonic_time : 1;
ClutterActor *stage, *window_group, *top_window_group, *feedback_group;
@@ -63,6 +67,11 @@ void meta_end_modal_for_plugin (MetaCompositor *compositor,
gint64 meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
gint64 monotonic_time);
+gboolean meta_compositor_window_is_stereo (MetaDisplay *display,
+ Window xwindow);
+void meta_compositor_select_stereo_notify (MetaDisplay *display,
+ Window xwindow);
+
void meta_compositor_flash_window (MetaCompositor *compositor,
MetaWindow *window);
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 2a2c8fb3b..6c08c8fe4 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -69,6 +69,8 @@
#include "core/core.h"
#include "core/display-private.h"
#include "core/frame.h"
+#include "core/stack-tracker.h"
+#include "core/stereo.h"
#include "core/util-private.h"
#include "core/window-private.h"
#include "meta/compositor-mutter.h"
@@ -514,6 +516,94 @@ redirect_windows (MetaX11Display *x11_display)
}
}
+#define GLX_STEREO_TREE_EXT 0x20F5
+#define GLX_STEREO_NOTIFY_MASK_EXT 0x00000001
+#define GLX_STEREO_NOTIFY_EXT 0x00000000
+
+typedef struct {
+ int type;
+ unsigned long serial;
+ Bool send_event;
+ Display *display;
+ int extension;
+ int evtype;
+ Drawable window;
+ Bool stereo_tree;
+} StereoNotifyEvent;
+
+static gboolean
+display_has_stereo_tree_ext (MetaX11Display *x11_display)
+{
+ Display *xdisplay = x11_display->xdisplay;
+ const char *extensions_string;
+
+ static const char * (*query_extensions_string) (Display *display,
+ int screen);
+
+ if (query_extensions_string == NULL)
+ query_extensions_string =
+ (const char * (*) (Display *, int))
+ cogl_get_proc_address ("glXQueryExtensionsString");
+
+ extensions_string = query_extensions_string (xdisplay,
+ meta_x11_display_get_screen_number (x11_display));
+
+ return extensions_string && strstr (extensions_string, "EXT_stereo_tree") != 0;
+}
+
+#include <GL/gl.h>
+
+gboolean
+meta_compositor_window_is_stereo (MetaDisplay *display,
+ Window xwindow)
+{
+ MetaCompositor *compositor = get_compositor_for_display (display);
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
+
+ static int (*query_drawable) (Display *dpy,
+ Drawable draw,
+ int attribute,
+ unsigned int *value);
+
+ if (compositor->stereo_tree_ext)
+ {
+ unsigned int stereo_tree = 0;
+
+ if (query_drawable == NULL)
+ query_drawable =
+ (int (*) (Display *, Drawable, int, unsigned int *))
+ cogl_get_proc_address ("glXQueryDrawable");
+
+ query_drawable (xdisplay, xwindow, GLX_STEREO_TREE_EXT, &stereo_tree);
+
+ return stereo_tree != 0;
+ }
+ else
+ return FALSE;
+}
+
+void
+meta_compositor_select_stereo_notify (MetaDisplay *display,
+ Window xwindow)
+{
+ MetaCompositor *compositor = get_compositor_for_display (display);
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
+
+ static void (*select_event) (Display *dpy,
+ Drawable draw,
+ unsigned long event_mask);
+
+ if (compositor->stereo_tree_ext)
+ {
+ if (select_event == NULL)
+ select_event =
+ (void (*) (Display *, Drawable, unsigned long))
+ cogl_get_proc_address ("glXSelectEvent");
+
+ select_event (xdisplay, xwindow, GLX_STEREO_NOTIFY_MASK_EXT);
+ }
+}
+
void
meta_compositor_manage (MetaCompositor *compositor)
{
@@ -525,6 +615,8 @@ meta_compositor_manage (MetaCompositor *compositor)
{
xdisplay = display->x11_display->xdisplay;
meta_x11_display_set_cm_selection (display->x11_display);
+
+ compositor->stereo_tree_ext = display_has_stereo_tree_ext (display->x11_display);
}
compositor->stage = meta_backend_get_stage (backend);
@@ -822,6 +914,23 @@ meta_compositor_process_event (MetaCompositor *compositor,
if (window)
process_damage (compositor, (XDamageNotifyEvent *) event, window);
}
+ else if (!meta_is_wayland_compositor () &&
+ event->type == GenericEvent &&
+ event->xcookie.extension == compositor->glx_opcode)
+ {
+ if (event->xcookie.evtype == GLX_STEREO_NOTIFY_EXT)
+ {
+ StereoNotifyEvent *stereo_event = (StereoNotifyEvent *)(event->xcookie.data);
+ window = meta_x11_display_lookup_x_window (x11_display, stereo_event->window);
+
+ if (window != NULL)
+ {
+ MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
+ meta_window_actor_stereo_notify (window_actor, stereo_event->stereo_tree);
+ meta_stack_tracker_queue_sync_stack (window->display->stack_tracker);
+ }
+ }
+ }
if (compositor->have_x11_sync_object)
meta_sync_ring_handle_event (event);
@@ -1038,6 +1147,7 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
GList *stack)
{
GList *old_stack;
+ int stereo_window_count = 0;
/* This is painful because hidden windows that we are in the process
* of animating out of existence. They'll be at the bottom of the
@@ -1113,6 +1223,8 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
* near the front of the other.)
*/
compositor->windows = g_list_prepend (compositor->windows, actor);
+ if (meta_window_actor_is_stereo (actor))
+ stereo_window_count++;
stack = g_list_remove (stack, window);
old_stack = g_list_remove (old_stack, actor);
@@ -1120,6 +1232,8 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
sync_actor_stacking (compositor);
+ meta_stereo_set_have_stereo_windows (stereo_window_count > 0);
+
if (compositor->top_window_actor)
g_signal_handlers_disconnect_by_func (compositor->top_window_actor,
on_top_window_actor_destroyed,
@@ -1325,6 +1439,17 @@ meta_compositor_new (MetaDisplay *display)
meta_post_paint_func,
compositor,
NULL);
+ if (!meta_is_wayland_compositor ())
+ {
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
+ int glx_major_opcode, glx_first_event, glx_first_error;
+
+ if (XQueryExtension (xdisplay,
+ "GLX",
+ &glx_major_opcode, &glx_first_event, &glx_first_error))
+ compositor->glx_opcode = glx_major_opcode;
+ }
+
return compositor;
}
diff --git a/src/compositor/meta-shaped-texture-private.h b/src/compositor/meta-shaped-texture-private.h
index a86a2bff0..d0efdd4dc 100644
--- a/src/compositor/meta-shaped-texture-private.h
+++ b/src/compositor/meta-shaped-texture-private.h
@@ -31,8 +31,9 @@
#include "meta/meta-shaped-texture.h"
ClutterActor *meta_shaped_texture_new (void);
-void meta_shaped_texture_set_texture (MetaShapedTexture *stex,
- CoglTexture *texture);
+void meta_shaped_texture_set_textures (MetaShapedTexture *stex,
+ CoglTexture *texture,
+ CoglTexture *texture_right);
void meta_shaped_texture_set_is_y_inverted (MetaShapedTexture *stex,
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..332b4c814 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -88,8 +88,10 @@ struct _MetaShapedTexture
ClutterActor parent;
MetaTextureTower *paint_tower;
+ MetaTextureTower *paint_tower_right;
CoglTexture *texture;
+ CoglTexture *texture_right;
CoglTexture *mask_texture;
CoglSnippet *snippet;
@@ -160,6 +162,7 @@ static void
meta_shaped_texture_init (MetaShapedTexture *stex)
{
stex->paint_tower = meta_texture_tower_new ();
+ stex->paint_tower_right = NULL; /* demand create */
stex->texture = NULL;
stex->mask_texture = NULL;
@@ -297,7 +300,11 @@ meta_shaped_texture_dispose (GObject *object)
meta_texture_tower_free (stex->paint_tower);
stex->paint_tower = NULL;
+ g_clear_pointer (&stex->paint_tower, meta_texture_tower_free);
+ 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);
meta_shaped_texture_set_mask_texture (stex, NULL);
@@ -507,8 +514,9 @@ paint_clipped_rectangle (MetaShapedTexture *stex,
}
static void
-set_cogl_texture (MetaShapedTexture *stex,
- CoglTexture *cogl_tex)
+set_cogl_textures (MetaShapedTexture *stex,
+ CoglTexture *cogl_tex,
+ CoglTexture *cogl_tex_right)
{
int width, height;
@@ -516,8 +524,11 @@ set_cogl_texture (MetaShapedTexture *stex,
if (stex->texture)
cogl_object_unref (stex->texture);
+ if (stex->texture_right)
+ cogl_object_unref (stex->texture_right);
stex->texture = cogl_tex;
+ stex->texture_right = cogl_tex_right;
if (cogl_tex != NULL)
{
@@ -531,6 +542,9 @@ set_cogl_texture (MetaShapedTexture *stex,
height = 0;
}
+ if (cogl_tex_right != NULL)
+ cogl_object_ref (cogl_tex_right);
+
if (stex->tex_width != width ||
stex->tex_height != height)
{
@@ -544,8 +558,23 @@ set_cogl_texture (MetaShapedTexture *stex,
* previous buffer. We only queue a redraw in response to surface
* damage. */
+ if (cogl_tex_right != NULL)
+ {
+ if (stex->paint_tower_right == NULL)
+ stex->paint_tower_right = meta_texture_tower_new ();
+ }
+ else
+ {
+ g_clear_pointer (&stex->paint_tower_right, meta_texture_tower_free);
+ }
+
if (stex->create_mipmaps)
- meta_texture_tower_set_base_texture (stex->paint_tower, cogl_tex);
+ {
+ meta_texture_tower_set_base_texture (stex->paint_tower, cogl_tex);
+
+ if (stex->paint_tower_right)
+ meta_texture_tower_set_base_texture (stex->paint_tower_right, cogl_tex_right);
+ }
}
static gboolean
@@ -779,7 +808,9 @@ meta_shaped_texture_paint (ClutterActor *actor)
{
MetaShapedTexture *stex = META_SHAPED_TEXTURE (actor);
CoglTexture *paint_tex;
+ CoglTexture *paint_tex_right = NULL;
CoglFramebuffer *fb;
+ gboolean stereo;
if (!stex->texture)
return;
@@ -841,7 +872,32 @@ meta_shaped_texture_paint (ClutterActor *actor)
return;
fb = cogl_get_draw_framebuffer ();
- do_paint (META_SHAPED_TEXTURE (actor), fb, paint_tex, stex->clip_region);
+
+ stereo = stex->texture_right && cogl_framebuffer_get_is_stereo (fb);
+
+ if (stereo)
+ {
+ if (stex->create_mipmaps)
+ paint_tex_right = meta_texture_tower_get_paint_texture (stex->paint_tower_right);
+
+ if (!paint_tex_right)
+ paint_tex_right = COGL_TEXTURE (stex->texture_right);
+ }
+ else
+ paint_tex_right = NULL;
+
+ if (stereo)
+ cogl_framebuffer_set_stereo_mode (fb, COGL_STEREO_LEFT);
+ do_paint (stex, fb, paint_tex, stex->clip_region);
+ if (stereo)
+ cogl_framebuffer_set_stereo_mode (fb, COGL_STEREO_BOTH);
+
+ if (paint_tex_right != NULL)
+ {
+ cogl_framebuffer_set_stereo_mode (fb, COGL_STEREO_RIGHT);
+ do_paint (stex, fb, paint_tex_right, stex->clip_region);
+ cogl_framebuffer_set_stereo_mode (fb, COGL_STEREO_BOTH);
+ }
}
static void
@@ -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);
+
+ if (stex->paint_tower_right)
+ {
+ base_texture = create_mipmaps ? stex->texture_right : NULL;
+ meta_texture_tower_set_base_texture (stex->paint_tower_right, base_texture);
+ }
}
}
@@ -1046,6 +1108,12 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
clip.y,
clip.width,
clip.height);
+ if (stex->paint_tower_right)
+ meta_texture_tower_update_area (stex->paint_tower_right,
+ clip.x,
+ clip.y,
+ clip.width,
+ clip.height);
stex->prev_invalidation = stex->last_invalidation;
stex->last_invalidation = g_get_monotonic_time ();
@@ -1092,17 +1160,18 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
}
/**
- * meta_shaped_texture_set_texture:
+ * meta_shaped_texture_set_textures:
* @stex: The #MetaShapedTexture
* @pixmap: The #CoglTexture to display
*/
void
-meta_shaped_texture_set_texture (MetaShapedTexture *stex,
- CoglTexture *texture)
+meta_shaped_texture_set_textures (MetaShapedTexture *stex,
+ CoglTexture *texture,
+ CoglTexture *texture_right)
{
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
- set_cogl_texture (stex, texture);
+ set_cogl_textures (stex, texture, texture_right);
}
/**
diff --git a/src/compositor/meta-surface-actor-wayland.c b/src/compositor/meta-surface-actor-wayland.c
index f8d6c32b7..a75c4dd09 100644
--- a/src/compositor/meta-surface-actor-wayland.c
+++ b/src/compositor/meta-surface-actor-wayland.c
@@ -182,7 +182,7 @@ meta_surface_actor_wayland_dispose (GObject *object)
MetaShapedTexture *stex =
meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
- meta_shaped_texture_set_texture (stex, NULL);
+ meta_shaped_texture_set_textures (stex, NULL, NULL);
if (self->surface)
{
g_object_remove_weak_pointer (G_OBJECT (self->surface),
diff --git a/src/compositor/meta-surface-actor-x11.c b/src/compositor/meta-surface-actor-x11.c
index 244b1e885..3cd164d77 100644
--- a/src/compositor/meta-surface-actor-x11.c
+++ b/src/compositor/meta-surface-actor-x11.c
@@ -32,6 +32,7 @@
#include "cogl/winsys/cogl-texture-pixmap-x11.h"
#include "compositor/meta-cullable.h"
#include "compositor/meta-shaped-texture-private.h"
+#include "compositor-private.h"
#include "core/window-private.h"
#include "meta/meta-x11-errors.h"
#include "x11/meta-x11-display-private.h"
@@ -46,6 +47,7 @@ struct _MetaSurfaceActorX11
MetaDisplay *display;
CoglTexture *texture;
+ CoglTexture *texture_right;
Pixmap pixmap;
Damage damage;
@@ -61,6 +63,8 @@ struct _MetaSurfaceActorX11
guint size_changed : 1;
guint unredirected : 1;
+
+ guint stereo : 1;
};
G_DEFINE_TYPE (MetaSurfaceActorX11,
@@ -96,7 +100,7 @@ detach_pixmap (MetaSurfaceActorX11 *self)
* you are supposed to be able to free a GLXPixmap after freeing the underlying
* pixmap, but it certainly doesn't work with current DRI/Mesa
*/
- meta_shaped_texture_set_texture (stex, NULL);
+ meta_shaped_texture_set_textures (stex, NULL, NULL);
cogl_flush ();
meta_x11_error_trap_push (display->x11_display);
@@ -105,6 +109,7 @@ detach_pixmap (MetaSurfaceActorX11 *self)
meta_x11_error_trap_pop (display->x11_display);
g_clear_pointer (&self->texture, cogl_object_unref);
+ g_clear_pointer (&self->texture_right, cogl_object_unref);
}
static void
@@ -114,23 +119,37 @@ set_pixmap (MetaSurfaceActorX11 *self,
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
CoglError *error = NULL;
- CoglTexture *texture;
+ CoglTexturePixmapX11 *texture;
+ CoglTexturePixmapX11 *texture_right;
g_assert (self->pixmap == None);
self->pixmap = pixmap;
- texture = COGL_TEXTURE (cogl_texture_pixmap_x11_new (ctx, self->pixmap, FALSE, &error));
+ if (self->stereo)
+ texture = cogl_texture_pixmap_x11_new_left (ctx, pixmap, FALSE, &error);
+ else
+ texture = cogl_texture_pixmap_x11_new (ctx, pixmap, FALSE, &error);
+
+ if (self->stereo)
+ texture_right = cogl_texture_pixmap_x11_new_right (texture);
+ else
+ texture_right = NULL;
if (error != NULL)
{
g_warning ("Failed to allocate stex texture: %s", error->message);
cogl_error_free (error);
}
- else if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (COGL_TEXTURE_PIXMAP_X11 (texture))))
+ else if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (texture)))
g_warning ("NOTE: Not using GLX TFP!\n");
- self->texture = texture;
- meta_shaped_texture_set_texture (stex, texture);
+ self->texture = COGL_TEXTURE (texture);
+ if (self->stereo)
+ self->texture_right = COGL_TEXTURE (texture_right);
+
+ meta_shaped_texture_set_textures (stex,
+ COGL_TEXTURE (texture),
+ COGL_TEXTURE (texture_right));;
}
static void
@@ -419,8 +438,8 @@ reset_texture (MetaSurfaceActorX11 *self)
/* Setting the texture to NULL will cause all the FBO's cached by the
* shaped texture's MetaTextureTower to be discarded and recreated.
*/
- meta_shaped_texture_set_texture (stex, NULL);
- meta_shaped_texture_set_texture (stex, self->texture);
+ meta_shaped_texture_set_textures (stex, NULL, NULL);
+ meta_shaped_texture_set_textures (stex, self->texture, self->texture_right);
}
MetaSurfaceActor *
@@ -428,12 +447,17 @@ meta_surface_actor_x11_new (MetaWindow *window)
{
MetaSurfaceActorX11 *self = g_object_new (META_TYPE_SURFACE_ACTOR_X11, NULL);
MetaDisplay *display = meta_window_get_display (window);
+ Window xwindow;
g_assert (!meta_is_wayland_compositor ());
self->window = window;
self->display = display;
+ xwindow = meta_window_x11_get_toplevel_xwindow (window);
+ self->stereo = meta_compositor_window_is_stereo (display, xwindow);
+ meta_compositor_select_stereo_notify (display, xwindow);
+
g_signal_connect_object (self->display, "gl-video-memory-purged",
G_CALLBACK (reset_texture), self, G_CONNECT_SWAPPED);
@@ -463,3 +487,17 @@ meta_surface_actor_x11_set_size (MetaSurfaceActorX11 *self,
self->last_height = height;
meta_shaped_texture_set_fallback_size (stex, width, height);
}
+
+void
+meta_surface_actor_x11_stereo_notify (MetaSurfaceActorX11 *self,
+ gboolean stereo_tree)
+{
+ self->stereo = stereo_tree != FALSE;
+ detach_pixmap (self);
+}
+
+gboolean
+meta_surface_actor_x11_is_stereo (MetaSurfaceActorX11 *self)
+{
+ return self->stereo;
+}
diff --git a/src/compositor/meta-surface-actor-x11.h b/src/compositor/meta-surface-actor-x11.h
index 2c4ed4dd6..3bdd5fdb0 100644
--- a/src/compositor/meta-surface-actor-x11.h
+++ b/src/compositor/meta-surface-actor-x11.h
@@ -47,6 +47,11 @@ MetaSurfaceActor * meta_surface_actor_x11_new (MetaWindow *window);
void meta_surface_actor_x11_set_size (MetaSurfaceActorX11 *self,
int width, int height);
+void meta_surface_actor_x11_stereo_notify (MetaSurfaceActorX11 *self,
+ gboolean stereo_tree);
+
+gboolean meta_surface_actor_x11_is_stereo (MetaSurfaceActorX11 *self);
+
G_END_DECLS
#endif /* __META_SURFACE_ACTOR_X11_H__ */
diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h
index 6333f43db..9c1c12d09 100644
--- a/src/compositor/meta-window-actor-private.h
+++ b/src/compositor/meta-window-actor-private.h
@@ -76,4 +76,9 @@ MetaSurfaceActor *meta_window_actor_get_surface (MetaWindowActor *self);
void meta_window_actor_update_surface (MetaWindowActor *self);
MetaWindowActor *meta_window_actor_from_window (MetaWindow *window);
+void meta_window_actor_stereo_notify (MetaWindowActor *actor,
+ gboolean stereo_tree);
+
+gboolean meta_window_actor_is_stereo (MetaWindowActor *actor);
+
#endif /* META_WINDOW_ACTOR_PRIVATE_H */
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 1c8dc8fe5..11686d00b 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -2031,3 +2031,25 @@ screen_cast_window_iface_init (MetaScreenCastWindowInterface *iface)
iface->capture_into = meta_window_actor_capture_into;
iface->has_damage = meta_window_actor_has_damage;
}
+
+void
+meta_window_actor_stereo_notify (MetaWindowActor *self,
+ gboolean stereo_tree)
+{
+ MetaWindowActorPrivate *priv = meta_window_actor_get_instance_private (self);
+
+ if (META_IS_SURFACE_ACTOR_X11 (priv->surface))
+ meta_surface_actor_x11_stereo_notify (META_SURFACE_ACTOR_X11 (priv->surface),
+ stereo_tree);
+}
+
+gboolean
+meta_window_actor_is_stereo (MetaWindowActor *self)
+{
+ MetaWindowActorPrivate *priv = meta_window_actor_get_instance_private (self);
+
+ if (META_IS_SURFACE_ACTOR_X11 (priv->surface))
+ return meta_surface_actor_x11_is_stereo (META_SURFACE_ACTOR_X11 (priv->surface));
+ else
+ return FALSE;
+}
diff --git a/src/core/main.c b/src/core/main.c
index e8464720f..629f8e94e 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -81,6 +81,7 @@
#include "meta/meta-backend.h"
#include "meta/meta-x11-errors.h"
#include "meta/prefs.h"
+#include "stereo.h"
#include "ui/ui.h"
#include "x11/session.h"
@@ -589,6 +590,9 @@ meta_init (void)
meta_init_backend (backend_gtype);
+ if (!meta_is_wayland_compositor ())
+ meta_stereo_init ();
+
meta_clutter_init ();
#ifdef HAVE_WAYLAND
diff --git a/src/core/stereo.c b/src/core/stereo.c
new file mode 100644
index 000000000..817056527
--- /dev/null
+++ b/src/core/stereo.c
@@ -0,0 +1,154 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * SECTION:stereo
+ * @short_description: Keep track of whether we are a stereo compositor
+ *
+ * With GLX, we need to use a different GL context for stereo and
+ * non-stereo support. Support for multiple GL contexts is unfinished
+ * in Cogl and entirely lacking in Clutter, so it's by far easier
+ * to just restart Mutter when we detect a stereo window.
+ *
+ * A property _MUTTER_ENABLE_STEREO is maintained on the root window
+ * to know whether we should initialize clutter for stereo or not.
+ * When the presence or absence of stereo windows mismatches the
+ * stereo-enabled state for a sufficiently long period of time,
+ * we restart Mutter.
+ */
+
+#include <config.h>
+
+#include <clutter/x11/clutter-x11.h>
+#include <gio/gunixinputstream.h>
+#include <X11/Xatom.h>
+
+#include "display-private.h"
+#include <meta/main.h>
+#include <meta/meta-x11-display.h>
+#include <meta/util.h>
+#include "stereo.h"
+#include "ui/ui.h"
+#include "util-private.h"
+
+static guint stereo_switch_id = 0;
+static gboolean stereo_enabled = FALSE;
+/* -1 so the first time meta_stereo_set_have_stereo_windows() is called
+ * we avoid the short-circuit and set up a timeout to restart
+ * if necessary */
+static gboolean stereo_have_windows = (gboolean)-1;
+static gboolean stereo_restart = FALSE;
+
+#define STEREO_ENABLE_WAIT 1000
+#define STEREO_DISABLE_WAIT 5000
+
+void
+meta_stereo_init (void)
+{
+ Display *xdisplay;
+ Window root;
+ Atom atom_enable_stereo;
+ Atom type;
+ int format;
+ unsigned long n_items, bytes_after;
+ guchar *data;
+
+ xdisplay = XOpenDisplay (NULL);
+ if (xdisplay == NULL)
+ meta_fatal ("Unable to open X display %s\n", XDisplayName (NULL));
+
+ root = DefaultRootWindow (xdisplay);
+ atom_enable_stereo = XInternAtom (xdisplay, "_MUTTER_ENABLE_STEREO", False);
+
+ XGetWindowProperty (xdisplay, root, atom_enable_stereo,
+ 0, 1, False, XA_INTEGER,
+ &type, &format, &n_items, &bytes_after, &data);
+ if (type == XA_INTEGER)
+ {
+ if (format == 32 && n_items == 1 && bytes_after == 0)
+ {
+ stereo_enabled = *(long *)data;
+ }
+ else
+ {
+ meta_warning ("Bad value for _MUTTER_ENABLE_STEREO property\n");
+ }
+
+ XFree (data);
+ }
+ else if (type != None)
+ {
+ meta_warning ("Bad type for _MUTTER_ENABLE_STEREO property\n");
+ }
+
+ meta_verbose ("On startup, _MUTTER_ENABLE_STEREO=%s",
+ stereo_enabled ? "yes" : "no");
+ clutter_x11_set_use_stereo_stage (stereo_enabled);
+ XCloseDisplay (xdisplay);
+}
+
+static gboolean
+meta_stereo_switch (gpointer data)
+{
+ stereo_switch_id = 0;
+ stereo_restart = TRUE;
+
+ meta_restart (stereo_have_windows ?
+ _("Enabling stereo...") :
+ _("Disabling stereo..."));
+
+ return FALSE;
+}
+
+void
+meta_stereo_set_have_stereo_windows (gboolean have_windows)
+{
+ have_windows = have_windows != FALSE;
+
+ if (!stereo_restart && have_windows != stereo_have_windows)
+ {
+ MetaDisplay *display = meta_get_display ();
+ Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
+ Window root = DefaultRootWindow (xdisplay);
+ Atom atom_enable_stereo = XInternAtom (xdisplay, "_MUTTER_ENABLE_STEREO", False);
+ long value;
+
+ stereo_have_windows = have_windows;
+
+ if (stereo_have_windows)
+ meta_verbose ("Detected stereo windows\n");
+ else
+ meta_verbose ("No stereo windows detected\n");
+
+ value = stereo_have_windows;
+ XChangeProperty (xdisplay, root,
+ atom_enable_stereo, XA_INTEGER, 32,
+ PropModeReplace, (guchar *)&value, 1);
+
+ if (stereo_switch_id != 0)
+ {
+ g_source_remove (stereo_switch_id);
+ stereo_switch_id = 0;
+ }
+
+ if (stereo_have_windows != stereo_enabled)
+ stereo_switch_id = g_timeout_add (stereo_have_windows ? STEREO_ENABLE_WAIT : STEREO_DISABLE_WAIT,
+ meta_stereo_switch, NULL);
+ }
+}
diff --git a/src/core/stereo.h b/src/core/stereo.h
new file mode 100644
index 000000000..ccd1d702a
--- /dev/null
+++ b/src/core/stereo.h
@@ -0,0 +1,28 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef META_STEREO_H
+#define META_STEREO_H
+
+void meta_stereo_init (void);
+void meta_stereo_set_have_stereo_windows (gboolean have_windows);
+gboolean meta_stereo_is_restart (void);
+void meta_stereo_finish_restart (void);
+
+#endif
diff --git a/src/meson.build b/src/meson.build
index 9919b5cfb..7cced8f53 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -353,6 +353,8 @@ mutter_sources = [
'core/stack.h',
'core/stack-tracker.c',
'core/stack-tracker.h',
+ 'core/stereo.c',
+ 'core/stereo.h',
'core/startup-notification.c',
'core/startup-notification-private.h',
'core/util.c',
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index da0acfcbb..ddad1a45c 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -731,7 +731,7 @@ meta_wayland_surface_apply_pending_state (MetaWaylandSurface *surface,
snippet = meta_wayland_buffer_create_snippet (pending->buffer);
is_y_inverted = meta_wayland_buffer_is_y_inverted (pending->buffer);
- meta_shaped_texture_set_texture (stex, texture);
+ meta_shaped_texture_set_textures (stex, texture, NULL);
meta_shaped_texture_set_snippet (stex, snippet);
meta_shaped_texture_set_is_y_inverted (stex, is_y_inverted);
g_clear_pointer (&snippet, cogl_object_unref);
--
2.28.0

View File

@ -1,55 +0,0 @@
From 38d88d4e4286c3ada041561426873e44fdba3c40 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 17 Jan 2020 14:45:00 +0100
Subject: [PATCH] Create explicit WacomDevices for tablet "touchpad" devices
---
src/backends/meta-input-settings.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index 28dc387ef9..820a3b201e 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -521,27 +521,34 @@ static gboolean
device_is_tablet_touchpad (MetaInputSettings *input_settings,
ClutterInputDevice *device)
{
+ gboolean is_tablet = FALSE;
#ifdef HAVE_LIBWACOM
+ MetaInputSettingsPrivate *priv;
WacomIntegrationFlags flags = 0;
WacomDevice *wacom_device;
+ priv = meta_input_settings_get_instance_private (input_settings);
+
if (clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
return FALSE;
wacom_device =
- meta_input_settings_get_tablet_wacom_device (input_settings,
- device);
+ libwacom_new_from_path (priv->wacom_db,
+ clutter_input_device_get_device_node (device),
+ WFALLBACK_NONE, NULL);
if (wacom_device)
{
flags = libwacom_get_integration_flags (wacom_device);
if ((flags & (WACOM_DEVICE_INTEGRATED_SYSTEM |
WACOM_DEVICE_INTEGRATED_DISPLAY)) == 0)
- return TRUE;
+ is_tablet = TRUE;
+
+ libwacom_destroy (wacom_device);
}
#endif
- return FALSE;
+ return is_tablet;
}
static void
--
2.25.0.rc2

View File

@ -1,68 +0,0 @@
From abfc64268d4135663fb46c5f3529cd5f082a5c20 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Sun, 20 Oct 2019 12:04:31 +0200
Subject: [PATCH] EGL: Include EGL/eglmesaext.h
The eglext.h shipped by libglvnd does not include the Mesa extensions,
unlike the header shipped in Mesa.
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/876
---
cogl/cogl/meson.build | 2 +-
src/backends/meta-egl-ext.h | 1 +
src/backends/meta-egl.c | 1 +
src/backends/meta-egl.h | 1 +
4 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build
index cb940420a..8032669e4 100644
--- a/cogl/cogl/meson.build
+++ b/cogl/cogl/meson.build
@@ -48,7 +48,7 @@ cogl_gl_header_h = configure_file(
built_headers += [cogl_gl_header_h]
if have_egl
- cogl_egl_includes_string = '#include <EGL/egl.h>\n#include <EGL/eglext.h>'
+ cogl_egl_includes_string = '#include <EGL/egl.h>\n#include <EGL/eglext.h>\n#include <EGL/eglmesaext.h>'
else
cogl_egl_includes_string = ''
endif
diff --git a/src/backends/meta-egl-ext.h b/src/backends/meta-egl-ext.h
index 8705e7d5b..db0b74f76 100644
--- a/src/backends/meta-egl-ext.h
+++ b/src/backends/meta-egl-ext.h
@@ -29,6 +29,7 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
+#include <EGL/eglmesaext.h>
/*
* This is a little different to the tests shipped with EGL implementations,
diff --git a/src/backends/meta-egl.c b/src/backends/meta-egl.c
index 8b953449a..a28eef4ca 100644
--- a/src/backends/meta-egl.c
+++ b/src/backends/meta-egl.c
@@ -26,6 +26,7 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
+#include <EGL/eglmesaext.h>
#include <gio/gio.h>
#include <glib.h>
#include <glib-object.h>
diff --git a/src/backends/meta-egl.h b/src/backends/meta-egl.h
index ff37f124f..81b53b32d 100644
--- a/src/backends/meta-egl.h
+++ b/src/backends/meta-egl.h
@@ -27,6 +27,7 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
+#include <EGL/eglmesaext.h>
#include <glib-object.h>
#define META_EGL_ERROR meta_egl_error_quark ()
--
2.23.0

View File

@ -1,28 +0,0 @@
From d9d355bfd8ecfb7dcf65a3810ec30e12f12673ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 24 Feb 2020 16:09:59 +0100
Subject: [PATCH] Revert "MetaMonitorManager: ignore hotplug_mode_update at
startup"
This reverts commit 183f4b0c13f3dc9565bf5f693f2e5d61ca0199c9.
---
src/backends/meta-monitor-manager.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 076dca8cb..0adf2100d 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -527,8 +527,7 @@ meta_monitor_manager_has_hotplug_mode_update (MetaMonitorManager *manager)
static gboolean
should_use_stored_config (MetaMonitorManager *manager)
{
- return (manager->in_init ||
- !meta_monitor_manager_has_hotplug_mode_update (manager));
+ return !meta_monitor_manager_has_hotplug_mode_update (manager);
}
static gboolean
--
2.24.1

View File

@ -0,0 +1,26 @@
From 3899a01cd6cb00ca686946d3065d58f59f5c2099 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Tue, 17 Nov 2020 14:00:02 +0100
Subject: [PATCH] Revert "build: Do not provide built sources as libmutter_dep
sources"
This reverts commit 4e9a2e479969973bf3063c740ceff149036b3af4.
---
src/meson.build | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/meson.build b/src/meson.build
index e7c99caee..8fe484ec2 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -955,6 +955,7 @@ libmutter = shared_library(libmutter_name,
libmutter_dep = declare_dependency(
link_with: libmutter,
include_directories: mutter_includes,
+ sources: mutter_built_sources,
dependencies: [
libmutter_cogl_dep,
libmutter_clutter_dep,
--
2.28.0

View File

@ -1,94 +0,0 @@
From dafc9cb414fd47112b972d34c205e73797a3c1c1 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 21 Feb 2020 16:45:35 +0100
Subject: [PATCH] Skip wacom touchpads when updating setting
---
src/backends/meta-input-settings.c | 46 +++++++++++++++++++++++-------
1 file changed, 36 insertions(+), 10 deletions(-)
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index cdff7b346..7d866594a 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -569,20 +569,33 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
- enabled = device_is_tablet_touchpad (input_settings, device) ||
- g_settings_get_boolean (priv->touchpad_settings, "tap-to-click");
if (device)
{
+ enabled = device_is_tablet_touchpad (input_settings, device) ||
+ g_settings_get_boolean (priv->touchpad_settings, "tap-to-click");
settings_device_set_bool_setting (input_settings, device,
input_settings_class->set_tap_enabled,
enabled);
}
else
{
- settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
- input_settings_class->set_tap_enabled,
- enabled);
+ const GSList *devices, *l;
+
+ devices = clutter_device_manager_peek_devices (priv->device_manager);
+ for (l = devices; l; l = l->next)
+ {
+ device = l->data;
+
+ if (clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
+ continue;
+
+ enabled = device_is_tablet_touchpad (input_settings, device) ||
+ g_settings_get_boolean (priv->touchpad_settings, "tap-to-click");
+ settings_device_set_bool_setting (input_settings, device,
+ input_settings_class->set_tap_enabled,
+ enabled);
+ }
}
}
@@ -600,20 +613,33 @@ update_touchpad_tap_and_drag_enabled (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
- enabled = device_is_tablet_touchpad (input_settings, device) ||
- g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag");
if (device)
{
+ enabled = device_is_tablet_touchpad (input_settings, device) ||
+ g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag");
settings_device_set_bool_setting (input_settings, device,
input_settings_class->set_tap_and_drag_enabled,
enabled);
}
else
{
- settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
- input_settings_class->set_tap_and_drag_enabled,
- enabled);
+ const GSList *devices, *l;
+
+ devices = clutter_device_manager_peek_devices (priv->device_manager);
+ for (l = devices; l; l = l->next)
+ {
+ device = l->data;
+
+ if (clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
+ continue;
+
+ enabled = device_is_tablet_touchpad (input_settings, device) ||
+ g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag");
+ settings_device_set_bool_setting (input_settings, device,
+ input_settings_class->set_tap_and_drag_enabled,
+ enabled);
+ }
}
}
--
2.24.1

View File

@ -0,0 +1,35 @@
From 9d0ded3178777cd6afcdd5fff7b6f0f39a0d5236 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Tue, 9 Mar 2021 17:21:59 -0800
Subject: [PATCH] Test: deny atomic KMS for "tegra" (RHBZ #1936991)
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
data/61-mutter.rules | 1 +
src/backends/native/meta-kms-device.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/data/61-mutter.rules b/data/61-mutter.rules
index edc03e6c1..d8e3c5f00 100644
--- a/data/61-mutter.rules
+++ b/data/61-mutter.rules
@@ -3,3 +3,4 @@ DRIVERS=="nouveau", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"
DRIVERS=="amdgpu", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"
DRIVERS=="radeon", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"
ENV{ID_PATH}=="platform-vkms", TAG+="mutter-device-ignore"
+DRIVER=="tegra", SUBSYSTEM=="platform", TAG+="mutter-device-disable-atomic-kms"
diff --git a/src/backends/native/meta-kms-device.c b/src/backends/native/meta-kms-device.c
index 85aded9a6..e749ab6b9 100644
--- a/src/backends/native/meta-kms-device.c
+++ b/src/backends/native/meta-kms-device.c
@@ -253,6 +253,7 @@ is_atomic_allowed (const char *driver_name)
"vboxvideo",
"nvidia-drm",
"virtio_gpu",
+ "tegra",
NULL,
};
--
2.32.0

View File

@ -1,49 +0,0 @@
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,92 @@
From ff4dc8cc8274dc5f6ed11515e05a341e4e2cec28 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 12 Aug 2021 14:13:23 -0400
Subject: [PATCH] backend: Clean up renderer after clutter backendm
commit c4a73e795020722eda3e2bec0c16d96f9f37333b added
code to cleanup the renderer when the meta backend is
disposed. Unfortunately, this introduced a crash when
the window manager is replaced.
This is because cleaning up the renderer involves talking
to the X server over a display connection that's closed
two lines higher as part of the clutter_backend_destroy
call.
This commit fixes the crash by swapping their order.
---
src/backends/meta-backend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index ff84bfe6a..7e8b4ee95 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -216,63 +216,63 @@ meta_backend_dispose (GObject *object)
if (priv->sleep_signal_id)
{
g_dbus_connection_signal_unsubscribe (priv->system_bus, priv->sleep_signal_id);
priv->sleep_signal_id = 0;
}
if (priv->upower_watch_id)
{
g_bus_unwatch_name (priv->upower_watch_id);
priv->upower_watch_id = 0;
}
g_cancellable_cancel (priv->cancellable);
g_clear_object (&priv->cancellable);
g_clear_object (&priv->system_bus);
g_clear_object (&priv->upower_proxy);
g_clear_handle_id (&priv->device_update_idle_id, g_source_remove);
g_clear_pointer (&priv->device_monitors, g_hash_table_destroy);
g_clear_object (&priv->settings);
#ifdef HAVE_PROFILER
g_clear_object (&priv->profiler);
#endif
g_clear_pointer (&priv->default_seat, clutter_seat_destroy);
g_clear_pointer (&priv->stage, clutter_actor_destroy);
- g_clear_pointer (&priv->clutter_backend, clutter_backend_destroy);
g_clear_object (&priv->renderer);
g_clear_list (&priv->gpus, g_object_unref);
+ g_clear_pointer (&priv->clutter_backend, clutter_backend_destroy);
G_OBJECT_CLASS (meta_backend_parent_class)->dispose (object);
}
static void
meta_backend_destroy (MetaBackend *backend)
{
g_object_run_dispose (G_OBJECT (backend));
g_object_unref (backend);
}
static void
meta_backend_sync_screen_size (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
int width, height;
meta_monitor_manager_get_screen_size (priv->monitor_manager, &width, &height);
META_BACKEND_GET_CLASS (backend)->update_screen_size (backend, width, height);
}
static void
reset_pointer_position (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
MetaMonitorManager *monitor_manager = priv->monitor_manager;
ClutterSeat *seat = clutter_backend_get_default_seat (priv->clutter_backend);
MetaLogicalMonitor *primary;
--
2.31.1

View File

@ -1,80 +0,0 @@
From eeff82f534f81b086d10d53124362d9e316e2cf9 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 12 Dec 2019 18:05:08 +0100
Subject: [PATCH] backends: Always enable tap-to-click/drag on opaque Wacom
tablets
Touch-wise, those are essentially giant touchpads, but have no buttons
associated to the "touchpad" device (There may be pad buttons, but
those are not mouse buttons).
Without tap-to-click/drag, touch in those devices is somewhat useless
out of the box. Have them always enable these features, despite the
setting.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/968
---
src/backends/meta-input-settings.c | 33 ++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index 2e6672d9c..28dc387ef 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -517,6 +517,33 @@ update_touchpad_disable_while_typing (MetaInputSettings *input_settings,
}
}
+static gboolean
+device_is_tablet_touchpad (MetaInputSettings *input_settings,
+ ClutterInputDevice *device)
+{
+#ifdef HAVE_LIBWACOM
+ WacomIntegrationFlags flags = 0;
+ WacomDevice *wacom_device;
+
+ if (clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
+ return FALSE;
+
+ wacom_device =
+ meta_input_settings_get_tablet_wacom_device (input_settings,
+ device);
+ if (wacom_device)
+ {
+ flags = libwacom_get_integration_flags (wacom_device);
+
+ if ((flags & (WACOM_DEVICE_INTEGRATED_SYSTEM |
+ WACOM_DEVICE_INTEGRATED_DISPLAY)) == 0)
+ return TRUE;
+ }
+#endif
+
+ return FALSE;
+}
+
static void
update_touchpad_tap_enabled (MetaInputSettings *input_settings,
ClutterInputDevice *device)
@@ -531,7 +558,8 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
- enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-to-click");
+ enabled = device_is_tablet_touchpad (input_settings, device) ||
+ g_settings_get_boolean (priv->touchpad_settings, "tap-to-click");
if (device)
{
@@ -561,7 +589,8 @@ update_touchpad_tap_and_drag_enabled (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
- enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag");
+ enabled = device_is_tablet_touchpad (input_settings, device) ||
+ g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag");
if (device)
{
--
2.23.0

View File

@ -1,205 +0,0 @@
From 20fcc3e045287c1ca591f3e795b19e120479a89a Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 12 Feb 2020 20:26:56 +0100
Subject: [PATCH 1/2] backends/x11: Implement is_grouped for X11
If the devices have a wacom description, compare those. Otherwise,
look up the devices' VID:PID, if they match they should also be
grouped.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/971
---
.../clutter/x11/clutter-input-device-xi2.c | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/clutter/clutter/x11/clutter-input-device-xi2.c b/clutter/clutter/x11/clutter-input-device-xi2.c
index ae2fa27..9eca34d 100644
--- a/clutter/clutter/x11/clutter-input-device-xi2.c
+++ b/clutter/clutter/x11/clutter-input-device-xi2.c
@@ -98,6 +98,31 @@ static gboolean
clutter_input_device_xi2_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device)
{
+#ifdef HAVE_LIBWACOM
+ ClutterInputDeviceXI2 *device_x11 = CLUTTER_INPUT_DEVICE_XI2 (device);
+ ClutterInputDeviceXI2 *other_device_x11 = CLUTTER_INPUT_DEVICE_XI2 (other_device);
+
+ if (device_x11->wacom_device &&
+ other_device_x11->wacom_device &&
+ libwacom_compare (device_x11->wacom_device,
+ other_device_x11->wacom_device,
+ WCOMPARE_NORMAL) == 0)
+ return TRUE;
+#endif
+
+ /* Devices with the same VID:PID get grouped together */
+ if (clutter_input_device_get_vendor_id (device) &&
+ clutter_input_device_get_product_id (device) &&
+ clutter_input_device_get_vendor_id (other_device) &&
+ clutter_input_device_get_product_id (other_device))
+ {
+ if (strcmp (clutter_input_device_get_vendor_id (device),
+ clutter_input_device_get_vendor_id (other_device)) == 0 &&
+ strcmp (clutter_input_device_get_product_id (device),
+ clutter_input_device_get_product_id (other_device)) == 0)
+ return TRUE;
+ }
+
return FALSE;
}
--
2.24.1
From 5914ab9ac79ce42da054036c4a8f118a3a868cc0 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 13 Dec 2019 15:26:05 +0100
Subject: [PATCH 2/2] backends: Check both input settings and mapper for tablet
monitors
The upper layers (OSDs basically) want to know the monitor that a
tablet is currently assigned to, not the monitor just as configured
through settings.
This broke proper OSD positioning for display-attached tablets since
commit 87858a4e01d9, as the MetaInputMapper kicks in precisely when
there is no configured monitor for the given device.
Consulting both about the assigned output will make OSDs pop up
again in the right place.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/971
---
src/backends/meta-input-mapper-private.h | 3 ++
src/backends/meta-input-mapper.c | 26 ++++++++++++
src/backends/meta-input-settings.c | 54 +++++++++++++++++++++++-
3 files changed, 81 insertions(+), 2 deletions(-)
diff --git a/src/backends/meta-input-mapper-private.h b/src/backends/meta-input-mapper-private.h
index 3431457..cdfdccd 100644
--- a/src/backends/meta-input-mapper-private.h
+++ b/src/backends/meta-input-mapper-private.h
@@ -42,5 +42,8 @@ ClutterInputDevice *
meta_input_mapper_get_logical_monitor_device (MetaInputMapper *mapper,
MetaLogicalMonitor *logical_monitor,
ClutterInputDeviceType device_type);
+MetaLogicalMonitor *
+meta_input_mapper_get_device_logical_monitor (MetaInputMapper *mapper,
+ ClutterInputDevice *device);
#endif /* META_INPUT_MAPPER_H */
diff --git a/src/backends/meta-input-mapper.c b/src/backends/meta-input-mapper.c
index fc4f3bd..fe02ab8 100644
--- a/src/backends/meta-input-mapper.c
+++ b/src/backends/meta-input-mapper.c
@@ -675,3 +675,29 @@ meta_input_mapper_get_logical_monitor_device (MetaInputMapper *mapper,
return NULL;
}
+
+MetaLogicalMonitor *
+meta_input_mapper_get_device_logical_monitor (MetaInputMapper *mapper,
+ ClutterInputDevice *device)
+{
+ MetaMapperOutputInfo *output;
+ MetaLogicalMonitor *logical_monitor;
+ GHashTableIter iter;
+ GList *l;
+
+ g_hash_table_iter_init (&iter, mapper->output_devices);
+
+ while (g_hash_table_iter_next (&iter, (gpointer *) &logical_monitor,
+ (gpointer *) &output))
+ {
+ for (l = output->input_devices; l; l = l->next)
+ {
+ MetaMapperInputInfo *input = l->data;
+
+ if (input->device == device)
+ return logical_monitor;
+ }
+ }
+
+ return NULL;
+}
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index b84595e..ab80bee 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -1937,6 +1937,42 @@ meta_input_settings_get_tablet_settings (MetaInputSettings *settings,
return info ? g_object_ref (info->settings) : NULL;
}
+static ClutterInputDevice *
+find_grouped_pen (MetaInputSettings *settings,
+ ClutterInputDevice *device)
+{
+ MetaInputSettingsPrivate *priv;
+ GSList *l, *devices;
+ ClutterInputDeviceType device_type;
+ ClutterInputDevice *pen = NULL;
+
+ device_type = clutter_input_device_get_device_type (device);
+
+ if (device_type == CLUTTER_TABLET_DEVICE ||
+ device_type == CLUTTER_PEN_DEVICE)
+ return device;
+
+ priv = meta_input_settings_get_instance_private (settings);
+ devices = clutter_device_manager_peek_devices (priv->device_manager);
+
+ for (l = devices; l; l = l->next)
+ {
+ ClutterInputDevice *device = l->data;
+
+ device_type = clutter_input_device_get_device_type (l->data);
+
+ if ((device_type == CLUTTER_TABLET_DEVICE ||
+ device_type == CLUTTER_PEN_DEVICE) &&
+ clutter_input_device_is_grouped (device, l->data))
+ {
+ pen = l->data;
+ break;
+ }
+ }
+
+ return pen;
+}
+
MetaLogicalMonitor *
meta_input_settings_get_tablet_logical_monitor (MetaInputSettings *settings,
ClutterInputDevice *device)
@@ -1948,13 +1984,27 @@ meta_input_settings_get_tablet_logical_monitor (MetaInputSettings *settings,
g_return_val_if_fail (META_IS_INPUT_SETTINGS (settings), NULL);
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
+ if (clutter_input_device_get_device_type (device) == CLUTTER_PAD_DEVICE)
+ {
+ device = find_grouped_pen (settings, device);
+ if (!device)
+ return NULL;
+ }
+
priv = meta_input_settings_get_instance_private (settings);
info = g_hash_table_lookup (priv->mappable_devices, device);
if (!info)
return NULL;
- meta_input_settings_find_monitor (settings, info->settings, device,
- NULL, &logical_monitor);
+ logical_monitor =
+ meta_input_mapper_get_device_logical_monitor (priv->input_mapper, device);
+
+ if (!logical_monitor)
+ {
+ meta_input_settings_find_monitor (settings, info->settings, device,
+ NULL, &logical_monitor);
+ }
+
return logical_monitor;
}
--
2.24.1

View File

@ -1,30 +0,0 @@
From e512c397a640994807f239c570333e9942717ef5 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 13 Dec 2019 17:01:44 +0100
Subject: [PATCH] backends: Consider pen/eraser devices when looking for
matching WacomDevice
Those device types are still in use through the X11 backend, breaking some
checks around on that backend...
https://gitlab.gnome.org/GNOME/mutter/merge_requests/972
---
src/backends/meta-input-settings.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index 2e6672d9c..18ae52dd7 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -1589,6 +1589,8 @@ check_add_mappable_device (MetaInputSettings *input_settings,
#ifdef HAVE_LIBWACOM
if (device_type == CLUTTER_TABLET_DEVICE ||
+ device_type == CLUTTER_PEN_DEVICE ||
+ device_type == CLUTTER_ERASER_DEVICE ||
device_type == CLUTTER_PAD_DEVICE)
{
WacomError *error = libwacom_error_new ();
--
2.23.0

View File

@ -0,0 +1,260 @@
From a1f33bdac95ba4fd0599f164ef893c05d8be123b Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 6 Oct 2021 15:31:30 -0400
Subject: [PATCH] backends/x11: Fix key repeat of on-screen keyboard for second
level keysyms
Certains keys (such as ~ and |) are in the keyboard map behind the
second shift level. This means in order for them to be input, the
shift key needs to be held down by the user.
The GNOME Shell on-screen keyboard presents these keys separately on
a page of keys that has no shift key. Instead, it relies on mutter
to set a shift latch before the key event is emitted. A shift latch
is a virtual press of the shift key that automatically gets released
after the next key press (in our case the ~ or | key).
The problem is using a shift latch doesn't work very well in the face
of key repeat. The latch is automatically released after the first
press, and subsequent repeats of that press no longer have shift
latched to them.
This commit fixes the problem by using a shift lock instead of a shift
latch. A shift lock is never implicitly released, so it remains
in place for the duration of key repeat.
---
src/backends/x11/meta-keymap-x11.c | 12 ++++++------
src/backends/x11/meta-keymap-x11.h | 6 +++---
src/backends/x11/meta-virtual-input-device-x11.c | 4 ++--
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/backends/x11/meta-keymap-x11.c b/src/backends/x11/meta-keymap-x11.c
index da5d064e7..1192cc387 100644
--- a/src/backends/x11/meta-keymap-x11.c
+++ b/src/backends/x11/meta-keymap-x11.c
@@ -829,85 +829,85 @@ meta_keymap_x11_reserve_keycode (MetaKeymapX11 *keymap_x11,
g_warning ("Cannot reserve a keycode for keyval %d: no available keycode", keyval);
return FALSE;
}
if (!meta_keymap_x11_replace_keycode (keymap_x11, *keycode_out, keyval))
{
g_warning ("Failed to remap keycode %d to keyval %d", *keycode_out, keyval);
return FALSE;
}
g_hash_table_insert (keymap_x11->reserved_keycodes, GUINT_TO_POINTER (*keycode_out), GUINT_TO_POINTER (keyval));
g_queue_remove (keymap_x11->available_keycodes, GUINT_TO_POINTER (*keycode_out));
return TRUE;
}
void
meta_keymap_x11_release_keycode_if_needed (MetaKeymapX11 *keymap_x11,
uint32_t keycode)
{
g_return_if_fail (META_IS_KEYMAP_X11 (keymap_x11));
if (!g_hash_table_contains (keymap_x11->reserved_keycodes, GUINT_TO_POINTER (keycode)) ||
g_queue_index (keymap_x11->available_keycodes, GUINT_TO_POINTER (keycode)) != -1)
return;
g_queue_push_tail (keymap_x11->available_keycodes, GUINT_TO_POINTER (keycode));
}
void
-meta_keymap_x11_latch_modifiers (MetaKeymapX11 *keymap_x11,
- uint32_t level,
- gboolean enable)
+meta_keymap_x11_lock_modifiers (MetaKeymapX11 *keymap_x11,
+ uint32_t level,
+ gboolean enable)
{
uint32_t modifiers[] = {
0,
ShiftMask,
keymap_x11->level3_shift_mask,
keymap_x11->level3_shift_mask | ShiftMask,
};
uint32_t value = 0;
if (!keymap_x11->use_xkb)
return;
level = CLAMP (level, 0, G_N_ELEMENTS (modifiers) - 1);
if (enable)
value = modifiers[level];
else
value = 0;
- XkbLatchModifiers (clutter_x11_get_default_display (),
- XkbUseCoreKbd, modifiers[level],
- value);
+ XkbLockModifiers (clutter_x11_get_default_display (),
+ XkbUseCoreKbd, modifiers[level],
+ value);
}
static uint32_t
meta_keymap_x11_get_current_group (MetaKeymapX11 *keymap_x11)
{
XkbStateRec state_rec;
if (keymap_x11->current_group >= 0)
return keymap_x11->current_group;
XkbGetState (clutter_x11_get_default_display (),
XkbUseCoreKbd, &state_rec);
return XkbStateGroup (&state_rec);
}
gboolean
meta_keymap_x11_keycode_for_keyval (MetaKeymapX11 *keymap_x11,
uint32_t keyval,
uint32_t *keycode_out,
uint32_t *level_out)
{
ClutterKeymapKey *keys;
int i, n_keys, group;
gboolean found = FALSE;
g_return_val_if_fail (keycode_out != NULL, FALSE);
g_return_val_if_fail (level_out != NULL, FALSE);
group = meta_keymap_x11_get_current_group (keymap_x11);
diff --git a/src/backends/x11/meta-keymap-x11.h b/src/backends/x11/meta-keymap-x11.h
index 67a5f8eb9..2f93acdbc 100644
--- a/src/backends/x11/meta-keymap-x11.h
+++ b/src/backends/x11/meta-keymap-x11.h
@@ -17,45 +17,45 @@
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#ifndef META_KEYMAP_X11_H
#define META_KEYMAP_X11_H
#include <glib-object.h>
#include <pango/pango.h>
#include "clutter/clutter.h"
G_BEGIN_DECLS
#define META_TYPE_KEYMAP_X11 (meta_keymap_x11_get_type ())
G_DECLARE_FINAL_TYPE (MetaKeymapX11, meta_keymap_x11,
META, KEYMAP_X11, ClutterKeymap)
int meta_keymap_x11_get_key_group (MetaKeymapX11 *keymap,
ClutterModifierType state);
int meta_keymap_x11_translate_key_state (MetaKeymapX11 *keymap,
guint hardware_keycode,
ClutterModifierType *modifier_state_p,
ClutterModifierType *mods_p);
gboolean meta_keymap_x11_get_is_modifier (MetaKeymapX11 *keymap,
int keycode);
gboolean meta_keymap_x11_keycode_for_keyval (MetaKeymapX11 *keymap_x11,
guint keyval,
guint *keycode_out,
guint *level_out);
-void meta_keymap_x11_latch_modifiers (MetaKeymapX11 *keymap_x11,
- uint32_t level,
- gboolean enable);
+void meta_keymap_x11_lock_modifiers (MetaKeymapX11 *keymap_x11,
+ uint32_t level,
+ gboolean enable);
gboolean meta_keymap_x11_reserve_keycode (MetaKeymapX11 *keymap_x11,
guint keyval,
guint *keycode_out);
void meta_keymap_x11_release_keycode_if_needed (MetaKeymapX11 *keymap_x11,
guint keycode);
gboolean meta_keymap_x11_handle_event (MetaKeymapX11 *keymap_x11,
XEvent *xevent);
G_END_DECLS
#endif /* META_KEYMAP_X11_H */
diff --git a/src/backends/x11/meta-virtual-input-device-x11.c b/src/backends/x11/meta-virtual-input-device-x11.c
index fe6040859..1a5cdfc2e 100644
--- a/src/backends/x11/meta-virtual-input-device-x11.c
+++ b/src/backends/x11/meta-virtual-input-device-x11.c
@@ -159,71 +159,71 @@ meta_virtual_input_device_x11_notify_key (ClutterVirtualInputDevice *virtual_dev
ClutterKeyState key_state)
{
XTestFakeKeyEvent (clutter_x11_get_default_display (),
key + 8, key_state == CLUTTER_KEY_STATE_PRESSED, 0);
}
static void
meta_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t keyval,
ClutterKeyState key_state)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterSeat *seat = clutter_backend_get_default_seat (backend);
MetaKeymapX11 *keymap = META_KEYMAP_X11 (clutter_seat_get_keymap (seat));
uint32_t keycode, level;
if (!meta_keymap_x11_keycode_for_keyval (keymap, keyval, &keycode, &level))
{
level = 0;
if (!meta_keymap_x11_reserve_keycode (keymap, keyval, &keycode))
{
g_warning ("No keycode found for keyval %x in current group", keyval);
return;
}
}
if (!meta_keymap_x11_get_is_modifier (keymap, keycode) &&
key_state == CLUTTER_KEY_STATE_PRESSED)
- meta_keymap_x11_latch_modifiers (keymap, level, TRUE);
+ meta_keymap_x11_lock_modifiers (keymap, level, TRUE);
XTestFakeKeyEvent (clutter_x11_get_default_display (),
(KeyCode) keycode,
key_state == CLUTTER_KEY_STATE_PRESSED, 0);
if (key_state == CLUTTER_KEY_STATE_RELEASED)
{
if (!meta_keymap_x11_get_is_modifier (keymap, keycode))
- meta_keymap_x11_latch_modifiers (keymap, level, FALSE);
+ meta_keymap_x11_lock_modifiers (keymap, level, FALSE);
meta_keymap_x11_release_keycode_if_needed (keymap, keycode);
}
}
static void
meta_virtual_input_device_x11_notify_touch_down (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
int device_slot,
double x,
double y)
{
g_warning ("Virtual touch motion not implemented under X11");
}
static void
meta_virtual_input_device_x11_notify_touch_motion (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
int device_slot,
double x,
double y)
{
g_warning ("Virtual touch motion not implemented under X11");
}
static void
meta_virtual_input_device_x11_notify_touch_up (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
int device_slot)
{
g_warning ("Virtual touch motion not implemented under X11");
--
2.33.1

View File

@ -1,118 +0,0 @@
From a8f12e7afdb35ebda581cee6a32b295cb6e643ec Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 13 Dec 2019 14:22:12 +0100
Subject: [PATCH] backends/x11: Observe multiple pad mode switch buttons in a
group
Some tablets like the Cintiq 24HDT have several mode switch buttons
per group. Those are meant to jump straight to a given mode, however
we just handle cycling across modes (as most other tablets have a
single mode switch button per group).
So spice up the mode switch handling so we handle multiple mode
switch buttons, assigning each of them a mode. If the device only
has one mode switch button, we do the old-fashioned cycling.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/970
---
.../clutter/x11/clutter-input-device-xi2.c | 71 ++++++++++++++++---
1 file changed, 60 insertions(+), 11 deletions(-)
diff --git a/clutter/clutter/x11/clutter-input-device-xi2.c b/clutter/clutter/x11/clutter-input-device-xi2.c
index 1254aca3a..c33adffc2 100644
--- a/clutter/clutter/x11/clutter-input-device-xi2.c
+++ b/clutter/clutter/x11/clutter-input-device-xi2.c
@@ -318,6 +318,57 @@ clutter_input_device_xi2_get_pad_group_mode (ClutterInputDevice *device,
return g_array_index (device_xi2->group_modes, guint, group);
}
+static gboolean
+pad_switch_mode (ClutterInputDevice *device,
+ uint32_t button,
+ uint32_t group,
+ uint32_t *mode)
+{
+ ClutterInputDeviceXI2 *device_x11 = CLUTTER_INPUT_DEVICE_XI2 (device);
+ uint32_t n_buttons, n_modes, button_group, next_mode, i;
+ GList *switch_buttons = NULL;
+
+ n_buttons = libwacom_get_num_buttons (device_x11->wacom_device);
+
+ for (i = 0; i < n_buttons; i++)
+ {
+ button_group = clutter_input_device_xi2_get_button_group (device, i);
+ if (button_group == group)
+ switch_buttons = g_list_prepend (switch_buttons, GINT_TO_POINTER (i));
+ }
+
+ switch_buttons = g_list_reverse (switch_buttons);
+ n_modes = clutter_input_device_get_group_n_modes (device, group);
+
+ if (g_list_length (switch_buttons) > 1)
+ {
+ /* If there's multiple switch buttons, we don't toggle but assign a mode
+ * to each of those buttons.
+ */
+ next_mode = g_list_index (switch_buttons, GINT_TO_POINTER (button));
+ }
+ else if (switch_buttons)
+ {
+ uint32_t cur_mode;
+
+ /* If there is a single button, have it toggle across modes */
+ cur_mode = g_array_index (device_x11->group_modes, uint32_t, group);
+ next_mode = (cur_mode + 1) % n_modes;
+ }
+ else
+ {
+ return FALSE;
+ }
+
+ g_list_free (switch_buttons);
+
+ if (next_mode < 0 || next_mode > n_modes)
+ return FALSE;
+
+ *mode = next_mode;
+ return TRUE;
+}
+
void
clutter_input_device_xi2_update_pad_state (ClutterInputDevice *device,
guint button,
@@ -330,23 +381,21 @@ clutter_input_device_xi2_update_pad_state (ClutterInputDevice *device,
gboolean is_mode_switch = FALSE;
button_group = clutter_input_device_xi2_get_button_group (device, button);
- is_mode_switch = button_group >= 0;
- /* Assign all non-mode-switch buttons to group 0 so far */
- button_group = MAX (0, button_group);
-
- if (button_group >= device_xi2->group_modes->len)
- return;
+ if (button_group < 0 || button_group >= device_xi2->group_modes->len)
+ {
+ *group = *mode = 0;
+ return;
+ }
group_mode = &g_array_index (device_xi2->group_modes, guint, button_group);
- if (is_mode_switch && state)
+ if (state)
{
- guint next, n_modes;
+ uint32_t next_mode;
- n_modes = clutter_input_device_get_group_n_modes (device, button_group);
- next = (*group_mode + 1) % n_modes;
- *group_mode = next;
+ if (pad_switch_mode (device, button, button_group, &next_mode))
+ *group_mode = next_mode;
}
if (group)
--
2.23.0

View File

@ -1,348 +0,0 @@
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
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 | 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..b2f5ca060 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -26,6 +26,7 @@
#include "backends/x11/meta-input-settings-x11.h"
#include <gdk/gdkx.h>
+#include <stdlib.h>
#include <string.h>
#include <X11/Xatom.h>
#include <X11/extensions/XInput2.h>
@@ -162,6 +163,179 @@ change_property (ClutterInputDevice *device,
meta_XFree (data_ret);
}
+static gboolean
+is_device_synaptics (ClutterInputDevice *device)
+{
+ guchar *has_setting;
+
+ /* We just need looking for a synaptics-specific property */
+ has_setting = get_property (device, "Synaptics Off", XA_INTEGER, 8, 1);
+ if (!has_setting)
+ return FALSE;
+
+ meta_XFree (has_setting);
+ return TRUE;
+}
+
+static void
+change_synaptics_tap_left_handed (ClutterInputDevice *device,
+ gboolean tap_enabled,
+ gboolean left_handed)
+{
+ MetaDisplay *display = meta_get_display ();
+ MetaBackend *backend = meta_get_backend ();
+ Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
+ XDevice *xdevice;
+ guchar *tap_action, *buttons;
+ guint buttons_capacity = 16, n_buttons;
+
+ xdevice = XOpenDevice(xdisplay, clutter_input_device_get_device_id (device));
+ if (!xdevice)
+ return;
+
+ tap_action = get_property (device, "Synaptics Tap Action",
+ XA_INTEGER, 8, 7);
+ if (!tap_action)
+ goto out;
+
+ tap_action[4] = tap_enabled ? (left_handed ? 3 : 1) : 0;
+ tap_action[5] = tap_enabled ? (left_handed ? 1 : 3) : 0;
+ tap_action[6] = tap_enabled ? 2 : 0;
+
+ change_property (device, "Synaptics Tap Action",
+ XA_INTEGER, 8, tap_action, 7);
+ meta_XFree (tap_action);
+
+ clutter_x11_trap_x_errors();
+ buttons = g_new (guchar, buttons_capacity);
+ n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice,
+ buttons, buttons_capacity);
+
+ while (n_buttons > buttons_capacity)
+ {
+ buttons_capacity = n_buttons;
+ buttons = (guchar *) g_realloc (buttons,
+ buttons_capacity * sizeof (guchar));
+
+ n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice,
+ buttons, buttons_capacity);
+ }
+
+ buttons[0] = left_handed ? 3 : 1;
+ buttons[2] = left_handed ? 1 : 3;
+ XSetDeviceButtonMapping (xdisplay, xdevice, buttons, n_buttons);
+ g_free (buttons);
+
+ if (clutter_x11_untrap_x_errors())
+ {
+ g_warning ("Could not set synaptics touchpad left-handed for %s",
+ clutter_input_device_get_device_name (device));
+ }
+
+ out:
+ XCloseDevice (xdisplay, xdevice);
+}
+
+static void
+change_synaptics_speed (ClutterInputDevice *device,
+ gdouble speed)
+{
+ MetaDisplay *display = meta_get_display ();
+ MetaBackend *backend = meta_get_backend ();
+ Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
+ XDevice *xdevice;
+ XPtrFeedbackControl feedback;
+ XFeedbackState *states, *state;
+ int i, num_feedbacks, motion_threshold, numerator, denominator;
+ gfloat motion_acceleration;
+
+ xdevice = XOpenDevice(xdisplay, clutter_input_device_get_device_id (device));
+ 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;
+
+ /* Calculate acceleration and threshold */
+ motion_acceleration = (speed + 1) * 5; /* speed is [-1..1], map to [0..10] */
+ motion_threshold = CLAMP (10 - floor (motion_acceleration), 1, 10);
+
+ if (motion_acceleration >= 1.0)
+ {
+ /* we want to get the acceleration, with a resolution of 0.5
+ */
+ if ((motion_acceleration - floor (motion_acceleration)) < 0.25)
+ {
+ numerator = floor (motion_acceleration);
+ denominator = 1;
+ }
+ else if ((motion_acceleration - floor (motion_acceleration)) < 0.5)
+ {
+ numerator = ceil (2.0 * motion_acceleration);
+ denominator = 2;
+ }
+ else if ((motion_acceleration - floor (motion_acceleration)) < 0.75)
+ {
+ numerator = floor (2.0 *motion_acceleration);
+ denominator = 2;
+ }
+ else
+ {
+ numerator = ceil (motion_acceleration);
+ denominator = 1;
+ }
+ }
+ else if (motion_acceleration < 1.0 && motion_acceleration > 0)
+ {
+ /* This we do to 1/10ths */
+ numerator = floor (motion_acceleration * 10) + 1;
+ denominator= 10;
+ }
+ else
+ {
+ numerator = -1;
+ denominator = -1;
+ }
+
+ clutter_x11_trap_x_errors();
+
+ state = (XFeedbackState *) states;
+
+ for (i = 0; i < num_feedbacks; i++)
+ {
+ if (state->class == PtrFeedbackClass)
+ {
+ /* And tell the device */
+ feedback.class = PtrFeedbackClass;
+ feedback.length = sizeof (XPtrFeedbackControl);
+ feedback.id = state->id;
+ feedback.threshold = motion_threshold;
+ feedback.accelNum = numerator;
+ feedback.accelDenom = denominator;
+
+ XChangeFeedbackControl (xdisplay, xdevice,
+ DvAccelNum | DvAccelDenom | DvThreshold,
+ (XFeedbackControl *) &feedback);
+ break;
+ }
+
+ state = (XFeedbackState *) ((char *) state + state->length);
+ }
+
+ if (clutter_x11_untrap_x_errors())
+ {
+ g_warning ("Could not set synaptics touchpad acceleration for %s",
+ clutter_input_device_get_device_name (device));
+ }
+
+ XFreeFeedbackList (states);
+ XCloseDevice (xdisplay, xdevice);
+}
+
static void
meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -170,6 +344,13 @@ meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
guchar values[2] = { 0 }; /* disabled, disabled-on-external-mouse */
guchar *available;
+ if (is_device_synaptics (device))
+ {
+ values[0] = mode != G_DESKTOP_DEVICE_SEND_EVENTS_ENABLED;
+ change_property (device, "Synaptics Off", XA_INTEGER, 8, &values, 1);
+ return;
+ }
+
available = get_property (device, "libinput Send Events Modes Available",
XA_INTEGER, 8, 2);
if (!available)
@@ -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;
+ if (is_device_synaptics (device))
+ {
+ change_synaptics_speed (device, speed);
+ return;
+ }
+
change_property (device, "libinput Accel Speed",
XInternAtom (xdisplay, "FLOAT", False),
32, &value, 1);
@@ -248,6 +435,19 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
else
{
value = enabled ? 1 : 0;
+
+ if (is_device_synaptics (device))
+ {
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad");
+ change_synaptics_tap_left_handed (device,
+ g_settings_get_boolean (settings, "tap-to-click"),
+ enabled);
+ g_object_unref (settings);
+ return;
+ }
+
change_property (device, "libinput Left Handed Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -271,6 +471,20 @@ meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings,
{
guchar value = (enabled) ? 1 : 0;
+ if (is_device_synaptics (device))
+ {
+ GDesktopTouchpadHandedness handedness;
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad");
+ handedness = g_settings_get_enum (settings, "left-handed");
+ g_object_unref (settings);
+
+ change_synaptics_tap_left_handed (device, enabled,
+ handedness == G_DESKTOP_TOUCHPAD_HANDEDNESS_LEFT);
+ return;
+ }
+
change_property (device, "libinput Tapping Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -293,6 +507,27 @@ meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings,
{
guchar value = (inverted) ? 1 : 0;
+ if (is_device_synaptics (device))
+ {
+ gint32 *scrolling_distance;
+
+ scrolling_distance = get_property (device, "Synaptics Scrolling Distance",
+ XA_INTEGER, 32, 2);
+ if (scrolling_distance)
+ {
+ scrolling_distance[0] = inverted ?
+ -abs (scrolling_distance[0]) : abs (scrolling_distance[0]);
+ scrolling_distance[1] = inverted ?
+ -abs (scrolling_distance[1]) : abs (scrolling_distance[1]);
+
+ change_property (device, "Synaptics Scrolling Distance",
+ XA_INTEGER, 32, scrolling_distance, 2);
+ meta_XFree (scrolling_distance);
+ }
+
+ return;
+ }
+
change_property (device, "libinput Natural Scrolling Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -306,6 +541,22 @@ meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings,
guchar *current = NULL;
guchar *available = NULL;
+ if (is_device_synaptics (device))
+ {
+ current = get_property (device, "Synaptics Edge Scrolling",
+ XA_INTEGER, 8, 3);
+ if (current)
+ {
+ current[0] = !!edge_scroll_enabled;
+ current[1] = !!edge_scroll_enabled;
+ change_property (device, "Synaptics Edge Scrolling",
+ XA_INTEGER, 8, current, 3);
+ meta_XFree (current);
+ }
+
+ return;
+ }
+
available = get_property (device, "libinput Scroll Methods Available",
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[SCROLL_METHOD_FIELD_EDGE])
@@ -335,6 +586,22 @@ meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *set
guchar *current = NULL;
guchar *available = NULL;
+ if (is_device_synaptics (device))
+ {
+ current = get_property (device, "Synaptics Two-Finger Scrolling",
+ XA_INTEGER, 8, 2);
+ if (current)
+ {
+ current[0] = !!two_finger_scroll_enabled;
+ current[1] = !!two_finger_scroll_enabled;
+ change_property (device, "Synaptics Two-Finger Scrolling",
+ XA_INTEGER, 8, current, 2);
+ meta_XFree (current);
+ }
+
+ return;
+ }
+
available = get_property (device, "libinput Scroll Methods Available",
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[SCROLL_METHOD_FIELD_2FG])
--
2.36.1

View File

@ -1,118 +0,0 @@
From 5a486f5b6bf5f838db5dc2bfc5819a0cba5d2d19 Mon Sep 17 00:00:00 2001
From: Daniel van Vugt <daniel.van.vugt@canonical.com>
Date: Thu, 23 May 2019 18:15:28 +0800
Subject: [PATCH] background: Reload when GPU memory is invalidated
Fixes corrupt background wallpaper when resuming from suspend on the
Nvidia driver.
https://gitlab.gnome.org/GNOME/gnome-shell/issues/1084
(cherry picked from commit a5265365dd268e15a461a58000a10b122d0bccba)
https://gitlab.gnome.org/GNOME/mutter/merge_requests/777
---
src/compositor/meta-background.c | 46 +++++++++++++++++++++++++-------
1 file changed, 36 insertions(+), 10 deletions(-)
diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c
index c033395fe..387ce5dd3 100644
--- a/src/compositor/meta-background.c
+++ b/src/compositor/meta-background.c
@@ -252,12 +252,11 @@ static void
set_file (MetaBackground *self,
GFile **filep,
MetaBackgroundImage **imagep,
- GFile *file)
+ GFile *file,
+ gboolean force_reload)
{
- if (!file_equal0 (*filep, file))
+ if (force_reload || !file_equal0 (*filep, file))
{
- g_clear_object (filep);
-
if (*imagep)
{
g_signal_handlers_disconnect_by_func (*imagep,
@@ -267,11 +266,12 @@ set_file (MetaBackground *self,
*imagep = NULL;
}
+ g_set_object (filep, file);
+
if (file)
{
MetaBackgroundImageCache *cache = meta_background_image_cache_get_default ();
- *filep = g_object_ref (file);
*imagep = meta_background_image_cache_load (cache, file);
g_signal_connect (*imagep, "loaded",
G_CALLBACK (on_background_loaded), self);
@@ -279,6 +279,32 @@ set_file (MetaBackground *self,
}
}
+static void
+on_gl_video_memory_purged (MetaBackground *self)
+{
+ MetaBackgroundImageCache *cache = meta_background_image_cache_get_default ();
+
+ /* The GPU memory that just got invalidated is the texture inside
+ * self->background_image1,2 and/or its mipmaps. However, to save memory the
+ * original pixbuf isn't kept in RAM so we can't do a simple re-upload. The
+ * only copy of the image was the one in texture memory that got invalidated.
+ * So we need to do a full reload from disk.
+ */
+ if (self->file1)
+ {
+ meta_background_image_cache_purge (cache, self->file1);
+ set_file (self, &self->file1, &self->background_image1, self->file1, TRUE);
+ }
+
+ if (self->file2)
+ {
+ meta_background_image_cache_purge (cache, self->file2);
+ set_file (self, &self->file2, &self->background_image2, self->file2, TRUE);
+ }
+
+ mark_changed (self);
+}
+
static void
meta_background_dispose (GObject *object)
{
@@ -287,8 +313,8 @@ meta_background_dispose (GObject *object)
free_color_texture (self);
free_wallpaper_texture (self);
- set_file (self, &self->file1, &self->background_image1, NULL);
- set_file (self, &self->file2, &self->background_image2, NULL);
+ set_file (self, &self->file1, &self->background_image1, NULL, FALSE);
+ set_file (self, &self->file2, &self->background_image2, NULL, FALSE);
set_display (self, NULL);
@@ -312,7 +338,7 @@ meta_background_constructed (GObject *object)
G_OBJECT_CLASS (meta_background_parent_class)->constructed (object);
g_signal_connect_object (self->display, "gl-video-memory-purged",
- G_CALLBACK (mark_changed), object, G_CONNECT_SWAPPED);
+ G_CALLBACK (on_gl_video_memory_purged), object, G_CONNECT_SWAPPED);
g_signal_connect_object (monitor_manager, "monitors-changed",
G_CALLBACK (on_monitors_changed), self,
@@ -937,8 +963,8 @@ meta_background_set_blend (MetaBackground *self,
g_return_if_fail (META_IS_BACKGROUND (self));
g_return_if_fail (blend_factor >= 0.0 && blend_factor <= 1.0);
- set_file (self, &self->file1, &self->background_image1, file1);
- set_file (self, &self->file2, &self->background_image2, file2);
+ set_file (self, &self->file1, &self->background_image1, file1, FALSE);
+ set_file (self, &self->file2, &self->background_image2, file2, FALSE);
self->blend_factor = blend_factor;
self->style = style;
--
2.26.2

View File

@ -1,357 +0,0 @@
From 2a2e870c139e2130b00d582546616269bca27458 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 4 Sep 2020 17:11:36 +0200
Subject: [PATCH] clutter: Backport of ::touch-mode
In upstream/master this is a ClutterSeat readonly property. Add it to
ClutterDeviceManager here, the mechanism and triggering is the same
though.
---
clutter/clutter/clutter-device-manager.c | 24 +++
clutter/clutter/clutter-device-manager.h | 2 +
.../evdev/clutter-device-manager-evdev.c | 179 ++++++++++++++++++
3 files changed, 205 insertions(+)
diff --git a/clutter/clutter/clutter-device-manager.c b/clutter/clutter/clutter-device-manager.c
index c676384..e1cc455 100644
--- a/clutter/clutter/clutter-device-manager.c
+++ b/clutter/clutter/clutter-device-manager.c
@@ -62,6 +62,7 @@ enum
PROP_0,
PROP_BACKEND,
+ PROP_TOUCH_MODE,
PROP_LAST
};
@@ -108,6 +109,7 @@ clutter_device_manager_set_property (GObject *gobject,
priv->backend = g_value_get_object (value);
break;
+ case PROP_TOUCH_MODE:
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
@@ -127,6 +129,10 @@ clutter_device_manager_get_property (GObject *gobject,
g_value_set_object (value, priv->backend);
break;
+ case PROP_TOUCH_MODE:
+ g_value_set_boolean (value, FALSE);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
@@ -143,6 +149,12 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
P_("The ClutterBackend of the device manager"),
CLUTTER_TYPE_BACKEND,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+ obj_props[PROP_TOUCH_MODE] =
+ g_param_spec_boolean ("touch-mode",
+ P_("Touch mode"),
+ P_("Touch mode"),
+ FALSE,
+ CLUTTER_PARAM_READABLE);
gobject_class->set_property = clutter_device_manager_set_property;
gobject_class->get_property = clutter_device_manager_get_property;
@@ -579,3 +591,15 @@ clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_man
*settings = device_manager->priv->kbd_a11y_settings;
}
+
+gboolean
+clutter_device_manager_get_touch_mode (ClutterDeviceManager *device_manager)
+{
+ gboolean touch_mode;
+
+ g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), FALSE);
+
+ g_object_get (G_OBJECT (device_manager), "touch-mode", &touch_mode, NULL);
+
+ return touch_mode;
+}
diff --git a/clutter/clutter/clutter-device-manager.h b/clutter/clutter/clutter-device-manager.h
index 1cbf030..a4a6271 100644
--- a/clutter/clutter/clutter-device-manager.h
+++ b/clutter/clutter/clutter-device-manager.h
@@ -155,6 +155,8 @@ void clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *devic
CLUTTER_EXPORT
void clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings);
+CLUTTER_EXPORT
+gboolean clutter_device_manager_get_touch_mode (ClutterDeviceManager *device_manager);
G_END_DECLS
diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c b/clutter/clutter/evdev/clutter-device-manager-evdev.c
index 84b0aad..78b5b64 100644
--- a/clutter/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c
@@ -108,6 +108,19 @@ struct _ClutterDeviceManagerEvdevPrivate
gint device_id_next;
GList *free_device_ids;
+
+ guint tablet_mode_switch_state : 1;
+ guint has_touchscreen : 1;
+ guint has_tablet_switch : 1;
+ guint has_pointer : 1;
+ guint touch_mode : 1;
+};
+
+enum
+{
+ PROP_0,
+ PROP_TOUCH_MODE,
+ N_PROPS
};
static void clutter_device_manager_evdev_event_extender_init (ClutterEventExtenderInterface *iface);
@@ -765,6 +778,34 @@ clutter_event_source_free (ClutterEventSource *source)
g_source_unref (g_source);
}
+static void
+update_touch_mode (ClutterDeviceManagerEvdev *manager_evdev)
+{
+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv;
+ gboolean touch_mode;
+
+ /* No touch mode if we don't have a touchscreen, easy */
+ if (!priv->has_touchscreen)
+ touch_mode = FALSE;
+ /* If we have a tablet mode switch, honor it being unset */
+ else if (priv->has_tablet_switch && !priv->tablet_mode_switch_state)
+ touch_mode = FALSE;
+ /* If tablet mode is enabled, go for it */
+ else if (priv->has_tablet_switch && priv->tablet_mode_switch_state)
+ touch_mode = TRUE;
+ /* If there is no tablet mode switch (eg. kiosk machines),
+ * assume touch-mode is mutually exclusive with pointers.
+ */
+ else
+ touch_mode = !priv->has_pointer;
+
+ if (priv->touch_mode != touch_mode)
+ {
+ priv->touch_mode = touch_mode;
+ g_object_notify (G_OBJECT (manager_evdev), "touch-mode");
+ }
+}
+
static void
evdev_add_device (ClutterDeviceManagerEvdev *manager_evdev,
struct libinput_device *libinput_device)
@@ -942,19 +983,81 @@ flush_event_queue (void)
}
}
+static gboolean
+has_touchscreen (ClutterDeviceManagerEvdev *manager_evdev)
+{
+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv;
+ GSList *l;
+
+ for (l = priv->devices; l; l = l->next)
+ {
+ ClutterInputDeviceType device_type;
+
+ device_type = clutter_input_device_get_device_type (l->data);
+
+ if (device_type == CLUTTER_TOUCHSCREEN_DEVICE)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+device_type_is_pointer (ClutterInputDeviceType device_type)
+{
+ return (device_type == CLUTTER_POINTER_DEVICE ||
+ device_type == CLUTTER_TOUCHPAD_DEVICE);
+}
+
+static gboolean
+has_pointer (ClutterDeviceManagerEvdev *manager_evdev)
+{
+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv;
+ GSList *l;
+
+ for (l = priv->devices; l; l = l->next)
+ {
+ ClutterInputDeviceType device_type;
+
+ device_type = clutter_input_device_get_device_type (l->data);
+
+ if (device_type_is_pointer (device_type))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static gboolean
process_base_event (ClutterDeviceManagerEvdev *manager_evdev,
struct libinput_event *event)
{
+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv;
ClutterInputDevice *device;
struct libinput_device *libinput_device;
gboolean handled = TRUE;
+ gboolean check_touch_mode;
switch (libinput_event_get_type (event))
{
case LIBINPUT_EVENT_DEVICE_ADDED:
libinput_device = libinput_event_get_device (event);
+ priv->has_touchscreen |=
+ libinput_device_has_capability (libinput_device, LIBINPUT_DEVICE_CAP_TOUCH);
+ priv->has_pointer |=
+ libinput_device_has_capability (libinput_device, LIBINPUT_DEVICE_CAP_POINTER);
+ check_touch_mode = priv->has_touchscreen | priv->has_pointer;
+
+ if (libinput_device_has_capability (libinput_device,
+ LIBINPUT_DEVICE_CAP_SWITCH) &&
+ libinput_device_switch_has_switch (libinput_device,
+ LIBINPUT_SWITCH_TABLET_MODE))
+ {
+ priv->has_tablet_switch = TRUE;
+ check_touch_mode = TRUE;
+ }
+
evdev_add_device (manager_evdev, libinput_device);
break;
@@ -966,7 +1069,17 @@ process_base_event (ClutterDeviceManagerEvdev *manager_evdev,
libinput_device = libinput_event_get_device (event);
+ check_touch_mode =
+ libinput_device_has_capability (libinput_device, LIBINPUT_DEVICE_CAP_TOUCH);
device = libinput_device_get_user_data (libinput_device);
+ if (check_touch_mode)
+ priv->has_touchscreen = has_touchscreen (manager_evdev);
+ if (device_type_is_pointer (clutter_input_device_get_device_type (device)))
+ {
+ priv->has_pointer = has_pointer (manager_evdev);
+ check_touch_mode = TRUE;
+ }
+
evdev_remove_device (manager_evdev,
CLUTTER_INPUT_DEVICE_EVDEV (device));
break;
@@ -975,6 +1088,9 @@ process_base_event (ClutterDeviceManagerEvdev *manager_evdev,
handled = FALSE;
}
+ if (check_touch_mode)
+ update_touch_mode (manager_evdev);
+
return handled;
}
@@ -1752,6 +1868,23 @@ process_device_event (ClutterDeviceManagerEvdev *manager_evdev,
notify_pad_ring (device, time, number, source, group, mode, angle);
break;
}
+ case LIBINPUT_EVENT_SWITCH_TOGGLE:
+ {
+ ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv;
+ struct libinput_event_switch *switch_event =
+ libinput_event_get_switch_event (event);
+ enum libinput_switch sw =
+ libinput_event_switch_get_switch (switch_event);
+ enum libinput_switch_state state =
+ libinput_event_switch_get_switch_state (switch_event);
+
+ if (sw == LIBINPUT_SWITCH_TABLET_MODE)
+ {
+ priv->tablet_mode_switch_state = (state == LIBINPUT_SWITCH_STATE_ON);
+ update_touch_mode (manager_evdev);
+ }
+ break;
+ }
default:
handled = FALSE;
}
@@ -1967,6 +2100,10 @@ clutter_device_manager_evdev_constructed (GObject *gobject)
source = clutter_event_source_new (manager_evdev);
priv->event_source = source;
+
+ priv->has_touchscreen = has_touchscreen (manager_evdev);
+ priv->has_pointer = has_pointer (manager_evdev);
+ update_touch_mode (manager_evdev);
}
static void
@@ -2001,6 +2138,43 @@ clutter_device_manager_evdev_dispose (GObject *object)
G_OBJECT_CLASS (clutter_device_manager_evdev_parent_class)->dispose (object);
}
+static void
+clutter_device_manager_evdev_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id)
+ {
+ case PROP_TOUCH_MODE:
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+clutter_device_manager_evdev_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ ClutterDeviceManagerEvdev *manager_evdev;
+ ClutterDeviceManagerEvdevPrivate *priv;
+
+ manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (object);
+ priv = manager_evdev->priv;
+
+ switch (prop_id)
+ {
+ case PROP_TOUCH_MODE:
+ g_value_set_boolean (value, priv->touch_mode);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+
static void
clutter_device_manager_evdev_finalize (GObject *object)
{
@@ -2036,6 +2210,8 @@ clutter_device_manager_evdev_class_init (ClutterDeviceManagerEvdevClass *klass)
gobject_class->constructed = clutter_device_manager_evdev_constructed;
gobject_class->finalize = clutter_device_manager_evdev_finalize;
gobject_class->dispose = clutter_device_manager_evdev_dispose;
+ gobject_class->set_property = clutter_device_manager_evdev_set_property;
+ gobject_class->get_property = clutter_device_manager_evdev_get_property;
manager_class = CLUTTER_DEVICE_MANAGER_CLASS (klass);
manager_class->add_device = clutter_device_manager_evdev_add_device;
@@ -2047,6 +2223,9 @@ clutter_device_manager_evdev_class_init (ClutterDeviceManagerEvdevClass *klass)
manager_class->get_supported_virtual_device_types = clutter_device_manager_evdev_get_supported_virtual_device_types;
manager_class->compress_motion = clutter_device_manager_evdev_compress_motion;
manager_class->apply_kbd_a11y_settings = clutter_device_manager_evdev_apply_kbd_a11y_settings;
+
+ g_object_class_override_property (gobject_class, PROP_TOUCH_MODE,
+ "touch-mode");
}
static void
--
2.29.2

View File

@ -1,61 +0,0 @@
From 368fdebe8f4f4e0c0e41f5be9961a748f328cb57 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Tue, 13 Feb 2018 11:44:40 +0100
Subject: [PATCH] clutter: Extend touchpad device property check for Synaptics
So we reliably get CLUTTER_TOUCHPAD_DEVICE for those. The other heuristics
to get the device type may fall short.
---
.../clutter/x11/clutter-device-manager-xi2.c | 22 ++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/clutter/clutter/x11/clutter-device-manager-xi2.c b/clutter/clutter/x11/clutter-device-manager-xi2.c
index 87da4b050..297d3acfe 100644
--- a/clutter/clutter/x11/clutter-device-manager-xi2.c
+++ b/clutter/clutter/x11/clutter-device-manager-xi2.c
@@ -282,8 +282,9 @@ is_touch_device (XIAnyClassInfo **classes,
}
static gboolean
-is_touchpad_device (ClutterBackendX11 *backend_x11,
- XIDeviceInfo *info)
+query_exists_device_property (ClutterBackendX11 *backend_x11,
+ XIDeviceInfo *info,
+ const gchar *property)
{
gulong nitems, bytes_after;
guint32 *data = NULL;
@@ -291,7 +292,7 @@ is_touchpad_device (ClutterBackendX11 *backend_x11,
Atom type;
Atom prop;
- prop = XInternAtom (backend_x11->xdpy, "libinput Tapping Enabled", True);
+ prop = XInternAtom (backend_x11->xdpy, property, True);
if (prop == None)
return FALSE;
@@ -312,6 +313,21 @@ is_touchpad_device (ClutterBackendX11 *backend_x11,
return TRUE;
}
+static gboolean
+is_touchpad_device (ClutterBackendX11 *backend_x11,
+ XIDeviceInfo *info)
+{
+ if (query_exists_device_property (backend_x11, info,
+ "libinput Tapping Enabled"))
+ return TRUE;
+
+ if (query_exists_device_property (backend_x11, info,
+ "Synaptics Off"))
+ return TRUE;
+
+ return FALSE;
+}
+
static gboolean
get_device_ids (ClutterBackendX11 *backend_x11,
XIDeviceInfo *info,
--
2.21.0

View File

@ -1,27 +0,0 @@
From 2259241e4e6f03bea4e9d746582a9e6a82b3c755 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 13 Jun 2018 13:48:24 +0200
Subject: [PATCH] clutter: Only reset scroll axes on slave devices
As a plus, unknown source device IDs will just warn instead of crash.
---
clutter/clutter/x11/clutter-device-manager-xi2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clutter/clutter/x11/clutter-device-manager-xi2.c b/clutter/clutter/x11/clutter-device-manager-xi2.c
index 297d3acfe..76ef420ed 100644
--- a/clutter/clutter/x11/clutter-device-manager-xi2.c
+++ b/clutter/clutter/x11/clutter-device-manager-xi2.c
@@ -1899,7 +1899,8 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
_clutter_input_device_set_stage (device, NULL);
}
- _clutter_input_device_reset_scroll_info (source_device);
+ if (clutter_input_device_get_device_mode (source_device) == CLUTTER_INPUT_MODE_SLAVE)
+ _clutter_input_device_reset_scroll_info (source_device);
clutter_event_set_device (event, device);
clutter_event_set_source_device (event, source_device);
--
2.21.0

View File

@ -1,53 +0,0 @@
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

@ -1,46 +0,0 @@
From 7bcc274dbc6cb75814cce3e5c2e7f45cf25b0538 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Tue, 9 Feb 2021 17:59:08 +0100
Subject: [PATCH 1/2] clutter/stage-view: Hide double buffered shadowfb behind
envvar
It still results in worse performance than a single FBO based shadowfb,
so don't use it. It will need a new EGL extension for zero copy CPU
memory based FBO to be feasable.
---
clutter/clutter/clutter-stage-view.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/clutter/clutter/clutter-stage-view.c b/clutter/clutter/clutter-stage-view.c
index 5e5966d06..ec18db7b8 100644
--- a/clutter/clutter/clutter-stage-view.c
+++ b/clutter/clutter/clutter-stage-view.c
@@ -282,6 +282,14 @@ init_dma_buf_shadowfbs (ClutterStageView *view,
CoglRenderer *cogl_renderer = cogl_context_get_renderer (cogl_context);
CoglFramebuffer *initial_shadowfb;
+ if (g_strcmp0 (g_getenv ("MUTTER_DEBUG_ENABLE_DOUBLE_BUFFER_SHADOWFB"),
+ "1") != 0)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Double buffered shadowfb not enabled");
+ return FALSE;
+ }
+
if (!cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
@@ -390,8 +398,8 @@ init_shadowfb (ClutterStageView *view)
return;
}
- g_warning ("Failed to initialize double buffered shadow fb for %s: %s",
- priv->name, error->message);
+ g_debug ("Failed to initialize double buffered shadow fb for %s: %s",
+ priv->name, error->message);
g_clear_error (&error);
if (!init_fallback_shadowfb (view, cogl_context, width, height, &error))
--
2.29.2

View File

@ -1,37 +0,0 @@
From 251ef4ff4bacefac211e21873e10da7fa067dd68 Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pekka.paalanen@collabora.com>
Date: Fri, 26 Apr 2019 12:23:18 +0300
Subject: [PATCH 01/12] cogl: Remove unused OFFSCREEN_BLIT feature flag
This named constant is never used anywhere.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
(cherry picked from commit c08a24bb40ad7aa7746e86251c9dbe6c264b4d7c)
---
cogl/cogl/cogl-types.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/cogl/cogl/cogl-types.h b/cogl/cogl/cogl-types.h
index 690daa16a..69d304cf0 100644
--- a/cogl/cogl/cogl-types.h
+++ b/cogl/cogl/cogl-types.h
@@ -325,7 +325,6 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
* @COGL_FEATURE_SHADERS_GLSL: GLSL support
* @COGL_FEATURE_OFFSCREEN: FBO support
* @COGL_FEATURE_OFFSCREEN_MULTISAMPLE: Multisample support on FBOs
- * @COGL_FEATURE_OFFSCREEN_BLIT: Blit support on FBOs
* @COGL_FEATURE_FOUR_CLIP_PLANES: At least 4 clip planes available
* @COGL_FEATURE_STENCIL_BUFFER: Stencil buffer support
* @COGL_FEATURE_VBOS: VBO support
@@ -368,7 +367,6 @@ typedef enum
COGL_FEATURE_SHADERS_GLSL = (1 << 5),
COGL_FEATURE_OFFSCREEN = (1 << 6),
COGL_FEATURE_OFFSCREEN_MULTISAMPLE = (1 << 7),
- COGL_FEATURE_OFFSCREEN_BLIT = (1 << 8),
COGL_FEATURE_FOUR_CLIP_PLANES = (1 << 9),
COGL_FEATURE_STENCIL_BUFFER = (1 << 10),
COGL_FEATURE_VBOS = (1 << 11),
--
2.21.0

View File

@ -1,265 +0,0 @@
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

@ -1,4 +1,4 @@
From 575490895047e0709bc84826fe6d6a73028d7bbc Mon Sep 17 00:00:00 2001
From 1ab51efc968d7d3c6244d9b7efcdf4bae4fc0a9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Wed, 12 Mar 2014 02:04:13 +0100
Subject: [PATCH] constraints: Enforce X11 size limits
@ -10,7 +10,7 @@ to keep insanely huge windows from crashing the WM.
1 file changed, 42 insertions(+)
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 117131b15..379372245 100644
index 4b1d95338a..eee16dc48f 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -109,6 +109,7 @@ typedef enum
@ -21,7 +21,7 @@ index 117131b15..379372245 100644
PRIORITY_MAXIMUM = 4 /* Dummy value used for loop end = max(all priorities) */
} ConstraintPriority;
@@ -201,6 +202,10 @@ static gboolean constrain_partially_onscreen (MetaWindow *window,
@@ -204,6 +205,10 @@ static gboolean constrain_partially_onscreen (MetaWindow *window,
ConstraintInfo *info,
ConstraintPriority priority,
gboolean check_only);
@ -32,7 +32,7 @@ index 117131b15..379372245 100644
static void setup_constraint_info (ConstraintInfo *info,
MetaWindow *window,
@@ -236,6 +241,7 @@ static const Constraint all_constraints[] = {
@@ -239,6 +244,7 @@ static const Constraint all_constraints[] = {
{constrain_fully_onscreen, "constrain_fully_onscreen"},
{constrain_titlebar_visible, "constrain_titlebar_visible"},
{constrain_partially_onscreen, "constrain_partially_onscreen"},
@ -40,7 +40,7 @@ index 117131b15..379372245 100644
{NULL, NULL}
};
@@ -1780,3 +1786,39 @@ constrain_partially_onscreen (MetaWindow *window,
@@ -1876,3 +1882,39 @@ constrain_partially_onscreen (MetaWindow *window,
return retval;
}
@ -81,5 +81,5 @@ index 117131b15..379372245 100644
+ return TRUE;
+}
--
2.21.0
2.31.1

View File

@ -1,163 +0,0 @@
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

@ -1,64 +0,0 @@
From 5cab6bac4d4fb06e60d3198dc654a5d70fa6240e Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Mon, 16 Dec 2019 13:53:26 +0100
Subject: [PATCH] core: Let pad mode switch events always go through
MetaInputSettings
We used to inhibit all pad actions while the OSD is shown, but one we
would actually want to handle are mode switches while the OSD is open.
So it has an opportunity to catch up to the mode switch.
This lets MetaInputSettings reflect the mode switch (eg. when querying
action labels), so the OSD has an opportunity to update the current
actions.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/975
---
src/core/events.c | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/src/core/events.c b/src/core/events.c
index d383778629..44f28d0b97 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -256,13 +256,31 @@ meta_display_handle_event (MetaDisplay *display,
}
#endif
- if (!display->current_pad_osd &&
- (event->type == CLUTTER_PAD_BUTTON_PRESS ||
- event->type == CLUTTER_PAD_BUTTON_RELEASE ||
- event->type == CLUTTER_PAD_RING ||
- event->type == CLUTTER_PAD_STRIP))
+ if (event->type == CLUTTER_PAD_BUTTON_PRESS ||
+ event->type == CLUTTER_PAD_BUTTON_RELEASE ||
+ event->type == CLUTTER_PAD_RING ||
+ event->type == CLUTTER_PAD_STRIP)
{
- if (meta_input_settings_handle_pad_event (meta_backend_get_input_settings (backend),
+ gboolean handle_pad_event = TRUE;
+ gboolean is_mode_switch = FALSE;
+
+ if (event->type == CLUTTER_PAD_BUTTON_PRESS ||
+ event->type == CLUTTER_PAD_BUTTON_RELEASE)
+ {
+ ClutterInputDevice *pad;
+ uint32_t button;
+
+ pad = clutter_event_get_source_device (event);
+ button = clutter_event_get_button (event);
+
+ is_mode_switch =
+ clutter_input_device_get_mode_switch_button_group (pad, button) >= 0;
+ }
+
+ handle_pad_event = !display->current_pad_osd || is_mode_switch;
+
+ if (handle_pad_event &&
+ meta_input_settings_handle_pad_event (meta_backend_get_input_settings (backend),
event))
{
bypass_wayland = bypass_clutter = TRUE;
--
2.24.0

View File

@ -1,73 +0,0 @@
From bac090f571e6f413ba2a362ed2d70146b7701d16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 24 Feb 2020 17:37:34 +0100
Subject: [PATCH] crtc-xrandr: Respect configured RANDR panning
A user may have configured an output to be panning, e.g. using xrandr
--output <output> --mode <mode> --panning <size>. Respect this by making
the logical monitor use the panning size, instead of the mode. This
makes e.g. makes the background cover the whole panning size, and panels
etc will cover the whole top of the panned area, instead of just the top
left part covering the monitor if having panned to (0, 0).
No support is added to configuring panning, i.e. a panned monitor
configuration cannot be stored in monitors.xml.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1085
---
src/backends/x11/meta-crtc-xrandr.c | 31 +++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/backends/x11/meta-crtc-xrandr.c b/src/backends/x11/meta-crtc-xrandr.c
index d201b8581..dc3f931e3 100644
--- a/src/backends/x11/meta-crtc-xrandr.c
+++ b/src/backends/x11/meta-crtc-xrandr.c
@@ -177,7 +177,14 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
RRCrtc crtc_id,
XRRScreenResources *resources)
{
+ MetaGpu *gpu = META_GPU (gpu_xrandr);
+ MetaMonitorManager *monitor_manager = meta_gpu_get_monitor_manager (gpu);
+ MetaMonitorManagerXrandr *monitor_manager_xrandr =
+ META_MONITOR_MANAGER_XRANDR (monitor_manager);
+ Display *xdisplay =
+ meta_monitor_manager_xrandr_get_xdisplay (monitor_manager_xrandr);
MetaCrtc *crtc;
+ XRRPanning *panning;
unsigned int i;
GList *modes;
@@ -185,10 +192,26 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
crtc->gpu = META_GPU (gpu_xrandr);
crtc->crtc_id = crtc_id;
- crtc->rect.x = xrandr_crtc->x;
- crtc->rect.y = xrandr_crtc->y;
- crtc->rect.width = xrandr_crtc->width;
- crtc->rect.height = xrandr_crtc->height;
+
+ panning = XRRGetPanning (xdisplay, resources, crtc_id);
+ if (panning && panning->width > 0 && panning->height > 0)
+ {
+ crtc->rect = (MetaRectangle) {
+ .x = panning->left,
+ .y = panning->top,
+ .width = panning->width,
+ .height = panning->height,
+ };
+ }
+ else
+ {
+ crtc->rect = (MetaRectangle) {
+ .x = xrandr_crtc->x,
+ .y = xrandr_crtc->y,
+ .width = xrandr_crtc->width,
+ .height = xrandr_crtc->height,
+ };
+ }
crtc->is_dirty = FALSE;
crtc->transform =
meta_monitor_transform_from_xrandr (xrandr_crtc->rotation);
--
2.24.1

View File

@ -1,248 +0,0 @@
From 7f6f326a1bb96aad0b7aea9c4d7e257bf53c026c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Fri, 21 Feb 2020 21:03:16 +0100
Subject: [PATCH] display: Make check-alive timeout configureable
The check-alive feature is there for the user to be able to terminate
frozen applications more easily. However, sometimes applications are
implemented in a way where they fail to be reply to ping requests in a
timely manner, resulting in that, to the compositor, they are
indistinguishable from clients that have frozen indefinitely.
When using an application that has these issues, the GUI showed in
response to the failure to respond to ping requests can become annoying,
as it disrupts the visual presentation of the application.
To allow users to work-around these issues, add a setting allowing them
to configure the timeout waited until an application is considered
frozen, or disabling the check completely.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1080
---
data/org.gnome.mutter.gschema.xml.in | 10 ++++
src/core/display.c | 18 ++++----
src/core/prefs.c | 68 ++++++++++++++++++++++++++++
src/meta/prefs.h | 3 ++
4 files changed, 90 insertions(+), 9 deletions(-)
diff --git a/data/org.gnome.mutter.gschema.xml.in b/data/org.gnome.mutter.gschema.xml.in
index 6cbd9c1b5..4d37b1488 100644
--- a/data/org.gnome.mutter.gschema.xml.in
+++ b/data/org.gnome.mutter.gschema.xml.in
@@ -123,6 +123,16 @@
</description>
</key>
+ <key name="check-alive-timeout" type="u">
+ <default>5000</default>
+ <summary>Timeout for check-alive ping</summary>
+ <description>
+ Number of milliseconds a client has to respond to a ping request in
+ order to not be detected as frozen. Using 0 will disable the alive check
+ completely.
+ </description>
+ </key>
+
<child name="keybindings" schema="org.gnome.mutter.keybindings"/>
</schema>
diff --git a/src/core/display.c b/src/core/display.c
index eb7dc43b6..c30a03385 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1923,12 +1923,6 @@ meta_set_syncing (gboolean setting)
}
}
-/*
- * How long, in milliseconds, we should wait after pinging a window
- * before deciding it's not going to get back to us.
- */
-#define PING_TIMEOUT_DELAY 5000
-
/**
* meta_display_ping_timeout:
* @data: All the information about this ping. It is a #MetaPingData
@@ -1986,6 +1980,11 @@ meta_display_ping_window (MetaWindow *window,
{
MetaDisplay *display = window->display;
MetaPingData *ping_data;
+ unsigned int check_alive_timeout;
+
+ check_alive_timeout = meta_prefs_get_check_alive_timeout ();
+ if (check_alive_timeout == 0)
+ return;
if (serial == 0)
{
@@ -1999,9 +1998,10 @@ meta_display_ping_window (MetaWindow *window,
ping_data = g_new (MetaPingData, 1);
ping_data->window = window;
ping_data->serial = serial;
- ping_data->ping_timeout_id = g_timeout_add (PING_TIMEOUT_DELAY,
- meta_display_ping_timeout,
- ping_data);
+ ping_data->ping_timeout_id =
+ g_timeout_add (check_alive_timeout,
+ meta_display_ping_timeout,
+ ping_data);
g_source_set_name_by_id (ping_data->ping_timeout_id, "[mutter] meta_display_ping_timeout");
display->pending_pings = g_slist_prepend (display->pending_pings, ping_data);
diff --git a/src/core/prefs.c b/src/core/prefs.c
index 3f0db8afc..4892406ce 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -99,6 +99,7 @@ static gboolean bell_is_visible = FALSE;
static gboolean bell_is_audible = TRUE;
static gboolean gnome_accessibility = FALSE;
static gboolean gnome_animations = TRUE;
+static unsigned int check_alive_timeout = 5000;
static char *cursor_theme = NULL;
/* cursor_size will, when running as an X11 compositing window manager, be the
* actual cursor size, multiplied with the global window scaling factor. On
@@ -213,6 +214,12 @@ typedef struct
gint *target;
} MetaIntPreference;
+typedef struct
+{
+ MetaBasePreference base;
+ unsigned int *target;
+} MetaUintPreference;
+
/* All preferences that are not keybindings must be listed here,
* plus in the GSettings schemas and the MetaPreference enum.
@@ -491,6 +498,18 @@ static MetaIntPreference preferences_int[] =
{ { NULL, 0, 0 }, NULL },
};
+static MetaUintPreference preferences_uint[] =
+ {
+ {
+ { "check-alive-timeout",
+ SCHEMA_MUTTER,
+ META_PREF_CHECK_ALIVE_TIMEOUT,
+ },
+ &check_alive_timeout,
+ },
+ { { NULL, 0, 0 }, NULL },
+ };
+
static void
handle_preference_init_enum (void)
{
@@ -613,6 +632,21 @@ handle_preference_init_int (void)
}
}
+static void
+handle_preference_init_uint (void)
+{
+ MetaUintPreference *cursor = preferences_uint;
+
+ while (cursor->base.key != NULL)
+ {
+ if (cursor->target)
+ *cursor->target = g_settings_get_uint (SETTINGS (cursor->base.schema),
+ cursor->base.key);
+
+ ++cursor;
+ }
+}
+
static void
handle_preference_update_enum (GSettings *settings,
gchar *key)
@@ -788,6 +822,28 @@ handle_preference_update_int (GSettings *settings,
}
}
+static void
+handle_preference_update_uint (GSettings *settings,
+ char *key)
+{
+ MetaUintPreference *cursor = preferences_uint;
+ unsigned int new_value;
+
+ while (cursor->base.key && strcmp (key, cursor->base.key) != 0)
+ ++cursor;
+
+ if (!cursor->base.key || !cursor->target)
+ return;
+
+ new_value = g_settings_get_uint (SETTINGS (cursor->base.schema), key);
+
+ if (*cursor->target != new_value)
+ {
+ *cursor->target = new_value;
+ queue_changed (cursor->base.pref);
+ }
+}
+
/****************************************************************************/
/* Listeners. */
@@ -964,6 +1020,7 @@ meta_prefs_init (void)
handle_preference_init_string ();
handle_preference_init_string_array ();
handle_preference_init_int ();
+ handle_preference_init_uint ();
init_bindings ();
}
@@ -1017,6 +1074,8 @@ settings_changed (GSettings *settings,
handle_preference_update_bool (settings, key);
else if (g_variant_type_equal (type, G_VARIANT_TYPE_INT32))
handle_preference_update_int (settings, key);
+ else if (g_variant_type_equal (type, G_VARIANT_TYPE_UINT32))
+ handle_preference_update_uint (settings, key);
else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING_ARRAY))
handle_preference_update_string_array (settings, key);
else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING))
@@ -1640,6 +1699,9 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_AUTO_MAXIMIZE:
return "AUTO_MAXIMIZE";
+
+ case META_PREF_CHECK_ALIVE_TIMEOUT:
+ return "CHECK_ALIVE_TIMEOUT";
}
return "(unknown)";
@@ -1966,6 +2028,12 @@ meta_prefs_get_overlay_binding (MetaKeyCombo *combo)
*combo = overlay_key_combo;
}
+unsigned int
+meta_prefs_get_check_alive_timeout (void)
+{
+ return check_alive_timeout;
+}
+
const char *
meta_prefs_get_iso_next_group_option (void)
{
diff --git a/src/meta/prefs.h b/src/meta/prefs.h
index 9664b5c07..f42d1c63c 100644
--- a/src/meta/prefs.h
+++ b/src/meta/prefs.h
@@ -103,6 +103,7 @@ typedef enum
META_PREF_AUTO_MAXIMIZE,
META_PREF_CENTER_NEW_WINDOWS,
META_PREF_DRAG_THRESHOLD,
+ META_PREF_CHECK_ALIVE_TIMEOUT,
} MetaPreference;
typedef void (* MetaPrefsChangedFunc) (MetaPreference pref,
@@ -475,4 +476,6 @@ gboolean meta_prefs_bell_is_audible (void);
META_EXPORT
GDesktopVisualBellType meta_prefs_get_visual_bell_type (void);
+unsigned int meta_prefs_get_check_alive_timeout (void);
+
#endif
--
2.28.0

View File

@ -1,55 +0,0 @@
From 62387eb649b7b33d923d5382f85c9210a3bedbe8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Thu, 30 May 2019 16:32:35 +0200
Subject: [PATCH] enum-types: Use @basename@ in header comment
@filename@ may contain arch-specific bits that introduce unnecessary
multi-lib issues.
---
clutter/clutter/clutter-enum-types.h.in | 2 +-
cogl/cogl-path/cogl-path-enum-types.h.in | 2 +-
src/meta/meta-enum-types.h.in | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/clutter/clutter/clutter-enum-types.h.in b/clutter/clutter/clutter-enum-types.h.in
index 2e5b6707e..17f9ee644 100644
--- a/clutter/clutter/clutter-enum-types.h.in
+++ b/clutter/clutter/clutter-enum-types.h.in
@@ -13,7 +13,7 @@ G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
+/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
diff --git a/cogl/cogl-path/cogl-path-enum-types.h.in b/cogl/cogl-path/cogl-path-enum-types.h.in
index 071686acd..2b377ed18 100644
--- a/cogl/cogl-path/cogl-path-enum-types.h.in
+++ b/cogl/cogl-path/cogl-path-enum-types.h.in
@@ -9,7 +9,7 @@ G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
+/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN file-tail ***/
diff --git a/src/meta/meta-enum-types.h.in b/src/meta/meta-enum-types.h.in
index 6e3b67b26..bee0196de 100644
--- a/src/meta/meta-enum-types.h.in
+++ b/src/meta/meta-enum-types.h.in
@@ -10,7 +10,7 @@ G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
+/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN file-tail ***/
--
2.21.0

View File

@ -1,4 +1,4 @@
From f735f345ad8390a7fb09ef54ca3e0e419d395d1b Mon Sep 17 00:00:00 2001
From 7ac5b7bad8f2d0e61700610f68282f6687cc9d2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Thu, 21 Jul 2016 15:43:12 +0200
Subject: [PATCH] events: Don't move (sloppy) focus while buttons are pressed
@ -9,10 +9,10 @@ Subject: [PATCH] events: Don't move (sloppy) focus while buttons are pressed
1 file changed, 11 insertions(+)
diff --git a/src/x11/events.c b/src/x11/events.c
index e363fdbb6..905b5bf9d 100644
index efa8f9856b..388eff0ac7 100644
--- a/src/x11/events.c
+++ b/src/x11/events.c
@@ -832,6 +832,16 @@ crossing_serial_is_ignored (MetaX11Display *x11_display,
@@ -839,6 +839,16 @@ crossing_serial_is_ignored (MetaX11Display *x11_display,
return FALSE;
}
@ -29,7 +29,7 @@ index e363fdbb6..905b5bf9d 100644
static gboolean
handle_input_xevent (MetaX11Display *x11_display,
XIEvent *input_event,
@@ -876,6 +886,7 @@ handle_input_xevent (MetaX11Display *x11_display,
@@ -883,6 +893,7 @@ handle_input_xevent (MetaX11Display *x11_display,
* avoid races.
*/
if (window && !crossing_serial_is_ignored (x11_display, serial) &&
@ -38,5 +38,5 @@ index e363fdbb6..905b5bf9d 100644
enter_event->mode != XINotifyUngrab &&
enter_event->detail != XINotifyInferior &&
--
2.21.0
2.31.1

View File

@ -1,26 +0,0 @@
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

@ -1,122 +0,0 @@
From f108395c32351cda8722130e0e2970827b18e5a9 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Wed, 2 Oct 2019 16:49:28 +0200
Subject: [PATCH] events: Sync pending pointer events without a window
Mutter issues a synchronous grab on the pointer for unfocused client
windows to be able to catch the button events first and raise/focus
client windows accordingly.
When there is a synchronous grab in effect, all events are queued until
the grabbing client releases the event queue as it processes the events.
Mutter does release the events in its event handler function but does so
only if it is able to find the window matching the event. If the window
is a shell widget, that matching may fail and therefore Mutter will not
release the events, hence causing a freeze in pointer events delivery.
To avoid the issue, make sure we sync the pointer events in case we
can't find a matching window.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/821
---
src/core/events.c | 62 ++++++++++++++++++++++++++++++++++++++---------
1 file changed, 51 insertions(+), 11 deletions(-)
diff --git a/src/core/events.c b/src/core/events.c
index 5b8e49fc7..831cb007b 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -50,6 +50,12 @@
#define IS_KEY_EVENT(e) ((e)->type == CLUTTER_KEY_PRESS || \
(e)->type == CLUTTER_KEY_RELEASE)
+typedef enum
+{
+ EVENTS_UNFREEZE_SYNC,
+ EVENTS_UNFREEZE_REPLAY,
+} EventsUnfreezeMethod;
+
static gboolean
stage_has_key_focus (void)
{
@@ -167,6 +173,43 @@ sequence_is_pointer_emulated (MetaDisplay *display,
return FALSE;
}
+static void
+maybe_unfreeze_pointer_events (MetaBackend *backend,
+ const ClutterEvent *event,
+ EventsUnfreezeMethod unfreeze_method)
+{
+ Display *xdisplay;
+ int event_mode;
+ int device_id;
+
+ if (event->type != CLUTTER_BUTTON_PRESS)
+ return;
+
+ if (!META_IS_BACKEND_X11 (backend))
+ return;
+
+ device_id = clutter_event_get_device_id (event);
+ switch (unfreeze_method)
+ {
+ case EVENTS_UNFREEZE_SYNC:
+ event_mode = XISyncDevice;
+ meta_verbose ("Syncing events time %u device %i\n",
+ (unsigned int) event->button.time, device_id);
+ break;
+ case EVENTS_UNFREEZE_REPLAY:
+ event_mode = XIReplayDevice;
+ meta_verbose ("Replaying events time %u device %i\n",
+ (unsigned int) event->button.time, device_id);
+ break;
+ default:
+ g_assert_not_reached ();
+ return;
+ }
+
+ xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
+ XIAllowEvents (xdisplay, device_id, event_mode, event->button.time);
+}
+
static gboolean
meta_display_handle_event (MetaDisplay *display,
const ClutterEvent *event)
@@ -366,17 +409,7 @@ meta_display_handle_event (MetaDisplay *display,
{
/* Only replay button press events, since that's where we
* have the synchronous grab. */
- if (event->type == CLUTTER_BUTTON_PRESS)
- {
- if (META_IS_BACKEND_X11 (backend))
- {
- Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
- meta_verbose ("Allowing events time %u\n",
- (unsigned int)event->button.time);
- XIAllowEvents (xdisplay, clutter_event_get_device_id (event),
- XIReplayDevice, event->button.time);
- }
- }
+ maybe_unfreeze_pointer_events (backend, event, EVENTS_UNFREEZE_REPLAY);
/* If the focus window has an active close dialog let clutter
* events go through, so fancy clutter dialogs can get to handle
@@ -392,6 +425,13 @@ meta_display_handle_event (MetaDisplay *display,
goto out;
}
+ else
+ {
+ /* We could not match the event with a window, make sure we sync
+ * the pointer to discard the sequence and don't keep events frozen.
+ */
+ maybe_unfreeze_pointer_events (backend, event, EVENTS_UNFREEZE_SYNC);
+ }
out:
/* If the compositor has a grab, don't pass that through to Wayland */
--
2.23.0

View File

@ -1,136 +0,0 @@
From 80f79e0cc7509b79b38193a006b0d98d03432044 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 5 Aug 2019 14:39:21 -0400
Subject: [PATCH] iconcache: Avoid xrender picture formats when creating cairo
surface
If an application provides its window icon via wmhints, then mutter
loads the pixmap specified by the application into a cairo xlib surface. When
creating the surface it specifies the visual, indirectly, via an XRender
picture format.
This is suboptimal, since XRender picture formats don't have a way to specify
16bpp depth, which an application may be using.
In particular, applications are likely to use 16bpp depth pixmaps for their
icons, if the video card offers a 16bpp framebuffer/root window.
This commit drops the XRender middleman, and just tells cairo a visual to use
directly.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/715
---
src/x11/iconcache.c | 31 ++++++-------------------------
1 file changed, 6 insertions(+), 25 deletions(-)
diff --git a/src/x11/iconcache.c b/src/x11/iconcache.c
index 15d72da65..521c77b8d 100644
--- a/src/x11/iconcache.c
+++ b/src/x11/iconcache.c
@@ -261,97 +261,78 @@ get_pixmap_geometry (MetaX11Display *x11_display,
Pixmap pixmap,
int *w,
int *h,
int *d)
{
Window root_ignored;
int x_ignored, y_ignored;
guint width, height;
guint border_width_ignored;
guint depth;
if (w)
*w = 1;
if (h)
*h = 1;
if (d)
*d = 1;
XGetGeometry (x11_display->xdisplay,
pixmap, &root_ignored, &x_ignored, &y_ignored,
&width, &height, &border_width_ignored, &depth);
if (w)
*w = width;
if (h)
*h = height;
if (d)
*d = depth;
}
-static int
-standard_pict_format_for_depth (int depth)
-{
- switch (depth)
- {
- case 1:
- return PictStandardA1;
- case 24:
- return PictStandardRGB24;
- case 32:
- return PictStandardARGB32;
- default:
- g_assert_not_reached ();
- }
- return 0;
-}
-
-static XRenderPictFormat *
-pict_format_for_depth (Display *xdisplay, int depth)
-{
- return XRenderFindStandardFormat (xdisplay, standard_pict_format_for_depth (depth));
-}
-
static cairo_surface_t *
surface_from_pixmap (Display *xdisplay, Pixmap xpixmap,
int width, int height)
{
Window root_return;
+ XVisualInfo visual_info;
int x_ret, y_ret;
unsigned int w_ret, h_ret, bw_ret, depth_ret;
if (!XGetGeometry (xdisplay, xpixmap, &root_return,
&x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret))
return NULL;
- return cairo_xlib_surface_create_with_xrender_format (xdisplay, xpixmap, DefaultScreenOfDisplay (xdisplay),
- pict_format_for_depth (xdisplay, depth_ret), w_ret, h_ret);
+ if (!XMatchVisualInfo (xdisplay, DefaultScreen (xdisplay),
+ depth_ret, TrueColor, &visual_info))
+ return NULL;
+
+ return cairo_xlib_surface_create (xdisplay, xpixmap, visual_info.visual, w_ret, h_ret);
}
static gboolean
try_pixmap_and_mask (MetaX11Display *x11_display,
Pixmap src_pixmap,
Pixmap src_mask,
cairo_surface_t **iconp)
{
Display *xdisplay = x11_display->xdisplay;
cairo_surface_t *icon, *mask = NULL;
int w, h, d;
if (src_pixmap == None)
return FALSE;
meta_x11_error_trap_push (x11_display);
get_pixmap_geometry (x11_display, src_pixmap, &w, &h, &d);
icon = surface_from_pixmap (xdisplay, src_pixmap, w, h);
if (icon && src_mask != None)
{
get_pixmap_geometry (x11_display, src_mask, &w, &h, &d);
if (d == 1)
mask = surface_from_pixmap (xdisplay, src_mask, w, h);
}
meta_x11_error_trap_pop (x11_display);
--
2.21.0

View File

@ -1,4 +1,4 @@
From 18d4fbb1fb641e2b507b3adcd13d231145a01cd6 Mon Sep 17 00:00:00 2001
From 99c74360451a85fca9dacad531ed22adbc1b0805 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 13 Feb 2018 09:44:50 -0500
Subject: [PATCH] main: be more aggressive in assuming X11 backend
@ -12,10 +12,10 @@ to X11 if the session type isn't set to wayland explicitly.
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/core/main.c b/src/core/main.c
index 629f8e94e..1e1e13367 100644
index a07dda9ecc..0d241f952b 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -333,7 +333,6 @@ find_session_type (void)
@@ -407,7 +407,6 @@ find_session_type (void)
char *session_id;
char *session_type;
const char *session_type_env;
@ -23,7 +23,7 @@ index 629f8e94e..1e1e13367 100644
int ret, i;
ret = sd_pid_get_session (0, &session_id);
@@ -346,8 +345,7 @@ find_session_type (void)
@@ -420,8 +419,7 @@ find_session_type (void)
{
if (session_type_is_supported (session_type))
goto out;
@ -33,7 +33,7 @@ index 629f8e94e..1e1e13367 100644
free (session_type);
}
}
@@ -379,8 +377,8 @@ find_session_type (void)
@@ -453,8 +451,8 @@ find_session_type (void)
goto out;
}
@ -45,5 +45,5 @@ index 629f8e94e..1e1e13367 100644
session_type = strdup ("x11");
goto out;
--
2.21.0
2.31.1

View File

@ -1,211 +0,0 @@
From 19024a5b2eff02b22cdb3fc90142f522dd361996 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Fri, 27 Nov 2020 09:03:38 +0100
Subject: [PATCH] monitor-config-manager: Handle multiple builtin panels
gracefully
While multiple built-in panels isn't actually supported in any
meaningful manner, if we would ever end up with such a situation, e.g.
due to kernel bugs[0], we shouldn't crash when trying to set an
'external only' without any external monitors.
While we could handle this with more degraded functionality (e.g. don't
support the 'switch' method of monitor configuration at all), handle it
by simply not trying to switch to external-only when there are no,
according to the kernel, external monitors available. This would e.g.
still allow betwene 'mirror-all', and 'linear' switches.
The crash itself was disguised as an arbitrary X11 BadValue error, due
to mutter trying to resize the root window to 0x0, as the monitor
configuration that was applied consisted of zero logical monitors, thus
was effectively empty.
[0] https://bugzilla.redhat.com/show_bug.cgi?id=1896904
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1899260
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1607>
---
src/backends/meta-monitor-config-manager.c | 3 +
src/tests/monitor-unit-tests.c | 145 +++++++++++++++++++++
2 files changed, 148 insertions(+)
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index bc1a39db8..d62bad52d 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -1157,6 +1157,9 @@ create_for_switch_config_external (MetaMonitorConfigManager *config_manager)
x += logical_monitor_config->layout.width;
}
+ if (!logical_monitor_configs)
+ return NULL;
+
return meta_monitors_config_new (monitor_manager,
logical_monitor_configs,
layout_mode,
diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c
index f47544b03..725f84173 100644
--- a/src/tests/monitor-unit-tests.c
+++ b/src/tests/monitor-unit-tests.c
@@ -3175,6 +3175,149 @@ meta_test_monitor_non_upright_panel (void)
check_monitor_configuration (&test_case);
}
+static void
+meta_test_monitor_switch_external_without_external (void)
+{
+ MonitorTestCase test_case = {
+ .setup = {
+ .modes = {
+ {
+ .width = 1024,
+ .height = 768,
+ .refresh_rate = 60.0
+ }
+ },
+ .n_modes = 1,
+ .outputs = {
+ {
+ .crtc = 0,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 0 },
+ .n_possible_crtcs = 1,
+ .width_mm = 222,
+ .height_mm = 125,
+ .is_laptop_panel = TRUE
+ },
+ {
+ .crtc = 1,
+ .modes = { 0 },
+ .n_modes = 1,
+ .preferred_mode = 0,
+ .possible_crtcs = { 1 },
+ .n_possible_crtcs = 1,
+ .width_mm = 222,
+ .height_mm = 125,
+ .is_laptop_panel = TRUE
+ }
+ },
+ .n_outputs = 2,
+ .crtcs = {
+ {
+ .current_mode = 0
+ },
+ {
+ .current_mode = 0
+ }
+ },
+ .n_crtcs = 2
+ },
+
+ .expect = {
+ .monitors = {
+ {
+ .outputs = { 0 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 1024,
+ .height = 768,
+ .refresh_rate = 60.0,
+ .crtc_modes = {
+ {
+ .output = 0,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125
+ },
+ {
+ .outputs = { 1 },
+ .n_outputs = 1,
+ .modes = {
+ {
+ .width = 1024,
+ .height = 768,
+ .refresh_rate = 60.0,
+ .crtc_modes = {
+ {
+ .output = 1,
+ .crtc_mode = 0
+ }
+ }
+ }
+ },
+ .n_modes = 1,
+ .current_mode = 0,
+ .width_mm = 222,
+ .height_mm = 125
+ }
+ },
+ .n_monitors = 2,
+ .logical_monitors = {
+ {
+ .monitors = { 0 },
+ .n_monitors = 1,
+ .layout = { .x = 0, .y = 0, .width = 1024, .height = 768 },
+ .scale = 1
+ },
+ {
+ .monitors = { 1 },
+ .n_monitors = 1,
+ .layout = { .x = 1024, .y = 0, .width = 1024, .height = 768 },
+ .scale = 1
+ }
+ },
+ .n_logical_monitors = 2,
+ .primary_logical_monitor = 0,
+ .n_outputs = 2,
+ .crtcs = {
+ {
+ .current_mode = 0,
+ },
+ {
+ .current_mode = 0,
+ },
+ },
+ .n_crtcs = 2,
+ .n_tiled_monitors = 0,
+ .screen_width = 2048,
+ .screen_height = 768
+ }
+ };
+ MetaMonitorTestSetup *test_setup;
+ MetaBackend *backend = meta_get_backend ();
+ MetaMonitorManager *monitor_manager =
+ meta_backend_get_monitor_manager (backend);
+
+ test_setup = create_monitor_test_setup (&test_case.setup,
+ MONITOR_TEST_FLAG_NO_STORED);
+ emulate_hotplug (test_setup);
+ check_monitor_configuration (&test_case);
+
+ meta_monitor_manager_switch_config (monitor_manager,
+ META_MONITOR_SWITCH_CONFIG_EXTERNAL);
+ check_monitor_configuration (&test_case);
+
+ check_monitor_test_clients_state ();
+}
+
static void
meta_test_monitor_custom_vertical_config (void)
{
@@ -5969,6 +6112,8 @@ init_monitor_tests (void)
meta_test_monitor_preferred_non_first_mode);
add_monitor_test ("/backends/monitor/non-upright-panel",
meta_test_monitor_non_upright_panel);
+ add_monitor_test ("/backends/monitor/switch-external-without-external",
+ meta_test_monitor_switch_external_without_external);
add_monitor_test ("/backends/monitor/custom/vertical-config",
meta_test_monitor_custom_vertical_config);
--
2.29.2

View File

@ -1,152 +0,0 @@
From 4904f1a1e5b881dfd5a051c15acecb3232dc8207 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Thu, 28 Jan 2016 15:26:33 +0100
Subject: [PATCH] monitor-manager: Consider external layout before default
linear config
In case of no existing configuration, we use a default layout of
aligning attached displays horizontally. This sidesteps any layout
configuration that is done externally, for instance via xorg.conf,
which is not desirable. Instead, base the initial configuration on
the existing layout if it passes some sanity checks before falling
back to the default linear config.
---
src/backends/meta-monitor-config-manager.c | 77 ++++++++++++++++++++++
src/backends/meta-monitor-config-manager.h | 2 +
src/backends/meta-monitor-manager.c | 19 ++++++
3 files changed, 98 insertions(+)
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index 9a54ce50f..d64ca1f79 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -643,6 +643,83 @@ create_preferred_logical_monitor_config (MetaMonitorManager *monitor_ma
return logical_monitor_config;
}
+static MetaLogicalMonitorConfig *
+create_logical_monitor_config_from_output (MetaMonitorManager *monitor_manager,
+ MetaMonitor *monitor,
+ MetaLogicalMonitorConfig *primary_logical_monitor_config,
+ MetaLogicalMonitorLayoutMode layout_mode)
+{
+ MetaOutput *output;
+ MetaCrtc *crtc;
+
+ output = meta_monitor_get_main_output (monitor);
+ crtc = meta_output_get_assigned_crtc (output);
+ return create_preferred_logical_monitor_config (monitor_manager,
+ monitor,
+ crtc->rect.x,
+ crtc->rect.y,
+ primary_logical_monitor_config,
+ layout_mode);
+}
+
+MetaMonitorsConfig *
+meta_monitor_config_manager_create_current (MetaMonitorConfigManager *config_manager)
+{
+ MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
+ GList *logical_monitor_configs;
+ MetaMonitor *primary_monitor;
+ MetaLogicalMonitorLayoutMode layout_mode;
+ MetaLogicalMonitorConfig *primary_logical_monitor_config;
+ GList *monitors;
+ GList *l;
+
+ if (meta_monitor_config_store_get_config_count (config_manager->config_store) > 0)
+ return NULL;
+
+ primary_monitor = find_primary_monitor (monitor_manager);
+ if (!primary_monitor || !meta_monitor_is_active (primary_monitor))
+ return NULL;
+
+ layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
+
+ primary_logical_monitor_config =
+ create_logical_monitor_config_from_output (monitor_manager,
+ primary_monitor,
+ NULL,
+ layout_mode);
+
+ primary_logical_monitor_config->is_primary = TRUE;
+ logical_monitor_configs = g_list_append (NULL,
+ primary_logical_monitor_config);
+
+ monitors = meta_monitor_manager_get_monitors (monitor_manager);
+ for (l = monitors; l; l = l->next)
+ {
+ MetaMonitor *monitor = l->data;
+ MetaLogicalMonitorConfig *logical_monitor_config;
+
+ if (monitor == primary_monitor)
+ continue;
+
+ if (!meta_monitor_is_active (monitor))
+ continue;
+
+ logical_monitor_config =
+ create_logical_monitor_config_from_output (monitor_manager,
+ monitor,
+ primary_logical_monitor_config,
+ layout_mode);
+
+ logical_monitor_configs = g_list_append (logical_monitor_configs,
+ logical_monitor_config);
+ }
+
+ return meta_monitors_config_new (monitor_manager,
+ logical_monitor_configs,
+ layout_mode,
+ META_MONITORS_CONFIG_FLAG_NONE);
+}
+
MetaMonitorsConfig *
meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_manager)
{
diff --git a/src/backends/meta-monitor-config-manager.h b/src/backends/meta-monitor-config-manager.h
index 3875e04e9..364a2b36b 100644
--- a/src/backends/meta-monitor-config-manager.h
+++ b/src/backends/meta-monitor-config-manager.h
@@ -94,6 +94,8 @@ gboolean meta_monitor_config_manager_assign (MetaMonitorManager *manager,
META_EXPORT_TEST
MetaMonitorsConfig * meta_monitor_config_manager_get_stored (MetaMonitorConfigManager *config_manager);
+META_EXPORT_TEST
+MetaMonitorsConfig * meta_monitor_config_manager_create_current (MetaMonitorConfigManager *config_manager);
META_EXPORT_TEST
MetaMonitorsConfig * meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_manager);
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 2d898c757..05b27c6be 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -614,6 +614,25 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
g_clear_object (&config);
}
+ config = meta_monitor_config_manager_create_current (manager->config_manager);
+ if (config)
+ {
+ if (!meta_monitor_manager_apply_monitors_config (manager,
+ config,
+ method,
+ &error))
+ {
+ g_clear_object (&config);
+ g_warning ("Failed to use current monitor configuration: %s",
+ error->message);
+ g_clear_error (&error);
+ }
+ else
+ {
+ goto done;
+ }
+ }
+
config = meta_monitor_config_manager_create_linear (manager->config_manager);
if (config)
{
--
2.21.0

View File

@ -1,41 +0,0 @@
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

@ -1,144 +0,0 @@
From 4ad8fd80355189ecbde6c38961335ae4be4db8b3 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 11 Sep 2018 10:19:44 -0400
Subject: [PATCH] monitor-manager: only reuse initial-config if monitor
topology matches startup
Right now we try to apply the current monitor config when a new
monitor is attached. The current config obviously doesn't include the
new monitor, so the new monitor isn't lit up.
The only reason we apply the current config at all is to handle the
startup case: We want to reuse the config set in Xorg when first
logging in.
This commit changes the code to look at the *initial config* instead
of the current config, and only if the new monitor topology matches
the start up topology.
---
src/backends/meta-monitor-config-manager.c | 20 +++++++++++++++-----
src/backends/meta-monitor-config-manager.h | 2 +-
src/backends/meta-monitor-manager.c | 16 +++++++++++++++-
3 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index d64ca1f79..c09edbe00 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -42,6 +42,7 @@ struct _MetaMonitorConfigManager
MetaMonitorConfigStore *config_store;
MetaMonitorsConfig *current_config;
+ MetaMonitorsConfig *initial_config;
GQueue config_history;
};
@@ -663,9 +664,10 @@ create_logical_monitor_config_from_output (MetaMonitorManager *monitor
}
MetaMonitorsConfig *
-meta_monitor_config_manager_create_current (MetaMonitorConfigManager *config_manager)
+meta_monitor_config_manager_create_initial (MetaMonitorConfigManager *config_manager)
{
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
+ MetaMonitorsConfig *initial_config;
GList *logical_monitor_configs;
MetaMonitor *primary_monitor;
MetaLogicalMonitorLayoutMode layout_mode;
@@ -673,6 +675,9 @@ meta_monitor_config_manager_create_current (MetaMonitorConfigManager *config_man
GList *monitors;
GList *l;
+ if (config_manager->initial_config != NULL)
+ return g_object_ref (config_manager->initial_config);
+
if (meta_monitor_config_store_get_config_count (config_manager->config_store) > 0)
return NULL;
@@ -714,10 +719,14 @@ meta_monitor_config_manager_create_current (MetaMonitorConfigManager *config_man
logical_monitor_config);
}
- return meta_monitors_config_new (monitor_manager,
- logical_monitor_configs,
- layout_mode,
- META_MONITORS_CONFIG_FLAG_NONE);
+ initial_config = meta_monitors_config_new (monitor_manager,
+ logical_monitor_configs,
+ layout_mode,
+ META_MONITORS_CONFIG_FLAG_NONE);
+
+ config_manager->initial_config = g_object_ref (initial_config);
+
+ return initial_config;
}
MetaMonitorsConfig *
@@ -1256,6 +1265,7 @@ meta_monitor_config_manager_dispose (GObject *object)
META_MONITOR_CONFIG_MANAGER (object);
g_clear_object (&config_manager->current_config);
+ g_clear_object (&config_manager->initial_config);
meta_monitor_config_manager_clear_history (config_manager);
G_OBJECT_CLASS (meta_monitor_config_manager_parent_class)->dispose (object);
diff --git a/src/backends/meta-monitor-config-manager.h b/src/backends/meta-monitor-config-manager.h
index 364a2b36b..409611bb0 100644
--- a/src/backends/meta-monitor-config-manager.h
+++ b/src/backends/meta-monitor-config-manager.h
@@ -95,7 +95,7 @@ META_EXPORT_TEST
MetaMonitorsConfig * meta_monitor_config_manager_get_stored (MetaMonitorConfigManager *config_manager);
META_EXPORT_TEST
-MetaMonitorsConfig * meta_monitor_config_manager_create_current (MetaMonitorConfigManager *config_manager);
+MetaMonitorsConfig * meta_monitor_config_manager_create_initial (MetaMonitorConfigManager *config_manager);
META_EXPORT_TEST
MetaMonitorsConfig * meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_manager);
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 05b27c6be..bb4b44188 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -534,9 +534,11 @@ should_use_stored_config (MetaMonitorManager *manager)
MetaMonitorsConfig *
meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
{
+ g_autoptr (MetaMonitorsConfig) initial_config = NULL;
MetaMonitorsConfig *config = NULL;
GError *error = NULL;
gboolean use_stored_config;
+ MetaMonitorsConfigKey *current_state_key;
MetaMonitorsConfigMethod method;
MetaMonitorsConfigMethod fallback_method =
META_MONITORS_CONFIG_METHOD_TEMPORARY;
@@ -547,6 +549,18 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
else
method = META_MONITORS_CONFIG_METHOD_TEMPORARY;
+ initial_config = meta_monitor_config_manager_create_initial (manager->config_manager);
+
+ if (initial_config)
+ {
+ current_state_key = meta_create_monitors_config_key_for_current_state (manager);
+
+ /* don't ever reuse initial configuration, if the monitor topology changed
+ */
+ if (current_state_key && !meta_monitors_config_key_equal (current_state_key, initial_config->key))
+ g_clear_object (&initial_config);
+ }
+
if (use_stored_config)
{
config = meta_monitor_config_manager_get_stored (manager->config_manager);
@@ -614,7 +628,7 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
g_clear_object (&config);
}
- config = meta_monitor_config_manager_create_current (manager->config_manager);
+ config = g_steal_pointer (&initial_config);
if (config)
{
if (!meta_monitor_manager_apply_monitors_config (manager,
--
2.21.0

View File

@ -1,272 +0,0 @@
From 849902beff553de41dd3940b17672ef98f687be5 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 4 Jun 2018 16:35:04 -0400
Subject: [PATCH] monitor-manager-xrandr: Force an update when resuming from
suspend
The stack below us isn't as reliable as we'd like and in some cases
doesn't generate RRScreenChangeNotify events when e.g. resuming a
laptop on a dock, meaning that we'd miss newly attached outputs.
---
src/backends/meta-gpu.c | 7 ++
src/backends/meta-gpu.h | 4 +
src/backends/x11/meta-gpu-xrandr.c | 26 ++++-
.../x11/meta-monitor-manager-xrandr.c | 96 +++++++++++++++++--
4 files changed, 123 insertions(+), 10 deletions(-)
diff --git a/src/backends/meta-gpu.c b/src/backends/meta-gpu.c
index 3577391e5..946f72387 100644
--- a/src/backends/meta-gpu.c
+++ b/src/backends/meta-gpu.c
@@ -64,6 +64,13 @@ meta_gpu_has_hotplug_mode_update (MetaGpu *gpu)
return FALSE;
}
+void
+meta_gpu_poll_hardware (MetaGpu *gpu)
+{
+ if (META_GPU_GET_CLASS (gpu)->poll_hardware)
+ META_GPU_GET_CLASS (gpu)->poll_hardware (gpu);
+}
+
gboolean
meta_gpu_read_current (MetaGpu *gpu,
GError **error)
diff --git a/src/backends/meta-gpu.h b/src/backends/meta-gpu.h
index 701acdc97..a2fd061f7 100644
--- a/src/backends/meta-gpu.h
+++ b/src/backends/meta-gpu.h
@@ -36,8 +36,12 @@ struct _MetaGpuClass
gboolean (* read_current) (MetaGpu *gpu,
GError **error);
+ void (* poll_hardware) (MetaGpu *gpu);
};
+META_EXPORT_TEST
+void meta_gpu_poll_hardware (MetaGpu *gpu);
+
META_EXPORT_TEST
gboolean meta_gpu_read_current (MetaGpu *gpu,
GError **error);
diff --git a/src/backends/x11/meta-gpu-xrandr.c b/src/backends/x11/meta-gpu-xrandr.c
index 3e8a7318d..90b33d486 100644
--- a/src/backends/x11/meta-gpu-xrandr.c
+++ b/src/backends/x11/meta-gpu-xrandr.c
@@ -44,6 +44,8 @@ struct _MetaGpuXrandr
int max_screen_width;
int max_screen_height;
+
+ gboolean need_hardware_poll;
};
G_DEFINE_TYPE (MetaGpuXrandr, meta_gpu_xrandr, META_TYPE_GPU)
@@ -81,6 +83,14 @@ get_xmode_name (XRRModeInfo *xmode)
return g_strdup_printf ("%dx%d", width, height);
}
+static void
+meta_gpu_xrandr_poll_hardware (MetaGpu *gpu)
+{
+ MetaGpuXrandr *gpu_xrandr = META_GPU_XRANDR (gpu);
+
+ gpu_xrandr->need_hardware_poll = TRUE;
+}
+
static gboolean
meta_gpu_xrandr_read_current (MetaGpu *gpu,
GError **error)
@@ -116,8 +126,18 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
monitor_manager->screen_width = WidthOfScreen (screen);
monitor_manager->screen_height = HeightOfScreen (screen);
- resources = XRRGetScreenResourcesCurrent (xdisplay,
- DefaultRootWindow (xdisplay));
+ if (gpu_xrandr->need_hardware_poll)
+ {
+ resources = XRRGetScreenResources (xdisplay,
+ DefaultRootWindow (xdisplay));
+ gpu_xrandr->need_hardware_poll = FALSE;
+ }
+ else
+ {
+ resources = XRRGetScreenResourcesCurrent (xdisplay,
+ DefaultRootWindow (xdisplay));
+ }
+
if (!resources)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
@@ -250,6 +270,7 @@ meta_gpu_xrandr_finalize (GObject *object)
static void
meta_gpu_xrandr_init (MetaGpuXrandr *gpu_xrandr)
{
+ gpu_xrandr->need_hardware_poll = TRUE;
}
static void
@@ -261,4 +282,5 @@ meta_gpu_xrandr_class_init (MetaGpuXrandrClass *klass)
object_class->finalize = meta_gpu_xrandr_finalize;
gpu_class->read_current = meta_gpu_xrandr_read_current;
+ gpu_class->poll_hardware = meta_gpu_xrandr_poll_hardware;
}
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index 448e51fae..d60f00325 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -71,6 +71,10 @@ struct _MetaMonitorManagerXrandr
Display *xdisplay;
int rr_event_base;
int rr_error_base;
+
+ guint logind_watch_id;
+ guint logind_signal_sub_id;
+
gboolean has_randr15;
/*
@@ -102,6 +106,8 @@ typedef struct _MetaMonitorXrandrData
GQuark quark_meta_monitor_xrandr_data;
+static void meta_monitor_manager_xrandr_update (MetaMonitorManagerXrandr *manager_xrandr);
+
Display *
meta_monitor_manager_xrandr_get_xdisplay (MetaMonitorManagerXrandr *manager_xrandr)
{
@@ -1016,6 +1022,62 @@ meta_monitor_manager_xrandr_get_default_layout_mode (MetaMonitorManager *manager
return META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL;
}
+static void
+logind_signal_handler (GDBusConnection *connection,
+ const gchar *sender_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data)
+{
+ MetaMonitorManagerXrandr *manager_xrandr = user_data;
+ gboolean suspending;
+
+ if (!g_str_equal (signal_name, "PrepareForSleep"))
+ return;
+
+ g_variant_get (parameters, "(b)", &suspending);
+ if (!suspending)
+ {
+ meta_gpu_poll_hardware (manager_xrandr->gpu);
+ meta_monitor_manager_xrandr_update (manager_xrandr);
+ }
+}
+
+static void
+logind_appeared (GDBusConnection *connection,
+ const gchar *name,
+ const gchar *name_owner,
+ gpointer user_data)
+{
+ MetaMonitorManagerXrandr *manager_xrandr = user_data;
+
+ manager_xrandr->logind_signal_sub_id = g_dbus_connection_signal_subscribe (connection,
+ "org.freedesktop.login1",
+ "org.freedesktop.login1.Manager",
+ "PrepareForSleep",
+ "/org/freedesktop/login1",
+ NULL,
+ G_DBUS_SIGNAL_FLAGS_NONE,
+ logind_signal_handler,
+ manager_xrandr,
+ NULL);
+}
+
+static void
+logind_vanished (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data)
+{
+ MetaMonitorManagerXrandr *manager_xrandr = user_data;
+
+ if (connection && manager_xrandr->logind_signal_sub_id > 0)
+ g_dbus_connection_signal_unsubscribe (connection, manager_xrandr->logind_signal_sub_id);
+
+ manager_xrandr->logind_signal_sub_id = 0;
+}
+
static void
meta_monitor_manager_xrandr_constructed (GObject *object)
{
@@ -1072,12 +1134,23 @@ meta_monitor_manager_xrandr_finalize (GObject *object)
g_hash_table_destroy (manager_xrandr->tiled_monitor_atoms);
g_free (manager_xrandr->supported_scales);
+ if (manager_xrandr->logind_watch_id > 0)
+ g_bus_unwatch_name (manager_xrandr->logind_watch_id);
+ manager_xrandr->logind_watch_id = 0;
+
G_OBJECT_CLASS (meta_monitor_manager_xrandr_parent_class)->finalize (object);
}
static void
meta_monitor_manager_xrandr_init (MetaMonitorManagerXrandr *manager_xrandr)
{
+ manager_xrandr->logind_watch_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
+ "org.freedesktop.login1",
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ logind_appeared,
+ logind_vanished,
+ manager_xrandr,
+ NULL);
}
static void
@@ -1123,9 +1196,8 @@ is_xvnc (MetaMonitorManager *manager)
return FALSE;
}
-gboolean
-meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xrandr,
- XEvent *event)
+static void
+meta_monitor_manager_xrandr_update (MetaMonitorManagerXrandr *manager_xrandr)
{
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr);
MetaGpuXrandr *gpu_xrandr;
@@ -1134,11 +1206,6 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
gboolean is_our_configuration;
unsigned int timestamp;
- if ((event->type - manager_xrandr->rr_event_base) != RRScreenChangeNotify)
- return FALSE;
-
- XRRUpdateConfiguration (event);
-
meta_monitor_manager_read_current_state (manager);
gpu_xrandr = META_GPU_XRANDR (manager_xrandr->gpu);
@@ -1173,6 +1240,19 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
meta_monitor_manager_xrandr_rebuild_derived (manager, config);
}
+}
+
+gboolean
+meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xrandr,
+ XEvent *event)
+{
+
+ if ((event->type - manager_xrandr->rr_event_base) != RRScreenChangeNotify)
+ return FALSE;
+
+ XRRUpdateConfiguration (event);
+
+ meta_monitor_manager_xrandr_update (manager_xrandr);
return TRUE;
}
--
2.21.0

View File

@ -1,114 +0,0 @@
From 078547521dd709d41ac3791322f711030ccc50e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 27 Nov 2019 19:03:50 +0100
Subject: [PATCH 1/2] monitor-manager-xrandr: Move dpms state and screen size
updating into helpers
To be used by no-Xrandr fallback path.
---
src/backends/x11/meta-gpu-xrandr.c | 37 +++++++++++++------
.../x11/meta-monitor-manager-xrandr.c | 18 ++++++---
2 files changed, 38 insertions(+), 17 deletions(-)
diff --git a/src/backends/x11/meta-gpu-xrandr.c b/src/backends/x11/meta-gpu-xrandr.c
index 90b33d486..1884278ca 100644
--- a/src/backends/x11/meta-gpu-xrandr.c
+++ b/src/backends/x11/meta-gpu-xrandr.c
@@ -91,6 +91,30 @@ meta_gpu_xrandr_poll_hardware (MetaGpu *gpu)
gpu_xrandr->need_hardware_poll = TRUE;
}
+static void
+update_screen_size (MetaGpuXrandr *gpu_xrandr)
+{
+ MetaGpu *gpu = META_GPU (gpu_xrandr);
+ MetaMonitorManager *monitor_manager = meta_gpu_get_monitor_manager (gpu);
+ MetaMonitorManagerXrandr *monitor_manager_xrandr =
+ META_MONITOR_MANAGER_XRANDR (monitor_manager);
+ Display *xdisplay =
+ meta_monitor_manager_xrandr_get_xdisplay (monitor_manager_xrandr);
+ int min_width, min_height;
+ Screen *screen;
+
+ XRRGetScreenSizeRange (xdisplay, DefaultRootWindow (xdisplay),
+ &min_width,
+ &min_height,
+ &gpu_xrandr->max_screen_width,
+ &gpu_xrandr->max_screen_height);
+
+ screen = ScreenOfDisplay (xdisplay, DefaultScreen (xdisplay));
+ /* This is updated because we called XRRUpdateConfiguration. */
+ monitor_manager->screen_width = WidthOfScreen (screen);
+ monitor_manager->screen_height = HeightOfScreen (screen);
+}
+
static gboolean
meta_gpu_xrandr_read_current (MetaGpu *gpu,
GError **error)
@@ -105,8 +129,6 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
RROutput primary_output;
unsigned int i, j;
GList *l;
- int min_width, min_height;
- Screen *screen;
GList *outputs = NULL;
GList *modes = NULL;
GList *crtcs = NULL;
@@ -115,16 +137,7 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
XRRFreeScreenResources (gpu_xrandr->resources);
gpu_xrandr->resources = NULL;
- XRRGetScreenSizeRange (xdisplay, DefaultRootWindow (xdisplay),
- &min_width,
- &min_height,
- &gpu_xrandr->max_screen_width,
- &gpu_xrandr->max_screen_height);
-
- screen = ScreenOfDisplay (xdisplay, DefaultScreen (xdisplay));
- /* This is updated because we called XRRUpdateConfiguration. */
- monitor_manager->screen_width = WidthOfScreen (screen);
- monitor_manager->screen_height = HeightOfScreen (screen);
+ update_screen_size (gpu_xrandr);
if (gpu_xrandr->need_hardware_poll)
{
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index b8d6342b6..7a0b43ac4 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -146,12 +146,9 @@ x11_dpms_state_to_power_save (CARD16 dpms_state)
}
static void
-meta_monitor_manager_xrandr_read_current_state (MetaMonitorManager *manager)
+meta_monitor_manager_xrandr_update_dpms_state (MetaMonitorManagerXrandr *manager_xrandr)
{
- MetaMonitorManagerXrandr *manager_xrandr =
- META_MONITOR_MANAGER_XRANDR (manager);
- MetaMonitorManagerClass *parent_class =
- META_MONITOR_MANAGER_CLASS (meta_monitor_manager_xrandr_parent_class);
+ MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr);
Display *xdisplay = meta_monitor_manager_xrandr_get_xdisplay (manager_xrandr);
BOOL dpms_capable, dpms_enabled;
CARD16 dpms_state;
@@ -167,6 +164,17 @@ meta_monitor_manager_xrandr_read_current_state (MetaMonitorManager *manager)
power_save_mode = META_POWER_SAVE_UNSUPPORTED;
meta_monitor_manager_power_save_mode_changed (manager, power_save_mode);
+}
+
+static void
+meta_monitor_manager_xrandr_read_current_state (MetaMonitorManager *manager)
+{
+ MetaMonitorManagerXrandr *manager_xrandr =
+ META_MONITOR_MANAGER_XRANDR (manager);
+ MetaMonitorManagerClass *parent_class =
+ META_MONITOR_MANAGER_CLASS (meta_monitor_manager_xrandr_parent_class);
+
+ meta_monitor_manager_xrandr_update_dpms_state (manager_xrandr);
parent_class->read_current_state (manager);
}
--
2.23.0

View File

@ -1,62 +0,0 @@
From 7e21503dc7c3b8321475eb5ccfdb23e71f86c0a0 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Tue, 6 Oct 2015 21:16:18 +0200
Subject: [PATCH] monitor-manager-xrandr: Work around spurious hotplugs on Xvnc
Xvnc turns its outputs off/on on every mode set which makes us believe
there was an hotplug when there actually wasn't. Work around this by
requiring new randr configuration timestamps to be ahead of the last
set timestamp by at least 100 ms for us to consider them an actual
hotplug.
---
.../x11/meta-monitor-manager-xrandr.c | 20 ++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index 45c81f4eb..448e51fae 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -1110,6 +1110,19 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
g_quark_from_static_string ("-meta-monitor-xrandr-data");
}
+static gboolean
+is_xvnc (MetaMonitorManager *manager)
+{
+ MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
+ GList *l;
+
+ for (l = meta_gpu_get_outputs (manager_xrandr->gpu); l; l = l->next)
+ if (g_str_has_prefix (((MetaOutput *)l->data)->name, "VNC-"))
+ return TRUE;
+
+ return FALSE;
+}
+
gboolean
meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xrandr,
XEvent *event)
@@ -1119,6 +1132,7 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
XRRScreenResources *resources;
gboolean is_hotplug;
gboolean is_our_configuration;
+ unsigned int timestamp;
if ((event->type - manager_xrandr->rr_event_base) != RRScreenChangeNotify)
return FALSE;
@@ -1130,7 +1144,11 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
gpu_xrandr = META_GPU_XRANDR (manager_xrandr->gpu);
resources = meta_gpu_xrandr_get_resources (gpu_xrandr);
- is_hotplug = resources->timestamp < resources->configTimestamp;
+ timestamp = resources->timestamp;
+ if (is_xvnc (manager))
+ timestamp += 100;
+
+ is_hotplug = (timestamp < resources->configTimestamp);
is_our_configuration = (resources->timestamp ==
manager_xrandr->last_xrandr_set_timestamp);
if (is_hotplug)
--
2.21.0

View File

@ -1,81 +0,0 @@
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

@ -1,108 +0,0 @@
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

@ -1,172 +0,0 @@
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

@ -1,40 +0,0 @@
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

@ -1,101 +0,0 @@
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

@ -1,4 +1,4 @@
From 9dfe362f41b8811450cb563c39899fafe8ec2b63 Mon Sep 17 00:00:00 2001
From 6e2ef652cd58136aa668d0c1bd843fe83f11a0ab Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Fri, 26 Oct 2018 08:49:39 +0200
Subject: [PATCH] wayland: Allow Xwayland grabs on selected apps
@ -9,19 +9,19 @@ Allow Xwayland grabs on a selected set of X11 applications.
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/data/org.gnome.mutter.wayland.gschema.xml.in b/data/org.gnome.mutter.wayland.gschema.xml.in
index 48241296e..7a6ab9288 100644
index 8a1878e105..5527a46bc6 100644
--- a/data/org.gnome.mutter.wayland.gschema.xml.in
+++ b/data/org.gnome.mutter.wayland.gschema.xml.in
@@ -60,7 +60,7 @@
@@ -66,7 +66,7 @@
gettext-domain="@GETTEXT_DOMAIN@">
<key name="xwayland-allow-grabs" type="b">
- <default>false</default>
+ <default>true</default>
<summary>Allow grabs with Xwayland</summary>
<summary>Allow X11 grabs to lock keyboard focus with Xwayland</summary>
<description>
Allow keyboard grabs issued by X11 applications running in Xwayland
@@ -73,7 +73,7 @@
Allow all keyboard events to be routed to X11 “override redirect”
@@ -86,7 +86,7 @@
</key>
<key name="xwayland-grab-access-rules" type="as">
@ -31,5 +31,5 @@ index 48241296e..7a6ab9288 100644
<description>
List the resource names or resource class of X11 windows either
--
2.21.0
2.31.1

View File

@ -0,0 +1,192 @@
From 5e4a1290ce75ed94e3f0f457d35a225f2ef3878c Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Tue, 28 Nov 2017 10:54:08 +0100
Subject: [PATCH] wayland: Avoid a race in wl_seat capabilities
The way wl_seat capabilities work, by notifying clients of capabilities
changes, and clients consequently requesting the relevant interface
objects (pointer, keyboard, touch) is inherently racy.
On quick VT changes for example, capabilities on the seat will be added
and removed, and by the time the client receives the capability change
notification and requests the relevant keyboard, pointer or touch,
another VT switch might have occurred and the wl_pointer, wl_keyboard or
wl_touch already destroyed, leading to a protocol error which kills the
client.
To avoid this, create the objects when requested regardless of the
capabilities.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1797
Related: https://bugzilla.gnome.org/show_bug.cgi?id=790932
---
src/wayland/meta-wayland-pointer.c | 45 ++++++++++++++++++++++++------
src/wayland/meta-wayland-seat.c | 9 ++----
src/wayland/meta-wayland-touch.c | 8 ------
3 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index 3132abfd2..abd779ad7 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -109,7 +109,7 @@ meta_wayland_pointer_client_new (void)
}
static void
-meta_wayland_pointer_client_free (MetaWaylandPointerClient *pointer_client)
+meta_wayland_pointer_make_resources_inert (MetaWaylandPointerClient *pointer_client)
{
struct wl_resource *resource, *next;
@@ -141,10 +141,25 @@ meta_wayland_pointer_client_free (MetaWaylandPointerClient *pointer_client)
wl_list_init (wl_resource_get_link (resource));
wl_resource_set_user_data (resource, NULL);
}
+}
+static void
+meta_wayland_pointer_client_free (MetaWaylandPointerClient *pointer_client)
+{
+ meta_wayland_pointer_make_resources_inert (pointer_client);
g_free (pointer_client);
}
+static void
+make_resources_inert_foreach (gpointer key,
+ gpointer value,
+ gpointer data)
+{
+ MetaWaylandPointerClient *pointer_client = value;
+
+ meta_wayland_pointer_make_resources_inert (pointer_client);
+}
+
static gboolean
meta_wayland_pointer_client_is_empty (MetaWaylandPointerClient *pointer_client)
{
@@ -158,8 +173,6 @@ MetaWaylandPointerClient *
meta_wayland_pointer_get_pointer_client (MetaWaylandPointer *pointer,
struct wl_client *client)
{
- if (!pointer->pointer_clients)
- return NULL;
return g_hash_table_lookup (pointer->pointer_clients, client);
}
@@ -475,10 +488,6 @@ meta_wayland_pointer_enable (MetaWaylandPointer *pointer)
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
ClutterSeat *clutter_seat;
- pointer->pointer_clients =
- g_hash_table_new_full (NULL, NULL, NULL,
- (GDestroyNotify) meta_wayland_pointer_client_free);
-
pointer->cursor_surface = NULL;
clutter_seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
@@ -508,6 +517,10 @@ meta_wayland_pointer_disable (MetaWaylandPointer *pointer)
ClutterBackend *clutter_backend = clutter_get_default_backend ();
ClutterSeat *clutter_seat = clutter_backend_get_default_seat (clutter_backend);
+ g_hash_table_foreach (pointer->pointer_clients,
+ make_resources_inert_foreach,
+ NULL);
+
g_signal_handlers_disconnect_by_func (cursor_tracker,
(gpointer) meta_wayland_pointer_on_cursor_changed,
pointer);
@@ -531,7 +544,6 @@ meta_wayland_pointer_disable (MetaWaylandPointer *pointer)
meta_wayland_pointer_set_focus (pointer, NULL);
meta_wayland_pointer_set_current (pointer, NULL);
- g_clear_pointer (&pointer->pointer_clients, g_hash_table_unref);
pointer->cursor_surface = NULL;
}
@@ -1356,11 +1368,28 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer)
pointer->default_grab.interface = &default_pointer_grab_interface;
pointer->default_grab.pointer = pointer;
pointer->grab = &pointer->default_grab;
+ pointer->pointer_clients =
+ g_hash_table_new_full (NULL, NULL, NULL,
+ (GDestroyNotify) meta_wayland_pointer_client_free);
+}
+
+static void
+meta_wayland_pointer_finalize (GObject *object)
+{
+ MetaWaylandPointer *pointer = META_WAYLAND_POINTER (object);
+
+ g_clear_pointer (&pointer->pointer_clients, g_hash_table_unref);
+
+ G_OBJECT_CLASS (meta_wayland_pointer_parent_class)->finalize (object);
}
static void
meta_wayland_pointer_class_init (MetaWaylandPointerClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = meta_wayland_pointer_finalize;
+
signals[FOCUS_SURFACE_CHANGED] = g_signal_new ("focus-surface-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index c6390dde7..efce6d6d6 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -46,8 +46,7 @@ seat_get_pointer (struct wl_client *client,
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
MetaWaylandPointer *pointer = seat->pointer;
- if (meta_wayland_seat_has_pointer (seat))
- meta_wayland_pointer_create_new_resource (pointer, client, resource, id);
+ meta_wayland_pointer_create_new_resource (pointer, client, resource, id);
}
static void
@@ -58,8 +57,7 @@ seat_get_keyboard (struct wl_client *client,
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
MetaWaylandKeyboard *keyboard = seat->keyboard;
- if (meta_wayland_seat_has_keyboard (seat))
- meta_wayland_keyboard_create_new_resource (keyboard, client, resource, id);
+ meta_wayland_keyboard_create_new_resource (keyboard, client, resource, id);
}
static void
@@ -70,8 +68,7 @@ seat_get_touch (struct wl_client *client,
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
MetaWaylandTouch *touch = seat->touch;
- if (meta_wayland_seat_has_touch (seat))
- meta_wayland_touch_create_new_resource (touch, client, resource, id);
+ meta_wayland_touch_create_new_resource (touch, client, resource, id);
}
static void
diff --git a/src/wayland/meta-wayland-touch.c b/src/wayland/meta-wayland-touch.c
index 002ff16f7..15f0312eb 100644
--- a/src/wayland/meta-wayland-touch.c
+++ b/src/wayland/meta-wayland-touch.c
@@ -521,16 +521,8 @@ meta_wayland_touch_create_new_resource (MetaWaylandTouch *touch,
struct wl_resource *seat_resource,
uint32_t id)
{
- MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
struct wl_resource *cr;
- if (!meta_wayland_seat_has_touch (seat))
- {
- wl_resource_post_error (seat_resource, WL_DISPLAY_ERROR_INVALID_METHOD,
- "Cannot retrieve touch interface without touch capability");
- return;
- }
-
cr = wl_resource_create (client, &wl_touch_interface, wl_resource_get_version (seat_resource), id);
wl_resource_set_implementation (cr, &touch_interface, touch, unbind_resource);
wl_list_insert (&touch->resource_list, wl_resource_get_link (cr));
--
2.31.1

View File

@ -1,109 +0,0 @@
From f2b3dd318f1165849b45a86251724939b100ef7d Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Mon, 28 Oct 2019 18:07:31 +0100
Subject: [PATCH] wayland: Check stylus serials on
meta_wayland_seat_can_popup()
This allows xdg_popup.grab() to work with styli. Without this check
we would bail out and emit xdg_popup.popup_done, leaving stylus users
unable to interact with popup menus, comboboxes, etc...
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/886
---
src/wayland/meta-wayland-seat.c | 10 +++++++++-
src/wayland/meta-wayland-tablet-seat.c | 17 +++++++++++++++++
src/wayland/meta-wayland-tablet-seat.h | 2 ++
src/wayland/meta-wayland-tablet-tool.c | 7 +++++++
src/wayland/meta-wayland-tablet-tool.h | 2 ++
5 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index 91fe376ff..cf41d6eb8 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -504,9 +504,17 @@ gboolean
meta_wayland_seat_can_popup (MetaWaylandSeat *seat,
uint32_t serial)
{
+ MetaWaylandCompositor *compositor;
+ MetaWaylandTabletSeat *tablet_seat;
+
+ compositor = meta_wayland_compositor_get_default ();
+ tablet_seat =
+ meta_wayland_tablet_manager_ensure_seat (compositor->tablet_manager, seat);
+
return (meta_wayland_pointer_can_popup (seat->pointer, serial) ||
meta_wayland_keyboard_can_popup (seat->keyboard, serial) ||
- meta_wayland_touch_can_popup (seat->touch, serial));
+ meta_wayland_touch_can_popup (seat->touch, serial) ||
+ meta_wayland_tablet_seat_can_popup (tablet_seat, serial));
}
gboolean
diff --git a/src/wayland/meta-wayland-tablet-seat.c b/src/wayland/meta-wayland-tablet-seat.c
index b4bc4aa58..b1964714a 100644
--- a/src/wayland/meta-wayland-tablet-seat.c
+++ b/src/wayland/meta-wayland-tablet-seat.c
@@ -552,3 +552,20 @@ meta_wayland_tablet_seat_set_pad_focus (MetaWaylandTabletSeat *tablet_seat,
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &pad))
meta_wayland_tablet_pad_set_focus (pad, surface);
}
+
+gboolean
+meta_wayland_tablet_seat_can_popup (MetaWaylandTabletSeat *tablet_seat,
+ uint32_t serial)
+{
+ MetaWaylandTabletTool *tool;
+ GHashTableIter iter;
+
+ g_hash_table_iter_init (&iter, tablet_seat->tools);
+ while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &tool))
+ {
+ if (meta_wayland_tablet_tool_can_popup (tool, serial))
+ return TRUE;
+ }
+
+ return FALSE;
+}
diff --git a/src/wayland/meta-wayland-tablet-seat.h b/src/wayland/meta-wayland-tablet-seat.h
index c083dec5f..e3be5f264 100644
--- a/src/wayland/meta-wayland-tablet-seat.h
+++ b/src/wayland/meta-wayland-tablet-seat.h
@@ -75,5 +75,7 @@ MetaWaylandTablet *meta_wayland_tablet_seat_lookup_paired_tablet (MetaWaylan
MetaWaylandTabletPad *pad);
GList *meta_wayland_tablet_seat_lookup_paired_pads (MetaWaylandTabletSeat *tablet_seat,
MetaWaylandTablet *tablet);
+gboolean meta_wayland_tablet_seat_can_popup (MetaWaylandTabletSeat *tablet_seat,
+ uint32_t serial);
#endif /* META_WAYLAND_TABLET_SEAT_H */
diff --git a/src/wayland/meta-wayland-tablet-tool.c b/src/wayland/meta-wayland-tablet-tool.c
index c02831d73..065c834bb 100644
--- a/src/wayland/meta-wayland-tablet-tool.c
+++ b/src/wayland/meta-wayland-tablet-tool.c
@@ -1018,3 +1018,10 @@ meta_wayland_tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool,
return ((tool->down_serial == serial || tool->button_serial == serial) &&
tablet_tool_can_grab_surface (tool, surface));
}
+
+gboolean
+meta_wayland_tablet_tool_can_popup (MetaWaylandTabletTool *tool,
+ uint32_t serial)
+{
+ return tool->down_serial == serial || tool->button_serial == serial;
+}
diff --git a/src/wayland/meta-wayland-tablet-tool.h b/src/wayland/meta-wayland-tablet-tool.h
index 71bc86643..315e26bde 100644
--- a/src/wayland/meta-wayland-tablet-tool.h
+++ b/src/wayland/meta-wayland-tablet-tool.h
@@ -85,5 +85,7 @@ void meta_wayland_tablet_tool_set_cursor_position (MetaWaylandTabletTool *t
gboolean meta_wayland_tablet_tool_can_grab_surface (MetaWaylandTabletTool *tool,
MetaWaylandSurface *surface,
uint32_t serial);
+gboolean meta_wayland_tablet_tool_can_popup (MetaWaylandTabletTool *tool,
+ uint32_t serial);
#endif /* META_WAYLAND_TABLET_TOOL_H */
--
2.23.0

View File

@ -1,150 +0,0 @@
From 9269b09028ae51c7bb74e9cc9aefafd8eaa882d6 Mon Sep 17 00:00:00 2001
From: Robert Mader <robert.mader@posteo.de>
Date: Tue, 16 Apr 2019 23:35:28 +0200
Subject: [PATCH 1/2] wayland: Move check for present window out of the
actor-surface class
All child classes of `MetaWaylandShellSurface` as well as
`MetaWaylandSurfaceRoleXWayland` should only sync their actor if
their toplevel surface has a window. Currently this check is done
in the actor-surface class, but not all surface classes have a
toplevel window, e.g. dnd-surfaces.
Move the check to the right places.
For subsurfaces this assumes that the subsurface is not the child of
a window-less surface (like, as stated above, e.g. a dnd-surface).
If we want to support subsurfaces of window-less surfaces in the future
we have to extend the check here.
But as this is not a regression, ignore this case for now.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/537
(cherry picked from commit 7e2a0ede16bed5671fe55d3d81ccc9f82eebd94b)
---
src/wayland/meta-wayland-actor-surface.c | 7 -------
src/wayland/meta-wayland-shell-surface.c | 20 ++++++++++++++++++++
src/wayland/meta-wayland-subsurface.c | 5 ++++-
src/wayland/meta-xwayland.c | 18 ++++++++++++++++++
4 files changed, 42 insertions(+), 8 deletions(-)
diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c
index 037dd901ab..e2143e51f1 100644
--- a/src/wayland/meta-wayland-actor-surface.c
+++ b/src/wayland/meta-wayland-actor-surface.c
@@ -295,9 +295,6 @@ meta_wayland_actor_surface_commit (MetaWaylandSurfaceRole *surface_role,
META_WAYLAND_ACTOR_SURFACE (surface_role);
MetaWaylandActorSurfacePrivate *priv =
meta_wayland_actor_surface_get_instance_private (actor_surface);
- MetaWaylandSurface *surface =
- meta_wayland_surface_role_get_surface (surface_role);
- MetaWaylandSurface *toplevel_surface;
if (!wl_list_empty (&pending->frame_callback_list) &&
priv->actor &&
@@ -311,10 +308,6 @@ meta_wayland_actor_surface_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_actor_surface_queue_frame_callbacks (actor_surface, pending);
- toplevel_surface = meta_wayland_surface_get_toplevel (surface);
- if (!toplevel_surface || !toplevel_surface->window)
- return;
-
meta_wayland_actor_surface_sync_actor_state (actor_surface);
}
diff --git a/src/wayland/meta-wayland-shell-surface.c b/src/wayland/meta-wayland-shell-surface.c
index 04f2aaeea8..f8354ab7c5 100644
--- a/src/wayland/meta-wayland-shell-surface.c
+++ b/src/wayland/meta-wayland-shell-surface.c
@@ -175,6 +175,22 @@ meta_wayland_shell_surface_surface_commit (MetaWaylandSurfaceRole *surface_role
window->buffer_rect.height = cogl_texture_get_height (texture) * scale;
}
+static void
+meta_wayland_shell_surface_sync_actor_state (MetaWaylandActorSurface *actor_surface)
+{
+ MetaWaylandSurfaceRole *surface_role =
+ META_WAYLAND_SURFACE_ROLE (actor_surface);
+ MetaWaylandSurface *surface =
+ meta_wayland_surface_role_get_surface (surface_role);
+ MetaWaylandActorSurfaceClass *actor_surface_class =
+ META_WAYLAND_ACTOR_SURFACE_CLASS (meta_wayland_shell_surface_parent_class);
+ MetaWaylandSurface *toplevel_surface;
+
+ toplevel_surface = meta_wayland_surface_get_toplevel (surface);
+ if (toplevel_surface && toplevel_surface->window)
+ actor_surface_class->sync_actor_state (actor_surface);
+}
+
static void
meta_wayland_shell_surface_init (MetaWaylandShellSurface *role)
{
@@ -185,6 +201,10 @@ meta_wayland_shell_surface_class_init (MetaWaylandShellSurfaceClass *klass)
{
MetaWaylandSurfaceRoleClass *surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (klass);
+ MetaWaylandActorSurfaceClass *actor_surface_class =
+ META_WAYLAND_ACTOR_SURFACE_CLASS (klass);
surface_role_class->commit = meta_wayland_shell_surface_surface_commit;
+ actor_surface_class->sync_actor_state =
+ meta_wayland_shell_surface_sync_actor_state;
}
diff --git a/src/wayland/meta-wayland-subsurface.c b/src/wayland/meta-wayland-subsurface.c
index c7059b99a2..9a7ff3ec12 100644
--- a/src/wayland/meta-wayland-subsurface.c
+++ b/src/wayland/meta-wayland-subsurface.c
@@ -199,8 +199,11 @@ meta_wayland_subsurface_sync_actor_state (MetaWaylandActorSurface *actor_surface
meta_wayland_surface_role_get_surface (surface_role);
MetaWaylandActorSurfaceClass *actor_surface_class =
META_WAYLAND_ACTOR_SURFACE_CLASS (meta_wayland_subsurface_parent_class);
+ MetaWaylandSurface *toplevel_surface;
- actor_surface_class->sync_actor_state (actor_surface);
+ toplevel_surface = meta_wayland_surface_get_toplevel (surface);
+ if (toplevel_surface && toplevel_surface->window)
+ actor_surface_class->sync_actor_state (actor_surface);
sync_actor_subsurface_state (surface);
}
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 6e4b9a8ffd..b71c638d93 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -794,6 +794,20 @@ xwayland_surface_get_toplevel (MetaWaylandSurfaceRole *surface_role)
return meta_wayland_surface_role_get_surface (surface_role);
}
+static void
+xwayland_surface_sync_actor_state (MetaWaylandActorSurface *actor_surface)
+{
+ MetaWaylandSurfaceRole *surface_role =
+ META_WAYLAND_SURFACE_ROLE (actor_surface);
+ MetaWaylandSurface *surface =
+ meta_wayland_surface_role_get_surface (surface_role);
+ MetaWaylandActorSurfaceClass *actor_surface_class =
+ META_WAYLAND_ACTOR_SURFACE_CLASS (meta_wayland_surface_role_xwayland_parent_class);
+
+ if (surface->window)
+ actor_surface_class->sync_actor_state (actor_surface);
+}
+
static void
meta_wayland_surface_role_xwayland_init (MetaWaylandSurfaceRoleXWayland *role)
{
@@ -804,9 +818,13 @@ meta_wayland_surface_role_xwayland_class_init (MetaWaylandSurfaceRoleXWaylandCla
{
MetaWaylandSurfaceRoleClass *surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (klass);
+ MetaWaylandActorSurfaceClass *actor_surface_class =
+ META_WAYLAND_ACTOR_SURFACE_CLASS (klass);
surface_role_class->get_toplevel = xwayland_surface_get_toplevel;
+ actor_surface_class->sync_actor_state = xwayland_surface_sync_actor_state;
+
xwayland_surface_signals[XWAYLAND_SURFACE_WINDOW_ASSOCIATED] =
g_signal_new ("window-associated",
G_TYPE_FROM_CLASS (klass),
--
2.31.1

View File

@ -1,35 +0,0 @@
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

@ -1,4 +1,4 @@
From 6bca5f001338d4647e4e21d549c8cdea4bcad669 Mon Sep 17 00:00:00 2001
From 9efcc35102b4c41265e93461b35a1193b3d5822d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Fri, 12 May 2017 13:40:31 +0200
Subject: [PATCH] window-actor: Special-case shaped Java windows
@ -8,28 +8,28 @@ They got lucky until commit b975676c changed the fallback case,
but now their compliance tests are broken. Make them happy again
by special-casing shaped Java windows.
---
src/compositor/meta-window-actor.c | 8 ++++++++
src/compositor/meta-window-actor-x11.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index f850cb222..1c8dc8fe5 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -798,6 +798,14 @@ meta_window_actor_has_shadow (MetaWindowActor *self)
if (priv->window->has_custom_frame_extents)
diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c
index b7032e0ba..b05d5e158 100644
--- a/src/compositor/meta-window-actor-x11.c
+++ b/src/compositor/meta-window-actor-x11.c
@@ -528,6 +528,14 @@ has_shadow (MetaWindowActorX11 *actor_x11)
*/
if (window->has_custom_frame_extents)
return FALSE;
+
+ /*
+ * OpenJDK wrongly assumes that shaping a window implies no compositor
+ * shadows; make its compliance tests happy to give it what it wants ...
+ */
+ if (g_strcmp0 (priv->window->res_name, "sun-awt-X11-XWindowPeer") == 0 &&
+ priv->window->shape_region != NULL)
+ if (g_strcmp0 (window->res_name, "sun-awt-X11-XWindowPeer") == 0 &&
+ window->shape_region != NULL)
+ return FALSE;
+
/*
* Generate shadows for all other windows.
*/
--
2.21.0
2.23.0

View File

@ -1,33 +0,0 @@
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,83 +0,0 @@
From eca25ab6a12770a2a767458d9b0129d4fde3995c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Tue, 13 Nov 2018 08:31:52 +0100
Subject: [PATCH 1/2] workspace: Focus only ancestors that are focusable
When destroying a window that has a parent, we initially try to focus one of
its ancestors. However if no ancestor can be focused, then we should instead
focus the default focus window instead of trying to request focus for a window
that can't get focus anyways.
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/308
(cherry picked from commit eccc791f3b3451216f957e67fec47a73b65ed2b2)
---
src/core/workspace.c | 37 +++++++++++++++++++++++++++----------
1 file changed, 27 insertions(+), 10 deletions(-)
diff --git a/src/core/workspace.c b/src/core/workspace.c
index f2b2c2c48..58fcfa78c 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -85,6 +85,12 @@ typedef struct _MetaWorkspaceLogicalMonitorData
MetaRectangle logical_monitor_work_area;
} MetaWorkspaceLogicalMonitorData;
+typedef struct _MetaWorkspaceFocusableAncestorData
+{
+ MetaWorkspace *workspace;
+ MetaWindow *out_window;
+} MetaWorkspaceFocusableAncestorData;
+
static MetaWorkspaceLogicalMonitorData *
meta_workspace_get_logical_monitor_data (MetaWorkspace *workspace,
MetaLogicalMonitor *logical_monitor)
@@ -1322,13 +1328,20 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace,
}
static gboolean
-record_ancestor (MetaWindow *window,
- void *data)
+find_focusable_ancestor (MetaWindow *window,
+ gpointer user_data)
{
- MetaWindow **result = data;
+ MetaWorkspaceFocusableAncestorData *data = user_data;
+
+ if (!window->unmanaging && meta_window_is_focusable (window) &&
+ meta_window_located_on_workspace (window, data->workspace) &&
+ meta_window_showing_on_its_workspace (window))
+ {
+ data->out_window = window;
+ return FALSE;
+ }
- *result = window;
- return FALSE; /* quit with the first ancestor we find */
+ return TRUE;
}
/* Focus ancestor of not_this_one if there is one */
@@ -1350,11 +1363,15 @@ focus_ancestor_or_top_window (MetaWorkspace *workspace,
if (not_this_one)
{
MetaWindow *ancestor;
- ancestor = NULL;
- meta_window_foreach_ancestor (not_this_one, record_ancestor, &ancestor);
- if (ancestor != NULL &&
- meta_window_located_on_workspace (ancestor, workspace) &&
- meta_window_showing_on_its_workspace (ancestor))
+ MetaWorkspaceFocusableAncestorData data;
+
+ data = (MetaWorkspaceFocusableAncestorData) {
+ .workspace = workspace,
+ };
+ meta_window_foreach_ancestor (not_this_one, find_focusable_ancestor, &data);
+ ancestor = data.out_window;
+
+ if (ancestor)
{
meta_topic (META_DEBUG_FOCUS,
"Focusing %s, ancestor of %s\n",
--
2.21.0

View File

@ -1,80 +0,0 @@
From 52536a44e96aa34d3ec3b9332adaa15a6399fc3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Tue, 4 Jun 2019 21:21:37 +0200
Subject: [PATCH] workspace-manager: Expose layout properties
gnome-shell hardcodes a vertical one-column workspace layout, and
while not supporting arbitrary grids is very much by design, it
currently doesn't have a choice: We simply don't expose the workspace
layout we use.
Change that to allow gnome-shell to be a bit more flexible with the
workspace layouts it supports.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/618
---
src/core/meta-workspace-manager.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/core/meta-workspace-manager.c b/src/core/meta-workspace-manager.c
index 8e1f03fe8..fbae34c73 100644
--- a/src/core/meta-workspace-manager.c
+++ b/src/core/meta-workspace-manager.c
@@ -50,6 +50,9 @@ enum
{
PROP_0,
+ PROP_LAYOUT_COLUMNS,
+ PROP_LAYOUT_ROWS,
+
PROP_N_WORKSPACES
};
@@ -68,6 +71,12 @@ meta_workspace_manager_get_property (GObject *object,
switch (prop_id)
{
+ case PROP_LAYOUT_COLUMNS:
+ g_value_set_int (value, workspace_manager->columns_of_workspaces);
+ break;
+ case PROP_LAYOUT_ROWS:
+ g_value_set_int (value, workspace_manager->rows_of_workspaces);
+ break;
case PROP_N_WORKSPACES:
g_value_set_int (value, meta_workspace_manager_get_n_workspaces (workspace_manager));
break;
@@ -154,6 +163,22 @@ meta_workspace_manager_class_init (MetaWorkspaceManagerClass *klass)
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
+ g_object_class_install_property (object_class,
+ PROP_LAYOUT_COLUMNS,
+ g_param_spec_int ("layout-columns",
+ "Layout columns",
+ "Number of columns in layout",
+ -1, G_MAXINT, 1,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class,
+ PROP_LAYOUT_ROWS,
+ g_param_spec_int ("layout-rows",
+ "Layout rows",
+ "Number of rows in layout",
+ -1, G_MAXINT, -1,
+ G_PARAM_READABLE));
+
g_object_class_install_property (object_class,
PROP_N_WORKSPACES,
g_param_spec_int ("n-workspaces",
@@ -474,6 +499,8 @@ meta_workspace_manager_update_workspace_layout (MetaWorkspaceManager *workspace_
workspace_manager->columns_of_workspaces,
workspace_manager->vertical_workspaces,
workspace_manager->starting_corner);
+ g_object_notify (G_OBJECT (workspace_manager), "layout-columns");
+ g_object_notify (G_OBJECT (workspace_manager), "layout-rows");
}
/**
--
2.21.0

View File

@ -1,53 +0,0 @@
From 57b3a2ea620f754cfd38f1ed4851dd8223efbcab Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 28 Nov 2019 22:50:36 +0100
Subject: [PATCH] x11: Check wacom button flags to determine whether button is
mode switch
Checking the leds is not really accurate, since some devices have mode
switch buttons without leds. Check in the button flags whether they are
mode switch buttons for any of ring/ring2/strip/strip2, and return the
appropriate group.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/952
---
.../clutter/x11/clutter-input-device-xi2.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/clutter/clutter/x11/clutter-input-device-xi2.c b/clutter/clutter/x11/clutter-input-device-xi2.c
index 1254aca3ae..4e5e2fd12c 100644
--- a/clutter/clutter/x11/clutter-input-device-xi2.c
+++ b/clutter/clutter/x11/clutter-input-device-xi2.c
@@ -155,14 +155,25 @@ clutter_input_device_xi2_get_button_group (ClutterInputDevice *device,
if (device_xi2->wacom_device)
{
+ WacomButtonFlags flags;
+
if (button >= libwacom_get_num_buttons (device_xi2->wacom_device))
return -1;
- return libwacom_get_button_led_group (device_xi2->wacom_device,
- 'A' + button);
+ flags = libwacom_get_button_flag (device_xi2->wacom_device,
+ 'A' + button);
+
+ if (flags &
+ (WACOM_BUTTON_RING_MODESWITCH |
+ WACOM_BUTTON_TOUCHSTRIP_MODESWITCH))
+ return 0;
+ if (flags &
+ (WACOM_BUTTON_RING2_MODESWITCH |
+ WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH))
+ return 1;
}
- else
- return -1;
+
+ return -1;
}
#endif
--
2.24.0

View File

@ -1,304 +0,0 @@
From d366b2bc4e89ed5807f0221afc25e66cb3d289ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 9 Dec 2020 11:23:37 +0100
Subject: [PATCH 1/2] xwayland: Don't spew warnings when looking for X11
displays
It's not important, so only show it when doing MUTTER_DEBUG=wayland.
Instead report what display numbers were eventually found.
---
src/wayland/meta-xwayland.c | 123 +++++++++++++++++++++++++++---------
1 file changed, 92 insertions(+), 31 deletions(-)
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 15c85df69..699d5561c 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -146,9 +146,10 @@ meta_xwayland_is_xwayland_surface (MetaWaylandSurface *surface)
}
static gboolean
-try_display (int display,
- char **filename_out,
- int *fd_out)
+try_display (int display,
+ char **filename_out,
+ int *fd_out,
+ GError **error)
{
gboolean ret = FALSE;
char *filename;
@@ -164,11 +165,32 @@ try_display (int display,
char pid[11];
char *end;
pid_t other;
+ int read_bytes;
fd = open (filename, O_CLOEXEC, O_RDONLY);
- if (fd < 0 || read (fd, pid, 11) != 11)
+ if (fd < 0)
{
- g_warning ("can't read lock file %s: %m", filename);
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to open lock file %s: %s",
+ filename, g_strerror (errno));
+ goto out;
+ }
+
+ read_bytes = read (fd, pid, 11);
+ if (read_bytes != 11)
+ {
+ if (read_bytes < 0)
+ {
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to read lock file %s: %s",
+ filename, g_strerror (errno));
+ }
+ else
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Failed to read lock file %s",
+ filename);
+ }
goto out;
}
close (fd);
@@ -178,7 +200,8 @@ try_display (int display,
other = strtol (pid, &end, 0);
if (end != pid + 10)
{
- g_warning ("can't parse lock file %s", filename);
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+ "Can't parse lock file %s", filename);
goto out;
}
@@ -187,18 +210,23 @@ try_display (int display,
/* Process is dead. Try unlinking the lock file and trying again. */
if (unlink (filename) < 0)
{
- g_warning ("failed to unlink stale lock file %s: %m", filename);
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to unlink stale lock file %s: %m", filename);
goto out;
}
goto again;
}
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Lock file %s already occupied", filename);
goto out;
}
else if (fd < 0)
{
- g_warning ("failed to create lock file %s: %m", filename);
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Failed to create lock file %s: %s",
+ filename, g_strerror (errno));
goto out;
}
@@ -223,24 +251,34 @@ try_display (int display,
}
static char *
-create_lock_file (int display, int *display_out)
+create_lock_file (int display,
+ int *display_out,
+ GError **error)
{
+ g_autoptr (GError) local_error = NULL;
char *filename;
int fd;
-
char pid[12];
int size;
int number_of_tries = 0;
- while (!try_display (display, &filename, &fd))
+ while (!try_display (display, &filename, &fd, &local_error))
{
+ meta_verbose ("Failed to open display %d: %s\n",
+ display, local_error->message);
+ g_clear_error (&local_error);
+
display++;
number_of_tries++;
/* If we can't get a display after 50 times, then something's wrong. Just
* abort in this case. */
if (number_of_tries >= 50)
- return NULL;
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Tried to bind 50 display numbers, giving up");
+ return NULL;
+ }
}
/* Subtle detail: we use the pid of the wayland compositor, not the xserver
@@ -248,11 +286,22 @@ create_lock_file (int display, int *display_out)
* it _would've_ written without either the NUL or the size clamping, hence
* the disparity in size. */
size = snprintf (pid, 12, "%10d\n", getpid ());
+ errno = 0;
if (size != 11 || write (fd, pid, 11) != 11)
{
+ if (errno != 0)
+ {
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to write pid to lock file: %s",
+ g_strerror (errno));
+ }
+ else
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Failed to write pid to lock file");
+ }
unlink (filename);
close (fd);
- g_warning ("failed to write pid to lock file %s", filename);
g_free (filename);
return NULL;
}
@@ -264,8 +313,8 @@ create_lock_file (int display, int *display_out)
}
static int
-bind_to_abstract_socket (int display,
- gboolean *fatal)
+bind_to_abstract_socket (int display,
+ GError **error)
{
struct sockaddr_un addr;
socklen_t size, name_size;
@@ -274,8 +323,8 @@ bind_to_abstract_socket (int display,
fd = socket (PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (fd < 0)
{
- *fatal = TRUE;
- g_warning ("Failed to create socket: %m");
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to create socket: %s", g_strerror (errno));
return -1;
}
@@ -285,17 +334,18 @@ bind_to_abstract_socket (int display,
size = offsetof (struct sockaddr_un, sun_path) + name_size;
if (bind (fd, (struct sockaddr *) &addr, size) < 0)
{
- *fatal = errno != EADDRINUSE;
- g_warning ("failed to bind to @%s: %m", addr.sun_path + 1);
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to bind to @%s: %s",
+ addr.sun_path + 1, g_strerror (errno));
close (fd);
return -1;
}
if (listen (fd, 1) < 0)
{
- *fatal = errno != EADDRINUSE;
- g_warning ("Failed to listen on abstract socket @%s: %m",
- addr.sun_path + 1);
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to listen on abstract socket @%s: %s",
+ addr.sun_path + 1, g_strerror (errno));
close (fd);
return -1;
}
@@ -304,7 +354,8 @@ bind_to_abstract_socket (int display,
}
static int
-bind_to_unix_socket (int display)
+bind_to_unix_socket (int display,
+ GError **error)
{
struct sockaddr_un addr;
socklen_t size, name_size;
@@ -321,13 +372,18 @@ bind_to_unix_socket (int display)
unlink (addr.sun_path);
if (bind (fd, (struct sockaddr *) &addr, size) < 0)
{
- g_warning ("failed to bind to %s: %m\n", addr.sun_path);
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to bind to %s: %s",
+ addr.sun_path, g_strerror (errno));
close (fd);
return -1;
}
if (listen (fd, 1) < 0)
{
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to listen on %s: %s",
+ addr.sun_path, g_strerror (errno));
unlink (addr.sun_path);
close (fd);
return -1;
@@ -385,7 +441,6 @@ choose_xdisplay (MetaXWaylandManager *manager)
{
int display = 0;
char *lock_file = NULL;
- gboolean fatal = FALSE;
if (display_number_override != -1)
display = display_number_override;
@@ -394,33 +449,37 @@ choose_xdisplay (MetaXWaylandManager *manager)
do
{
- lock_file = create_lock_file (display, &display);
+ g_autoptr (GError) error = NULL;
+
+ lock_file = create_lock_file (display, &display, &error);
if (!lock_file)
{
- g_warning ("Failed to create an X lock file");
+ g_warning ("Failed to create an X lock file: %s", error->message);
return FALSE;
}
- manager->abstract_fd = bind_to_abstract_socket (display, &fatal);
+ manager->abstract_fd = bind_to_abstract_socket (display, &error);
if (manager->abstract_fd < 0)
{
unlink (lock_file);
- if (!fatal)
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_ADDRESS_IN_USE))
{
+ meta_verbose ("Failed to bind abstract socket: %s\n", error->message);
display++;
continue;
}
else
{
- g_warning ("Failed to bind abstract socket");
+ g_warning ("Failed to bind abstract socket: %s", error->message);
return FALSE;
}
}
- manager->unix_fd = bind_to_unix_socket (display);
+ manager->unix_fd = bind_to_unix_socket (display, &error);
if (manager->unix_fd < 0)
{
+ meta_verbose ("Failed to bind unix socket: %s\n", error->message);
unlink (lock_file);
close (manager->abstract_fd);
display++;
@@ -435,6 +494,8 @@ choose_xdisplay (MetaXWaylandManager *manager)
manager->display_name = g_strdup_printf (":%d", manager->display_index);
manager->lock_file = lock_file;
+ g_message ("Using X11 display %s for Xwayland", manager->display_name);
+
return TRUE;
}
--
2.29.2

View File

@ -1,192 +0,0 @@
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

@ -1,42 +0,0 @@
From 801da0dab1d2928578e9b191ee1684bcc7154081 Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pekka.paalanen@collabora.com>
Date: Tue, 30 Apr 2019 17:01:04 +0300
Subject: [PATCH 02/12] cogl: Fix doc for _cogl_blit_framebuffer
Commit 38921701e533b7fda38a236cc45aec2ed3afef8a added explicit source and
destination parameters. Fix the documentation to match.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
(cherry picked from commit fc0ce11fcd997af12fc2253eeb37e03cebb5964f)
---
cogl/cogl/cogl-framebuffer-private.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cogl/cogl/cogl-framebuffer-private.h b/cogl/cogl/cogl-framebuffer-private.h
index 296788c2b..de886b64f 100644
--- a/cogl/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl/cogl-framebuffer-private.h
@@ -4,6 +4,7 @@
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2007,2008,2009 Intel Corporation.
+ * Copyright (C) 2019 DisplayLink (UK) Ltd.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -377,9 +378,8 @@ _cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
* @width: Width of region to copy
* @height: Height of region to copy
*
- * This blits a region of the color buffer of the current draw buffer
- * to the current read buffer. The draw and read buffers can be set up
- * using _cogl_push_framebuffers(). This function should only be
+ * This blits a region of the color buffer of the source buffer
+ * to the destination buffer. This function should only be
* called if the COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT feature is
* advertised. The two buffers must both be offscreen and have the
* same format.
--
2.21.0

View File

@ -1,27 +0,0 @@
From 03c30b76bae4c2e3f51a6689ebb7c0c60bd7b29a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Tue, 9 Feb 2021 18:00:26 +0100
Subject: [PATCH 2/2] cogl/gpu-info: Fix software acceleration detection
The string used to match mesa changed; update to fix software rendering
detection.
---
cogl/cogl/cogl-gpu-info.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/cogl/cogl/cogl-gpu-info.c b/cogl/cogl/cogl-gpu-info.c
index f44319e96..c1817b3b0 100644
--- a/cogl/cogl/cogl-gpu-info.c
+++ b/cogl/cogl/cogl-gpu-info.c
@@ -192,6 +192,8 @@ check_mesa_vendor (const CoglGpuInfoStrings *strings)
return TRUE;
else if (strcmp (strings->vendor_string, "Mesa Project") == 0)
return TRUE;
+ else if (strcmp (strings->vendor_string, "Mesa/X.org") == 0)
+ return TRUE;
return FALSE;
}
--
2.29.2

View File

@ -1,28 +0,0 @@
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

@ -1,185 +0,0 @@
From 85484d8f5d75764ab74308da7b21411c3fe4a2da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 3 Oct 2018 10:50:47 +0200
Subject: [PATCH 2/2] monitor-manager/xrandr: Create dummy screen sized monitor
if no RANDR
When there is no RANDR support enabled in the X server, we wont get
notified of any monitors, resulting in mutter believing we're being
headless. To get at least something working, although with no way
configuration ability, lets pretend the whole screen is just a single
monitor with a single output, crtc and mode.
---
src/backends/x11/meta-gpu-xrandr.c | 60 +++++++++++++++++++
.../x11/meta-monitor-manager-xrandr.c | 22 ++++++-
.../x11/meta-monitor-manager-xrandr.h | 4 ++
3 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/src/backends/x11/meta-gpu-xrandr.c b/src/backends/x11/meta-gpu-xrandr.c
index 1884278ca..22e7e70e0 100644
--- a/src/backends/x11/meta-gpu-xrandr.c
+++ b/src/backends/x11/meta-gpu-xrandr.c
@@ -115,6 +115,63 @@ update_screen_size (MetaGpuXrandr *gpu_xrandr)
monitor_manager->screen_height = HeightOfScreen (screen);
}
+static gboolean
+read_current_fallback (MetaGpuXrandr *gpu_xrandr,
+ MetaMonitorManagerXrandr *monitor_manager_xrandr)
+{
+ MetaGpu *gpu = META_GPU (gpu_xrandr);
+ MetaMonitorManager *monitor_manager =
+ META_MONITOR_MANAGER (monitor_manager_xrandr);
+ MetaCrtcMode *mode;
+ MetaCrtc *crtc;
+ MetaOutput *output;
+
+ meta_monitor_manager_xrandr_update_dpms_state (monitor_manager_xrandr);
+ update_screen_size (gpu_xrandr);
+
+ mode = g_object_new (META_TYPE_CRTC_MODE, NULL);
+ mode->mode_id = 0;
+ mode->width = monitor_manager->screen_width;
+ mode->height = monitor_manager->screen_height;
+ mode->refresh_rate = 60.0;
+ mode->name = g_strdup_printf ("%dx%d", mode->width, mode->height);
+
+ meta_gpu_take_modes (gpu, g_list_prepend (NULL, mode));
+
+ crtc = g_object_new (META_TYPE_CRTC, NULL);
+ crtc->gpu = gpu;
+ crtc->crtc_id = 0;
+ crtc->rect = (MetaRectangle) { .width = mode->width, .height = mode->height };
+ crtc->current_mode = mode;
+
+ meta_gpu_take_crtcs (gpu, g_list_prepend (NULL, crtc));
+
+ output = g_object_new (META_TYPE_OUTPUT, NULL);
+ output->gpu = gpu;
+ output->winsys_id = 0;
+ output->name = g_strdup ("X11 Screen");
+ output->vendor = g_strdup ("unknown");
+ output->product = g_strdup ("unknown");
+ output->serial = g_strdup ("unknown");
+ output->hotplug_mode_update = TRUE;
+ output->suggested_x = -1;
+ output->suggested_y = -1;
+ output->connector_type = META_CONNECTOR_TYPE_Unknown;
+ output->modes = g_new0 (MetaCrtcMode *, 1);
+ output->modes[0] = mode;
+ output->n_modes = 1;
+ output->preferred_mode = mode;
+ output->possible_crtcs = g_new0 (MetaCrtc *, 1);
+ output->possible_crtcs[0] = crtc;
+ output->n_possible_crtcs = 1;
+ meta_output_assign_crtc (output, crtc);
+ output->is_primary = TRUE;
+
+ meta_gpu_take_outputs (gpu, g_list_prepend (NULL, output));
+
+ return TRUE;
+}
+
static gboolean
meta_gpu_xrandr_read_current (MetaGpu *gpu,
GError **error)
@@ -133,6 +190,9 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
GList *modes = NULL;
GList *crtcs = NULL;
+ if (!meta_monitor_manager_xrandr_has_randr (monitor_manager_xrandr))
+ return read_current_fallback (gpu_xrandr, monitor_manager_xrandr);
+
if (gpu_xrandr->resources)
XRRFreeScreenResources (gpu_xrandr->resources);
gpu_xrandr->resources = NULL;
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index 7a0b43ac4..d6306faeb 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -75,6 +75,7 @@ struct _MetaMonitorManagerXrandr
guint logind_watch_id;
guint logind_signal_sub_id;
+ gboolean has_randr;
gboolean has_randr15;
/*
@@ -114,6 +115,12 @@ meta_monitor_manager_xrandr_get_xdisplay (MetaMonitorManagerXrandr *manager_xran
return manager_xrandr->xdisplay;
}
+gboolean
+meta_monitor_manager_xrandr_has_randr (MetaMonitorManagerXrandr *manager_xrandr)
+{
+ return manager_xrandr->has_randr;
+}
+
gboolean
meta_monitor_manager_xrandr_has_randr15 (MetaMonitorManagerXrandr *manager_xrandr)
{
@@ -145,7 +152,7 @@ x11_dpms_state_to_power_save (CARD16 dpms_state)
}
}
-static void
+void
meta_monitor_manager_xrandr_update_dpms_state (MetaMonitorManagerXrandr *manager_xrandr)
{
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr);
@@ -637,9 +644,18 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
MetaMonitorsConfigMethod method,
GError **error)
{
+ MetaMonitorManagerXrandr *manager_xrandr =
+ META_MONITOR_MANAGER_XRANDR (manager);
GPtrArray *crtc_infos;
GPtrArray *output_infos;
+ if (!manager_xrandr->has_randr)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Tried to change configuration without XRANDR support");
+ return FALSE;
+ }
+
if (!config)
{
meta_monitor_manager_xrandr_rebuild_derived (manager, NULL);
@@ -1105,11 +1121,15 @@ meta_monitor_manager_xrandr_constructed (GObject *object)
&manager_xrandr->rr_event_base,
&manager_xrandr->rr_error_base))
{
+ g_warning ("No RANDR support, monitor configuration disabled");
return;
}
else
{
int major_version, minor_version;
+
+ manager_xrandr->has_randr = TRUE;
+
/* We only use ScreenChangeNotify, but GDK uses the others,
and we don't want to step on its toes */
XRRSelectInput (manager_xrandr->xdisplay,
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.h b/src/backends/x11/meta-monitor-manager-xrandr.h
index d55b3d2b8..dc75134a5 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.h
+++ b/src/backends/x11/meta-monitor-manager-xrandr.h
@@ -33,9 +33,13 @@ G_DECLARE_FINAL_TYPE (MetaMonitorManagerXrandr, meta_monitor_manager_xrandr,
Display * meta_monitor_manager_xrandr_get_xdisplay (MetaMonitorManagerXrandr *manager_xrandr);
+gboolean meta_monitor_manager_xrandr_has_randr (MetaMonitorManagerXrandr *manager_xrandr);
+
gboolean meta_monitor_manager_xrandr_has_randr15 (MetaMonitorManagerXrandr *manager_xrandr);
gboolean meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager,
XEvent *event);
+void meta_monitor_manager_xrandr_update_dpms_state (MetaMonitorManagerXrandr *manager_xrandr);
+
#endif /* META_MONITOR_MANAGER_XRANDR_H */
--
2.23.0

View File

@ -1,46 +0,0 @@
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

@ -1,44 +0,0 @@
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

@ -1,38 +0,0 @@
From f37ef55525777f742051cb988341fa1bab403666 Mon Sep 17 00:00:00 2001
From: Robert Mader <robert.mader@posteo.de>
Date: Mon, 15 Apr 2019 02:02:10 +0200
Subject: [PATCH 2/2] wayland/dnd-surface: Propagate commit to parent class
We need to call the underlying actor-surface so the actor
state is synced, otherwise surface state like the scale factor
does not get applied.
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/550
https://gitlab.gnome.org/GNOME/mutter/merge_requests/537
(cherry picked from commit 01d0316fd703872a2470a351f906ffa4605a647e)
---
src/wayland/meta-wayland-dnd-surface.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/wayland/meta-wayland-dnd-surface.c b/src/wayland/meta-wayland-dnd-surface.c
index 8ddeb2a7bd..7aa7e3be2f 100644
--- a/src/wayland/meta-wayland-dnd-surface.c
+++ b/src/wayland/meta-wayland-dnd-surface.c
@@ -51,9 +51,13 @@ dnd_surface_commit (MetaWaylandSurfaceRole *surface_role,
{
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
+ MetaWaylandSurfaceRoleClass *surface_role_class =
+ META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_surface_role_dnd_parent_class);
meta_wayland_compositor_add_frame_callback_surface (surface->compositor,
surface);
+
+ surface_role_class->commit (surface_role, pending);
}
static void
--
2.31.1

View File

@ -1,42 +0,0 @@
From 9a8bb8a205656ca1089444a041c99c5591477642 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Fri, 3 May 2019 18:10:47 +0000
Subject: [PATCH 2/2] window: Emit an error and return when trying to activate
an unmanaged
If something (i.e. gnome-shell or an extension) tries to activate an unmanaged
window, we should warn about this and avoid to perform further actions as this
could lead to a crash of mutter, since the window has not valid flags (like
workspace) set anymore at this stage.
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/580
https://gitlab.gnome.org/GNOME/mutter/merge_requests/564
(cherry picked from commit a6fc656e917fd48b8708b8d9f4bf9f8b15581313)
---
src/core/window.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/core/window.c b/src/core/window.c
index d2c24506b..725cca7ce 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -3683,6 +3683,13 @@ meta_window_activate_full (MetaWindow *window,
{
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
gboolean allow_workspace_switch;
+
+ if (window->unmanaging)
+ {
+ g_warning ("Trying to activate unmanaged window '%s'", window->desc);
+ return;
+ }
+
meta_topic (META_DEBUG_FOCUS,
"_NET_ACTIVE_WINDOW message sent for %s at time %u "
"by client type %u.\n",
--
2.21.0

View File

@ -1,90 +0,0 @@
From 56c2e4efdcef14531dcf752e89117d22a21ec8ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 9 Dec 2020 15:18:29 +0100
Subject: [PATCH 2/2] xwayland: Make sure /tmp/.X11-unix/ exists
When we're running under a polyinstantiated SELinux environment, we'll
likely start with an isolated and empty /tmp, meannig no /tmp/.X11-unix
directory to add things to. To make it possible to still function in
this kind of setup, make sure said directory exists.
---
src/wayland/meta-xwayland.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 699d5561c..f3df9766e 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -30,6 +30,7 @@
#include <glib-unix.h>
#include <glib.h>
#include <sys/socket.h>
+#include <sys/stat.h>
#include <sys/un.h>
#include "compositor/meta-surface-actor-wayland.h"
@@ -436,9 +437,27 @@ meta_xwayland_override_display_number (int number)
display_number_override = number;
}
+static gboolean
+ensure_x11_unix_dir (GError **error)
+{
+ if (mkdir ("/tmp/.X11-unix", 01777) != 0)
+ {
+ if (errno == EEXIST)
+ return TRUE;
+
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to create directory \"/tmp/.X11-unix\": %s",
+ g_strerror (errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static gboolean
choose_xdisplay (MetaXWaylandManager *manager)
{
+ g_autoptr (GError) error = NULL;
int display = 0;
char *lock_file = NULL;
@@ -447,10 +466,15 @@ choose_xdisplay (MetaXWaylandManager *manager)
else if (g_getenv ("RUNNING_UNDER_GDM"))
display = 1024;
- do
+ if (!ensure_x11_unix_dir (&error))
{
- g_autoptr (GError) error = NULL;
+ g_warning ("Failed to ensure X11 socket directory: %s",
+ error->message);
+ return FALSE;
+ }
+ do
+ {
lock_file = create_lock_file (display, &display, &error);
if (!lock_file)
{
@@ -466,6 +490,7 @@ choose_xdisplay (MetaXWaylandManager *manager)
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_ADDRESS_IN_USE))
{
meta_verbose ("Failed to bind abstract socket: %s\n", error->message);
+ g_clear_error (&error);
display++;
continue;
}
@@ -480,6 +505,7 @@ choose_xdisplay (MetaXWaylandManager *manager)
if (manager->unix_fd < 0)
{
meta_verbose ("Failed to bind unix socket: %s\n", error->message);
+ g_clear_error (&error);
unlink (lock_file);
close (manager->abstract_fd);
display++;
--
2.29.2

View File

@ -1,167 +0,0 @@
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

@ -1,77 +0,0 @@
From 04d921c2c1da571c8c61a4ca12a380bc3b9623fe Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pekka.paalanen@collabora.com>
Date: Mon, 6 May 2019 13:40:31 +0300
Subject: [PATCH 03/12] cogl: Replace ANGLE with GLES3 and NV framebuffer_blit
ANGLE extensions are only provided by Google's Almost Native Graphics Layer
Engine (ANGLE) implementation. Therefore they do not seem too useful for
Mutter.
The reason to drop GL_ANGLE_framebuffer_blit support is that it has more
limitations compared to the glBlitFramebuffer in GL_EXT_framebuffer_blit,
GL_NV_framebuffer_bit, OpenGL 3.0 and OpenGL ES 3.0. Most importantly, the
ANGLE version cannot flip the image while copying, which limits
_cogl_blit_framebuffer to only off-screen <-> off-screen copies. Follow-up work
will need off-screen <-> on-screen copies.
Instead of adding yet more capability flags to Cogl, dropping ANGLE support
seems appropriate.
The NV extension is added to the list of glBlitFramebuffer providers because it
provides the same support as ANGLE and more.
Likewise OpenGL ES 3.0 is added to the list of glBlitFramebuffer providers
because e.g. Mesa GLES implementation usually provides it and that makes it
widely available, again surpassing the ANGLE supported features.
Follow-up patches will lift some of the Cogl assumptions of what
glBlitFramebuffer cannot do.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
(cherry picked from commit 3e68c9e8faa78298039fa3583898f18550740812)
---
cogl/cogl/cogl-framebuffer-private.h | 3 +--
cogl/cogl/gl-prototypes/cogl-all-functions.h | 5 +++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cogl/cogl/cogl-framebuffer-private.h b/cogl/cogl/cogl-framebuffer-private.h
index de886b64f..3aab852c4 100644
--- a/cogl/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl/cogl-framebuffer-private.h
@@ -387,8 +387,7 @@ _cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
* Note that this function differs a lot from the glBlitFramebuffer
* function provided by the GL_EXT_framebuffer_blit extension. Notably
* it doesn't support having different sizes for the source and
- * destination rectangle. This isn't supported by the corresponding
- * GL_ANGLE_framebuffer_blit extension on GLES2.0 and it doesn't seem
+ * destination rectangle. This doesn't seem
* like a particularly useful feature. If the application wanted to
* scale the results it may make more sense to draw a primitive
* instead.
diff --git a/cogl/cogl/gl-prototypes/cogl-all-functions.h b/cogl/cogl/gl-prototypes/cogl-all-functions.h
index 924ee349d..0af126059 100644
--- a/cogl/cogl/gl-prototypes/cogl-all-functions.h
+++ b/cogl/cogl/gl-prototypes/cogl-all-functions.h
@@ -4,6 +4,7 @@
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2009, 2011 Intel Corporation.
+ * Copyright (C) 2019 DisplayLink (UK) Ltd.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -132,8 +133,8 @@ COGL_EXT_END ()
COGL_EXT_BEGIN (offscreen_blit, 3, 0,
- 0, /* not in either GLES */
- "EXT\0ANGLE\0",
+ COGL_EXT_IN_GLES3,
+ "EXT\0NV\0",
"framebuffer_blit\0")
COGL_EXT_FUNCTION (void, glBlitFramebuffer,
(GLint srcX0,
--
2.21.0

View File

@ -1,108 +0,0 @@
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

@ -1,100 +0,0 @@
From 6c6c6ad5412f5bb13592630d7cb3b7aed25d159b Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pekka.paalanen@collabora.com>
Date: Mon, 6 May 2019 14:09:16 +0300
Subject: [PATCH 04/12] cogl: Relax formats on glBlitFramebuffer
Depends on: "cogl: Replace ANGLE with GLES3 and NV framebuffer_blit"
As a possible ANGLE implementation is not longer limiting the pixel format
matching, lift the requirement of having the same pixel format.
We still cannot do a premult <-> non-premult conversion during a blit, so guard
against that.
This will be useful in follow-up work to copy from onscreen primary GPU
framebuffer to an offscreen secondary GPU framebuffer if the formats do not
match exactly.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
(cherry picked from commit 6df34eb4b7c65210f4066f7eb9bd462278b7279b)
---
cogl/cogl/cogl-blit.c | 10 ++++++----
cogl/cogl/cogl-framebuffer-private.h | 8 ++++++--
cogl/cogl/cogl-framebuffer.c | 6 ++++--
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/cogl/cogl/cogl-blit.c b/cogl/cogl/cogl-blit.c
index 74f404f3d..a61eb66d2 100644
--- a/cogl/cogl/cogl-blit.c
+++ b/cogl/cogl/cogl-blit.c
@@ -4,6 +4,7 @@
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2011 Intel Corporation.
+ * Copyright (C) 2019 DisplayLink (UK) Ltd.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -152,10 +153,11 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data)
CoglFramebuffer *dst_fb, *src_fb;
CoglError *ignore_error = NULL;
- /* We can only blit between FBOs if both textures are the same
- format and the blit framebuffer extension is supported */
- if ((_cogl_texture_get_format (data->src_tex) & ~COGL_A_BIT) !=
- (_cogl_texture_get_format (data->dst_tex) & ~COGL_A_BIT) ||
+ /* We can only blit between FBOs if both textures have the same
+ premult convention and the blit framebuffer extension is
+ supported. */
+ if ((_cogl_texture_get_format (data->src_tex) & COGL_PREMULT_BIT) !=
+ (_cogl_texture_get_format (data->dst_tex) & COGL_PREMULT_BIT) ||
!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT))
return FALSE;
diff --git a/cogl/cogl/cogl-framebuffer-private.h b/cogl/cogl/cogl-framebuffer-private.h
index 3aab852c4..b06fbaee1 100644
--- a/cogl/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl/cogl-framebuffer-private.h
@@ -381,8 +381,12 @@ _cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
* This blits a region of the color buffer of the source buffer
* to the destination buffer. This function should only be
* called if the COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT feature is
- * advertised. The two buffers must both be offscreen and have the
- * same format.
+ * advertised. The two buffers must both be offscreen.
+ *
+ * The two buffers must have the same value types (e.g. floating-point,
+ * unsigned int, signed int, or fixed-point), but color formats do not
+ * need to match. This limitation comes from OpenGL ES 3.0 definition
+ * of glBlitFramebuffer.
*
* Note that this function differs a lot from the glBlitFramebuffer
* function provided by the GL_EXT_framebuffer_blit extension. Notably
diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c
index bd8a7fa42..0bc225945 100644
--- a/cogl/cogl/cogl-framebuffer.c
+++ b/cogl/cogl/cogl-framebuffer.c
@@ -4,6 +4,7 @@
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2007,2008,2009,2012 Intel Corporation.
+ * Copyright (C) 2019 DisplayLink (UK) Ltd.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -1468,8 +1469,9 @@ _cogl_blit_framebuffer (CoglFramebuffer *src,
support this */
_COGL_RETURN_IF_FAIL (cogl_is_offscreen (src));
_COGL_RETURN_IF_FAIL (cogl_is_offscreen (dest));
- /* The buffers must be the same format */
- _COGL_RETURN_IF_FAIL (src->internal_format == dest->internal_format);
+ /* The buffers must use the same premult convention */
+ _COGL_RETURN_IF_FAIL ((src->internal_format & COGL_PREMULT_BIT) ==
+ (dest->internal_format & COGL_PREMULT_BIT));
/* Make sure the current framebuffers are bound. We explicitly avoid
flushing the clip state so we can bind our own empty state */
--
2.21.0

View File

@ -1,209 +0,0 @@
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

View File

@ -1,145 +0,0 @@
From e4b2234d9918e9d3357ac3c7ca3898599725d3da Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pekka.paalanen@collabora.com>
Date: Mon, 6 May 2019 15:08:29 +0300
Subject: [PATCH 05/12] cogl: Allow glBlitFramebuffer between
onscreen/offscreen
Depends on "cogl: Replace ANGLE with GLES3 and NV framebuffer_blit"
Allow blitting between onscreen and offscreen framebuffers by doing the y-flip
as necessary. This was not possible with ANGLE, but now with ANGLE gone,
glBlitFramebuffer supports flipping the copied image.
This will be useful in follow-up work to copy from onscreen primary GPU
framebuffer to an offscreen secondary GPU framebuffer.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
(cherry picked from commit 45289b3d65e308117f1bc8fe6a4c88c1baaacca7)
---
cogl/cogl/cogl-framebuffer-private.h | 14 +++----
cogl/cogl/cogl-framebuffer.c | 46 ++++++++++++++++++-----
cogl/cogl/driver/gl/cogl-framebuffer-gl.c | 5 +--
3 files changed, 43 insertions(+), 22 deletions(-)
diff --git a/cogl/cogl/cogl-framebuffer-private.h b/cogl/cogl/cogl-framebuffer-private.h
index b06fbaee1..f68153d8b 100644
--- a/cogl/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl/cogl-framebuffer-private.h
@@ -381,7 +381,11 @@ _cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
* This blits a region of the color buffer of the source buffer
* to the destination buffer. This function should only be
* called if the COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT feature is
- * advertised. The two buffers must both be offscreen.
+ * advertised.
+ *
+ * The source and destination rectangles are defined in offscreen
+ * framebuffer orientation. When copying between an offscreen and
+ * onscreen framebuffers, the image is y-flipped accordingly.
*
* The two buffers must have the same value types (e.g. floating-point,
* unsigned int, signed int, or fixed-point), but color formats do not
@@ -396,14 +400,6 @@ _cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
* scale the results it may make more sense to draw a primitive
* instead.
*
- * We can only really support blitting between two offscreen buffers
- * for this function on GLES2.0. This is because we effectively render
- * upside down to offscreen buffers to maintain Cogl's representation
- * of the texture coordinate system where 0,0 is the top left of the
- * texture. If we were to blit from an offscreen to an onscreen buffer
- * then we would need to mirror the blit along the x-axis but the GLES
- * extension does not support this.
- *
* The GL function is documented to be affected by the scissor. This
* function therefore ensure that an empty clip stack is flushed
* before performing the blit which means the scissor is effectively
diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c
index 0bc225945..90976a611 100644
--- a/cogl/cogl/cogl-framebuffer.c
+++ b/cogl/cogl/cogl-framebuffer.c
@@ -1460,15 +1460,12 @@ _cogl_blit_framebuffer (CoglFramebuffer *src,
int height)
{
CoglContext *ctx = src->context;
+ int src_x1, src_y1, src_x2, src_y2;
+ int dst_x1, dst_y1, dst_x2, dst_y2;
_COGL_RETURN_IF_FAIL (_cogl_has_private_feature
(ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT));
- /* We can only support blitting between offscreen buffers because
- otherwise we would need to mirror the image and GLES2.0 doesn't
- support this */
- _COGL_RETURN_IF_FAIL (cogl_is_offscreen (src));
- _COGL_RETURN_IF_FAIL (cogl_is_offscreen (dest));
/* The buffers must use the same premult convention */
_COGL_RETURN_IF_FAIL ((src->internal_format & COGL_PREMULT_BIT) ==
(dest->internal_format & COGL_PREMULT_BIT));
@@ -1492,10 +1489,41 @@ _cogl_blit_framebuffer (CoglFramebuffer *src,
* as changed */
ctx->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP;
- ctx->glBlitFramebuffer (src_x, src_y,
- src_x + width, src_y + height,
- dst_x, dst_y,
- dst_x + width, dst_y + height,
+ /* Offscreens we do the normal way, onscreens need an y-flip. Even if
+ * we consider offscreens to be rendered upside-down, the offscreen
+ * orientation is in this function's API. */
+ if (cogl_is_offscreen (src))
+ {
+ src_x1 = src_x;
+ src_y1 = src_y;
+ src_x2 = src_x + width;
+ src_y2 = src_y + height;
+ }
+ else
+ {
+ src_x1 = src_x;
+ src_y1 = cogl_framebuffer_get_height (src) - src_y;
+ src_x2 = src_x + width;
+ src_y2 = src_y1 - height;
+ }
+
+ if (cogl_is_offscreen (dest))
+ {
+ dst_x1 = dst_x;
+ dst_y1 = dst_y;
+ dst_x2 = dst_x + width;
+ dst_y2 = dst_y + height;
+ }
+ else
+ {
+ dst_x1 = dst_x;
+ dst_y1 = cogl_framebuffer_get_height (dest) - dst_y;
+ dst_x2 = dst_x + width;
+ dst_y2 = dst_y1 - height;
+ }
+
+ ctx->glBlitFramebuffer (src_x1, src_y1, src_x2, src_y2,
+ dst_x1, dst_y1, dst_x2, dst_y2,
GL_COLOR_BUFFER_BIT,
GL_NEAREST);
}
diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
index 5402a7075..83e1d263a 100644
--- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
+++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
@@ -400,12 +400,9 @@ _cogl_framebuffer_gl_flush_state (CoglFramebuffer *draw_buffer,
else
{
/* NB: Currently we only take advantage of binding separate
- * read/write buffers for offscreen framebuffer blit
- * purposes. */
+ * read/write buffers for framebuffer blit purposes. */
_COGL_RETURN_IF_FAIL (_cogl_has_private_feature
(ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT));
- _COGL_RETURN_IF_FAIL (draw_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN);
- _COGL_RETURN_IF_FAIL (read_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN);
_cogl_framebuffer_gl_bind (draw_buffer, GL_DRAW_FRAMEBUFFER);
_cogl_framebuffer_gl_bind (read_buffer, GL_READ_FRAMEBUFFER);
--
2.21.0

View File

@ -1,115 +0,0 @@
From 579c85d17b17fc7ad3d6c88af39932ce8faeaabe Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pekka.paalanen@collabora.com>
Date: Mon, 6 May 2019 15:58:33 +0300
Subject: [PATCH 06/12] cogl: Rename feature OFFSCREEN_BLIT to BLIT_FRAMEBUFFER
The feature is not limited to offscreen framebuffer blits anymore since
"cogl: Allow glBlitFramebuffer between onscreen/offscreen".
https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
(cherry picked from commit 55c084e6e1059d8f94c699b01c408523ed504196)
---
cogl/cogl/cogl-blit.c | 2 +-
cogl/cogl/cogl-framebuffer-private.h | 2 +-
cogl/cogl/cogl-framebuffer.c | 2 +-
cogl/cogl/cogl-private.h | 2 +-
cogl/cogl/driver/gl/cogl-framebuffer-gl.c | 2 +-
cogl/cogl/driver/gl/gl/cogl-driver-gl.c | 2 +-
cogl/cogl/driver/gl/gles/cogl-driver-gles.c | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/cogl/cogl/cogl-blit.c b/cogl/cogl/cogl-blit.c
index a61eb66d2..c561b2e45 100644
--- a/cogl/cogl/cogl-blit.c
+++ b/cogl/cogl/cogl-blit.c
@@ -158,7 +158,7 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data)
supported. */
if ((_cogl_texture_get_format (data->src_tex) & COGL_PREMULT_BIT) !=
(_cogl_texture_get_format (data->dst_tex) & COGL_PREMULT_BIT) ||
- !_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT))
+ !_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER))
return FALSE;
dst_offscreen = _cogl_offscreen_new_with_texture_full
diff --git a/cogl/cogl/cogl-framebuffer-private.h b/cogl/cogl/cogl-framebuffer-private.h
index f68153d8b..cb1f87354 100644
--- a/cogl/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl/cogl-framebuffer-private.h
@@ -380,7 +380,7 @@ _cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
*
* This blits a region of the color buffer of the source buffer
* to the destination buffer. This function should only be
- * called if the COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT feature is
+ * called if the COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER feature is
* advertised.
*
* The source and destination rectangles are defined in offscreen
diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c
index 90976a611..5cc4eada4 100644
--- a/cogl/cogl/cogl-framebuffer.c
+++ b/cogl/cogl/cogl-framebuffer.c
@@ -1464,7 +1464,7 @@ _cogl_blit_framebuffer (CoglFramebuffer *src,
int dst_x1, dst_y1, dst_x2, dst_y2;
_COGL_RETURN_IF_FAIL (_cogl_has_private_feature
- (ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT));
+ (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER));
/* The buffers must use the same premult convention */
_COGL_RETURN_IF_FAIL ((src->internal_format & COGL_PREMULT_BIT) ==
diff --git a/cogl/cogl/cogl-private.h b/cogl/cogl/cogl-private.h
index 9f918b851..d9fbe68c7 100644
--- a/cogl/cogl/cogl-private.h
+++ b/cogl/cogl/cogl-private.h
@@ -42,7 +42,7 @@ typedef enum
{
COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE,
COGL_PRIVATE_FEATURE_MESA_PACK_INVERT,
- COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT,
+ COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER,
COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES,
COGL_PRIVATE_FEATURE_PBOS,
COGL_PRIVATE_FEATURE_VBOS,
diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
index 83e1d263a..90d08954d 100644
--- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
+++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
@@ -402,7 +402,7 @@ _cogl_framebuffer_gl_flush_state (CoglFramebuffer *draw_buffer,
/* NB: Currently we only take advantage of binding separate
* read/write buffers for framebuffer blit purposes. */
_COGL_RETURN_IF_FAIL (_cogl_has_private_feature
- (ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT));
+ (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER));
_cogl_framebuffer_gl_bind (draw_buffer, GL_DRAW_FRAMEBUFFER);
_cogl_framebuffer_gl_bind (read_buffer, GL_READ_FRAMEBUFFER);
diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
index 4d46844d5..e06e27961 100644
--- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -467,7 +467,7 @@ _cogl_driver_update_features (CoglContext *ctx,
if (ctx->glBlitFramebuffer)
COGL_FLAGS_SET (private_features,
- COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT, TRUE);
+ COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER, TRUE);
if (ctx->glRenderbufferStorageMultisampleIMG)
{
diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
index 23158d5c7..bcb0bdf07 100644
--- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
+++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
@@ -326,7 +326,7 @@ _cogl_driver_update_features (CoglContext *context,
if (context->glBlitFramebuffer)
COGL_FLAGS_SET (private_features,
- COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT, TRUE);
+ COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER, TRUE);
if (_cogl_check_extension ("GL_OES_element_index_uint", gl_extensions))
{
--
2.21.0

View File

@ -1,261 +0,0 @@
From be13d3c844a6623563ae4e74dbb3409baf16fc9c Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pekka.paalanen@collabora.com>
Date: Mon, 3 Dec 2018 14:34:41 +0200
Subject: [PATCH 07/12] cogl: Expose cogl_blit_framebuffer
The function will be used in copying from a primary GPU framebuffer to a
secondary GPU framebuffer using the primary GPU specifically when the
secondary GPU is not render-capable.
To allow falling back in case glBlitFramebuffer cannot be used, add boolean
return value, and GError argument for debugging purposes.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
(cherry picked from commit 6061abbf90cd1d62e262ebf3636470d2219e04a7)
---
cogl/cogl/cogl-blit.c | 11 ++---
cogl/cogl/cogl-framebuffer-private.h | 55 -----------------------
cogl/cogl/cogl-framebuffer.c | 40 +++++++++++------
cogl/cogl/cogl-framebuffer.h | 66 +++++++++++++++++++++++++++-
4 files changed, 98 insertions(+), 74 deletions(-)
diff --git a/cogl/cogl/cogl-blit.c b/cogl/cogl/cogl-blit.c
index c561b2e45..ae5a8a345 100644
--- a/cogl/cogl/cogl-blit.c
+++ b/cogl/cogl/cogl-blit.c
@@ -207,11 +207,12 @@ _cogl_blit_framebuffer_blit (CoglBlitData *data,
int width,
int height)
{
- _cogl_blit_framebuffer (data->src_fb,
- data->dest_fb,
- src_x, src_y,
- dst_x, dst_y,
- width, height);
+ cogl_blit_framebuffer (data->src_fb,
+ data->dest_fb,
+ src_x, src_y,
+ dst_x, dst_y,
+ width, height,
+ NULL);
}
static void
diff --git a/cogl/cogl/cogl-framebuffer-private.h b/cogl/cogl/cogl-framebuffer-private.h
index cb1f87354..7d71fb1dc 100644
--- a/cogl/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl/cogl-framebuffer-private.h
@@ -367,61 +367,6 @@ void
_cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
CoglFramebuffer *read_buffer);
-/*
- * _cogl_blit_framebuffer:
- * @src: The source #CoglFramebuffer
- * @dest: The destination #CoglFramebuffer
- * @src_x: Source x position
- * @src_y: Source y position
- * @dst_x: Destination x position
- * @dst_y: Destination y position
- * @width: Width of region to copy
- * @height: Height of region to copy
- *
- * This blits a region of the color buffer of the source buffer
- * to the destination buffer. This function should only be
- * called if the COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER feature is
- * advertised.
- *
- * The source and destination rectangles are defined in offscreen
- * framebuffer orientation. When copying between an offscreen and
- * onscreen framebuffers, the image is y-flipped accordingly.
- *
- * The two buffers must have the same value types (e.g. floating-point,
- * unsigned int, signed int, or fixed-point), but color formats do not
- * need to match. This limitation comes from OpenGL ES 3.0 definition
- * of glBlitFramebuffer.
- *
- * Note that this function differs a lot from the glBlitFramebuffer
- * function provided by the GL_EXT_framebuffer_blit extension. Notably
- * it doesn't support having different sizes for the source and
- * destination rectangle. This doesn't seem
- * like a particularly useful feature. If the application wanted to
- * scale the results it may make more sense to draw a primitive
- * instead.
- *
- * The GL function is documented to be affected by the scissor. This
- * function therefore ensure that an empty clip stack is flushed
- * before performing the blit which means the scissor is effectively
- * ignored.
- *
- * The function also doesn't support specifying the buffers to copy
- * and instead only the color buffer is copied. When copying the depth
- * or stencil buffers the extension on GLES2.0 only supports copying
- * the full buffer which would be awkward to document with this
- * API. If we wanted to support that feature it may be better to have
- * a separate function to copy the entire buffer for a given mask.
- */
-void
-_cogl_blit_framebuffer (CoglFramebuffer *src,
- CoglFramebuffer *dest,
- int src_x,
- int src_y,
- int dst_x,
- int dst_y,
- int width,
- int height);
-
void
_cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer);
diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c
index 5cc4eada4..6d35c6b13 100644
--- a/cogl/cogl/cogl-framebuffer.c
+++ b/cogl/cogl/cogl-framebuffer.c
@@ -1449,26 +1449,38 @@ cogl_framebuffer_read_pixels (CoglFramebuffer *framebuffer,
return ret;
}
-void
-_cogl_blit_framebuffer (CoglFramebuffer *src,
- CoglFramebuffer *dest,
- int src_x,
- int src_y,
- int dst_x,
- int dst_y,
- int width,
- int height)
+gboolean
+cogl_blit_framebuffer (CoglFramebuffer *src,
+ CoglFramebuffer *dest,
+ int src_x,
+ int src_y,
+ int dst_x,
+ int dst_y,
+ int width,
+ int height,
+ GError **error)
{
CoglContext *ctx = src->context;
int src_x1, src_y1, src_x2, src_y2;
int dst_x1, dst_y1, dst_x2, dst_y2;
- _COGL_RETURN_IF_FAIL (_cogl_has_private_feature
- (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER));
+ if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER))
+ {
+ g_set_error_literal (error, COGL_SYSTEM_ERROR,
+ COGL_SYSTEM_ERROR_UNSUPPORTED,
+ "Cogl BLIT_FRAMEBUFFER is not supported by the system.");
+ return FALSE;
+ }
/* The buffers must use the same premult convention */
- _COGL_RETURN_IF_FAIL ((src->internal_format & COGL_PREMULT_BIT) ==
- (dest->internal_format & COGL_PREMULT_BIT));
+ if ((src->internal_format & COGL_PREMULT_BIT) !=
+ (dest->internal_format & COGL_PREMULT_BIT))
+ {
+ g_set_error_literal (error, COGL_SYSTEM_ERROR,
+ COGL_SYSTEM_ERROR_UNSUPPORTED,
+ "cogl_blit_framebuffer premult mismatch.");
+ return FALSE;
+ }
/* Make sure the current framebuffers are bound. We explicitly avoid
flushing the clip state so we can bind our own empty state */
@@ -1526,6 +1538,8 @@ _cogl_blit_framebuffer (CoglFramebuffer *src,
dst_x1, dst_y1, dst_x2, dst_y2,
GL_COLOR_BUFFER_BIT,
GL_NEAREST);
+
+ return TRUE;
}
void
diff --git a/cogl/cogl/cogl-framebuffer.h b/cogl/cogl/cogl-framebuffer.h
index 48a77e1ed..230a78627 100644
--- a/cogl/cogl/cogl-framebuffer.h
+++ b/cogl/cogl/cogl-framebuffer.h
@@ -3,7 +3,8 @@
*
* A Low Level GPU Graphics and Utilities API
*
- * Copyright (C) 2011 Intel Corporation.
+ * Copyright (C) 2007,2008,2009,2011 Intel Corporation.
+ * Copyright (C) 2019 DisplayLink (UK) Ltd.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -1846,6 +1847,69 @@ typedef enum /*< prefix=COGL_FRAMEBUFFER_ERROR >*/
gboolean
cogl_is_framebuffer (void *object);
+/**
+ * cogl_blit_framebuffer:
+ * @src: The source #CoglFramebuffer
+ * @dest: The destination #CoglFramebuffer
+ * @src_x: Source x position
+ * @src_y: Source y position
+ * @dst_x: Destination x position
+ * @dst_y: Destination y position
+ * @width: Width of region to copy
+ * @height: Height of region to copy
+ * @error: optional error object
+ *
+ * @return FALSE for an immediately detected error, TRUE otherwise.
+ *
+ * This blits a region of the color buffer of the source buffer
+ * to the destination buffer. This function should only be
+ * called if the COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER feature is
+ * advertised.
+ *
+ * The source and destination rectangles are defined in offscreen
+ * framebuffer orientation. When copying between an offscreen and
+ * onscreen framebuffers, the image is y-flipped accordingly.
+ *
+ * The two buffers must have the same value types (e.g. floating-point,
+ * unsigned int, signed int, or fixed-point), but color formats do not
+ * need to match. This limitation comes from OpenGL ES 3.0 definition
+ * of glBlitFramebuffer.
+ *
+ * Note that this function differs a lot from the glBlitFramebuffer
+ * function provided by the GL_EXT_framebuffer_blit extension. Notably
+ * it doesn't support having different sizes for the source and
+ * destination rectangle. This doesn't seem
+ * like a particularly useful feature. If the application wanted to
+ * scale the results it may make more sense to draw a primitive
+ * instead.
+ *
+ * The GL function is documented to be affected by the scissor. This
+ * function therefore ensure that an empty clip stack is flushed
+ * before performing the blit which means the scissor is effectively
+ * ignored.
+ *
+ * The function also doesn't support specifying the buffers to copy
+ * and instead only the color buffer is copied. When copying the depth
+ * or stencil buffers the extension on GLES2.0 only supports copying
+ * the full buffer which would be awkward to document with this
+ * API. If we wanted to support that feature it may be better to have
+ * a separate function to copy the entire buffer for a given mask.
+ *
+ * The @c error argument is optional, it can be NULL. If it is not NULL
+ * and this function returns FALSE, an error object with a code from
+ * COGL_SYSTEM_ERROR will be created.
+ */
+gboolean
+cogl_blit_framebuffer (CoglFramebuffer *src,
+ CoglFramebuffer *dest,
+ int src_x,
+ int src_y,
+ int dst_x,
+ int dst_y,
+ int width,
+ int height,
+ GError **error);
+
G_END_DECLS
#endif /* __COGL_FRAMEBUFFER_H */
--
2.21.0

View File

@ -1,42 +0,0 @@
From bbeb161e8ab31bbef3c7d378e9a8d4ecc786c25d Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Thu, 26 Sep 2019 10:20:36 +0200
Subject: [PATCH 08/12] clutter/stage-view: Use cogl_blit_framebuffer() for
shadow FB
If there is no transformation, use `cogl_blit_framebuffer()` as a
shortcut in `clutter_stage_view_blit_offscreen()`, that dramatically
improves performance when using a shadow framebuffer.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/809
(cherry picked from commit 3400c555a032832a689c208486891352a6cb92de)
---
clutter/clutter/clutter-stage-view.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/clutter/clutter/clutter-stage-view.c b/clutter/clutter/clutter-stage-view.c
index cd6cd35cb..00cbfd1ce 100644
--- a/clutter/clutter/clutter-stage-view.c
+++ b/clutter/clutter/clutter-stage-view.c
@@ -126,6 +126,18 @@ clutter_stage_view_blit_offscreen (ClutterStageView *view,
clutter_stage_view_get_instance_private (view);
CoglMatrix matrix;
+ clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
+ if (cogl_matrix_is_identity (&matrix))
+ {
+ if (cogl_blit_framebuffer (priv->offscreen,
+ priv->framebuffer,
+ rect->x, rect->y,
+ rect->x, rect->y,
+ rect->width, rect->height,
+ NULL))
+ return;
+ }
+
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
cogl_framebuffer_push_matrix (priv->framebuffer);
--
2.21.0

View File

@ -1,49 +0,0 @@
From 46bb54bcd9c90f90dd170355209f8c379680d5c1 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Tue, 1 Oct 2019 14:16:25 +0200
Subject: [PATCH 09/12] clutter/stage-view: Ignore clipping rectangle for
offscreen blit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In `clutter_stage_view_blit_offscreen()`, the given clipping rectangle
is in “view” coordinates whereas we intend to copy the whole actual
framebuffer, meaning that we cannot use the clipping rectangle.
Use the actual framebuffer size, starting at (0, 0) instead.
That fixes the issue with partial repainting with shadow framebuffer
when fractional scaling is enabled.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/820
(cherry picked from commit 0a3f25c3039b586f5b5721e91136c5d2fccecca1)
---
clutter/clutter/clutter-stage-view.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/clutter/clutter/clutter-stage-view.c b/clutter/clutter/clutter-stage-view.c
index 00cbfd1ce..503c31e78 100644
--- a/clutter/clutter/clutter-stage-view.c
+++ b/clutter/clutter/clutter-stage-view.c
@@ -129,11 +129,14 @@ clutter_stage_view_blit_offscreen (ClutterStageView *view,
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
if (cogl_matrix_is_identity (&matrix))
{
+ int fb_width = cogl_framebuffer_get_width (priv->framebuffer);
+ int fb_height = cogl_framebuffer_get_height (priv->framebuffer);
+
if (cogl_blit_framebuffer (priv->offscreen,
priv->framebuffer,
- rect->x, rect->y,
- rect->x, rect->y,
- rect->width, rect->height,
+ 0, 0,
+ 0, 0,
+ fb_width, fb_height,
NULL))
return;
}
--
2.21.0

View File

@ -1,34 +0,0 @@
From 4c7fe200e05f9a028d440ed2032961d1b798c83b Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Tue, 1 Oct 2019 15:54:47 +0200
Subject: [PATCH 10/12] cogl: Flush journal before blitting
Make sure to submit all pending primitives before blitting, otherwise
rendering from the shell may be incomplete leaving partial drawing of
the shell widgets.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/820
(cherry picked from commit 0cdf13ac12c570d38737fddb68946157c0b7a4d2)
---
cogl/cogl/cogl-framebuffer.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c
index 6d35c6b13..948cd112d 100644
--- a/cogl/cogl/cogl-framebuffer.c
+++ b/cogl/cogl/cogl-framebuffer.c
@@ -1482,6 +1482,11 @@ cogl_blit_framebuffer (CoglFramebuffer *src,
return FALSE;
}
+ /* Make sure any batched primitives get submitted to the driver
+ * before blitting
+ */
+ _cogl_framebuffer_flush_journal (src);
+
/* Make sure the current framebuffers are bound. We explicitly avoid
flushing the clip state so we can bind our own empty state */
_cogl_framebuffer_flush_state (dest,
--
2.21.0

View File

@ -1,304 +0,0 @@
From cf8f1fb8478e4b76c91e825d1537396b014689a0 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Tue, 22 Oct 2019 17:03:03 +0200
Subject: [PATCH 11/12] clutter/stage-view: Separate offscreen and shadowfb
Previously, we would use a single offscreen framebuffer for both
transformations and when a shadow framebuffer should be used, but that
can be dreadfully slow when using software rendering with a discrete GPU
due to bandwidth limitations.
Keep the offscreen framebuffer for transformations only and add another
intermediate shadow framebuffer used as a copy of the onscreen
framebuffer.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/917
(cherry picked from commit 2b8b450fe16c21f0f37a1779560c0e5da61a9b89)
---
clutter/clutter/clutter-stage-view.c | 162 +++++++++++++++++-----
clutter/clutter/cogl/clutter-stage-cogl.c | 6 +-
2 files changed, 128 insertions(+), 40 deletions(-)
diff --git a/clutter/clutter/clutter-stage-view.c b/clutter/clutter/clutter-stage-view.c
index 503c31e78..c536ac720 100644
--- a/clutter/clutter/clutter-stage-view.c
+++ b/clutter/clutter/clutter-stage-view.c
@@ -29,6 +29,7 @@ enum
PROP_LAYOUT,
PROP_FRAMEBUFFER,
PROP_OFFSCREEN,
+ PROP_SHADOWFB,
PROP_SCALE,
PROP_LAST
@@ -43,7 +44,10 @@ typedef struct _ClutterStageViewPrivate
CoglFramebuffer *framebuffer;
CoglOffscreen *offscreen;
- CoglPipeline *pipeline;
+ CoglPipeline *offscreen_pipeline;
+
+ CoglOffscreen *shadowfb;
+ CoglPipeline *shadowfb_pipeline;
guint dirty_viewport : 1;
guint dirty_projection : 1;
@@ -69,6 +73,8 @@ clutter_stage_view_get_framebuffer (ClutterStageView *view)
if (priv->offscreen)
return priv->offscreen;
+ else if (priv->shadowfb)
+ return priv->shadowfb;
else
return priv->framebuffer;
}
@@ -82,6 +88,24 @@ clutter_stage_view_get_onscreen (ClutterStageView *view)
return priv->framebuffer;
}
+static CoglPipeline *
+clutter_stage_view_create_framebuffer_pipeline (CoglFramebuffer *framebuffer)
+{
+ CoglPipeline *pipeline;
+
+ pipeline = cogl_pipeline_new (cogl_framebuffer_get_context (framebuffer));
+
+ cogl_pipeline_set_layer_filters (pipeline, 0,
+ COGL_PIPELINE_FILTER_NEAREST,
+ COGL_PIPELINE_FILTER_NEAREST);
+ cogl_pipeline_set_layer_texture (pipeline, 0,
+ cogl_offscreen_get_texture (framebuffer));
+ cogl_pipeline_set_layer_wrap_mode (pipeline, 0,
+ COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
+
+ return pipeline;
+}
+
static void
clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
{
@@ -92,71 +116,122 @@ clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
g_assert (priv->offscreen != NULL);
- if (priv->pipeline)
+ if (priv->offscreen_pipeline)
return;
- priv->pipeline =
- cogl_pipeline_new (cogl_framebuffer_get_context (priv->offscreen));
- cogl_pipeline_set_layer_filters (priv->pipeline, 0,
- COGL_PIPELINE_FILTER_NEAREST,
- COGL_PIPELINE_FILTER_NEAREST);
- cogl_pipeline_set_layer_texture (priv->pipeline, 0,
- cogl_offscreen_get_texture (priv->offscreen));
- cogl_pipeline_set_layer_wrap_mode (priv->pipeline, 0,
- COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
+ priv->offscreen_pipeline =
+ clutter_stage_view_create_framebuffer_pipeline (priv->offscreen);
if (view_class->setup_offscreen_blit_pipeline)
- view_class->setup_offscreen_blit_pipeline (view, priv->pipeline);
+ view_class->setup_offscreen_blit_pipeline (view, priv->offscreen_pipeline);
}
-void
-clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
+static void
+clutter_stage_view_ensure_shadowfb_blit_pipeline (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
- g_clear_pointer (&priv->pipeline, cogl_object_unref);
+ if (priv->shadowfb_pipeline)
+ return;
+
+ priv->shadowfb_pipeline =
+ clutter_stage_view_create_framebuffer_pipeline (priv->shadowfb);
}
void
-clutter_stage_view_blit_offscreen (ClutterStageView *view,
- const cairo_rectangle_int_t *rect)
+clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
+
+ g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
+}
+
+static void
+clutter_stage_view_copy_to_framebuffer (ClutterStageView *view,
+ const cairo_rectangle_int_t *rect,
+ CoglPipeline *pipeline,
+ CoglFramebuffer *src_framebuffer,
+ CoglFramebuffer *dst_framebuffer,
+ gboolean can_blit)
+{
CoglMatrix matrix;
- clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
- if (cogl_matrix_is_identity (&matrix))
+ /* First, try with blit */
+ if (can_blit)
{
- int fb_width = cogl_framebuffer_get_width (priv->framebuffer);
- int fb_height = cogl_framebuffer_get_height (priv->framebuffer);
-
- if (cogl_blit_framebuffer (priv->offscreen,
- priv->framebuffer,
+ if (cogl_blit_framebuffer (src_framebuffer,
+ dst_framebuffer,
0, 0,
0, 0,
- fb_width, fb_height,
+ cogl_framebuffer_get_width (dst_framebuffer),
+ cogl_framebuffer_get_height (dst_framebuffer),
NULL))
return;
}
- clutter_stage_view_ensure_offscreen_blit_pipeline (view);
- cogl_framebuffer_push_matrix (priv->framebuffer);
+ /* If blit fails, fallback to the slower painting method */
+ cogl_framebuffer_push_matrix (dst_framebuffer);
- /* Set transform so 0,0 is on the top left corner and 1,1 on
- * the bottom right corner.
- */
cogl_matrix_init_identity (&matrix);
cogl_matrix_translate (&matrix, -1, 1, 0);
cogl_matrix_scale (&matrix, 2, -2, 0);
- cogl_framebuffer_set_projection_matrix (priv->framebuffer, &matrix);
+ cogl_framebuffer_set_projection_matrix (dst_framebuffer, &matrix);
- cogl_framebuffer_draw_rectangle (priv->framebuffer,
- priv->pipeline,
+ cogl_framebuffer_draw_rectangle (dst_framebuffer,
+ pipeline,
0, 0, 1, 1);
- cogl_framebuffer_pop_matrix (priv->framebuffer);
+ cogl_framebuffer_pop_matrix (dst_framebuffer);
+}
+
+void
+clutter_stage_view_blit_offscreen (ClutterStageView *view,
+ const cairo_rectangle_int_t *rect)
+{
+ ClutterStageViewPrivate *priv =
+ clutter_stage_view_get_instance_private (view);
+
+ if (priv->offscreen)
+ {
+ gboolean can_blit;
+ CoglMatrix matrix;
+
+ clutter_stage_view_ensure_offscreen_blit_pipeline (view);
+ clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
+ can_blit = cogl_matrix_is_identity (&matrix);
+
+ if (priv->shadowfb)
+ {
+ clutter_stage_view_copy_to_framebuffer (view,
+ rect,
+ priv->offscreen_pipeline,
+ priv->offscreen,
+ priv->shadowfb,
+ can_blit);
+ }
+ else
+ {
+ clutter_stage_view_copy_to_framebuffer (view,
+ rect,
+ priv->offscreen_pipeline,
+ priv->offscreen,
+ priv->framebuffer,
+ can_blit);
+ }
+ }
+
+ if (priv->shadowfb)
+ {
+ clutter_stage_view_ensure_shadowfb_blit_pipeline (view);
+ clutter_stage_view_copy_to_framebuffer (view,
+ rect,
+ priv->shadowfb_pipeline,
+ priv->shadowfb,
+ priv->framebuffer,
+ TRUE);
+ }
}
float
@@ -256,6 +331,9 @@ clutter_stage_view_get_property (GObject *object,
case PROP_OFFSCREEN:
g_value_set_boxed (value, priv->offscreen);
break;
+ case PROP_SHADOWFB:
+ g_value_set_boxed (value, priv->shadowfb);
+ break;
case PROP_SCALE:
g_value_set_float (value, priv->scale);
break;
@@ -301,6 +379,9 @@ clutter_stage_view_set_property (GObject *object,
case PROP_OFFSCREEN:
priv->offscreen = g_value_dup_boxed (value);
break;
+ case PROP_SHADOWFB:
+ priv->shadowfb = g_value_dup_boxed (value);
+ break;
case PROP_SCALE:
priv->scale = g_value_get_float (value);
break;
@@ -317,8 +398,10 @@ clutter_stage_view_dispose (GObject *object)
clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->framebuffer, cogl_object_unref);
+ g_clear_pointer (&priv->shadowfb, cogl_object_unref);
g_clear_pointer (&priv->offscreen, cogl_object_unref);
- g_clear_pointer (&priv->pipeline, cogl_object_unref);
+ g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
+ g_clear_pointer (&priv->shadowfb_pipeline, cogl_object_unref);
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
}
@@ -373,6 +456,15 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
+ obj_props[PROP_SHADOWFB] =
+ g_param_spec_boxed ("shadowfb",
+ "Shadow framebuffer",
+ "Framebuffer used as intermediate shadow buffer",
+ COGL_TYPE_HANDLE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
obj_props[PROP_SCALE] =
g_param_spec_float ("scale",
"View scale",
diff --git a/clutter/clutter/cogl/clutter-stage-cogl.c b/clutter/clutter/cogl/clutter-stage-cogl.c
index e0c39185b..eab76e52f 100644
--- a/clutter/clutter/cogl/clutter-stage-cogl.c
+++ b/clutter/clutter/cogl/clutter-stage-cogl.c
@@ -477,11 +477,7 @@ paint_stage (ClutterStageCogl *stage_cogl,
_clutter_stage_maybe_setup_viewport (stage, view);
_clutter_stage_paint_view (stage, view, clip);
- if (clutter_stage_view_get_onscreen (view) !=
- clutter_stage_view_get_framebuffer (view))
- {
- clutter_stage_view_blit_offscreen (view, clip);
- }
+ clutter_stage_view_blit_offscreen (view, clip);
}
static void
--
2.21.0

View File

@ -1,98 +0,0 @@
From ca3e9e3b3b84fe95affbe5485212c6ecfa1a4b51 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Tue, 22 Oct 2019 17:05:46 +0200
Subject: [PATCH 12/12] renderer-native: Separate offscreen and shadowfb
Create the intermediate shadow framebuffer for use exclusively when a
shadowfb is required.
Keep the previous offscreen framebuffer is as an intermediate
framebuffer for transformations only.
This way, we can apply transformations between in-memory framebuffers
prior to blit the result to screen, and achieve acceptable performance
even with software rendering on discrete GPU.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/917
(cherry picked from commit 551641c74822ca2e3c685e49603836ebf5397df2)
---
src/backends/native/meta-renderer-native.c | 29 ++++++++++++++++++----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 3cd01bcb7..ffb64a6bd 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -3287,7 +3287,6 @@ meta_renderer_native_create_onscreen (MetaRendererNative *renderer_native,
static CoglOffscreen *
meta_renderer_native_create_offscreen (MetaRendererNative *renderer,
CoglContext *context,
- MetaMonitorTransform transform,
gint view_width,
gint view_height,
GError **error)
@@ -3489,6 +3488,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
MetaMonitorTransform view_transform;
CoglOnscreen *onscreen = NULL;
CoglOffscreen *offscreen = NULL;
+ CoglOffscreen *shadowfb = NULL;
float scale;
int width, height;
MetaRendererView *view;
@@ -3515,18 +3515,35 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
if (!onscreen)
g_error ("Failed to allocate onscreen framebuffer: %s", error->message);
- if (view_transform != META_MONITOR_TRANSFORM_NORMAL ||
- should_force_shadow_fb (renderer_native,
- renderer_native->primary_gpu_kms))
+ if (view_transform != META_MONITOR_TRANSFORM_NORMAL)
{
offscreen = meta_renderer_native_create_offscreen (renderer_native,
cogl_context,
- view_transform,
width,
height,
&error);
if (!offscreen)
g_error ("Failed to allocate back buffer texture: %s", error->message);
+
+ }
+
+ if (should_force_shadow_fb (renderer_native,
+ renderer_native->primary_gpu_kms))
+ {
+ int shadow_width;
+ int shadow_height;
+
+ /* The shadowfb must be the same size as the on-screen framebuffer */
+ shadow_width = cogl_framebuffer_get_width (COGL_FRAMEBUFFER (onscreen));
+ shadow_height = cogl_framebuffer_get_height (COGL_FRAMEBUFFER (onscreen));
+
+ shadowfb = meta_renderer_native_create_offscreen (renderer_native,
+ cogl_context,
+ shadow_width,
+ shadow_height,
+ &error);
+ if (!shadowfb)
+ g_error ("Failed to allocate shadow buffer texture: %s", error->message);
}
view = g_object_new (META_TYPE_RENDERER_VIEW,
@@ -3534,10 +3551,12 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
"scale", scale,
"framebuffer", onscreen,
"offscreen", offscreen,
+ "shadowfb", shadowfb,
"logical-monitor", logical_monitor,
"transform", view_transform,
NULL);
g_clear_pointer (&offscreen, cogl_object_unref);
+ g_clear_pointer (&shadowfb, cogl_object_unref);
meta_onscreen_native_set_view (onscreen, view);
--
2.21.0

View File

@ -1,375 +0,0 @@
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
availability
Commit "backends/x11: Support synaptics configuration" added support
for synaptics two finger scrolling but didn't add the code to check
that it is available resulting in the upper layer always assuming it
isn't.
---
src/backends/x11/meta-input-settings-x11.c | 11 +++++++++++
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 16a3ff33d..7ad304704 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -626,6 +626,17 @@ meta_input_settings_x11_has_two_finger_scroll (MetaInputSettings *settings,
guchar *available = NULL;
gboolean has_two_finger = TRUE;
+ if (is_device_synaptics (device))
+ {
+ available = get_property (device, "Synaptics Capabilities",
+ XA_INTEGER, 8, 4);
+ if (!available || !available[3])
+ has_two_finger = FALSE;
+
+ meta_XFree (available);
+ return has_two_finger;
+ }
+
available = get_property (device, "libinput Scroll Methods Available",
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[SCROLL_METHOD_FIELD_2FG])
--
2.36.1
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
synaptics
This is basically a copy of the old g-s-d mouse plugin code to manage
syndaemon when the synaptics driver is being used.
---
src/backends/x11/meta-input-settings-x11.c | 112 +++++++++++++++++++++
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 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 @@
#ifdef HAVE_LIBGUDEV
#include <gudev/gudev.h>
#endif
+#ifdef __linux
+#include <sys/prctl.h>
+#endif
#include "backends/meta-logical-monitor.h"
#include "backends/x11/meta-backend-x11.h"
@@ -46,6 +49,8 @@ typedef struct _MetaInputSettingsX11Private
#ifdef HAVE_LIBGUDEV
GUdevClient *udev_client;
#endif
+ gboolean syndaemon_spawned;
+ GPid syndaemon_pid;
} MetaInputSettingsX11Private;
G_DEFINE_TYPE_WITH_PRIVATE (MetaInputSettingsX11, meta_input_settings_x11,
@@ -333,6 +338,107 @@ change_synaptics_speed (ClutterInputDevice *device,
XCloseDevice (xdisplay, xdevice);
}
+/* Ensure that syndaemon dies together with us, to avoid running several of
+ * them */
+static void
+setup_syndaemon (gpointer user_data)
+{
+#ifdef __linux
+ prctl (PR_SET_PDEATHSIG, SIGHUP);
+#endif
+}
+
+static gboolean
+have_program_in_path (const char *name)
+{
+ gchar *path;
+ gboolean result;
+
+ path = g_find_program_in_path (name);
+ result = (path != NULL);
+ g_free (path);
+ return result;
+}
+
+static void
+syndaemon_died (GPid pid,
+ gint status,
+ gpointer user_data)
+{
+ MetaInputSettingsX11 *settings_x11 = META_INPUT_SETTINGS_X11 (user_data);
+ MetaInputSettingsX11Private *priv =
+ meta_input_settings_x11_get_instance_private (settings_x11);
+ GError *error = NULL;
+
+ if (!g_spawn_check_exit_status (status, &error))
+ {
+ if ((WIFSIGNALED (status) && WTERMSIG (status) != SIGHUP) ||
+ error->domain == G_SPAWN_EXIT_ERROR)
+ g_warning ("Syndaemon exited unexpectedly: %s", error->message);
+ g_error_free (error);
+ }
+
+ g_spawn_close_pid (pid);
+ priv->syndaemon_spawned = FALSE;
+}
+
+static void
+set_synaptics_disable_w_typing (MetaInputSettings *settings,
+ gboolean state)
+{
+ MetaInputSettingsX11 *settings_x11 = META_INPUT_SETTINGS_X11 (settings);
+ MetaInputSettingsX11Private *priv =
+ meta_input_settings_x11_get_instance_private (settings_x11);
+
+ if (state)
+ {
+ GError *error = NULL;
+ GPtrArray *args;
+
+ if (priv->syndaemon_spawned)
+ return;
+
+ if (!have_program_in_path ("syndaemon"))
+ return;
+
+ args = g_ptr_array_new ();
+
+ g_ptr_array_add (args, (gpointer)"syndaemon");
+ g_ptr_array_add (args, (gpointer)"-i");
+ g_ptr_array_add (args, (gpointer)"1.0");
+ g_ptr_array_add (args, (gpointer)"-t");
+ g_ptr_array_add (args, (gpointer)"-K");
+ g_ptr_array_add (args, (gpointer)"-R");
+ g_ptr_array_add (args, NULL);
+
+ /* we must use G_SPAWN_DO_NOT_REAP_CHILD to avoid
+ * double-forking, otherwise syndaemon will immediately get
+ * killed again through (PR_SET_PDEATHSIG when the intermediate
+ * process dies */
+ g_spawn_async (g_get_home_dir (), (char **) args->pdata, NULL,
+ G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD, setup_syndaemon, NULL,
+ &priv->syndaemon_pid, &error);
+
+ priv->syndaemon_spawned = (error == NULL);
+ g_ptr_array_free (args, TRUE);
+
+ if (error)
+ {
+ g_warning ("Failed to launch syndaemon: %s", error->message);
+ g_error_free (error);
+ }
+ else
+ {
+ g_child_watch_add (priv->syndaemon_pid, syndaemon_died, settings);
+ }
+ }
+ else if (priv->syndaemon_spawned)
+ {
+ kill (priv->syndaemon_pid, SIGHUP);
+ priv->syndaemon_spawned = FALSE;
+ }
+}
+
static void
meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -457,6 +563,12 @@ meta_input_settings_x11_set_disable_while_typing (MetaInputSettings *settings,
{
guchar value = (enabled) ? 1 : 0;
+ if (is_device_synaptics (device))
+ {
+ set_synaptics_disable_w_typing (settings, enabled);
+ return;
+ }
+
change_property (device, "libinput Disable While Typing Enabled",
XA_INTEGER, 8, &value, 1);
}
--
2.36.1
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
We re-use part of the code added to support synaptics and add a few
bits specific for xorg-x11-drv-evdev devices.
---
src/backends/x11/meta-input-settings-x11.c | 97 +++++++++++++++++-----
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 743f4a7ce..85f24e92b 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -182,35 +182,35 @@ is_device_synaptics (ClutterInputDevice *device)
return TRUE;
}
+static gboolean
+is_device_libinput (ClutterInputDevice *device)
+{
+ guchar *has_setting;
+
+ /* We just need looking for a synaptics-specific property */
+ has_setting = get_property (device, "libinput Send Events Modes Available", XA_INTEGER, 8, 2);
+ if (!has_setting)
+ return FALSE;
+
+ meta_XFree (has_setting);
+ return TRUE;
+}
+
static void
-change_synaptics_tap_left_handed (ClutterInputDevice *device,
- gboolean tap_enabled,
- gboolean left_handed)
+change_x_device_left_handed (ClutterInputDevice *device,
+ gboolean left_handed)
{
MetaDisplay *display = meta_get_display ();
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
XDevice *xdevice;
- guchar *tap_action, *buttons;
+ guchar *buttons;
guint buttons_capacity = 16, n_buttons;
xdevice = XOpenDevice(xdisplay, clutter_input_device_get_device_id (device));
if (!xdevice)
return;
- tap_action = get_property (device, "Synaptics Tap Action",
- XA_INTEGER, 8, 7);
- if (!tap_action)
- goto out;
-
- tap_action[4] = tap_enabled ? (left_handed ? 3 : 1) : 0;
- tap_action[5] = tap_enabled ? (left_handed ? 1 : 3) : 0;
- tap_action[6] = tap_enabled ? 2 : 0;
-
- change_property (device, "Synaptics Tap Action",
- XA_INTEGER, 8, tap_action, 7);
- meta_XFree (tap_action);
-
clutter_x11_trap_x_errors();
buttons = g_new (guchar, buttons_capacity);
n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice,
@@ -233,17 +233,39 @@ change_synaptics_tap_left_handed (ClutterInputDevice *device,
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",
clutter_input_device_get_device_name (device));
}
- out:
XCloseDevice (xdisplay, xdevice);
}
static void
-change_synaptics_speed (ClutterInputDevice *device,
- gdouble speed)
+change_synaptics_tap_left_handed (ClutterInputDevice *device,
+ gboolean tap_enabled,
+ gboolean left_handed)
+{
+ guchar *tap_action;
+
+ tap_action = get_property (device, "Synaptics Tap Action",
+ XA_INTEGER, 8, 7);
+ if (!tap_action)
+ return;
+
+ tap_action[4] = tap_enabled ? (left_handed ? 3 : 1) : 0;
+ tap_action[5] = tap_enabled ? (left_handed ? 1 : 3) : 0;
+ tap_action[6] = tap_enabled ? 2 : 0;
+
+ change_property (device, "Synaptics Tap Action",
+ XA_INTEGER, 8, tap_action, 7);
+ meta_XFree (tap_action);
+
+ change_x_device_left_handed (device, left_handed);
+}
+
+static void
+change_x_device_speed (ClutterInputDevice *device,
+ gdouble speed)
{
MetaDisplay *display = meta_get_display ();
MetaBackend *backend = meta_get_backend ();
@@ -338,6 +360,23 @@ change_synaptics_speed (ClutterInputDevice *device,
XCloseDevice (xdisplay, xdevice);
}
+static void
+change_x_device_scroll_button (ClutterInputDevice *device,
+ guint button)
+{
+ guchar value;
+
+ value = button > 0 ? 1 : 0;
+ change_property (device, "Evdev Wheel Emulation",
+ XA_INTEGER, 8, &value, 1);
+ if (button > 0)
+ {
+ value = button;
+ change_property (device, "Evdev Wheel Emulation Button",
+ XA_INTEGER, 8, &value, 1);
+ }
+}
+
/* Ensure that syndaemon dies together with us, to avoid running several of
* them */
static void
@@ -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;
- if (is_device_synaptics (device))
+ if (is_device_synaptics (device) ||
+ !is_device_libinput (device))
{
- change_synaptics_speed (device, speed);
+ change_x_device_speed (device, speed);
return;
}
@@ -550,6 +590,11 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
g_object_unref (settings);
return;
}
+ else if (!is_device_libinput (device) && device_type != CLUTTER_PAD_DEVICE)
+ {
+ change_x_device_left_handed (device, enabled);
+ return;
+ }
change_property (device, "libinput Left Handed Enabled",
XA_INTEGER, 8, &value, 1);
@@ -763,6 +808,12 @@ meta_input_settings_x11_set_scroll_button (MetaInputSettings *settings,
ClutterInputDevice *device,
guint button)
{
+ if (!is_device_libinput (device))
+ {
+ change_x_device_scroll_button (device, button);
+ return;
+ }
+
change_property (device, "libinput Button Scrolling Button",
XA_INTEGER, 32, &button, 1);
}
--
2.36.1

View File

@ -1,246 +0,0 @@
From 55417eea4294210495eceebd6dd4b832f371f054 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
Date: Sun, 14 Apr 2019 17:15:06 +0200
Subject: [PATCH 1/5] display: Fix a possible bug in
meta_display_sync_wayland_focus
The check for the focus xwindow is called, but not used. Fix that by
renaming the variable to reflect better what it does and actually using
the return value of the check.
This was the original intention of the author in commit
05899596d10918df5359d89baa82e6fedd0ae208 and got broken in commit
8e7e1eeef59c4f74046e6783b6334c1432255c5a.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/535
---
src/core/display.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/core/display.c b/src/core/display.c
index 0de99edb2..4c8907f40 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1208,15 +1208,15 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display)
MetaWindow *focus_window = NULL;
MetaBackend *backend = meta_get_backend ();
MetaStage *stage = META_STAGE (meta_backend_get_stage (backend));
- gboolean is_focus_xwindow = FALSE;
+ gboolean is_no_focus_xwindow = FALSE;
if (display->x11_display)
- meta_x11_display_xwindow_is_a_no_focus_window (display->x11_display,
- display->x11_display->focus_xwindow);
+ is_no_focus_xwindow = meta_x11_display_xwindow_is_a_no_focus_window (display->x11_display,
+ display->x11_display->focus_xwindow);
if (!meta_display_windows_are_interactable (display))
focus_window = NULL;
- else if (is_focus_xwindow)
+ else if (is_no_focus_xwindow)
focus_window = NULL;
else if (display->focus_window && display->focus_window->surface)
focus_window = display->focus_window;
--
2.21.0
From 17cc0a2a21c504b8631bf2ce0f508f611f9b1d3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Mon, 27 May 2019 20:03:25 +0000
Subject: [PATCH 2/5] renderer-x11-nested: Fix copy-and-paste error
The rounding added in commit c5471e5b8b1 mixed up some variables,
whoops.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/598
---
src/backends/x11/nested/meta-renderer-x11-nested.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backends/x11/nested/meta-renderer-x11-nested.c b/src/backends/x11/nested/meta-renderer-x11-nested.c
index 71a85a8c2..5000bf357 100644
--- a/src/backends/x11/nested/meta-renderer-x11-nested.c
+++ b/src/backends/x11/nested/meta-renderer-x11-nested.c
@@ -203,7 +203,7 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer,
height = logical_monitor->rect.height;
}
width = roundf (width * view_scale);
- height = roundf (width * view_scale);
+ height = roundf (height * view_scale);
fake_onscreen = create_offscreen (cogl_context, width, height);
--
2.21.0
From a58fabbb0e3173359d3374b931815c21ce65032d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Mon, 27 May 2019 19:59:53 +0000
Subject: [PATCH 3/5] input-mapper: Remove unnecessary return value
Since commit ae6d9e35bd, there is a fallback to META_MATCH_IS_BUILTIN,
so the condition for returning FALSE is never met.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/598
---
src/backends/meta-input-mapper.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/src/backends/meta-input-mapper.c b/src/backends/meta-input-mapper.c
index acc9b1618..fc4f3bd59 100644
--- a/src/backends/meta-input-mapper.c
+++ b/src/backends/meta-input-mapper.c
@@ -353,7 +353,7 @@ find_builtin_output (MetaInputMapper *mapper,
return panel != NULL;
}
-static gboolean
+static void
guess_candidates (MetaInputMapper *mapper,
MetaMapperInputInfo *input,
DeviceCandidates *info)
@@ -387,15 +387,7 @@ guess_candidates (MetaInputMapper *mapper,
find_builtin_output (mapper, &info->candidates[META_MATCH_IS_BUILTIN]);
}
- if (best < N_OUTPUT_MATCHES)
- {
- info->best = best;
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ info->best = best;
}
static void
@@ -408,8 +400,7 @@ mapping_helper_add (MappingHelper *helper,
info.input = input;
- if (!guess_candidates (mapper, input, &info))
- return;
+ guess_candidates (mapper, input, &info);
for (i = 0; i < helper->device_maps->len; i++)
{
--
2.21.0
From 4eb025cf36a9118cc496ae9143ee2eb510b6228c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Mon, 27 May 2019 20:22:50 +0000
Subject: [PATCH 4/5] workspace-manager: Remove unnecessary assignment
The initialization to -1 is never used, instead the variables are
re-initialized to 0 before the loop that uses them.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/598
---
src/core/meta-workspace-manager.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/core/meta-workspace-manager.c b/src/core/meta-workspace-manager.c
index af7344709..8e1f03fe8 100644
--- a/src/core/meta-workspace-manager.c
+++ b/src/core/meta-workspace-manager.c
@@ -600,8 +600,6 @@ meta_workspace_manager_calc_workspace_layout (MetaWorkspaceManager *workspace_ma
grid = g_new (int, grid_area);
- current_row = -1;
- current_col = -1;
i = 0;
switch (workspace_manager->starting_corner)
--
2.21.0
From a854a337ac8807f310ac2c474f9be290089f79f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Mon, 27 May 2019 20:43:21 +0000
Subject: [PATCH 5/5] x11-display: Simplify bell handling
Since commit 956ab4bd made libcanberra mandatory, we never use
the system bell for handling the `audible-bell` setting. So
instead of reacting to settings changes with the exact same call
to XkbChangeEnabledControls(), just call it once when initializing.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/598
---
src/x11/meta-x11-display.c | 39 +++++++-------------------------------
1 file changed, 7 insertions(+), 32 deletions(-)
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index 8ce12b994..065ffcdda 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -463,6 +463,13 @@ init_x11_bell (MetaX11Display *x11_display)
&mask);
}
}
+
+ /* We are playing sounds using libcanberra support, we handle the
+ * bell whether its an audible bell or a visible bell */
+ XkbChangeEnabledControls (x11_display->xdisplay,
+ XkbUseCoreKbd,
+ XkbAudibleBellMask,
+ 0);
}
/*
@@ -480,32 +487,6 @@ shutdown_x11_bell (MetaX11Display *x11_display)
XkbAudibleBellMask);
}
-/*
- * Turns the bell to audible or visual. This tells X what to do, but
- * not Mutter; you will need to set the "visual bell" pref for that.
- */
-static void
-set_x11_bell_is_audible (MetaX11Display *x11_display,
- gboolean is_audible)
-{
- /* When we are playing sounds using libcanberra support, we handle the
- * bell whether its an audible bell or a visible bell */
- gboolean enable_system_bell = FALSE;
-
- XkbChangeEnabledControls (x11_display->xdisplay,
- XkbUseCoreKbd,
- XkbAudibleBellMask,
- enable_system_bell ? XkbAudibleBellMask : 0);
-}
-
-static void
-on_is_audible_changed (MetaBell *bell,
- gboolean is_audible,
- MetaX11Display *x11_display)
-{
- set_x11_bell_is_audible (x11_display, is_audible);
-}
-
static void
set_desktop_geometry_hint (MetaX11Display *x11_display)
{
@@ -1320,12 +1301,6 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
init_x11_bell (x11_display);
- g_signal_connect_object (display->bell, "is-audible-changed",
- G_CALLBACK (on_is_audible_changed),
- x11_display, 0);
-
- set_x11_bell_is_audible (x11_display, meta_prefs_bell_is_audible ());
-
meta_x11_startup_notification_init (x11_display);
return x11_display;
--
2.21.0

File diff suppressed because it is too large Load Diff

View File

@ -1,333 +0,0 @@
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

View File

@ -1,138 +0,0 @@
From 30d6e3abe2a0251b11513d66d15a59cd0705a828 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Mon, 27 May 2019 17:48:41 +0000
Subject: [PATCH 1/2] clutter-text: Fix selection color drawing
Commit cabcad185 removed the call to cogl_set_source_color4ub() before
cogl_fill_path(), so instead of the previously assigned selection color,
the background is drawn with the last set source.
In order to honour the newly added framebuffer parameter and still apply
the correct color, switch from cogl_fill_path() to the (deprecated!)
cogl_framebuffer_fill_path() method.
https://gitlab.gnome.org/GNOME/mutter/issues/494
---
clutter/clutter/clutter-text.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c
index fb9d926df..000bbbbd4 100644
--- a/clutter/clutter/clutter-text.c
+++ b/clutter/clutter/clutter-text.c
@@ -1975,6 +1975,7 @@ selection_paint (ClutterText *self,
else
{
/* Paint selection background first */
+ CoglPipeline *color_pipeline = cogl_pipeline_copy (default_color_pipeline);
PangoLayout *layout = clutter_text_get_layout (self);
CoglPath *selection_path = cogl_path_new ();
CoglColor cogl_color = { 0, };
@@ -1987,11 +1988,19 @@ selection_paint (ClutterText *self,
else
color = &priv->text_color;
+ cogl_color_init_from_4ub (&cogl_color,
+ color->red,
+ color->green,
+ color->blue,
+ paint_opacity * color->alpha / 255);
+ cogl_color_premultiply (&cogl_color);
+ cogl_pipeline_set_color (color_pipeline, &cogl_color);
+
clutter_text_foreach_selection_rectangle_prescaled (self,
add_selection_rectangle_to_path,
selection_path);
- cogl_path_fill (selection_path);
+ cogl_framebuffer_fill_path (fb, color_pipeline, selection_path);
/* Paint selected text */
cogl_framebuffer_push_path_clip (fb, selection_path);
--
2.21.0
From 13a1624c1050c91cd4d8a298f7a10fafe56fe9e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Mon, 27 May 2019 22:40:47 +0000
Subject: [PATCH 2/2] cogl-path: Undeprecate framebuffer functions
It looks like deprecating the functions with explicit framebuffer/pipeline
arguments made it to (cogl) master by mistake:
https://mail.gnome.org/archives/clutter-list/2016-April/msg00008.html
We now use one of them, so this is a good time to undeprecate the lot.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/597
---
cogl/cogl-path/cogl-path-functions.h | 6 ------
cogl/cogl-path/cogl-path.c | 3 ---
2 files changed, 9 deletions(-)
diff --git a/cogl/cogl-path/cogl-path-functions.h b/cogl/cogl-path/cogl-path-functions.h
index d4ef328d2..318fed028 100644
--- a/cogl/cogl-path/cogl-path-functions.h
+++ b/cogl/cogl-path/cogl-path-functions.h
@@ -460,9 +460,7 @@ cogl_path_fill (CoglPath *path);
* use while filling a path.</note>
*
* Stability: unstable
- * Deprecated: 1.16: Use cogl_path_fill() instead
*/
-COGL_DEPRECATED_FOR (cogl_path_fill)
void
cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
@@ -492,9 +490,7 @@ cogl_path_stroke (CoglPath *path);
* regardless of the current transformation matrix.
*
* Stability: unstable
- * Deprecated: 1.16: Use cogl_path_stroke() instead
*/
-COGL_DEPRECATED_FOR (cogl_path_stroke)
void
cogl_framebuffer_stroke_path (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
@@ -529,9 +525,7 @@ cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
*
* Since: 1.8
* Stability: Unstable
- * Deprecated: 1.16: Use cogl_framebuffer_push_path_clip() instead
*/
-COGL_DEPRECATED_FOR (cogl_framebuffer_push_path_clip)
void
cogl_clip_push_from_path (CoglPath *path);
diff --git a/cogl/cogl-path/cogl-path.c b/cogl/cogl-path/cogl-path.c
index 4d86c6fb5..8774406f8 100644
--- a/cogl/cogl-path/cogl-path.c
+++ b/cogl/cogl-path/cogl-path.c
@@ -1504,7 +1504,6 @@ cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
COGL_FRAMEBUFFER_STATE_CLIP;
}
-/* XXX: deprecated */
void
cogl_clip_push_from_path (CoglPath *path)
{
@@ -1575,7 +1574,6 @@ _cogl_path_build_stroke_attribute_buffer (CoglPath *path)
data->stroke_n_attributes = n_attributes;
}
-/* XXX: deprecated */
void
cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
@@ -1588,7 +1586,6 @@ cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
_cogl_path_fill_nodes (path, framebuffer, pipeline, 0 /* flags */);
}
-/* XXX: deprecated */
void
cogl_framebuffer_stroke_path (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
--
2.21.0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,614 +0,0 @@
From d442ef48412e3dc1b24a9f97b02ee3383404d501 Mon Sep 17 00:00:00 2001
From: Emil Velikov <emil.velikov@collabora.com>
Date: Wed, 12 Jun 2019 16:58:54 +0000
Subject: [PATCH 1/8] renderer/native: add missing eglTerminate in EGLDevice
error path
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Currently the EGLDevice code gets the display and calls eglInitialize.
As a follow-up it checks the required EGL extensions - technically it
could check the EGL device extensions earlier.
In either case, eglTerminate is missing. Thus the connection to the
display was still bound.
This was highlighted with Mesa commit d6edccee8da ("egl: add
EGL_platform_device support") + amdgpu.
In that case, since the eglTerminate is missing, we end up reusing the
underlying amdgpu_device due to some caching in libdrm_amdgpu. The
latter in itself being a good solution since it allows buffer sharing
across primary and render node of the same device.
Note: we should really get this in branches all the way back to 3.30.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/619
Fixes: 934184e23 ("MetaRendererNative: Add EGLDevice based rendering support")
Cc: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 9213574870faee7fe40609791fc48f4b44f861c0)
---
src/backends/native/meta-renderer-native.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index dbfc97aae..207b654fa 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -4038,6 +4038,7 @@ create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native,
G_IO_ERROR_FAILED,
"Missing EGL extensions required for EGLDevice renderer: %s",
missing_extensions_str);
+ meta_egl_terminate (egl, egl_display, NULL);
g_free (missing_extensions_str);
g_free (missing_extensions);
return NULL;
--
2.24.1
From e18dfc888343585d21b3f64568571009c4967a95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 17 Jun 2019 18:18:12 +0200
Subject: [PATCH 2/8] renderer/native: Use g_set_error() instead of
_cogl_set_error()
It's even a GError, so lets use the proper API.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/622
(cherry picked from commit 1efb32d3000ca06ee3cfcc146dc812866d243619)
---
src/backends/native/meta-renderer-native.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 207b654fa..e7aa6f389 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -1277,7 +1277,7 @@ meta_renderer_native_egl_context_created (CoglDisplay *cogl_display,
cogl_display_egl->dummy_surface,
cogl_display_egl->egl_context))
{
- _cogl_set_error (error, COGL_WINSYS_ERROR,
+ g_set_error (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_CREATE_CONTEXT,
"Failed to make context current");
return FALSE;
--
2.24.1
From 1947a81db93624d57471ce1edf5548c7774c3569 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 17 Jun 2019 18:18:42 +0200
Subject: [PATCH 3/8] renderer/native: Make sure we're not destroying an active
EGLSurface
When making a new surface/context pair current, mesa may want to flush
the old context. Make sure we don't try to flush any freed memory by
unmaking a surface/context pair current before freeing it.
Not doing this results in the following valgrind warnings:
==15986== Invalid read of size 8
==15986== at 0x69A6D80: dri_flush_front_buffer (gbm_dri.c:92)
==15986== by 0x1750D458: intel_flush_front (brw_context.c:251)
==15986== by 0x1750D4BB: intel_glFlush (brw_context.c:296)
==15986== by 0x1739D8DD: dri2_make_current (egl_dri2.c:1461)
==15986== by 0x17393A3A: eglMakeCurrent (eglapi.c:869)
==15986== by 0x54381FB: InternalMakeCurrentVendor (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0)
==15986== by 0x5438515: eglMakeCurrent (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0)
==15986== by 0x522A782: _cogl_winsys_egl_make_current (cogl-winsys-egl.c:303)
==15986== by 0x49B64C8: meta_renderer_native_create_view (meta-renderer-native.c:3076)
==15986== by 0x48D26E7: meta_renderer_create_view (meta-renderer.c:78)
==15986== by 0x48D277A: meta_renderer_rebuild_views (meta-renderer.c:111)
==15986== by 0x49BF46E: meta_stage_native_rebuild_views (meta-stage-native.c:142)
==15986== Address 0x1b076600 is 0 bytes inside a block of size 48 free'd
==15986== at 0x4839A0C: free (vg_replace_malloc.c:540)
==15986== by 0x49B59F3: meta_renderer_native_release_onscreen (meta-renderer-native.c:2651)
==15986== by 0x5211441: _cogl_onscreen_free (cogl-onscreen.c:167)
==15986== by 0x5210D81: _cogl_object_onscreen_indirect_free (cogl-onscreen.c:51)
==15986== by 0x51D0066: _cogl_object_default_unref (cogl-object.c:103)
==15986== by 0x520F989: _cogl_framebuffer_unref (cogl-framebuffer.c:1814)
==15986== by 0x51D00B1: cogl_object_unref (cogl-object.c:115)
==15986== by 0x536F3C7: clutter_stage_view_dispose (clutter-stage-view.c:304)
==15986== by 0x4B7DAF2: g_object_unref (gobject.c:3309)
==15986== by 0x4A9596C: g_list_foreach (glist.c:1013)
==15986== by 0x4A9599A: g_list_free_full (glist.c:223)
==15986== by 0x48D2737: meta_renderer_rebuild_views (meta-renderer.c:100)
==15986== Block was alloc'd at
==15986== at 0x483AB1A: calloc (vg_replace_malloc.c:762)
==15986== by 0x69A76B2: gbm_dri_surface_create (gbm_dri.c:1252)
==15986== by 0x69A6BFE: gbm_surface_create (gbm.c:600)
==15986== by 0x49B4E29: meta_renderer_native_create_surface_gbm (meta-renderer-native.c:2221)
==15986== by 0x49B57DB: meta_onscreen_native_allocate (meta-renderer-native.c:2569)
==15986== by 0x49B6423: meta_renderer_native_create_view (meta-renderer-native.c:3062)
==15986== by 0x48D26E7: meta_renderer_create_view (meta-renderer.c:78)
==15986== by 0x48D277A: meta_renderer_rebuild_views (meta-renderer.c:111)
==15986== by 0x49BF46E: meta_stage_native_rebuild_views (meta-stage-native.c:142)
==15986== by 0x49A75B5: meta_backend_native_update_screen_size (meta-backend-native.c:520)
==15986== by 0x48B01BB: meta_backend_sync_screen_size (meta-backend.c:224)
==15986== by 0x48B09B7: meta_backend_real_post_init (meta-backend.c:501)
https://gitlab.gnome.org/GNOME/mutter/merge_requests/622
(cherry picked from commit 56ddaaa3809240a357b5e19b5789d1aa49aaecc3)
---
src/backends/native/meta-renderer-native.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index e7aa6f389..b7bc3121a 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -3040,6 +3040,8 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
{
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
CoglContext *cogl_context = framebuffer->context;
+ CoglDisplay *cogl_display = cogl_context_get_display (cogl_context);
+ CoglDisplayEGL *cogl_display_egl = cogl_display->winsys;
CoglRenderer *cogl_renderer = cogl_context->display->renderer;
CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys;
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
@@ -3052,6 +3054,17 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
onscreen_native = onscreen_egl->platform;
+ if (onscreen_egl->egl_surface != EGL_NO_SURFACE &&
+ (cogl_display_egl->current_draw_surface == onscreen_egl->egl_surface ||
+ cogl_display_egl->current_read_surface == onscreen_egl->egl_surface))
+ {
+ if (!_cogl_winsys_egl_make_current (cogl_display,
+ cogl_display_egl->dummy_surface,
+ cogl_display_egl->dummy_surface,
+ cogl_display_egl->egl_context))
+ g_warning ("Failed to clear current context");
+ }
+
g_list_free_full (onscreen_native->pending_page_flip_retries,
(GDestroyNotify) retry_page_flip_data_free);
if (onscreen_native->retry_page_flips_source)
--
2.24.1
From 60551e5e6f984a7ed3ba3339f027ed7b37f802c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 17 Jun 2019 19:16:12 +0200
Subject: [PATCH 4/8] renderer/native: Fix EGLSurface destruction order
Make sure to destroy the EGL surface after releasing held buffers,
otherwise we'll get the following valgrind warnings:
==24016== Invalid read of size 8
==24016== at 0x1739943F: release_buffer (platform_drm.c:73)
==24016== by 0x49AC355: meta_drm_buffer_gbm_finalize (meta-drm-buffer-gbm.c:213)
==24016== by 0x4B75B61: g_object_unref (gobject.c:3346)
==24016== by 0x49B4B41: free_current_bo (meta-renderer-native.c:991)
==24016== by 0x49B816F: meta_renderer_native_release_onscreen (meta-renderer-native.c:2971)
==24016== by 0x5209441: _cogl_onscreen_free (cogl-onscreen.c:167)
==24016== by 0x5208D81: _cogl_object_onscreen_indirect_free (cogl-onscreen.c:51)
==24016== by 0x51C8066: _cogl_object_default_unref (cogl-object.c:103)
==24016== by 0x5207989: _cogl_framebuffer_unref (cogl-framebuffer.c:1814)
==24016== by 0x51C80B1: cogl_object_unref (cogl-object.c:115)
==24016== by 0x53673C7: clutter_stage_view_dispose (clutter-stage-view.c:304)
==24016== by 0x4B75AF2: g_object_unref (gobject.c:3309)
==24016== Address 0x18e742a8 is 536 bytes inside a block of size 784 free'd
==24016== at 0x4839A0C: free (vg_replace_malloc.c:540)
==24016== by 0x17399764: dri2_drm_destroy_surface (platform_drm.c:231)
==24016== by 0x1738550A: eglDestroySurface (eglapi.c:1145)
==24016== by 0x5440286: eglDestroySurface (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0)
==24016== by 0x49613A5: meta_egl_destroy_surface (meta-egl.c:432)
==24016== by 0x49B80F9: meta_renderer_native_release_onscreen (meta-renderer-native.c:2954)
==24016== by 0x5209441: _cogl_onscreen_free (cogl-onscreen.c:167)
==24016== by 0x5208D81: _cogl_object_onscreen_indirect_free (cogl-onscreen.c:51)
==24016== by 0x51C8066: _cogl_object_default_unref (cogl-object.c:103)
==24016== by 0x5207989: _cogl_framebuffer_unref (cogl-framebuffer.c:1814)
==24016== by 0x51C80B1: cogl_object_unref (cogl-object.c:115)
==24016== by 0x53673C7: clutter_stage_view_dispose (clutter-stage-view.c:304)
==24016== Block was alloc'd at
==24016== at 0x483AB1A: calloc (vg_replace_malloc.c:762)
==24016== by 0x173997AE: dri2_drm_create_window_surface (platform_drm.c:145)
==24016== by 0x17388906: _eglCreateWindowSurfaceCommon (eglapi.c:929)
==24016== by 0x5440197: eglCreateWindowSurface (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0)
==24016== by 0x49612FF: meta_egl_create_window_surface (meta-egl.c:396)
==24016== by 0x49B752E: meta_renderer_native_create_surface_gbm (meta-renderer-native.c:2538)
==24016== by 0x49B7E6C: meta_onscreen_native_allocate (meta-renderer-native.c:2870)
==24016== by 0x49B8BCF: meta_renderer_native_create_view (meta-renderer-native.c:3387)
==24016== by 0x48D274B: meta_renderer_create_view (meta-renderer.c:78)
==24016== by 0x48D27DE: meta_renderer_rebuild_views (meta-renderer.c:111)
==24016== by 0x49BB4FB: meta_stage_native_rebuild_views (meta-stage-native.c:142)
==24016== by 0x49A733C: meta_backend_native_update_screen_size (meta-backend-native.c:517)
https://gitlab.gnome.org/GNOME/mutter/merge_requests/622
(cherry picked from commit d9fb11b04319c00fd89715dd9207fe54e1d18c2d)
---
src/backends/native/meta-renderer-native.c | 38 +++++++++++++++-------
1 file changed, 27 insertions(+), 11 deletions(-)
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index b7bc3121a..62c27c191 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -3035,6 +3035,28 @@ meta_onscreen_native_allocate (CoglOnscreen *onscreen,
return TRUE;
}
+static void
+destroy_egl_surface (CoglOnscreen *onscreen)
+{
+ CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+
+ if (onscreen_egl->egl_surface != EGL_NO_SURFACE)
+ {
+ MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
+ MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native);
+ CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
+ CoglContext *cogl_context = framebuffer->context;
+ CoglRenderer *cogl_renderer = cogl_context->display->renderer;
+ CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys;
+
+ meta_egl_destroy_surface (egl,
+ cogl_renderer_egl->edpy,
+ onscreen_egl->egl_surface,
+ NULL);
+ onscreen_egl->egl_surface = EGL_NO_SURFACE;
+ }
+}
+
static void
meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
{
@@ -3077,17 +3099,6 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
g_source_destroy);
}
- if (onscreen_egl->egl_surface != EGL_NO_SURFACE)
- {
- MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native);
-
- meta_egl_destroy_surface (egl,
- cogl_renderer_egl->edpy,
- onscreen_egl->egl_surface,
- NULL);
- onscreen_egl->egl_surface = EGL_NO_SURFACE;
- }
-
renderer_gpu_data =
meta_renderer_native_get_gpu_data (onscreen_native->renderer_native,
onscreen_native->render_gpu);
@@ -3100,6 +3111,8 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
free_current_bo (onscreen);
+ destroy_egl_surface (onscreen);
+
if (onscreen_native->gbm.surface)
{
gbm_surface_destroy (onscreen_native->gbm.surface);
@@ -3110,6 +3123,9 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
case META_RENDERER_NATIVE_MODE_EGL_DEVICE:
release_dumb_fb (&onscreen_native->egl.dumb_fb,
onscreen_native->render_gpu);
+
+ destroy_egl_surface (onscreen);
+
if (onscreen_native->egl.stream != EGL_NO_STREAM_KHR)
{
MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native);
--
2.24.1
From c447010a23edc03c7a1103b477972ad666c2600f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 19 Jun 2019 20:55:48 +0200
Subject: [PATCH 5/8] renderer/native: Remove left-over function declarations
There are no callers and no definitions of these.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/655
---
src/backends/native/meta-renderer-native.h | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/src/backends/native/meta-renderer-native.h b/src/backends/native/meta-renderer-native.h
index a006dcbe7..8468208e1 100644
--- a/src/backends/native/meta-renderer-native.h
+++ b/src/backends/native/meta-renderer-native.h
@@ -55,18 +55,6 @@ gboolean meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_n
void meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native);
-gboolean meta_renderer_native_set_legacy_view_size (MetaRendererNative *renderer_native,
- MetaRendererView *view,
- int width,
- int height,
- GError **error);
-
-void meta_renderer_native_set_ignore_crtc (MetaRendererNative *renderer_native,
- uint32_t id,
- gboolean ignore);
-
-MetaRendererView * meta_renderer_native_create_legacy_view (MetaRendererNative *renderer_native);
-
void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native);
int64_t meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native);
--
2.24.1
From 7f97403d12df19cf936a341cc218743ec339aa0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 19 Jun 2019 20:57:14 +0200
Subject: [PATCH 6/8] renderer/native: Queue mode reset from new rebuild_views
vfunc
Simplify the call site a bit and make the native renderer know it should
queue mode reset itself when views have been rebuilt. This is done
partly due to more things needing to be dealt with after views have been
rebuilt.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/655
---
src/backends/meta-renderer.c | 8 ++++++++
src/backends/meta-renderer.h | 1 +
src/backends/native/meta-renderer-native.c | 17 ++++++++++++++++-
src/backends/native/meta-renderer-native.h | 2 --
src/backends/native/meta-stage-native.c | 1 -
5 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/src/backends/meta-renderer.c b/src/backends/meta-renderer.c
index 28637437b..87ba9f9f0 100644
--- a/src/backends/meta-renderer.c
+++ b/src/backends/meta-renderer.c
@@ -90,6 +90,12 @@ meta_renderer_create_view (MetaRenderer *renderer,
*/
void
meta_renderer_rebuild_views (MetaRenderer *renderer)
+{
+ return META_RENDERER_GET_CLASS (renderer)->rebuild_views (renderer);
+}
+
+static void
+meta_renderer_real_rebuild_views (MetaRenderer *renderer)
{
MetaRendererPrivate *priv = meta_renderer_get_instance_private (renderer);
MetaBackend *backend = meta_get_backend ();
@@ -181,4 +187,6 @@ meta_renderer_class_init (MetaRendererClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_renderer_finalize;
+
+ klass->rebuild_views = meta_renderer_real_rebuild_views;
}
diff --git a/src/backends/meta-renderer.h b/src/backends/meta-renderer.h
index dae52cb9a..478baee91 100644
--- a/src/backends/meta-renderer.h
+++ b/src/backends/meta-renderer.h
@@ -43,6 +43,7 @@ struct _MetaRendererClass
CoglRenderer * (* create_cogl_renderer) (MetaRenderer *renderer);
MetaRendererView * (* create_view) (MetaRenderer *renderer,
MetaLogicalMonitor *logical_monitor);
+ void (* rebuild_views) (MetaRenderer *renderer);
};
CoglRenderer * meta_renderer_create_cogl_renderer (MetaRenderer *renderer);
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 62c27c191..70e1c4f9d 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -258,6 +258,9 @@ cogl_pixel_format_from_drm_format (uint32_t drm_format,
CoglPixelFormat *out_format,
CoglTextureComponents *out_components);
+static void
+meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native);
+
static MetaBackend *
backend_from_renderer_native (MetaRendererNative *renderer_native)
{
@@ -3186,7 +3189,7 @@ meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_native)
return TRUE;
}
-void
+static void
meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native)
{
MetaRenderer *renderer = META_RENDERER (renderer_native);
@@ -3552,6 +3555,17 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
return view;
}
+static void
+meta_renderer_native_rebuild_views (MetaRenderer *renderer)
+{
+ MetaRendererClass *parent_renderer_class =
+ META_RENDERER_CLASS (meta_renderer_native_parent_class);
+
+ parent_renderer_class->rebuild_views (renderer);
+
+ meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer));
+}
+
void
meta_renderer_native_finish_frame (MetaRendererNative *renderer_native)
{
@@ -4350,6 +4364,7 @@ meta_renderer_native_class_init (MetaRendererNativeClass *klass)
renderer_class->create_cogl_renderer = meta_renderer_native_create_cogl_renderer;
renderer_class->create_view = meta_renderer_native_create_view;
+ renderer_class->rebuild_views = meta_renderer_native_rebuild_views;
obj_props[PROP_MONITOR_MANAGER] =
g_param_spec_object ("monitor-manager",
diff --git a/src/backends/native/meta-renderer-native.h b/src/backends/native/meta-renderer-native.h
index 8468208e1..9eecdead1 100644
--- a/src/backends/native/meta-renderer-native.h
+++ b/src/backends/native/meta-renderer-native.h
@@ -53,8 +53,6 @@ struct gbm_device * meta_gbm_device_from_gpu (MetaGpuKms *gpu_kms);
gboolean meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_native);
-void meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native);
-
void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native);
int64_t meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native);
diff --git a/src/backends/native/meta-stage-native.c b/src/backends/native/meta-stage-native.c
index add3e81fd..9b9c45ef3 100644
--- a/src/backends/native/meta-stage-native.c
+++ b/src/backends/native/meta-stage-native.c
@@ -140,7 +140,6 @@ meta_stage_native_rebuild_views (MetaStageNative *stage_native)
ClutterActor *stage = meta_backend_get_stage (backend);
meta_renderer_rebuild_views (renderer);
- meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer));
clutter_stage_update_resource_scales (CLUTTER_STAGE (stage));
ensure_frame_callbacks (stage_native);
}
--
2.24.1
From 025054c93e43e8359c9ecafb6edea1eb4b7ad681 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 19 Jun 2019 21:14:05 +0200
Subject: [PATCH 7/8] renderer/native: Discard page flip retries when
rebuilding views
Rebuilding views means we don't care to retry page flip attempts for
previous views, especially since connectors may have been disconnected,
making a page flip retry hit an assert a flipped CRTC has connectors
associated with it.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/655
---
src/backends/native/meta-renderer-native.c | 50 +++++++++++++++++-----
1 file changed, 39 insertions(+), 11 deletions(-)
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 70e1c4f9d..3cd01bcb7 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -3060,6 +3060,24 @@ destroy_egl_surface (CoglOnscreen *onscreen)
}
}
+static void
+discard_onscreen_page_flip_retries (MetaOnscreenNative *onscreen_native)
+{
+ g_list_free_full (onscreen_native->pending_page_flip_retries,
+ (GDestroyNotify) retry_page_flip_data_free);
+ onscreen_native->pending_page_flip_retries = NULL;
+
+ if (onscreen_native->retry_page_flips_source)
+ {
+ MetaBackend *backend =
+ backend_from_renderer_native (onscreen_native->renderer_native);
+
+ meta_backend_thaw_updates (backend);
+ g_clear_pointer (&onscreen_native->retry_page_flips_source,
+ g_source_destroy);
+ }
+}
+
static void
meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
{
@@ -3090,17 +3108,7 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
g_warning ("Failed to clear current context");
}
- g_list_free_full (onscreen_native->pending_page_flip_retries,
- (GDestroyNotify) retry_page_flip_data_free);
- if (onscreen_native->retry_page_flips_source)
- {
- MetaBackend *backend =
- backend_from_renderer_native (onscreen_native->renderer_native);
-
- meta_backend_thaw_updates (backend);
- g_clear_pointer (&onscreen_native->retry_page_flips_source,
- g_source_destroy);
- }
+ discard_onscreen_page_flip_retries (onscreen_native);
renderer_gpu_data =
meta_renderer_native_get_gpu_data (onscreen_native->renderer_native,
@@ -3555,12 +3563,32 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
return view;
}
+static void
+discard_page_flip_retries (MetaRenderer *renderer)
+{
+ GList *l;
+
+ for (l = meta_renderer_get_views (renderer); l; l = l->next)
+ {
+ ClutterStageView *stage_view = l->data;
+ CoglFramebuffer *framebuffer =
+ clutter_stage_view_get_onscreen (stage_view);
+ CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
+ CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+ MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
+
+ discard_onscreen_page_flip_retries (onscreen_native);
+ }
+}
+
static void
meta_renderer_native_rebuild_views (MetaRenderer *renderer)
{
MetaRendererClass *parent_renderer_class =
META_RENDERER_CLASS (meta_renderer_native_parent_class);
+ discard_page_flip_retries (renderer);
+
parent_renderer_class->rebuild_views (renderer);
meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer));
--
2.24.1
From f4fdec6003e2cf9fa4b1882e92faf1da64e6052e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 27 Nov 2019 17:34:35 +0100
Subject: [PATCH 8/8] =?UTF-8?q?crtc-kms:=20Ignore=2090=C2=B0=20rotations?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
They tend to require special modifiers or won't work at all; ignore
them.
---
src/backends/native/meta-crtc-kms.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c
index 8c2fbfe3c..8374376d5 100644
--- a/src/backends/native/meta-crtc-kms.c
+++ b/src/backends/native/meta-crtc-kms.c
@@ -368,12 +368,8 @@ parse_transforms (MetaCrtc *crtc,
if (strcmp (prop->enums[i].name, "rotate-0") == 0)
transform = META_MONITOR_TRANSFORM_NORMAL;
- else if (strcmp (prop->enums[i].name, "rotate-90") == 0)
- transform = META_MONITOR_TRANSFORM_90;
else if (strcmp (prop->enums[i].name, "rotate-180") == 0)
transform = META_MONITOR_TRANSFORM_180;
- else if (strcmp (prop->enums[i].name, "rotate-270") == 0)
- transform = META_MONITOR_TRANSFORM_270;
if (transform != -1)
{
--
2.24.1

View File

@ -1,128 +0,0 @@
From 35333114a991440d671e3642170aa080df45a171 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 16 Sep 2019 16:17:48 +0200
Subject: [PATCH 1/3] idle-monitor: Make helper function static
It wasn't used outside the file, so no reason to not have it static.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/799
---
src/backends/meta-idle-monitor-private.h | 1 -
src/backends/meta-idle-monitor.c | 8 ++++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/backends/meta-idle-monitor-private.h b/src/backends/meta-idle-monitor-private.h
index 93948b14b..cc08f8c8e 100644
--- a/src/backends/meta-idle-monitor-private.h
+++ b/src/backends/meta-idle-monitor-private.h
@@ -54,7 +54,6 @@ struct _MetaIdleMonitorClass
GObjectClass parent_class;
};
-void _meta_idle_monitor_watch_fire (MetaIdleMonitorWatch *watch);
void meta_idle_monitor_reset_idletime (MetaIdleMonitor *monitor);
#endif /* META_IDLE_MONITOR_PRIVATE_H */
diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c
index e83d6c778..de1c7e0ba 100644
--- a/src/backends/meta-idle-monitor.c
+++ b/src/backends/meta-idle-monitor.c
@@ -54,8 +54,8 @@ static GParamSpec *obj_props[PROP_LAST];
G_DEFINE_TYPE (MetaIdleMonitor, meta_idle_monitor, G_TYPE_OBJECT)
-void
-_meta_idle_monitor_watch_fire (MetaIdleMonitorWatch *watch)
+static void
+meta_idle_monitor_watch_fire (MetaIdleMonitorWatch *watch)
{
MetaIdleMonitor *monitor;
guint id;
@@ -324,7 +324,7 @@ idle_monitor_dispatch_timeout (GSource *source,
if (ready_time > now)
return G_SOURCE_CONTINUE;
- _meta_idle_monitor_watch_fire (watch);
+ meta_idle_monitor_watch_fire (watch);
g_source_set_ready_time (watch->timeout_source, -1);
return G_SOURCE_CONTINUE;
@@ -511,7 +511,7 @@ meta_idle_monitor_reset_idletime (MetaIdleMonitor *monitor)
if (watch->timeout_msec == 0)
{
- _meta_idle_monitor_watch_fire ((MetaIdleMonitorWatch *) watch);
+ meta_idle_monitor_watch_fire ((MetaIdleMonitorWatch *) watch);
}
else
{
--
2.23.0
From 07276cf94d84489d450c17b7dec5a8075c60440a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 16 Sep 2019 16:36:05 +0200
Subject: [PATCH 2/3] idle-monitor: Remove redundant type cast
No need to type cast a `MetaIdleMonitorWatch *` to a
`MetaIdleMonitorWatch *`.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/799
---
src/backends/meta-idle-monitor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c
index de1c7e0ba..e5124abc1 100644
--- a/src/backends/meta-idle-monitor.c
+++ b/src/backends/meta-idle-monitor.c
@@ -511,7 +511,7 @@ meta_idle_monitor_reset_idletime (MetaIdleMonitor *monitor)
if (watch->timeout_msec == 0)
{
- meta_idle_monitor_watch_fire ((MetaIdleMonitorWatch *) watch);
+ meta_idle_monitor_watch_fire (watch);
}
else
{
--
2.23.0
From 73c1f387765ef528c7323e6e7ca3c05899cfcc4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 16 Sep 2019 16:36:51 +0200
Subject: [PATCH 3/3] idle-monitor: Reset timeout before firing watch
The watch might be removed during firing, meaning the source is
destroyed after returning. Avoid use-after-free by unsetting the timeout
before firing. Returning G_SOURCE_CONTINUE in that case is harmless, as
source is destroyed.
Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/796
https://gitlab.gnome.org/GNOME/mutter/merge_requests/799
---
src/backends/meta-idle-monitor.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c
index e5124abc1..9fa481742 100644
--- a/src/backends/meta-idle-monitor.c
+++ b/src/backends/meta-idle-monitor.c
@@ -324,9 +324,10 @@ idle_monitor_dispatch_timeout (GSource *source,
if (ready_time > now)
return G_SOURCE_CONTINUE;
- meta_idle_monitor_watch_fire (watch);
g_source_set_ready_time (watch->timeout_source, -1);
+ meta_idle_monitor_watch_fire (watch);
+
return G_SOURCE_CONTINUE;
}
--
2.23.0

View File

@ -1,365 +0,0 @@
From 2fd3910c29d2af2a7c64b82f075cd3647d7e4bee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 18 Mar 2019 17:08:11 +0100
Subject: [PATCH 1/2] monitor-config-manager: Use current mode when deriving
current config
Instead of overriding the existing mode with the preferred mode of the monitor,
use the one already configured. Also use the MetaMonitor API for deriving the
position of the monitor in the screen coordinate space.
---
src/backends/meta-monitor-config-manager.c | 77 +++++++++++++---------
1 file changed, 47 insertions(+), 30 deletions(-)
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index c09edbe00..a3387aa0f 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -592,20 +592,19 @@ create_monitor_config (MetaMonitor *monitor,
}
static MetaLogicalMonitorConfig *
-create_preferred_logical_monitor_config (MetaMonitorManager *monitor_manager,
- MetaMonitor *monitor,
- int x,
- int y,
- MetaLogicalMonitorConfig *primary_logical_monitor_config,
- MetaLogicalMonitorLayoutMode layout_mode)
+create_logical_monitor_config (MetaMonitorManager *monitor_manager,
+ MetaMonitor *monitor,
+ MetaMonitorMode *mode,
+ int x,
+ int y,
+ MetaLogicalMonitorConfig *primary_logical_monitor_config,
+ MetaLogicalMonitorLayoutMode layout_mode)
{
- MetaMonitorMode *mode;
int width, height;
float scale;
MetaMonitorConfig *monitor_config;
MetaLogicalMonitorConfig *logical_monitor_config;
- mode = meta_monitor_get_preferred_mode (monitor);
meta_monitor_mode_get_resolution (mode, &width, &height);
if ((meta_monitor_manager_get_capabilities (monitor_manager) &
@@ -645,22 +644,40 @@ create_preferred_logical_monitor_config (MetaMonitorManager *monitor_ma
}
static MetaLogicalMonitorConfig *
-create_logical_monitor_config_from_output (MetaMonitorManager *monitor_manager,
- MetaMonitor *monitor,
- MetaLogicalMonitorConfig *primary_logical_monitor_config,
- MetaLogicalMonitorLayoutMode layout_mode)
+create_preferred_logical_monitor_config (MetaMonitorManager *monitor_manager,
+ MetaMonitor *monitor,
+ int x,
+ int y,
+ MetaLogicalMonitorConfig *primary_logical_monitor_config,
+ MetaLogicalMonitorLayoutMode layout_mode)
{
- MetaOutput *output;
- MetaCrtc *crtc;
+ return create_logical_monitor_config (monitor_manager,
+ monitor,
+ meta_monitor_get_preferred_mode (monitor),
+ x, y,
+ primary_logical_monitor_config,
+ layout_mode);
+}
- output = meta_monitor_get_main_output (monitor);
- crtc = meta_output_get_assigned_crtc (output);
- return create_preferred_logical_monitor_config (monitor_manager,
- monitor,
- crtc->rect.x,
- crtc->rect.y,
- primary_logical_monitor_config,
- layout_mode);
+static MetaLogicalMonitorConfig *
+create_logical_monitor_config_from_monitor (MetaMonitorManager *monitor_manager,
+ MetaMonitor *monitor,
+ MetaLogicalMonitorConfig *primary_logical_monitor_config,
+ MetaLogicalMonitorLayoutMode layout_mode)
+{
+ MetaRectangle monitor_layout;
+ MetaMonitorMode *mode;
+
+ meta_monitor_derive_layout (monitor, &monitor_layout);
+ mode = meta_monitor_get_current_mode (monitor);
+
+ return create_logical_monitor_config (monitor_manager,
+ monitor,
+ mode,
+ monitor_layout.x,
+ monitor_layout.y,
+ primary_logical_monitor_config,
+ layout_mode);
}
MetaMonitorsConfig *
@@ -688,10 +705,10 @@ meta_monitor_config_manager_create_initial (MetaMonitorConfigManager *config_man
layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
primary_logical_monitor_config =
- create_logical_monitor_config_from_output (monitor_manager,
- primary_monitor,
- NULL,
- layout_mode);
+ create_logical_monitor_config_from_monitor (monitor_manager,
+ primary_monitor,
+ NULL,
+ layout_mode);
primary_logical_monitor_config->is_primary = TRUE;
logical_monitor_configs = g_list_append (NULL,
@@ -710,10 +727,10 @@ meta_monitor_config_manager_create_initial (MetaMonitorConfigManager *config_man
continue;
logical_monitor_config =
- create_logical_monitor_config_from_output (monitor_manager,
- monitor,
- primary_logical_monitor_config,
- layout_mode);
+ create_logical_monitor_config_from_monitor (monitor_manager,
+ monitor,
+ primary_logical_monitor_config,
+ layout_mode);
logical_monitor_configs = g_list_append (logical_monitor_configs,
logical_monitor_config);
--
2.21.0
From d8c34e4cd7e500567e72e0f219295d7c2162dcf3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 18 Mar 2019 17:10:37 +0100
Subject: [PATCH 2/2] monitor-manager: Don't try to derive current config on
non-X11
This commit also reworks the initial config state reading some. Appart from
avoiding trying to inherit from backends where it doesn't make sense, it does
the following changes:
* Replace the name "initial" with "inherited", as the initial config in the
context of monitor management is the one used initialization. E.g. if there is
a applicable configuration in monitors.xml, the initial config is taken from
there.
* Don't make "_create_()" functions have side effects. Previously
meta_monitor_config_manager_create_initial() also set state on the config
manager object. Instead, add a meta_monitor_config_manager_ensure_inherited()
and meta_monitor_manager_get_inherited_config() function to make things more
explicit.
* Don't recreate "is-applicable" logic, just use the existing helper.
---
src/backends/meta-monitor-config-manager.c | 39 +++++++++++--------
src/backends/meta-monitor-config-manager.h | 5 +++
src/backends/meta-monitor-manager-private.h | 4 +-
src/backends/meta-monitor-manager.c | 32 ++++++++-------
.../x11/meta-monitor-manager-xrandr.c | 3 +-
5 files changed, 49 insertions(+), 34 deletions(-)
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index a3387aa0f..bc1a39db8 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -42,7 +42,7 @@ struct _MetaMonitorConfigManager
MetaMonitorConfigStore *config_store;
MetaMonitorsConfig *current_config;
- MetaMonitorsConfig *initial_config;
+ MetaMonitorsConfig *inherited_config;
GQueue config_history;
};
@@ -680,11 +680,10 @@ create_logical_monitor_config_from_monitor (MetaMonitorManager *monito
layout_mode);
}
-MetaMonitorsConfig *
-meta_monitor_config_manager_create_initial (MetaMonitorConfigManager *config_manager)
+static MetaMonitorsConfig *
+meta_monitor_config_manager_derive_current (MetaMonitorConfigManager *config_manager)
{
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
- MetaMonitorsConfig *initial_config;
GList *logical_monitor_configs;
MetaMonitor *primary_monitor;
MetaLogicalMonitorLayoutMode layout_mode;
@@ -692,12 +691,6 @@ meta_monitor_config_manager_create_initial (MetaMonitorConfigManager *config_man
GList *monitors;
GList *l;
- if (config_manager->initial_config != NULL)
- return g_object_ref (config_manager->initial_config);
-
- if (meta_monitor_config_store_get_config_count (config_manager->config_store) > 0)
- return NULL;
-
primary_monitor = find_primary_monitor (monitor_manager);
if (!primary_monitor || !meta_monitor_is_active (primary_monitor))
return NULL;
@@ -736,14 +729,26 @@ meta_monitor_config_manager_create_initial (MetaMonitorConfigManager *config_man
logical_monitor_config);
}
- initial_config = meta_monitors_config_new (monitor_manager,
- logical_monitor_configs,
- layout_mode,
- META_MONITORS_CONFIG_FLAG_NONE);
+ return meta_monitors_config_new (monitor_manager,
+ logical_monitor_configs,
+ layout_mode,
+ META_MONITORS_CONFIG_FLAG_NONE);
+}
+
+void
+meta_monitor_config_manager_ensure_inherited_config (MetaMonitorConfigManager *config_manager)
+{
+ if (config_manager->inherited_config)
+ return;
- config_manager->initial_config = g_object_ref (initial_config);
+ config_manager->inherited_config =
+ meta_monitor_config_manager_derive_current (config_manager);
+}
- return initial_config;
+MetaMonitorsConfig *
+meta_monitor_config_manager_get_inherited_config (MetaMonitorConfigManager *config_manager)
+{
+ return config_manager->inherited_config;
}
MetaMonitorsConfig *
@@ -1282,7 +1287,7 @@ meta_monitor_config_manager_dispose (GObject *object)
META_MONITOR_CONFIG_MANAGER (object);
g_clear_object (&config_manager->current_config);
- g_clear_object (&config_manager->initial_config);
+ g_clear_object (&config_manager->inherited_config);
meta_monitor_config_manager_clear_history (config_manager);
G_OBJECT_CLASS (meta_monitor_config_manager_parent_class)->dispose (object);
diff --git a/src/backends/meta-monitor-config-manager.h b/src/backends/meta-monitor-config-manager.h
index 409611bb0..bb847b96e 100644
--- a/src/backends/meta-monitor-config-manager.h
+++ b/src/backends/meta-monitor-config-manager.h
@@ -96,6 +96,11 @@ MetaMonitorsConfig * meta_monitor_config_manager_get_stored (MetaMonitorConfigMa
META_EXPORT_TEST
MetaMonitorsConfig * meta_monitor_config_manager_create_initial (MetaMonitorConfigManager *config_manager);
+
+void meta_monitor_config_manager_ensure_inherited_config (MetaMonitorConfigManager *config_manager);
+
+MetaMonitorsConfig * meta_monitor_config_manager_get_inherited_config (MetaMonitorConfigManager *config_manager);
+
META_EXPORT_TEST
MetaMonitorsConfig * meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_manager);
diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h
index cdb8f4209..223b5dfbd 100644
--- a/src/backends/meta-monitor-manager-private.h
+++ b/src/backends/meta-monitor-manager-private.h
@@ -44,7 +44,8 @@ typedef enum _MetaMonitorManagerCapability
META_MONITOR_MANAGER_CAPABILITY_NONE = 0,
META_MONITOR_MANAGER_CAPABILITY_MIRRORING = (1 << 0),
META_MONITOR_MANAGER_CAPABILITY_LAYOUT_MODE = (1 << 1),
- META_MONITOR_MANAGER_CAPABILITY_GLOBAL_SCALE_REQUIRED = (1 << 2)
+ META_MONITOR_MANAGER_CAPABILITY_GLOBAL_SCALE_REQUIRED = (1 << 2),
+ META_MONITOR_MANAGER_CAPABILITY_CAN_DERIVE_CURRENT = (1 << 3),
} MetaMonitorManagerCapability;
/* Equivalent to the 'method' enum in org.gnome.Mutter.DisplayConfig */
@@ -133,6 +134,7 @@ struct _MetaMonitorManager
int persistent_timeout_id;
MetaMonitorConfigManager *config_manager;
+ MetaMonitorsConfig *initial_config;
GnomePnpIds *pnp_ids;
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index bb4b44188..076dca8cb 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -531,14 +531,21 @@ should_use_stored_config (MetaMonitorManager *manager)
!meta_monitor_manager_has_hotplug_mode_update (manager));
}
+static gboolean
+can_derive_current_config (MetaMonitorManager *manager)
+{
+ MetaMonitorManagerCapability capabilities;
+
+ capabilities = meta_monitor_manager_get_capabilities (manager);
+ return !!(capabilities & META_MONITOR_MANAGER_CAPABILITY_CAN_DERIVE_CURRENT);
+}
+
MetaMonitorsConfig *
meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
{
- g_autoptr (MetaMonitorsConfig) initial_config = NULL;
MetaMonitorsConfig *config = NULL;
GError *error = NULL;
gboolean use_stored_config;
- MetaMonitorsConfigKey *current_state_key;
MetaMonitorsConfigMethod method;
MetaMonitorsConfigMethod fallback_method =
META_MONITORS_CONFIG_METHOD_TEMPORARY;
@@ -549,17 +556,8 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
else
method = META_MONITORS_CONFIG_METHOD_TEMPORARY;
- initial_config = meta_monitor_config_manager_create_initial (manager->config_manager);
-
- if (initial_config)
- {
- current_state_key = meta_create_monitors_config_key_for_current_state (manager);
-
- /* don't ever reuse initial configuration, if the monitor topology changed
- */
- if (current_state_key && !meta_monitors_config_key_equal (current_state_key, initial_config->key))
- g_clear_object (&initial_config);
- }
+ if (can_derive_current_config (manager))
+ meta_monitor_config_manager_ensure_inherited_config (manager->config_manager);
if (use_stored_config)
{
@@ -628,9 +626,13 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
g_clear_object (&config);
}
- config = g_steal_pointer (&initial_config);
- if (config)
+ config =
+ meta_monitor_config_manager_get_inherited_config (manager->config_manager);
+ if (config &&
+ meta_monitor_manager_is_config_complete (manager, config))
{
+ config = g_object_ref (config);
+
if (!meta_monitor_manager_apply_monitors_config (manager,
config,
method,
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index d60f00325..b8d6342b6 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -999,7 +999,8 @@ static MetaMonitorManagerCapability
meta_monitor_manager_xrandr_get_capabilities (MetaMonitorManager *manager)
{
return (META_MONITOR_MANAGER_CAPABILITY_MIRRORING |
- META_MONITOR_MANAGER_CAPABILITY_GLOBAL_SCALE_REQUIRED);
+ META_MONITOR_MANAGER_CAPABILITY_GLOBAL_SCALE_REQUIRED |
+ META_MONITOR_MANAGER_CAPABILITY_CAN_DERIVE_CURRENT);
}
static gboolean
--
2.21.0

View File

@ -1,374 +0,0 @@
From 05bca153bb92c5daa5b961214ff7f80af88cb7cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 24 Oct 2019 21:19:36 +0200
Subject: [PATCH 1/2] display: Move finishing of touch sequence to the backend
We need to manipulate an X11 grab when a touch sequence ends; move that
logic to where it belongs - in the X11 backend.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/886
---
src/backends/meta-backend-private.h | 16 ++++++++++++
src/backends/meta-backend.c | 14 +++++++++++
src/backends/x11/meta-backend-x11.c | 23 +++++++++++++++++
src/core/display.c | 33 +++++++++++--------------
src/core/meta-gesture-tracker-private.h | 9 +------
5 files changed, 69 insertions(+), 26 deletions(-)
diff --git a/src/backends/meta-backend-private.h b/src/backends/meta-backend-private.h
index 7eba1806b..81ec81e5f 100644
--- a/src/backends/meta-backend-private.h
+++ b/src/backends/meta-backend-private.h
@@ -49,6 +49,14 @@
#define DEFAULT_XKB_RULES_FILE "evdev"
#define DEFAULT_XKB_MODEL "pc105+inet"
+typedef enum
+{
+ META_SEQUENCE_NONE,
+ META_SEQUENCE_ACCEPTED,
+ META_SEQUENCE_REJECTED,
+ META_SEQUENCE_PENDING_END
+} MetaSequenceState;
+
struct _MetaBackendClass
{
GObjectClass parent_class;
@@ -71,6 +79,10 @@ struct _MetaBackendClass
int device_id,
uint32_t timestamp);
+ void (* finish_touch_sequence) (MetaBackend *backend,
+ ClutterEventSequence *sequence,
+ MetaSequenceState state);
+
void (* warp_pointer) (MetaBackend *backend,
int x,
int y);
@@ -135,6 +147,10 @@ gboolean meta_backend_ungrab_device (MetaBackend *backend,
int device_id,
uint32_t timestamp);
+void meta_backend_finish_touch_sequence (MetaBackend *backend,
+ ClutterEventSequence *sequence,
+ MetaSequenceState state);
+
void meta_backend_warp_pointer (MetaBackend *backend,
int x,
int y);
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index c980cf150..bb7d66f2a 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -1086,6 +1086,20 @@ meta_backend_ungrab_device (MetaBackend *backend,
return META_BACKEND_GET_CLASS (backend)->ungrab_device (backend, device_id, timestamp);
}
+/**
+ * meta_backend_finish_touch_sequence: (skip)
+ */
+void
+meta_backend_finish_touch_sequence (MetaBackend *backend,
+ ClutterEventSequence *sequence,
+ MetaSequenceState state)
+{
+ if (META_BACKEND_GET_CLASS (backend)->finish_touch_sequence)
+ META_BACKEND_GET_CLASS (backend)->finish_touch_sequence (backend,
+ sequence,
+ state);
+}
+
/**
* meta_backend_warp_pointer: (skip)
*/
diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c
index c10365f9d..cdefa50a9 100644
--- a/src/backends/x11/meta-backend-x11.c
+++ b/src/backends/x11/meta-backend-x11.c
@@ -591,6 +591,28 @@ meta_backend_x11_ungrab_device (MetaBackend *backend,
return (ret == Success);
}
+static void
+meta_backend_x11_finish_touch_sequence (MetaBackend *backend,
+ ClutterEventSequence *sequence,
+ MetaSequenceState state)
+{
+ MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
+ MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
+ int event_mode;
+
+ if (state == META_SEQUENCE_ACCEPTED)
+ event_mode = XIAcceptTouch;
+ else if (state == META_SEQUENCE_REJECTED)
+ event_mode = XIRejectTouch;
+ else
+ g_return_if_reached ();
+
+ XIAllowTouchEvents (priv->xdisplay,
+ META_VIRTUAL_CORE_POINTER_ID,
+ clutter_x11_event_sequence_get_touch_detail (sequence),
+ DefaultRootWindow (priv->xdisplay), event_mode);
+}
+
static void
meta_backend_x11_warp_pointer (MetaBackend *backend,
int x,
@@ -776,6 +798,7 @@ meta_backend_x11_class_init (MetaBackendX11Class *klass)
backend_class->post_init = meta_backend_x11_post_init;
backend_class->grab_device = meta_backend_x11_grab_device;
backend_class->ungrab_device = meta_backend_x11_ungrab_device;
+ backend_class->finish_touch_sequence = meta_backend_x11_finish_touch_sequence;
backend_class->warp_pointer = meta_backend_x11_warp_pointer;
backend_class->get_current_logical_monitor = meta_backend_x11_get_current_logical_monitor;
backend_class->get_keymap = meta_backend_x11_get_keymap;
diff --git a/src/core/display.c b/src/core/display.c
index 4c8907f40..eb7dc43b6 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -42,6 +42,7 @@
#include <X11/extensions/Xdamage.h>
#include <X11/extensions/Xfixes.h>
+#include "backends/meta-backend-private.h"
#include "backends/meta-cursor-sprite-xcursor.h"
#include "backends/meta-cursor-tracker-private.h"
#include "backends/meta-idle-monitor-dbus.h"
@@ -598,27 +599,23 @@ gesture_tracker_state_changed (MetaGestureTracker *tracker,
MetaSequenceState state,
MetaDisplay *display)
{
- if (meta_is_wayland_compositor ())
+ switch (state)
{
- if (state == META_SEQUENCE_ACCEPTED)
- meta_display_cancel_touch (display);
- }
- else
- {
- MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
- int event_mode;
+ case META_SEQUENCE_NONE:
+ case META_SEQUENCE_PENDING_END:
+ return;
+ case META_SEQUENCE_ACCEPTED:
+ meta_display_cancel_touch (display);
- if (state == META_SEQUENCE_ACCEPTED)
- event_mode = XIAcceptTouch;
- else if (state == META_SEQUENCE_REJECTED)
- event_mode = XIRejectTouch;
- else
- return;
+ /* Intentional fall-through */
+ case META_SEQUENCE_REJECTED:
+ {
+ MetaBackend *backend;
- XIAllowTouchEvents (meta_backend_x11_get_xdisplay (backend),
- META_VIRTUAL_CORE_POINTER_ID,
- clutter_x11_event_sequence_get_touch_detail (sequence),
- DefaultRootWindow (display->x11_display->xdisplay), event_mode);
+ backend = meta_get_backend ();
+ meta_backend_finish_touch_sequence (backend, sequence, state);
+ break;
+ }
}
}
diff --git a/src/core/meta-gesture-tracker-private.h b/src/core/meta-gesture-tracker-private.h
index a9db35ebc..e7bfc5472 100644
--- a/src/core/meta-gesture-tracker-private.h
+++ b/src/core/meta-gesture-tracker-private.h
@@ -26,6 +26,7 @@
#include <glib-object.h>
+#include "backends/meta-backend-private.h"
#include "clutter/clutter.h"
#include "meta/window.h"
@@ -39,14 +40,6 @@
typedef struct _MetaGestureTracker MetaGestureTracker;
typedef struct _MetaGestureTrackerClass MetaGestureTrackerClass;
-typedef enum
-{
- META_SEQUENCE_NONE,
- META_SEQUENCE_ACCEPTED,
- META_SEQUENCE_REJECTED,
- META_SEQUENCE_PENDING_END
-} MetaSequenceState;
-
struct _MetaGestureTracker
{
GObject parent_instance;
--
2.23.0
From 8cf4f500defb421d5c96f2c1f9fcf7bb5545d70d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Fri, 25 Oct 2019 10:06:55 +0200
Subject: [PATCH 2/2] x11: Limit touch replay pointer events to when replaying
When a touch sequence was rejected, the emulated pointer events would be
replayed with old timestamps. This caused issues with grabs as they
would be ignored due to being too old. This was mitigated by making sure
device event timestamps never travelled back in time by tampering with
any event that had a timestamp seemingly in the past.
This failed when the most recent timestamp that had been received were
much older than the timestamp of the new event. This could for example
happen when a session was left not interacted with for 40+ days or so;
when interacted with again, as any new timestamp would according to
XSERVER_TIME_IS_BEFORE() still be in the past compared to the "most
recent" one. The effect is that we'd always use the `latest_evtime` for
all new device events without ever updating it.
The end result of this was that passive grabs would become active when
interacted with, but would then newer be released, as the timestamps to
XIAllowEvents() would out of date, resulting in the desktop effectively
freezing, as the Shell would have an active pointer grab.
To avoid the situation where we get stuck with an old `latest_evtime`
timestamp, limit the tampering with device event timestamp to 1) only
pointer events, and 2) only during the replay sequence. The second part
is implemented by sending an asynchronous message via the X server after
rejecting a touch sequence, only potentially tampering with the device
event timestamps until the reply. This should avoid the stuck timestamp
as in those situations, we'll always have a relatively up to date
`latest_evtime` meaning XSERVER_TIME_IS_BEFORE() will not get confused.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/886
---
src/backends/x11/meta-backend-x11.c | 71 +++++++++++++++++++++++------
1 file changed, 58 insertions(+), 13 deletions(-)
diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c
index cdefa50a9..821b30f5b 100644
--- a/src/backends/x11/meta-backend-x11.c
+++ b/src/backends/x11/meta-backend-x11.c
@@ -66,6 +66,10 @@ struct _MetaBackendX11Private
XSyncAlarm user_active_alarm;
XSyncCounter counter;
+ int current_touch_replay_sync_serial;
+ int pending_touch_replay_sync_serial;
+ Atom touch_replay_sync_atom;
+
int xinput_opcode;
int xinput_event_base;
int xinput_error_base;
@@ -174,6 +178,26 @@ meta_backend_x11_translate_device_event (MetaBackendX11 *x11,
backend_x11_class->translate_device_event (x11, device_event);
}
+static void
+maybe_translate_touch_replay_pointer_event (MetaBackendX11 *x11,
+ XIDeviceEvent *device_event)
+{
+ MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
+
+ if (!device_event->send_event &&
+ device_event->time != META_CURRENT_TIME &&
+ priv->current_touch_replay_sync_serial !=
+ priv->pending_touch_replay_sync_serial &&
+ XSERVER_TIME_IS_BEFORE (device_event->time, priv->latest_evtime))
+ {
+ /* Emulated pointer events received after XIRejectTouch is received
+ * on a passive touch grab will contain older timestamps, update those
+ * so we dont get InvalidTime at grabs.
+ */
+ device_event->time = priv->latest_evtime;
+ }
+}
+
static void
translate_device_event (MetaBackendX11 *x11,
XIDeviceEvent *device_event)
@@ -183,19 +207,7 @@ translate_device_event (MetaBackendX11 *x11,
meta_backend_x11_translate_device_event (x11, device_event);
if (!device_event->send_event && device_event->time != META_CURRENT_TIME)
- {
- if (XSERVER_TIME_IS_BEFORE (device_event->time, priv->latest_evtime))
- {
- /* Emulated pointer events received after XIRejectTouch is received
- * on a passive touch grab will contain older timestamps, update those
- * so we dont get InvalidTime at grabs.
- */
- device_event->time = priv->latest_evtime;
- }
-
- /* Update the internal latest evtime, for any possible later use */
- priv->latest_evtime = device_event->time;
- }
+ priv->latest_evtime = device_event->time;
}
static void
@@ -260,6 +272,9 @@ maybe_spoof_event_as_stage_event (MetaBackendX11 *x11,
case XI_Motion:
case XI_ButtonPress:
case XI_ButtonRelease:
+ maybe_translate_touch_replay_pointer_event (x11,
+ (XIDeviceEvent *) input_event);
+ /* Intentional fall-through */
case XI_KeyPress:
case XI_KeyRelease:
case XI_TouchBegin:
@@ -327,6 +342,17 @@ handle_host_xevent (MetaBackend *backend,
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
gboolean bypass_clutter = FALSE;
+ switch (event->type)
+ {
+ case ClientMessage:
+ if (event->xclient.window == meta_backend_x11_get_xwindow (x11) &&
+ event->xclient.message_type == priv->touch_replay_sync_atom)
+ priv->current_touch_replay_sync_serial = event->xclient.data.l[0];
+ break;
+ default:
+ break;
+ }
+
XGetEventData (priv->xdisplay, &event->xcookie);
{
@@ -534,6 +560,10 @@ meta_backend_x11_post_init (MetaBackend *backend)
monitor_manager = meta_backend_get_monitor_manager (backend);
g_signal_connect (monitor_manager, "monitors-changed-internal",
G_CALLBACK (on_monitors_changed), backend);
+
+ priv->touch_replay_sync_atom = XInternAtom (priv->xdisplay,
+ "_MUTTER_TOUCH_SEQUENCE_SYNC",
+ False);
}
static ClutterBackend *
@@ -611,6 +641,21 @@ meta_backend_x11_finish_touch_sequence (MetaBackend *backend,
META_VIRTUAL_CORE_POINTER_ID,
clutter_x11_event_sequence_get_touch_detail (sequence),
DefaultRootWindow (priv->xdisplay), event_mode);
+
+ if (state == META_SEQUENCE_REJECTED)
+ {
+ XClientMessageEvent ev;
+
+ ev = (XClientMessageEvent) {
+ .type = ClientMessage,
+ .window = meta_backend_x11_get_xwindow (x11),
+ .message_type = priv->touch_replay_sync_atom,
+ .format = 32,
+ .data.l[0] = ++priv->pending_touch_replay_sync_serial,
+ };
+ XSendEvent (priv->xdisplay, meta_backend_x11_get_xwindow (x11),
+ False, 0, (XEvent *) &ev);
+ }
}
static void
--
2.23.0

View File

@ -0,0 +1,819 @@
From 705818340dec181335b48ab73d6411e639daaeae Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Tue, 1 Jun 2021 11:44:20 +0200
Subject: [PATCH 1/6] 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 | 275 +++++++++++++++++++++
1 file changed, 275 insertions(+)
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 96390285a6..0631fd2fee 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -26,6 +26,7 @@
#include "backends/x11/meta-input-settings-x11.h"
#include <gdk/gdkx.h>
+#include <stdlib.h>
#include <string.h>
#include <X11/Xatom.h>
#include <X11/extensions/XInput2.h>
@@ -165,6 +166,184 @@ change_property (ClutterInputDevice *device,
meta_XFree (data_ret);
}
+static gboolean
+is_device_synaptics (ClutterInputDevice *device)
+{
+ guchar *has_setting;
+
+ /* We just need looking for a synaptics-specific property */
+ has_setting = get_property (device, "Synaptics Off", XA_INTEGER, 8, 1);
+ if (!has_setting)
+ return FALSE;
+
+ meta_XFree (has_setting);
+ return TRUE;
+}
+
+static void
+change_synaptics_tap_left_handed (ClutterInputDevice *device,
+ gboolean tap_enabled,
+ 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));
+ int device_id;
+ XDevice *xdevice;
+ guchar *tap_action, *buttons;
+ guint buttons_capacity = 16, n_buttons;
+
+ device_id = meta_input_device_x11_get_device_id (device);
+ xdevice = XOpenDevice (xdisplay, device_id);
+ if (!xdevice)
+ return;
+
+ tap_action = get_property (device, "Synaptics Tap Action",
+ XA_INTEGER, 8, 7);
+ if (!tap_action)
+ goto out;
+
+ tap_action[4] = tap_enabled ? (left_handed ? 3 : 1) : 0;
+ tap_action[5] = tap_enabled ? (left_handed ? 1 : 3) : 0;
+ tap_action[6] = tap_enabled ? 2 : 0;
+
+ change_property (device, "Synaptics Tap Action",
+ XA_INTEGER, 8, tap_action, 7);
+ meta_XFree (tap_action);
+
+ if (x11_display)
+ meta_x11_error_trap_push (x11_display);
+ buttons = g_new (guchar, buttons_capacity);
+ n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice,
+ buttons, buttons_capacity);
+
+ while (n_buttons > buttons_capacity)
+ {
+ buttons_capacity = n_buttons;
+ buttons = (guchar *) g_realloc (buttons,
+ buttons_capacity * sizeof (guchar));
+
+ n_buttons = XGetDeviceButtonMapping (xdisplay, xdevice,
+ buttons, buttons_capacity);
+ }
+
+ buttons[0] = left_handed ? 3 : 1;
+ buttons[2] = left_handed ? 1 : 3;
+ XSetDeviceButtonMapping (xdisplay, xdevice, buttons, n_buttons);
+ g_free (buttons);
+
+ if (x11_display && meta_x11_error_trap_pop_with_return (x11_display))
+ {
+ g_warning ("Could not set synaptics touchpad left-handed for %s",
+ clutter_input_device_get_device_name (device));
+ }
+
+ out:
+ XCloseDevice (xdisplay, xdevice);
+}
+
+static void
+change_synaptics_speed (ClutterInputDevice *device,
+ 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));
+ int device_id;
+ XDevice *xdevice;
+ XPtrFeedbackControl feedback;
+ XFeedbackState *states, *state;
+ int i, num_feedbacks, motion_threshold, numerator, denominator;
+ gfloat motion_acceleration;
+
+ device_id = meta_input_device_x11_get_device_id (device);
+ xdevice = XOpenDevice (xdisplay, device_id);
+ if (!xdevice)
+ return;
+ /* Get the list of feedbacks for the device */
+ states = XGetFeedbackControl (xdisplay, xdevice, &num_feedbacks);
+ if (!states)
+ return;
+
+ /* Calculate acceleration and threshold */
+ motion_acceleration = (speed + 1) * 5; /* speed is [-1..1], map to [0..10] */
+ motion_threshold = CLAMP (10 - floor (motion_acceleration), 1, 10);
+
+ if (motion_acceleration >= 1.0)
+ {
+ /* we want to get the acceleration, with a resolution of 0.5
+ */
+ if ((motion_acceleration - floor (motion_acceleration)) < 0.25)
+ {
+ numerator = floor (motion_acceleration);
+ denominator = 1;
+ }
+ else if ((motion_acceleration - floor (motion_acceleration)) < 0.5)
+ {
+ numerator = ceil (2.0 * motion_acceleration);
+ denominator = 2;
+ }
+ else if ((motion_acceleration - floor (motion_acceleration)) < 0.75)
+ {
+ numerator = floor (2.0 *motion_acceleration);
+ denominator = 2;
+ }
+ else
+ {
+ numerator = ceil (motion_acceleration);
+ denominator = 1;
+ }
+ }
+ else if (motion_acceleration < 1.0 && motion_acceleration > 0)
+ {
+ /* This we do to 1/10ths */
+ numerator = floor (motion_acceleration * 10) + 1;
+ denominator= 10;
+ }
+ else
+ {
+ numerator = -1;
+ denominator = -1;
+ }
+
+ if (x11_display)
+ meta_x11_error_trap_push (x11_display);
+
+ state = (XFeedbackState *) states;
+
+ for (i = 0; i < num_feedbacks; i++)
+ {
+ if (state->class == PtrFeedbackClass)
+ {
+ /* And tell the device */
+ feedback.class = PtrFeedbackClass;
+ feedback.length = sizeof (XPtrFeedbackControl);
+ feedback.id = state->id;
+ feedback.threshold = motion_threshold;
+ feedback.accelNum = numerator;
+ feedback.accelDenom = denominator;
+
+ XChangeFeedbackControl (xdisplay, xdevice,
+ DvAccelNum | DvAccelDenom | DvThreshold,
+ (XFeedbackControl *) &feedback);
+ break;
+ }
+
+ state = (XFeedbackState *) ((char *) state + state->length);
+ }
+
+ if (x11_display && meta_x11_error_trap_pop_with_return (x11_display))
+ {
+ g_warning ("Could not set synaptics touchpad acceleration for %s",
+ clutter_input_device_get_device_name (device));
+ }
+
+ XFreeFeedbackList (states);
+ XCloseDevice (xdisplay, xdevice);
+}
+
static void
meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -173,6 +352,13 @@ meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
guchar values[2] = { 0 }; /* disabled, disabled-on-external-mouse */
guchar *available;
+ if (is_device_synaptics (device))
+ {
+ values[0] = mode != G_DESKTOP_DEVICE_SEND_EVENTS_ENABLED;
+ change_property (device, "Synaptics Off", XA_INTEGER, 8, &values, 1);
+ return;
+ }
+
available = get_property (device, "libinput Send Events Modes Available",
XA_INTEGER, 8, 2);
if (!available)
@@ -225,6 +411,12 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gfloat value = speed;
+ if (is_device_synaptics (device))
+ {
+ change_synaptics_speed (device, speed);
+ return;
+ }
+
change_property (device, "libinput Accel Speed",
XInternAtom (xdisplay, "FLOAT", False),
32, &value, 1);
@@ -251,6 +443,19 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
else
{
value = enabled ? 1 : 0;
+
+ if (is_device_synaptics (device))
+ {
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad");
+ change_synaptics_tap_left_handed (device,
+ g_settings_get_boolean (settings, "tap-to-click"),
+ enabled);
+ g_object_unref (settings);
+ return;
+ }
+
change_property (device, "libinput Left Handed Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -274,6 +479,20 @@ meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings,
{
guchar value = (enabled) ? 1 : 0;
+ if (is_device_synaptics (device))
+ {
+ GDesktopTouchpadHandedness handedness;
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad");
+ handedness = g_settings_get_enum (settings, "left-handed");
+ g_object_unref (settings);
+
+ change_synaptics_tap_left_handed (device, enabled,
+ handedness == G_DESKTOP_TOUCHPAD_HANDEDNESS_LEFT);
+ return;
+ }
+
change_property (device, "libinput Tapping Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -307,6 +526,27 @@ meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings,
{
guchar value = (inverted) ? 1 : 0;
+ if (is_device_synaptics (device))
+ {
+ gint32 *scrolling_distance;
+
+ scrolling_distance = get_property (device, "Synaptics Scrolling Distance",
+ XA_INTEGER, 32, 2);
+ if (scrolling_distance)
+ {
+ scrolling_distance[0] = inverted ?
+ -abs (scrolling_distance[0]) : abs (scrolling_distance[0]);
+ scrolling_distance[1] = inverted ?
+ -abs (scrolling_distance[1]) : abs (scrolling_distance[1]);
+
+ change_property (device, "Synaptics Scrolling Distance",
+ XA_INTEGER, 32, scrolling_distance, 2);
+ meta_XFree (scrolling_distance);
+ }
+
+ return;
+ }
+
change_property (device, "libinput Natural Scrolling Enabled",
XA_INTEGER, 8, &value, 1);
}
@@ -320,6 +560,41 @@ change_scroll_method (ClutterInputDevice *device,
guchar *current = NULL;
guchar *available = NULL;
+ if (is_device_synaptics (device))
+ {
+ switch (method)
+ {
+ case SCROLL_METHOD_FIELD_EDGE:
+ current = get_property (device, "Synaptics Edge Scrolling",
+ XA_INTEGER, 8, 3);
+ if (current)
+ {
+ current[0] = enabled;
+ current[1] = enabled;
+ change_property (device, "Synaptics Edge Scrolling",
+ XA_INTEGER, 8, current, 3);
+ meta_XFree (current);
+ }
+ break;
+ case SCROLL_METHOD_FIELD_2FG:
+ current = get_property (device, "Synaptics Two-Finger Scrolling",
+ XA_INTEGER, 8, 2);
+ if (current)
+ {
+ current[0] = enabled;
+ current[1] = enabled;
+ change_property (device, "Synaptics Two-Finger Scrolling",
+ XA_INTEGER, 8, current, 2);
+ meta_XFree (current);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return;
+ }
+
available = get_property (device, "libinput Scroll Methods Available",
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[method])
--
2.31.1
From 50c4733acf56b3b67a2706d32f5c455cb51f9458 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Tue, 13 Feb 2018 11:44:40 +0100
Subject: [PATCH 2/6] clutter: Extend touchpad device property check for
Synaptics
So we reliably get CLUTTER_TOUCHPAD_DEVICE for those. The other heuristics
to get the device type may fall short.
---
src/backends/x11/meta-seat-x11.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
index d43834bd7b..73938e22e0 100644
--- a/src/backends/x11/meta-seat-x11.c
+++ b/src/backends/x11/meta-seat-x11.c
@@ -246,7 +246,8 @@ is_touch_device (XIAnyClassInfo **classes,
}
static gboolean
-is_touchpad_device (XIDeviceInfo *info)
+query_exists_device_property (XIDeviceInfo *info,
+ const char *property)
{
gulong nitems, bytes_after;
uint32_t *data = NULL;
@@ -254,7 +255,7 @@ is_touchpad_device (XIDeviceInfo *info)
Atom type;
Atom prop;
- prop = XInternAtom (clutter_x11_get_default_display (), "libinput Tapping Enabled", True);
+ prop = XInternAtom (clutter_x11_get_default_display (), property, True);
if (prop == None)
return FALSE;
@@ -275,6 +276,18 @@ is_touchpad_device (XIDeviceInfo *info)
return TRUE;
}
+static gboolean
+is_touchpad_device (XIDeviceInfo *info)
+{
+ if (query_exists_device_property (info, "libinput Tapping Enabled"))
+ return TRUE;
+
+ if (query_exists_device_property (info, "Synaptics Off"))
+ return TRUE;
+
+ return FALSE;
+}
+
static gboolean
get_device_ids (XIDeviceInfo *info,
char **vendor_id,
--
2.31.1
From 307970305d11cdca1b97c53c85bda8b809ff4f0f Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 9 Oct 2017 18:39:52 +0200
Subject: [PATCH 3/6] backends/x11: Add a synaptics check for two finger scroll
availability
Commit "backends/x11: Support synaptics configuration" added support
for synaptics two finger scrolling but didn't add the code to check
that it is available resulting in the upper layer always assuming it
isn't.
---
src/backends/x11/meta-input-settings-x11.c | 11 +++++++++++
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 0631fd2fee..2ac080127c 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -638,6 +638,17 @@ meta_input_settings_x11_has_two_finger_scroll (MetaInputSettings *settings,
guchar *available = NULL;
gboolean has_two_finger = TRUE;
+ if (is_device_synaptics (device))
+ {
+ available = get_property (device, "Synaptics Capabilities",
+ XA_INTEGER, 8, 4);
+ if (!available || !available[3])
+ has_two_finger = FALSE;
+
+ meta_XFree (available);
+ return has_two_finger;
+ }
+
available = get_property (device, "libinput Scroll Methods Available",
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[SCROLL_METHOD_FIELD_2FG])
--
2.31.1
From cba31f88ddbfb7355de1daa34397aba8e8607765 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 9 Oct 2017 18:55:56 +0200
Subject: [PATCH 4/6] backends/x11: Add disable while typing support for
synaptics
This is basically a copy of the old g-s-d mouse plugin code to manage
syndaemon when the synaptics driver is being used.
---
src/backends/x11/meta-input-settings-x11.c | 112 +++++++++++++++++++++
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 2ac080127c..2658b82172 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -35,6 +35,9 @@
#ifdef HAVE_LIBGUDEV
#include <gudev/gudev.h>
#endif
+#ifdef __linux
+#include <sys/prctl.h>
+#endif
#include "backends/x11/meta-backend-x11.h"
#include "backends/x11/meta-input-device-x11.h"
@@ -46,6 +49,8 @@ typedef struct _MetaInputSettingsX11Private
#ifdef HAVE_LIBGUDEV
GUdevClient *udev_client;
#endif
+ gboolean syndaemon_spawned;
+ GPid syndaemon_pid;
} MetaInputSettingsX11Private;
G_DEFINE_TYPE_WITH_PRIVATE (MetaInputSettingsX11, meta_input_settings_x11,
@@ -344,6 +349,107 @@ change_synaptics_speed (ClutterInputDevice *device,
XCloseDevice (xdisplay, xdevice);
}
+/* Ensure that syndaemon dies together with us, to avoid running several of
+ * them */
+static void
+setup_syndaemon (gpointer user_data)
+{
+#ifdef __linux
+ prctl (PR_SET_PDEATHSIG, SIGHUP);
+#endif
+}
+
+static gboolean
+have_program_in_path (const char *name)
+{
+ gchar *path;
+ gboolean result;
+
+ path = g_find_program_in_path (name);
+ result = (path != NULL);
+ g_free (path);
+ return result;
+}
+
+static void
+syndaemon_died (GPid pid,
+ gint status,
+ gpointer user_data)
+{
+ MetaInputSettingsX11 *settings_x11 = META_INPUT_SETTINGS_X11 (user_data);
+ MetaInputSettingsX11Private *priv =
+ meta_input_settings_x11_get_instance_private (settings_x11);
+ GError *error = NULL;
+
+ if (!g_spawn_check_exit_status (status, &error))
+ {
+ if ((WIFSIGNALED (status) && WTERMSIG (status) != SIGHUP) ||
+ error->domain == G_SPAWN_EXIT_ERROR)
+ g_warning ("Syndaemon exited unexpectedly: %s", error->message);
+ g_error_free (error);
+ }
+
+ g_spawn_close_pid (pid);
+ priv->syndaemon_spawned = FALSE;
+}
+
+static void
+set_synaptics_disable_w_typing (MetaInputSettings *settings,
+ gboolean state)
+{
+ MetaInputSettingsX11 *settings_x11 = META_INPUT_SETTINGS_X11 (settings);
+ MetaInputSettingsX11Private *priv =
+ meta_input_settings_x11_get_instance_private (settings_x11);
+
+ if (state)
+ {
+ GError *error = NULL;
+ GPtrArray *args;
+
+ if (priv->syndaemon_spawned)
+ return;
+
+ if (!have_program_in_path ("syndaemon"))
+ return;
+
+ args = g_ptr_array_new ();
+
+ g_ptr_array_add (args, (gpointer)"syndaemon");
+ g_ptr_array_add (args, (gpointer)"-i");
+ g_ptr_array_add (args, (gpointer)"1.0");
+ g_ptr_array_add (args, (gpointer)"-t");
+ g_ptr_array_add (args, (gpointer)"-K");
+ g_ptr_array_add (args, (gpointer)"-R");
+ g_ptr_array_add (args, NULL);
+
+ /* we must use G_SPAWN_DO_NOT_REAP_CHILD to avoid
+ * double-forking, otherwise syndaemon will immediately get
+ * killed again through (PR_SET_PDEATHSIG when the intermediate
+ * process dies */
+ g_spawn_async (g_get_home_dir (), (char **) args->pdata, NULL,
+ G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD, setup_syndaemon, NULL,
+ &priv->syndaemon_pid, &error);
+
+ priv->syndaemon_spawned = (error == NULL);
+ g_ptr_array_free (args, TRUE);
+
+ if (error)
+ {
+ g_warning ("Failed to launch syndaemon: %s", error->message);
+ g_error_free (error);
+ }
+ else
+ {
+ g_child_watch_add (priv->syndaemon_pid, syndaemon_died, settings);
+ }
+ }
+ else if (priv->syndaemon_spawned)
+ {
+ kill (priv->syndaemon_pid, SIGHUP);
+ priv->syndaemon_spawned = FALSE;
+ }
+}
+
static void
meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -468,6 +574,12 @@ meta_input_settings_x11_set_disable_while_typing (MetaInputSettings *settings,
{
guchar value = (enabled) ? 1 : 0;
+ if (is_device_synaptics (device))
+ {
+ set_synaptics_disable_w_typing (settings, enabled);
+ return;
+ }
+
change_property (device, "libinput Disable While Typing Enabled",
XA_INTEGER, 8, &value, 1);
}
--
2.31.1
From 354d34263534d0c7a5c7f7169d8b4a3dba79491c Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 13 Jun 2018 13:48:24 +0200
Subject: [PATCH 5/6] clutter: Only reset scroll axes on slave devices
As a plus, unknown source device IDs will just warn instead of crash.
---
src/backends/x11/meta-seat-x11.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
index 73938e22e0..6d2c7d3740 100644
--- a/src/backends/x11/meta-seat-x11.c
+++ b/src/backends/x11/meta-seat-x11.c
@@ -2362,7 +2362,9 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
seat->has_pointer_focus = FALSE;
}
- meta_input_device_x11_reset_scroll_info (source_device);
+ if (clutter_input_device_get_device_mode (source_device) ==
+ CLUTTER_INPUT_MODE_PHYSICAL)
+ meta_input_device_x11_reset_scroll_info (source_device);
clutter_event_set_device (event, device);
clutter_event_set_source_device (event, source_device);
--
2.31.1
From b7f94b5dd09953d5a4c8aee1b79491d71f8c1e0e Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Tue, 10 Oct 2017 19:07:27 +0200
Subject: [PATCH 6/6] backends/x11: Support plain old X device configuration
We re-use part of the code added to support synaptics and add a few
bits specific for xorg-x11-drv-evdev devices.
---
src/backends/x11/meta-input-settings-x11.c | 98 +++++++++++++++++-----
1 file changed, 75 insertions(+), 23 deletions(-)
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 2658b82172..80bc33c6b5 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -185,10 +185,23 @@ is_device_synaptics (ClutterInputDevice *device)
return TRUE;
}
+static gboolean
+is_device_libinput (ClutterInputDevice *device)
+{
+ guchar *has_setting;
+
+ /* We just need looking for a synaptics-specific property */
+ has_setting = get_property (device, "libinput Send Events Modes Available", XA_INTEGER, 8, 2);
+ if (!has_setting)
+ return FALSE;
+
+ meta_XFree (has_setting);
+ return TRUE;
+}
+
static void
-change_synaptics_tap_left_handed (ClutterInputDevice *device,
- gboolean tap_enabled,
- gboolean left_handed)
+change_x_device_left_handed (ClutterInputDevice *device,
+ gboolean left_handed)
{
MetaDisplay *display = meta_get_display ();
MetaX11Display *x11_display = display ? display->x11_display : NULL;
@@ -196,7 +209,7 @@ change_synaptics_tap_left_handed (ClutterInputDevice *device,
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
int device_id;
XDevice *xdevice;
- guchar *tap_action, *buttons;
+ guchar *buttons;
guint buttons_capacity = 16, n_buttons;
device_id = meta_input_device_x11_get_device_id (device);
@@ -204,19 +217,6 @@ change_synaptics_tap_left_handed (ClutterInputDevice *device,
if (!xdevice)
return;
- tap_action = get_property (device, "Synaptics Tap Action",
- XA_INTEGER, 8, 7);
- if (!tap_action)
- goto out;
-
- tap_action[4] = tap_enabled ? (left_handed ? 3 : 1) : 0;
- tap_action[5] = tap_enabled ? (left_handed ? 1 : 3) : 0;
- tap_action[6] = tap_enabled ? 2 : 0;
-
- change_property (device, "Synaptics Tap Action",
- XA_INTEGER, 8, tap_action, 7);
- meta_XFree (tap_action);
-
if (x11_display)
meta_x11_error_trap_push (x11_display);
buttons = g_new (guchar, buttons_capacity);
@@ -240,17 +240,39 @@ change_synaptics_tap_left_handed (ClutterInputDevice *device,
if (x11_display && meta_x11_error_trap_pop_with_return (x11_display))
{
- g_warning ("Could not set synaptics touchpad left-handed for %s",
+ g_warning ("Could not set left-handed for %s",
clutter_input_device_get_device_name (device));
}
- out:
XCloseDevice (xdisplay, xdevice);
}
static void
-change_synaptics_speed (ClutterInputDevice *device,
- gdouble speed)
+change_synaptics_tap_left_handed (ClutterInputDevice *device,
+ gboolean tap_enabled,
+ gboolean left_handed)
+{
+ guchar *tap_action;
+
+ tap_action = get_property (device, "Synaptics Tap Action",
+ XA_INTEGER, 8, 7);
+ if (!tap_action)
+ return;
+
+ tap_action[4] = tap_enabled ? (left_handed ? 3 : 1) : 0;
+ tap_action[5] = tap_enabled ? (left_handed ? 1 : 3) : 0;
+ tap_action[6] = tap_enabled ? 2 : 0;
+
+ change_property (device, "Synaptics Tap Action",
+ XA_INTEGER, 8, tap_action, 7);
+ meta_XFree (tap_action);
+
+ change_x_device_left_handed (device, left_handed);
+}
+
+static void
+change_x_device_speed (ClutterInputDevice *device,
+ gdouble speed)
{
MetaDisplay *display = meta_get_display ();
MetaX11Display *x11_display = display ? display->x11_display : NULL;
@@ -349,6 +371,23 @@ change_synaptics_speed (ClutterInputDevice *device,
XCloseDevice (xdisplay, xdevice);
}
+static void
+change_x_device_scroll_button (ClutterInputDevice *device,
+ guint button)
+{
+ guchar value;
+
+ value = button > 0 ? 1 : 0;
+ change_property (device, "Evdev Wheel Emulation",
+ XA_INTEGER, 8, &value, 1);
+ if (button > 0)
+ {
+ value = button;
+ change_property (device, "Evdev Wheel Emulation Button",
+ XA_INTEGER, 8, &value, 1);
+ }
+}
+
/* Ensure that syndaemon dies together with us, to avoid running several of
* them */
static void
@@ -517,9 +556,10 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gfloat value = speed;
- if (is_device_synaptics (device))
+ if (is_device_synaptics (device) ||
+ !is_device_libinput (device))
{
- change_synaptics_speed (device, speed);
+ change_x_device_speed (device, speed);
return;
}
@@ -561,6 +601,11 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
g_object_unref (settings);
return;
}
+ else if (!is_device_libinput (device) && device_type != CLUTTER_PAD_DEVICE)
+ {
+ change_x_device_left_handed (device, enabled);
+ return;
+ }
change_property (device, "libinput Left Handed Enabled",
XA_INTEGER, 8, &value, 1);
@@ -778,7 +823,14 @@ meta_input_settings_x11_set_scroll_button (MetaInputSettings *settings,
{
gchar lock = button_lock;
+ if (!is_device_libinput (device))
+ {
+ change_x_device_scroll_button (device, button);
+ return;
+ }
+
change_scroll_method (device, SCROLL_METHOD_FIELD_BUTTON, button != 0);
+
change_property (device, "libinput Button Scrolling Button",
XA_CARDINAL, 32, &button, 1);
change_property (device, "libinput Button Scrolling Button Lock Enabled",
--
2.31.1

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +0,0 @@
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
{

View File

@ -1,45 +0,0 @@
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

@ -1,68 +0,0 @@
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)
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More