summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2009-04-09 14:31:01 -0700
committerIan Romanick <ian.d.romanick@intel.com>2009-06-11 22:45:59 -0700
commit73b786f7e7f46d40bf3b039538540c2e25f45947 (patch)
tree90693c98d9cec0732ca14ed4fc33740798b90a1c
parent32d250a881341ece8a1f1d78359adc1b265b5174 (diff)
DRI2: Do not send the real front buffer of a window to the client
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> (cherry picked from commit f1a995d1496d73741731e32f475097c44a8da972)
-rw-r--r--glx/glxdri2.c10
-rw-r--r--hw/xfree86/dri2/dri2ext.c24
2 files changed, 32 insertions, 2 deletions
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 4544a2c50..4596cc554 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -361,6 +361,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);
@@ -375,6 +376,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;
@@ -382,6 +391,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 1409777e4..ccc1bbb7f 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -203,6 +203,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))
@@ -212,15 +213,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;