summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <mdaenzer@redhat.com>2020-01-30 12:29:03 +0100
committerMichel Dänzer <michel@daenzer.net>2020-01-31 11:15:13 +0100
commit9e85aa9c1fbf51ef00674e3a91aded4083a14a15 (patch)
treebe03476e505bb6330e9c27487b4ba4139416e83a
parent6a5e47c57d16de8b6a6a2636f3cbad1aebec32e2 (diff)
xwayland/glamor-gbm: Add xwl_glamor_gbm_post_damage hook
It flushes any pending drawing to the kernel, to make sure it'll be visible to the Wayland server. Without this, it was possible for the Wayland server to process surface commits before Xwayland got around to flushing the corresponding drawing, which could result in stale or even completely random window contents being visible. v2: * Make EGL backend post_damage hook mandatory, don't check for NULL in xwl_glamor_post_damage. (Olivier Fourdan) Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/951 Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
-rw-r--r--hw/xwayland/xwayland-glamor-gbm.c10
-rw-r--r--hw/xwayland/xwayland-glamor.c3
-rw-r--r--hw/xwayland/xwayland-glamor.h6
3 files changed, 13 insertions, 6 deletions
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 80655fd16..17682a172 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -49,6 +49,7 @@
#include "xwayland-glamor.h"
#include "xwayland-pixmap.h"
#include "xwayland-screen.h"
+#include "xwayland-window.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h"
@@ -919,6 +920,14 @@ xwl_glamor_gbm_has_wl_interfaces(struct xwl_screen *xwl_screen)
return TRUE;
}
+static void
+xwl_glamor_gbm_post_damage(struct xwl_window *xwl_window, PixmapPtr pixmap,
+ RegionPtr region)
+{
+ /* Make sure any pending drawing to the pixmap is flushed to the kernel */
+ glamor_block_handler(xwl_window->xwl_screen->screen);
+}
+
static Bool
xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
{
@@ -1111,5 +1120,6 @@ xwl_glamor_init_gbm(struct xwl_screen *xwl_screen)
xwl_screen->gbm_backend.init_egl = xwl_glamor_gbm_init_egl;
xwl_screen->gbm_backend.init_screen = xwl_glamor_gbm_init_screen;
xwl_screen->gbm_backend.get_wl_buffer_for_pixmap = xwl_glamor_gbm_get_wl_buffer_for_pixmap;
+ xwl_screen->gbm_backend.post_damage = xwl_glamor_gbm_post_damage;
xwl_screen->gbm_backend.is_available = TRUE;
}
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index d9523b0a7..f3327f4ee 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -124,8 +124,7 @@ xwl_glamor_post_damage(struct xwl_window *xwl_window,
{
struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
- if (xwl_screen->egl_backend->post_damage)
- xwl_screen->egl_backend->post_damage(xwl_window, pixmap, region);
+ xwl_screen->egl_backend->post_damage(xwl_window, pixmap, region);
}
Bool
diff --git a/hw/xwayland/xwayland-glamor.h b/hw/xwayland/xwayland-glamor.h
index e9896bfef..138accd6d 100644
--- a/hw/xwayland/xwayland-glamor.h
+++ b/hw/xwayland/xwayland-glamor.h
@@ -70,10 +70,8 @@ struct xwl_egl_backend {
Bool *created);
/* Called by Xwayland to perform any pre-wl_surface damage routines
- * that are required by the backend. If your backend is poorly
- * designed and lacks the ability to render directly to a surface,
- * you should implement blitting from the glamor pixmap to the wayland
- * pixmap here. Otherwise, this callback is optional.
+ * that are required by the backend to make sure any pending drawing
+ * operations to the pixmap will be visible to the Wayland server.
*/
void (*post_damage)(struct xwl_window *xwl_window,
PixmapPtr pixmap, RegionPtr region);