xserver: Branch 'xwayland-21.1' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Feb 15 09:16:19 UTC 2022


 hw/xwayland/xwayland-cursor.c  |    6 ++++--
 hw/xwayland/xwayland-present.c |   19 +++++++++++++++++++
 hw/xwayland/xwayland-present.h |    2 ++
 3 files changed, 25 insertions(+), 2 deletions(-)

New commits:
commit b153a38bf41aeaefd59a62e0b3ebb535a039f813
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Fri Feb 11 09:20:46 2022 +0100

    xwayland: Fix cursor color
    
    When using colored X11 cursors, the colors would appear wrong, yellow
    would show white, green would show as cyan, and blue would show black
    whereas red would show fine.
    
    This is because the code expanding the cursor data accounts for green
    for both green and blue channels. Funnily this bug has been there from
    the beginning.
    
    Fix the issue by correctly account for the color channels.
    
    Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1303
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Simon Ser <contact at emersion.fr>
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
    (cherry picked from commit 6ad6517a796cb4536d368091b647423981ad1217)

diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
index c4457cc2a..25304d48d 100644
--- a/hw/xwayland/xwayland-cursor.c
+++ b/hw/xwayland/xwayland-cursor.c
@@ -54,9 +54,11 @@ expand_source_and_mask(CursorPtr cursor, CARD32 *data)
 
     p = data;
     fg = ((cursor->foreRed & 0xff00) << 8) |
-        (cursor->foreGreen & 0xff00) | (cursor->foreGreen >> 8);
+          (cursor->foreGreen & 0xff00) |
+          (cursor->foreBlue >> 8);
     bg = ((cursor->backRed & 0xff00) << 8) |
-        (cursor->backGreen & 0xff00) | (cursor->backGreen >> 8);
+          (cursor->backGreen & 0xff00) |
+          (cursor->backBlue >> 8);
     stride = BitmapBytePad(bits->width);
     for (y = 0; y < bits->height; y++)
         for (x = 0; x < bits->width; x++) {
commit 2a02a0d30db14a418e3c17d5ed7593a2692fcc7a
Author: Michel Dänzer <mdaenzer at redhat.com>
Date:   Fri Dec 24 19:06:47 2021 +0100

    xwayland/present: Run fallback timer callback after more than a second
    
    If the Wayland compositor doesn't send a pending frame event, e.g.
    because the Wayland surface isn't visible anywhere, it could happen that
    the timer kept getting pushed back and never fired. This resulted in an
    enormous list of pending vblank events, which could take minutes to
    process when the frame event finally arrived.
    
    Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1110
    Reviewed-by: Olivier Fourdan <ofourdan at redhat.com>
    Tested-by: Jaap Buurman <jaapbuurman at gmail.com>
    (cherry picked from commit 288ec0e046c4cb975367f5ad043b76666c30fe9b)

diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 83d67517a..958035c6c 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -83,6 +83,7 @@ xwl_present_free_timer(struct xwl_present_window *xwl_present_window)
 {
     TimerFree(xwl_present_window->frame_timer);
     xwl_present_window->frame_timer = NULL;
+    xwl_present_window->timer_armed = 0;
 }
 
 static CARD32
@@ -101,6 +102,7 @@ static void
 xwl_present_reset_timer(struct xwl_present_window *xwl_present_window)
 {
     if (xwl_present_has_pending_events(xwl_present_window)) {
+        CARD32 now = GetTimeInMillis();
         CARD32 timeout;
 
         if (!xorg_list_is_empty(&xwl_present_window->frame_callback_list))
@@ -108,6 +110,21 @@ xwl_present_reset_timer(struct xwl_present_window *xwl_present_window)
         else
             timeout = TIMER_LEN_COPY;
 
+        /* Make sure the timer callback runs if at least a second has passed
+         * since we first armed the timer. This can happen e.g. if the Wayland
+         * compositor doesn't send a pending frame event, e.g. because the
+         * Wayland surface isn't visible anywhere.
+         */
+        if (xwl_present_window->timer_armed) {
+            if ((int)(now - xwl_present_window->timer_armed) > 1000) {
+                xwl_present_timer_callback(xwl_present_window->frame_timer, now,
+                                           xwl_present_window);
+                return;
+            }
+        } else {
+            xwl_present_window->timer_armed = now;
+        }
+
         xwl_present_window->frame_timer = TimerSet(xwl_present_window->frame_timer,
                                                    0, timeout,
                                                    &xwl_present_timer_callback,
@@ -200,6 +217,8 @@ xwl_present_msc_bump(struct xwl_present_window *xwl_present_window)
 
     xwl_present_window->ust = GetTimeInMicros();
 
+    xwl_present_window->timer_armed = 0;
+
     event = xwl_present_window->sync_flip;
     xwl_present_window->sync_flip = NULL;
     if (event) {
diff --git a/hw/xwayland/xwayland-present.h b/hw/xwayland/xwayland-present.h
index 35b579469..40bd79459 100644
--- a/hw/xwayland/xwayland-present.h
+++ b/hw/xwayland/xwayland-present.h
@@ -42,6 +42,8 @@ struct xwl_present_window {
     uint64_t ust;
 
     OsTimerPtr frame_timer;
+    /* Timestamp when the current timer was first armed */
+    CARD32 timer_armed;
 
     struct wl_callback *sync_callback;
 


More information about the xorg-commit mailing list