From 9cf1dc899bbcd14c66669597accdcca301e3a810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 30 Oct 2025 16:37:22 +0100 Subject: [PATCH 1/2] Revert "composite: Only copy bits from the parent pixmap when absolutely necessary" This reverts commit 7e6c55cc9f5f26ef8afa74b2e86e883ce2ec1163. In the pParent->drawable.depth == pWin->drawable.depth case, pWin may already have valid contents, which need to be copied to the new pixmap. --- composite/compalloc.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/composite/compalloc.c b/composite/compalloc.c index 11d929a0f..d1342799b 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -542,9 +542,6 @@ compNewPixmap(WindowPtr pWin, int x, int y, int w, int h) pPixmap->screen_x = x; pPixmap->screen_y = y; - if (pWin->backgroundState != None) - return pPixmap; - if (pParent->drawable.depth == pWin->drawable.depth) { GCPtr pGC = GetScratchGC(pWin->drawable.depth, pScreen); From 83ee720817fccac7463d833b977691a14a87f968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 30 Oct 2025 16:45:23 +0100 Subject: [PATCH 2/2] composite: Skip copying parent pixmap contents when possible If the parent window has a different depth (which means pWin can't have valid contents yet) and pWin has effective background other than None. --- composite/compalloc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/composite/compalloc.c b/composite/compalloc.c index d1342799b..df9cf18e5 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -526,6 +526,15 @@ compUnredirectOneSubwindow(WindowPtr pParent, WindowPtr pWin) return Success; } +static unsigned +compGetBackgroundState(WindowPtr pWin) +{ + while (pWin->backgroundState == ParentRelative) + pWin = pWin->parent; + + return pWin->backgroundState; +} + static PixmapPtr compNewPixmap(WindowPtr pWin, int x, int y, int w, int h) { @@ -560,7 +569,7 @@ compNewPixmap(WindowPtr pWin, int x, int y, int w, int h) FreeScratchGC(pGC); } } - else { + else if (compGetBackgroundState(pWin) == None) { PictFormatPtr pSrcFormat = PictureWindowFormat(pParent); PictFormatPtr pDstFormat = PictureWindowFormat(pWin); XID inferiors = IncludeInferiors;