81 lines
2.7 KiB
Diff
81 lines
2.7 KiB
Diff
From 44c693f45d6abd6f7f3bd2f756d35811db143af7 Mon Sep 17 00:00:00 2001
|
|
From: Olivier Fourdan <ofourdan@redhat.com>
|
|
Date: Fri, 28 Jun 2019 16:55:11 +0200
|
|
Subject: [PATCH xserver 03/15] xwayland: Update screen pixmap on output resize
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Running Xwayland non-rootless and resizing the output would lead to a
|
|
crash while trying to update the larger areas of the root window.
|
|
|
|
Make sure we resize the backing pixmap according to the new output size
|
|
to avoid the crash.
|
|
|
|
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
|
Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/834
|
|
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
|
|
(cherry picked from commit ce9455b5ee389b100a9b7da76b79690d97211b7a)
|
|
---
|
|
hw/xwayland/xwayland-output.c | 37 +++++++++++++++++++++++++++++++++++
|
|
1 file changed, 37 insertions(+)
|
|
|
|
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
|
|
index cc68f0340..9d33ed862 100644
|
|
--- a/hw/xwayland/xwayland-output.c
|
|
+++ b/hw/xwayland/xwayland-output.c
|
|
@@ -171,6 +171,40 @@ approximate_mmpd(struct xwl_screen *xwl_screen)
|
|
return 25.4 / DEFAULT_DPI;
|
|
}
|
|
|
|
+static int
|
|
+xwl_set_pixmap_visit_window(WindowPtr window, void *data)
|
|
+{
|
|
+ ScreenPtr screen = window->drawable.pScreen;
|
|
+
|
|
+ if (screen->GetWindowPixmap(window) == data) {
|
|
+ screen->SetWindowPixmap(window, screen->GetScreenPixmap(screen));
|
|
+ return WT_WALKCHILDREN;
|
|
+ }
|
|
+
|
|
+ return WT_DONTWALKCHILDREN;
|
|
+}
|
|
+
|
|
+static void
|
|
+update_backing_pixmaps(struct xwl_screen *xwl_screen, int width, int height)
|
|
+{
|
|
+ ScreenPtr pScreen = xwl_screen->screen;
|
|
+ WindowPtr pRoot = pScreen->root;
|
|
+ PixmapPtr old_pixmap, new_pixmap;
|
|
+
|
|
+ old_pixmap = pScreen->GetScreenPixmap(pScreen);
|
|
+ new_pixmap = pScreen->CreatePixmap(pScreen, width, height,
|
|
+ pScreen->rootDepth,
|
|
+ CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
|
|
+ pScreen->SetScreenPixmap(new_pixmap);
|
|
+
|
|
+ if (old_pixmap) {
|
|
+ TraverseTree(pRoot, xwl_set_pixmap_visit_window, old_pixmap);
|
|
+ pScreen->DestroyPixmap(old_pixmap);
|
|
+ }
|
|
+
|
|
+ pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL);
|
|
+}
|
|
+
|
|
static void
|
|
update_screen_size(struct xwl_output *xwl_output, int width, int height)
|
|
{
|
|
@@ -180,6 +214,9 @@ update_screen_size(struct xwl_output *xwl_output, int width, int height)
|
|
if (xwl_screen->root_clip_mode == ROOT_CLIP_FULL)
|
|
SetRootClip(xwl_screen->screen, ROOT_CLIP_NONE);
|
|
|
|
+ if (!xwl_screen->rootless && xwl_screen->screen->root)
|
|
+ update_backing_pixmaps (xwl_screen, width, height);
|
|
+
|
|
xwl_screen->width = width;
|
|
xwl_screen->height = height;
|
|
xwl_screen->screen->width = width;
|
|
--
|
|
2.21.0
|
|
|