DRI2: Do not send the real front buffer of a window to the client

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Ian Romanick 2009-04-09 14:31:01 -07:00
parent aa2928325f
commit f1a995d149
2 changed files with 32 additions and 2 deletions

View File

@ -406,6 +406,7 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
__GLXDRIdrawable *private = loaderPrivate; __GLXDRIdrawable *private = loaderPrivate;
DRI2BufferPtr buffers; DRI2BufferPtr buffers;
int i; int i;
int skip = 0;
buffers = DRI2GetBuffers(private->base.pDraw, buffers = DRI2GetBuffers(private->base.pDraw,
width, height, attachments, count, out_count); width, height, attachments, count, out_count);
@ -420,6 +421,14 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
/* This assumes the DRI2 buffer attachment tokens matches the /* This assumes the DRI2 buffer attachment tokens matches the
* __DRIbuffer tokens. */ * __DRIbuffer tokens. */
for (i = 0; i < *out_count; i++) { 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].attachment = buffers[i].attachment;
private->buffers[i].name = buffers[i].name; private->buffers[i].name = buffers[i].name;
private->buffers[i].pitch = buffers[i].pitch; private->buffers[i].pitch = buffers[i].pitch;
@ -427,6 +436,7 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
private->buffers[i].flags = buffers[i].flags; private->buffers[i].flags = buffers[i].flags;
} }
*out_count -= skip;
return private->buffers; return private->buffers;
} }

View File

@ -202,6 +202,7 @@ ProcDRI2GetBuffers(ClientPtr client)
int i, status, width, height, count; int i, status, width, height, count;
unsigned int *attachments; unsigned int *attachments;
xDRI2Buffer buffer; xDRI2Buffer buffer;
int skip;
REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * 4); REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * 4);
if (!validDrawable(client, stuff->drawable, &pDrawable, &status)) if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
@ -211,15 +212,34 @@ ProcDRI2GetBuffers(ClientPtr client)
buffers = DRI2GetBuffers(pDrawable, &width, &height, buffers = DRI2GetBuffers(pDrawable, &width, &height,
attachments, stuff->count, &count); 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.type = X_Reply;
rep.length = count * sizeof(xDRI2Buffer) / 4; rep.length = (count - skip) * sizeof(xDRI2Buffer) / 4;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.width = width; rep.width = width;
rep.height = height; rep.height = height;
rep.count = count; rep.count = count - skip;
WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep); WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep);
for (i = 0; i < count; i++) { 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.attachment = buffers[i].attachment;
buffer.name = buffers[i].name; buffer.name = buffers[i].name;
buffer.pitch = buffers[i].pitch; buffer.pitch = buffers[i].pitch;