summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-10 07:45:05 +0100
committerKeith Packard <keithp@keithp.com>2014-06-23 15:05:08 -0700
commit18744907d0766b1b57be12df5adafd0f93221006 (patch)
treece77121909f817bb389d891759de37be8c573a94
parent4d92fab39c4225e89f2d157a1f559cb0618a6eaa (diff)
dri2: Invalidate DRI2Buffers upon SetWindowPixmap updates
When transitioning to a redirected or unredirected Window, the Composite layer modifies the Window's Pixmap. However, the DRI2Buffer for the Drawable is still pointing to the backing bo of the old Pixmap with the result that rendering goes astray. This now also effects DRI2 Drawables that are touched by PresentPixmap. v2: Fixup the function name after rebasing Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Reinis Danne <reinis.danne@gmail.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Cc: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--hw/xfree86/dri2/dri2.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 5705baa16..6459f11b1 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -130,6 +130,7 @@ typedef struct _DRI2Screen {
HandleExposuresProcPtr HandleExposures;
ConfigNotifyProcPtr ConfigNotify;
+ SetWindowPixmapProcPtr SetWindowPixmap;
DRI2CreateBuffer2ProcPtr CreateBuffer2;
DRI2DestroyBuffer2ProcPtr DestroyBuffer2;
DRI2CopyRegion2ProcPtr CopyRegion2;
@@ -1378,6 +1379,21 @@ DRI2ConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw,
return Success;
}
+static void
+DRI2SetWindowPixmap(WindowPtr pWin, PixmapPtr pPix)
+{
+ DrawablePtr pDraw = (DrawablePtr) pWin;
+ ScreenPtr pScreen = pDraw->pScreen;
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
+ pScreen->SetWindowPixmap = ds->SetWindowPixmap;
+ (*pScreen->SetWindowPixmap) (pWin, pPix);
+ ds->SetWindowPixmap = pScreen->SetWindowPixmap;
+ pScreen->SetWindowPixmap = DRI2SetWindowPixmap;
+
+ DRI2InvalidateDrawableAll(pDraw);
+}
+
#define MAX_PRIME DRI2DriverPrimeMask
static int
get_prime_id(void)
@@ -1524,6 +1540,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]) {
@@ -1548,6 +1567,7 @@ DRI2CloseScreen(ScreenPtr pScreen)
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
pScreen->ConfigNotify = ds->ConfigNotify;
+ pScreen->SetWindowPixmap = ds->SetWindowPixmap;
if (ds->prime_id)
prime_id_allocate_bitmask &= ~(1 << ds->prime_id);