[PATCH 4/4] dri2: Listen for changes to the WindowPixmap and invalidate buffers

Chris Wilson chris at chris-wilson.co.uk
Sun Jun 12 02:47:37 PDT 2011


Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala at nokia.com>
Cc: Dave Airlie <airlied at redhat.com>
Cc: Kristian Høgsberg <krh at bitplanet.net>
Cc: Jesse Barnes <jbarnes at virtuousgeek.org>
Cc: Michel Dänzer <michel at daenzer.net>
---
 hw/xfree86/dri2/dri2.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 7896a61..0cdda07 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -107,6 +107,7 @@ typedef struct _DRI2Screen {
     HandleExposuresProcPtr       HandleExposures;
 
     ConfigNotifyProcPtr		 ConfigNotify;
+    SetWindowPixmapProcPtr	 SetWindowPixmap;
 } DRI2ScreenRec;
 
 static DRI2ScreenPtr
@@ -1091,6 +1092,25 @@ DRI2ConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw,
     return Success;
 }
 
+static void
+DRI2SetWindowPixmap(WindowPtr pWin, PixmapPtr pPixmap)
+{
+    DrawablePtr pDraw = &pWin->drawable;
+    ScreenPtr pScreen = pWin->drawable.pScreen;
+    DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
+    if (ds->SetWindowPixmap) {
+	pScreen->SetWindowPixmap = ds->SetWindowPixmap;
+
+	(*pScreen->SetWindowPixmap)(pWin, pPixmap);
+
+	ds->SetWindowPixmap = pScreen->SetWindowPixmap;
+	pScreen->SetWindowPixmap = DRI2SetWindowPixmap;
+    }
+
+    DRI2InvalidateDrawable(pDraw);
+}
+
 Bool
 DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
 {
@@ -1187,6 +1207,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
     ds->ConfigNotify = pScreen->ConfigNotify;
     pScreen->ConfigNotify = DRI2ConfigNotify;
 
+    ds->SetWindowPixmap = pScreen->SetWindowPixmap;
+    pScreen->SetWindowPixmap = DRI2SetWindowPixmap;
+
     xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n");
     for (i = 0; i < sizeof(driverTypeNames) / sizeof(driverTypeNames[0]); i++) {
 	if (i < ds->numDrivers && ds->driverNames[i]) {
-- 
1.7.5.1



More information about the xorg-devel mailing list