xserver: Branch 'master' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 13 15:21:06 UTC 2019


 hw/xwayland/xwayland-window-buffers.c |    6 ++++--
 hw/xwayland/xwayland.c                |   19 ++++++++++++++++---
 2 files changed, 20 insertions(+), 5 deletions(-)

New commits:
commit 46e5236bbe0ca90f1c2a480c54d3f729d4930dfb
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Thu Dec 12 13:50:16 2019 +0100

    xwayland: Take border width into account
    
    Damage coordinates are relative to the drawable, (0,0) being the top
    left corner inside the border.
    
    Therefore, when applying damages or accumulating damages between window
    buffers, we need to take the window border width into account as well,
    otherwise the updates might be only partial or misplaced.
    
    Related: https://gitlab.freedesktop.org/xorg/xserver/issues/951
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>

diff --git a/hw/xwayland/xwayland-window-buffers.c b/hw/xwayland/xwayland-window-buffers.c
index 62999091d..22fef3ffd 100644
--- a/hw/xwayland/xwayland-window-buffers.c
+++ b/hw/xwayland/xwayland-window-buffers.c
@@ -286,8 +286,10 @@ xwl_window_buffers_get_pixmap(struct xwl_window *xwl_window,
         while (nBox--) {
             if (!copy_pixmap_area(window_pixmap,
                                   xwl_window_buffer->pixmap,
-                                  pBox->x1, pBox->y1,
-                                  pBox->x2 - pBox->x1, pBox->y2 - pBox->y1))
+                                  pBox->x1 + xwl_window->window->borderWidth,
+                                  pBox->y1 + xwl_window->window->borderWidth,
+                                  pBox->x2 - pBox->x1,
+                                  pBox->y2 - pBox->y1))
                 return window_pixmap;
 
             pBox++;
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 54a1fdac0..686b259df 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -1163,13 +1163,16 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
      */
     if (RegionNumRects(region) > 256) {
         box = RegionExtents(region);
-        xwl_surface_damage(xwl_screen, xwl_window->surface, box->x1, box->y1,
+        xwl_surface_damage(xwl_screen, xwl_window->surface,
+                           box->x1 + xwl_window->window->borderWidth,
+                           box->y1 + xwl_window->window->borderWidth,
                            box->x2 - box->x1, box->y2 - box->y1);
     } else {
         box = RegionRects(region);
         for (i = 0; i < RegionNumRects(region); i++, box++) {
             xwl_surface_damage(xwl_screen, xwl_window->surface,
-                               box->x1, box->y1,
+                               box->x1 + xwl_window->window->borderWidth,
+                               box->y1 + xwl_window->window->borderWidth,
                                box->x2 - box->x1, box->y2 - box->y1);
         }
     }
commit 1cb886bc2a3e556b15779300350ec8867b4f907e
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Fri Dec 13 11:10:03 2019 +0100

    xwayland: Recycle window buffers when setting pixmap
    
    Right now, we would recycle the window buffers whenever the window the
    window is resized.
    
    This, however, is not sufficient to guarantee that the buffers are up
    to date, since changing the window border width for example would not
    trigger a `WindowResize` (the border being outside the window).
    
    Make sure we recycle the buffers on `SetWindowPixmap` to ensure that
    the buffers will be recycled whenever the pixmap size is changed.
    
    Related: https://gitlab.freedesktop.org/xorg/xserver/issues/951
    Suggested-by: Michel Dänzer <mdaenzer at redhat.com>
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index fc7932f67..54a1fdac0 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -1025,7 +1025,10 @@ xwl_set_window_pixmap(WindowPtr window,
 {
     ScreenPtr screen = window->drawable.pScreen;
     struct xwl_screen *xwl_screen;
+    struct xwl_window *xwl_window;
+    PixmapPtr old_pixmap;
 
+    old_pixmap = (*screen->GetWindowPixmap) (window);
     xwl_screen = xwl_screen_get(screen);
 
     screen->SetWindowPixmap = xwl_screen->SetWindowPixmap;
@@ -1037,6 +1040,14 @@ xwl_set_window_pixmap(WindowPtr window,
         return;
 
     ensure_surface_for_window(window);
+
+    if (old_pixmap->drawable.width == pixmap->drawable.width &&
+        old_pixmap->drawable.height == pixmap->drawable.height)
+       return;
+
+    xwl_window = xwl_window_get(window);
+    if (xwl_window)
+            xwl_window_buffers_recycle(xwl_window);
 }
 
 static void
@@ -1058,7 +1069,6 @@ xwl_resize_window(WindowPtr window,
     screen->ResizeWindow = xwl_resize_window;
 
     if (xwl_window) {
-        xwl_window_buffers_recycle(xwl_window);
         xwl_window->x = x;
         xwl_window->y = y;
         xwl_window->width = width;


More information about the xorg-commit mailing list