[PATCH] dri2: Only invalidate our tree upon Pixmap changes

Chris Wilson chris at chris-wilson.co.uk
Mon Oct 20 00:02:23 PDT 2014


x11perf -ucreate highlights an instance where compCreateWindow reassigns
the same Pixmap to the Window. Currently this triggers an expensive
invalidation of the entire window hierachy, making sure that DRI2
clients are kept informed of the handle changes. However, as the backing
Pixmap for the Window is actually unchanged, there is no need to
invalidate at all.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 hw/xfree86/dri2/dri2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 140c833..028cfae 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -1393,13 +1393,15 @@ DRI2SetWindowPixmap(WindowPtr pWin, PixmapPtr pPix)
     DrawablePtr pDraw = (DrawablePtr) pWin;
     ScreenPtr pScreen = pDraw->pScreen;
     DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+    PixmapPtr pOld = pScreen->GetWindowPixmap(pWin);
 
     pScreen->SetWindowPixmap = ds->SetWindowPixmap;
     (*pScreen->SetWindowPixmap) (pWin, pPix);
     ds->SetWindowPixmap = pScreen->SetWindowPixmap;
     pScreen->SetWindowPixmap = DRI2SetWindowPixmap;
 
-    DRI2InvalidateDrawableAll(pDraw);
+    if (pPix != pOld)
+	DRI2InvalidateDrawableAll(pDraw);
 }
 
 #define MAX_PRIME DRI2DriverPrimeMask
-- 
2.1.1



More information about the xorg-devel mailing list