aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/dri2/dri2.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/dri2/dri2.c')
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c
index 6dd77963c..6459f11b1 100644
--- a/xorg-server/hw/xfree86/dri2/dri2.c
+++ b/xorg-server/hw/xfree86/dri2/dri2.c
@@ -130,6 +130,7 @@ typedef struct _DRI2Screen {
HandleExposuresProcPtr HandleExposures;
ConfigNotifyProcPtr ConfigNotify;
+ SetWindowPixmapProcPtr SetWindowPixmap;
DRI2CreateBuffer2ProcPtr CreateBuffer2;
DRI2DestroyBuffer2ProcPtr DestroyBuffer2;
DRI2CopyRegion2ProcPtr CopyRegion2;
@@ -415,18 +416,14 @@ DRI2DrawableGone(void *p, XID id)
}
static DRI2BufferPtr
-create_buffer(DrawablePtr pDraw,
+create_buffer(DRI2ScreenPtr ds, DrawablePtr pDraw,
unsigned int attachment, unsigned int format)
{
- ScreenPtr primeScreen;
- DRI2DrawablePtr pPriv;
- DRI2ScreenPtr ds;
DRI2BufferPtr buffer;
- pPriv = DRI2GetDrawable(pDraw);
- primeScreen = GetScreenPrime(pDraw->pScreen, pPriv->prime_id);
- ds = DRI2GetScreenPrime(pDraw->pScreen, pPriv->prime_id);
if (ds->CreateBuffer2)
- buffer = (*ds->CreateBuffer2)(primeScreen, pDraw, attachment, format);
+ buffer = (*ds->CreateBuffer2)(GetScreenPrime(pDraw->pScreen,
+ DRI2GetDrawable(pDraw)->prime_id),
+ pDraw, attachment, format);
else
buffer = (*ds->CreateBuffer)(pDraw, attachment, format);
return buffer;
@@ -475,7 +472,7 @@ allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds,
if ((old_buf < 0)
|| attachment == DRI2BufferFrontLeft
|| !dimensions_match || (pPriv->buffers[old_buf]->format != format)) {
- *buffer = create_buffer (pDraw, attachment, format);
+ *buffer = create_buffer(ds, pDraw, attachment, format);
return TRUE;
}
@@ -538,7 +535,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
return NULL;
}
- ds = DRI2GetScreen(pDraw->pScreen);
+ ds = DRI2GetScreenPrime(pDraw->pScreen, pPriv->prime_id);
dimensions_match = (pDraw->width == pPriv->width)
&& (pDraw->height == pPriv->height);
@@ -1382,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)
@@ -1528,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]) {
@@ -1552,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);