summaryrefslogtreecommitdiff
authorIan Romanick <ian.d.romanick@intel.com>2009-04-09 21:38:24 (GMT)
committer Ian Romanick <ian.d.romanick@intel.com>2009-04-10 19:00:36 (GMT)
commit567cf67959b30432ae30f4851ec17b3a375ab838 (patch) (side-by-side diff)
treea7f3e7d5bdf2e177828cb2446d56815b25f0890a
parentf1a995d1496d73741731e32f475097c44a8da972 (diff)
downloadxserver-567cf67959b30432ae30f4851ec17b3a375ab838.zip
xserver-567cf67959b30432ae30f4851ec17b3a375ab838.tar.gz
DRI2: Synchronize the contents of the real and fake front-buffers
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--hw/xfree86/dri2/dri2.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 351d02b..0b52a0f 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -141,6 +141,7 @@ DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
DRI2BufferPtr buffers;
unsigned int temp_buf[32];
unsigned int *temp = temp_buf;
+ int have_fake_front = 0;
/* If the drawable is a window and the front-buffer is requested, silently
@@ -163,6 +164,7 @@ DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
if (attachments[i] == DRI2BufferFakeFrontLeft) {
need_fake_front--;
+ have_fake_front = 1;
}
temp[i] = attachments[i];
@@ -171,6 +173,7 @@ DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
if (need_fake_front > 0) {
temp[i] = DRI2BufferFakeFrontLeft;
count++;
+ have_fake_front = 1;
attachments = temp;
}
}
@@ -195,6 +198,25 @@ DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
*height = pPriv->height;
*out_count = pPriv->bufferCount;
+
+ /* If the client is getting a fake front-buffer, pre-fill it with the
+ * contents of the real front-buffer. This ensures correct operation of
+ * applications that call glXWaitX before calling glDrawBuffer.
+ */
+ if (have_fake_front) {
+ BoxRec box;
+ RegionRec region;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pPriv->width;
+ box.y2 = pPriv->height;
+ REGION_INIT(pDraw->pScreen, &region, &box, 0);
+
+ DRI2CopyRegion(pDraw, &region, DRI2BufferFakeFrontLeft,
+ DRI2BufferFrontLeft);
+ }
+
return pPriv->buffers;
}