Blob Blame History Raw
From c2c9450bc7b324e58ea6b77d0d7e1d2d18f35646 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Tue, 30 Jul 2019 21:26:49 -0400
Subject: [PATCH xserver] dix: Optimize setting backing store state

Extra special RHEL 7.7+ edition
---
 composite/compinit.c | 15 +++++----------
 dix/window.c         |  6 ++++++
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/composite/compinit.c b/composite/compinit.c
index 2a4de4a22..149f354a6 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -120,20 +120,15 @@ compCheckBackingStore(WindowPtr pWin)
         (pWin->backingStore == Always) ||
         (pWin->backingStore == WhenMapped && pWin->viewable);
 
-    if (should && !pWin->backStorage) {
+    if (should) {
         compCheckPaintable(pWin);
-        if (Success == compRedirectWindow(serverClient, pWin,
-                                          CompositeRedirectAutomatic))
-            pWin->backStorage = TRUE;
+        compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
     }
-    else if (!should && pWin->backStorage) {
+    else if (!should) {
         compCheckPaintable(pWin);
-        if (Success == compUnredirectWindow(serverClient, pWin,
-                                            CompositeRedirectAutomatic))
-            pWin->backStorage = FALSE;
+        compUnredirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
     }
-    pWin->paintable = pWin->viewable ||
-        (pWin->backingStore == Always && pWin->backStorage);
+    compCheckPaintable(pWin); /* XXX before and after? really? */
 }
 
 /* Fake backing store via automatic redirection */
diff --git a/dix/window.c b/dix/window.c
index 34bed93d9..30ae5db89 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -1342,6 +1342,12 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
                 client->errorValue = val;
                 goto PatchUp;
             }
+            /* if we're not actually changing the window's state, hide
+             * CWBackingStore from vmaskCopy so it doesn't get passed to
+             * ->ChangeWindowAttributes below
+             */
+            if (pWin->backingStore == val)
+                continue;
             pWin->backingStore = val;
             pWin->forcedBS = FALSE;
             break;
-- 
2.21.0