xserver: Branch 'xwayland-22.1' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 28 19:09:04 UTC 2023


 glamor/glamor.c                 |    7 ++-----
 glamor/glamor_priv.h            |    1 +
 glamor/glamor_sync.c            |    3 +--
 glamor/glamor_utils.h           |   11 +++++++++++
 test/scripts/xwayland-piglit.sh |    7 ++++++-
 5 files changed, 21 insertions(+), 8 deletions(-)

New commits:
commit 9e52a28be8aa763e1005f05affc7cef3c4219989
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Wed Mar 22 11:31:03 2023 +0100

    test: Use either wayland-info or weston-info
    
    weston-info has been deprecated for quite some time, whereas wayland-info
    may not be available yet.
    
    So we use either, depending on what's actually available.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
    (cherry picked from commit fc625fe172d9f6a149a594b5214364bedf680239)

diff --git a/test/scripts/xwayland-piglit.sh b/test/scripts/xwayland-piglit.sh
index a898008eb..59955900e 100755
--- a/test/scripts/xwayland-piglit.sh
+++ b/test/scripts/xwayland-piglit.sh
@@ -17,8 +17,13 @@ weston --no-config --backend=headless-backend.so --socket=wayland-$$ &
 WESTON_PID=$!
 export WAYLAND_DISPLAY=wayland-$$
 
+# We can use either wayland-info or weston-info (deprecated), depending
+# on what's actually available.
+WAYLAND_INFO=wayland-info
+command -V $WAYLAND_INFO >/dev/null 2>&1 || WAYLAND_INFO=weston-info
+
 # Wait for weston to initialize before starting Xwayland
-timeout --preserve-status 60s bash -c 'while ! weston-info &>/dev/null; do sleep 1; done'
+timeout --preserve-status 60s bash -c "while ! $WAYLAND_INFO &>/dev/null; do sleep 1; done"
 
 # Start an Xwayland server
 export PIGLIT_RESULTS_DIR=$XSERVER_BUILDDIR/test/piglit-results/xwayland
commit d2e27b0a8c05efe56a4179d053c0258f95d3772f
Author: Joshua Ashton <joshua at froggi.es>
Date:   Fri Mar 17 12:31:44 2023 +0000

    glamor: Don't glFlush/ctx switch unless any work has been performed
    
    `glamor_make_current` is always called before any calls to GL.
    
    Apply some dirty-tracking to whenever we call `glamor_make_current` so
    that we can avoid a decent amount of redundant GL work on each
    Dispatch cycle.
    
    Gamescope previously was waking up an empty Xwayland server with an
    XQueryPointer and I noticed a significant amount of churn doing
    redundant GL work.
    
    This has been addressed on the Gamescope side as well, but avoiding any
    useless GL context switches and flushes when glamor is doing nothing
    is still beneficial for CPU and power usage on portable devices.
    
    Signed-off-by: Joshua Ashton <joshua at froggi.es>
    Reviewed-by: Emma Anholt <emma at anholt.net>
    Acked-by: Olivier Fourdan <ofourdan at redhat.com
    (cherry picked from commit 89163917e1976db4ae4863ad5337fa14bf348081)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 9dcef5fac..b8e8f2b8f 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -271,9 +271,7 @@ void
 glamor_block_handler(ScreenPtr screen)
 {
     glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
-
-    glamor_make_current(glamor_priv);
-    glFlush();
+    glamor_flush(glamor_priv);
 }
 
 static void
@@ -281,8 +279,7 @@ _glamor_block_handler(ScreenPtr screen, void *timeout)
 {
     glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
 
-    glamor_make_current(glamor_priv);
-    glFlush();
+    glamor_flush(glamor_priv);
 
     screen->BlockHandler = glamor_priv->saved_procs.block_handler;
     screen->BlockHandler(screen, timeout);
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 028a6d374..7dcfe06f5 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -313,6 +313,7 @@ typedef struct glamor_screen_private {
     Bool suppress_gl_out_of_memory_logging;
     Bool logged_any_fbo_allocation_failure;
     Bool logged_any_pbo_allocation_failure;
+    Bool dirty;
 
     /* xv */
     glamor_program xv_prog;
diff --git a/glamor/glamor_sync.c b/glamor/glamor_sync.c
index 907e0c613..3f98be400 100644
--- a/glamor/glamor_sync.c
+++ b/glamor/glamor_sync.c
@@ -52,8 +52,7 @@ glamor_sync_fence_set_triggered (SyncFence *fence)
 	struct glamor_sync_fence *glamor_fence = glamor_get_sync_fence(fence);
 
 	/* Flush pending rendering operations */
-        glamor_make_current(glamor);
-        glFlush();
+	glamor_flush(glamor);
 
 	fence->funcs.SetTriggered = glamor_fence->set_triggered;
 	fence->funcs.SetTriggered(fence);
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index 93a933eed..bee48d989 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -672,6 +672,17 @@ glamor_make_current(glamor_screen_private *glamor_priv)
         lastGLContext = glamor_priv->ctx.ctx;
         glamor_priv->ctx.make_current(&glamor_priv->ctx);
     }
+    glamor_priv->dirty = TRUE;
+}
+
+static inline void
+glamor_flush(glamor_screen_private *glamor_priv)
+{
+    if (glamor_priv->dirty) {
+        glamor_make_current(glamor_priv);
+        glFlush();
+        glamor_priv->dirty = FALSE;
+    }
 }
 
 static inline BoxRec


More information about the xorg-commit mailing list