Bug #7213: Fix the XFree86-DRI extension for byte-swapped clients.

These clients are by definition non-local and thus not direct rendering
capable, but they still need the QueryVersion and QueryDirectRenderingCapable
requests to find out cleanly.
This commit is contained in:
Michel Dänzer 2006-06-24 15:02:56 +02:00
parent a195a3debc
commit 4426215a6e

View File

@ -81,6 +81,7 @@ static DISPATCH_PROC(ProcXF86DRIDispatch);
static DISPATCH_PROC(ProcXF86DRIAuthConnection);
static DISPATCH_PROC(SProcXF86DRIQueryVersion);
static DISPATCH_PROC(SProcXF86DRIQueryDirectRenderingCapable);
static DISPATCH_PROC(SProcXF86DRIDispatch);
static void XF86DRIResetProc(ExtensionEntry* extEntry);
@ -142,6 +143,9 @@ ProcXF86DRIQueryVersion(
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.majorVersion, n);
swaps(&rep.minorVersion, n);
swapl(&rep.patchVersion, n);
}
WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *)&rep);
return (client->noClientException);
@ -154,6 +158,7 @@ ProcXF86DRIQueryDirectRenderingCapable(
{
xXF86DRIQueryDirectRenderingCapableReply rep;
Bool isCapable;
register int n;
REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq);
@ -172,9 +177,14 @@ ProcXF86DRIQueryDirectRenderingCapable(
}
rep.isCapable = isCapable;
if (!LocalClient(client))
if (!LocalClient(client) || client->swapped)
rep.isCapable = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
}
WriteToClient(client,
sizeof(xXF86DRIQueryDirectRenderingCapableReply), (char *)&rep);
return (client->noClientException);
@ -626,6 +636,18 @@ SProcXF86DRIQueryVersion(
return ProcXF86DRIQueryVersion(client);
}
static int
SProcXF86DRIQueryDirectRenderingCapable(
register ClientPtr client
)
{
register int n;
REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
swaps(&stuff->length, n);
swapl(&stuff->screen, n);
return ProcXF86DRIQueryDirectRenderingCapable(client);
}
static int
SProcXF86DRIDispatch (
register ClientPtr client
@ -633,16 +655,17 @@ SProcXF86DRIDispatch (
{
REQUEST(xReq);
/* It is bound to be non-local when there is byte swapping */
if (!LocalClient(client))
return DRIErrorBase + XF86DRIClientNotLocal;
/* only local clients are allowed DRI access */
/*
* Only local clients are allowed DRI access, but remote clients still need
* these requests to find out cleanly.
*/
switch (stuff->data)
{
case X_XF86DRIQueryVersion:
return SProcXF86DRIQueryVersion(client);
case X_XF86DRIQueryDirectRenderingCapable:
return SProcXF86DRIQueryDirectRenderingCapable(client);
default:
return BadRequest;
return DRIErrorBase + XF86DRIClientNotLocal;
}
}