xserver: Branch 'master' - 3 commits
Ian Romanick
idr at kemper.freedesktop.org
Fri Apr 10 12:00:42 PDT 2009
glx/glxdri2.c | 10 +++++++
hw/xfree86/dri2/dri2.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++
hw/xfree86/dri2/dri2ext.c | 24 ++++++++++++++++-
3 files changed, 94 insertions(+), 2 deletions(-)
New commits:
commit 567cf67959b30432ae30f4851ec17b3a375ab838
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Thu Apr 9 14:38:24 2009 -0700
DRI2: Synchronize the contents of the real and fake front-buffers
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
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, ®ion, &box, 0);
+
+ DRI2CopyRegion(pDraw, ®ion, DRI2BufferFakeFrontLeft,
+ DRI2BufferFrontLeft);
+ }
+
return pPriv->buffers;
}
commit f1a995d1496d73741731e32f475097c44a8da972
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Thu Apr 9 14:31:01 2009 -0700
DRI2: Do not send the real front buffer of a window to the client
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index c896536..ea5b5ef 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -406,6 +406,7 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
__GLXDRIdrawable *private = loaderPrivate;
DRI2BufferPtr buffers;
int i;
+ int skip = 0;
buffers = DRI2GetBuffers(private->base.pDraw,
width, height, attachments, count, out_count);
@@ -420,6 +421,14 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
/* This assumes the DRI2 buffer attachment tokens matches the
* __DRIbuffer tokens. */
for (i = 0; i < *out_count; i++) {
+ /* Do not send the real front buffer of a window to the client.
+ */
+ if ((private->base.pDraw->type == DRAWABLE_WINDOW)
+ && (buffers[i].attachment == DRI2BufferFrontLeft)) {
+ skip++;
+ continue;
+ }
+
private->buffers[i].attachment = buffers[i].attachment;
private->buffers[i].name = buffers[i].name;
private->buffers[i].pitch = buffers[i].pitch;
@@ -427,6 +436,7 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
private->buffers[i].flags = buffers[i].flags;
}
+ *out_count -= skip;
return private->buffers;
}
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index d6e1c96..503f827 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -202,6 +202,7 @@ ProcDRI2GetBuffers(ClientPtr client)
int i, status, width, height, count;
unsigned int *attachments;
xDRI2Buffer buffer;
+ int skip;
REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * 4);
if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
@@ -211,15 +212,34 @@ ProcDRI2GetBuffers(ClientPtr client)
buffers = DRI2GetBuffers(pDrawable, &width, &height,
attachments, stuff->count, &count);
+ skip = 0;
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ for (i = 0; i < count; i++) {
+ /* Do not send the real front buffer of a window to the client.
+ */
+ if (buffers[i].attachment == DRI2BufferFrontLeft) {
+ skip++;
+ continue;
+ }
+ }
+ }
+
rep.type = X_Reply;
- rep.length = count * sizeof(xDRI2Buffer) / 4;
+ rep.length = (count - skip) * sizeof(xDRI2Buffer) / 4;
rep.sequenceNumber = client->sequence;
rep.width = width;
rep.height = height;
- rep.count = count;
+ rep.count = count - skip;
WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep);
for (i = 0; i < count; i++) {
+ /* Do not send the real front buffer of a window to the client.
+ */
+ if ((pDrawable->type == DRAWABLE_WINDOW)
+ && (buffers[i].attachment == DRI2BufferFrontLeft)) {
+ continue;
+ }
+
buffer.attachment = buffers[i].attachment;
buffer.name = buffers[i].name;
buffer.pitch = buffers[i].pitch;
commit aa2928325fe51d94a636dde9c090e8f54a311a12
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Wed Apr 8 15:44:34 2009 -0700
DRI2: Add fake front-buffer to request list for windows
If a front-buffer is requested for a window, add the fake front-buffer
to the list of requested buffers.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 0f2e24b..351d02b 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -139,6 +139,42 @@ DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
DRI2BufferPtr buffers;
+ unsigned int temp_buf[32];
+ unsigned int *temp = temp_buf;
+
+
+ /* If the drawable is a window and the front-buffer is requested, silently
+ * add the fake front-buffer to the list of requested attachments. The
+ * counting logic in the loop accounts for the case where the client
+ * requests both the fake and real front-buffer.
+ */
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ int need_fake_front = 0;
+ int i;
+
+ if ((count + 1) > 32) {
+ temp = xalloc((count + 1) * sizeof(temp[0]));
+ }
+
+ for (i = 0; i < count; i++) {
+ if (attachments[i] == DRI2BufferFrontLeft) {
+ need_fake_front++;
+ }
+
+ if (attachments[i] == DRI2BufferFakeFrontLeft) {
+ need_fake_front--;
+ }
+
+ temp[i] = attachments[i];
+ }
+
+ if (need_fake_front > 0) {
+ temp[i] = DRI2BufferFakeFrontLeft;
+ count++;
+ attachments = temp;
+ }
+ }
+
if (pPriv->buffers == NULL ||
pDraw->width != pPriv->width || pDraw->height != pPriv->height)
@@ -151,6 +187,10 @@ DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
pPriv->height = pDraw->height;
}
+ if (temp != temp_buf) {
+ xfree(temp);
+ }
+
*width = pPriv->width;
*height = pPriv->height;
*out_count = pPriv->bufferCount;
More information about the xorg-commit
mailing list