diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2009-04-09 14:38:24 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2009-04-10 12:00:36 -0700 |
commit | 567cf67959b30432ae30f4851ec17b3a375ab838 (patch) | |
tree | a7f3e7d5bdf2e177828cb2446d56815b25f0890a | |
parent | f1a995d1496d73741731e32f475097c44a8da972 (diff) |
DRI2: Synchronize the contents of the real and fake front-buffers
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r-- | hw/xfree86/dri2/dri2.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 351d02b7b..0b52a0f8c 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, ®ion, &box, 0); + + DRI2CopyRegion(pDraw, ®ion, DRI2BufferFakeFrontLeft, + DRI2BufferFrontLeft); + } + return pPriv->buffers; } |