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-04-10 12:00:36 -0700
commitf1a995d1496d73741731e32f475097c44a8da972 (patch)
tree1625b7bb7d1483518bc0681419a532a7c86b8a79
parentaa2928325fe51d94a636dde9c090e8f54a311a12 (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>
-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 c896536c8..ea5b5ef72 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -406,6 +406,7 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
406 __GLXDRIdrawable *private = loaderPrivate; 406 __GLXDRIdrawable *private = loaderPrivate;
407 DRI2BufferPtr buffers; 407 DRI2BufferPtr buffers;
408 int i; 408 int i;
409 int skip = 0;
409 410
410 buffers = DRI2GetBuffers(private->base.pDraw, 411 buffers = DRI2GetBuffers(private->base.pDraw,
411 width, height, attachments, count, out_count); 412 width, height, attachments, count, out_count);
@@ -420,6 +421,14 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
420 /* This assumes the DRI2 buffer attachment tokens matches the 421 /* This assumes the DRI2 buffer attachment tokens matches the
421 * __DRIbuffer tokens. */ 422 * __DRIbuffer tokens. */
422 for (i = 0; i < *out_count; i++) { 423 for (i = 0; i < *out_count; i++) {
424 /* Do not send the real front buffer of a window to the client.
425 */
426 if ((private->base.pDraw->type == DRAWABLE_WINDOW)
427 && (buffers[i].attachment == DRI2BufferFrontLeft)) {
428 skip++;
429 continue;
430 }
431
423 private->buffers[i].attachment = buffers[i].attachment; 432 private->buffers[i].attachment = buffers[i].attachment;
424 private->buffers[i].name = buffers[i].name; 433 private->buffers[i].name = buffers[i].name;
425 private->buffers[i].pitch = buffers[i].pitch; 434 private->buffers[i].pitch = buffers[i].pitch;
@@ -427,6 +436,7 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
427 private->buffers[i].flags = buffers[i].flags; 436 private->buffers[i].flags = buffers[i].flags;
428 } 437 }
429 438
439 *out_count -= skip;
430 return private->buffers; 440 return private->buffers;
431} 441}
432 442
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index d6e1c9689..503f82716 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -202,6 +202,7 @@ ProcDRI2GetBuffers(ClientPtr client)
202 int i, status, width, height, count; 202 int i, status, width, height, count;
203 unsigned int *attachments; 203 unsigned int *attachments;
204 xDRI2Buffer buffer; 204 xDRI2Buffer buffer;
205 int skip;
205 206
206 REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * 4); 207 REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * 4);
207 if (!validDrawable(client, stuff->drawable, &pDrawable, &status)) 208 if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
@@ -211,15 +212,34 @@ ProcDRI2GetBuffers(ClientPtr client)
211 buffers = DRI2GetBuffers(pDrawable, &width, &height, 212 buffers = DRI2GetBuffers(pDrawable, &width, &height,
212 attachments, stuff->count, &count); 213 attachments, stuff->count, &count);
213 214
215 skip = 0;
216 if (pDrawable->type == DRAWABLE_WINDOW) {
217 for (i = 0; i < count; i++) {
218 /* Do not send the real front buffer of a window to the client.
219 */
220 if (buffers[i].attachment == DRI2BufferFrontLeft) {
221 skip++;
222 continue;
223 }
224 }
225 }
226
214 rep.type = X_Reply; 227 rep.type = X_Reply;
215 rep.length = count * sizeof(xDRI2Buffer) / 4; 228 rep.length = (count - skip) * sizeof(xDRI2Buffer) / 4;
216 rep.sequenceNumber = client->sequence; 229 rep.sequenceNumber = client->sequence;
217 rep.width = width; 230 rep.width = width;
218 rep.height = height; 231 rep.height = height;
219 rep.count = count; 232 rep.count = count - skip;
220 WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep); 233 WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep);
221 234
222 for (i = 0; i < count; i++) { 235 for (i = 0; i < count; i++) {
236 /* Do not send the real front buffer of a window to the client.
237 */
238 if ((pDrawable->type == DRAWABLE_WINDOW)
239 && (buffers[i].attachment == DRI2BufferFrontLeft)) {
240 continue;
241 }
242
223 buffer.attachment = buffers[i].attachment; 243 buffer.attachment = buffers[i].attachment;
224 buffer.name = buffers[i].name; 244 buffer.name = buffers[i].name;
225 buffer.pitch = buffers[i].pitch; 245 buffer.pitch = buffers[i].pitch;