From 0f477cc68bbfe37555f73313dcc50b303c3ca210 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 14 Mar 2019 16:34:40 -0400 Subject: [PATCH] dix, composite: Optimize setting window backing store state We hide CWBackingStore from the screen hook if nothing's actually changing, which means compChangeWindowAttributes no longer needs to compare the requested state with the present one. --- composite/compinit.c | 4 ++-- dix/window.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/composite/compinit.c b/composite/compinit.c index 6ea33ea4e..539dc0460 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -108,11 +108,11 @@ compInstallColormap(ColormapPtr pColormap) static void compCheckBackingStore(WindowPtr pWin) { - if (pWin->backingStore != NotUseful && !pWin->backStorage) { + if (pWin->backingStore != NotUseful) { compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic); pWin->backStorage = TRUE; } - else if (pWin->backingStore == NotUseful && pWin->backStorage) { + else { compUnredirectWindow(serverClient, pWin, CompositeRedirectAutomatic); pWin->backStorage = FALSE; diff --git a/dix/window.c b/dix/window.c index ec94a8843..d99b61c02 100644 --- a/dix/window.c +++ b/dix/window.c @@ -1328,6 +1328,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; break; case CWBackingPlanes: