XQuartz: appledri: Allow byte swapped requests

Even though it's only valid when local, it is possible for a local
client and the server to not match endianness, such as when running
a ppc application under Rosetta.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
Jeremy Huddleston 2011-10-21 10:27:16 -07:00
parent 14205ade0c
commit 1c8bda798b

View File

@ -2,7 +2,7 @@
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
Copyright (c) 2002, 2009 Apple Computer, Inc.
Copyright (c) 2002, 2009-2011 Apple Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
@ -409,6 +409,77 @@ SProcAppleDRIQueryVersion(
return ProcAppleDRIQueryVersion(client);
}
static int
SProcAppleDRIQueryDirectRenderingCapable(
register ClientPtr client
)
{
REQUEST(xAppleDRIQueryDirectRenderingCapableReq);
swaps(&stuff->length);
swapl(&stuff->screen);
return ProcAppleDRIQueryDirectRenderingCapable(client);
}
static int
SProcAppleDRIAuthConnection(
register ClientPtr client
)
{
REQUEST(xAppleDRIAuthConnectionReq);
swaps(&stuff->length);
swapl(&stuff->screen);
swapl(&stuff->magic);
return ProcAppleDRIAuthConnection(client);
}
static int
SProcAppleDRICreateSurface(
register ClientPtr client
)
{
REQUEST(xAppleDRICreateSurfaceReq);
swaps(&stuff->length);
swapl(&stuff->screen);
swapl(&stuff->drawable);
swapl(&stuff->client_id);
return ProcAppleDRICreateSurface(client);
}
static int
SProcAppleDRIDestroySurface(
register ClientPtr client
)
{
REQUEST(xAppleDRIDestroySurfaceReq);
swaps(&stuff->length);
swapl(&stuff->screen);
swapl(&stuff->drawable);
return ProcAppleDRIDestroySurface(client);
}
static int
SProcAppleDRICreatePixmap(
register ClientPtr client
)
{
REQUEST(xAppleDRICreatePixmapReq);
swaps(&stuff->length);
swapl(&stuff->screen);
swapl(&stuff->drawable);
return ProcAppleDRICreatePixmap(client);
}
static int
SProcAppleDRIDestroyPixmap(
register ClientPtr client
)
{
REQUEST(xAppleDRIDestroyPixmapReq);
swaps(&stuff->length);
swapl(&stuff->drawable);
return ProcAppleDRIDestroyPixmap(client);
}
static int
SProcAppleDRIDispatch (
register ClientPtr client
@ -416,15 +487,30 @@ SProcAppleDRIDispatch (
{
REQUEST(xReq);
/* It is bound to be non-local when there is byte swapping */
if (!LocalClient(client))
return DRIErrorBase + AppleDRIClientNotLocal;
/* only local clients are allowed DRI access */
switch (stuff->data)
{
case X_AppleDRIQueryVersion:
return SProcAppleDRIQueryVersion(client);
case X_AppleDRIQueryDirectRenderingCapable:
return SProcAppleDRIQueryDirectRenderingCapable(client);
}
if (!LocalClient(client))
return DRIErrorBase + AppleDRIClientNotLocal;
switch (stuff->data)
{
case X_AppleDRIAuthConnection:
return SProcAppleDRIAuthConnection(client);
case X_AppleDRICreateSurface:
return SProcAppleDRICreateSurface(client);
case X_AppleDRIDestroySurface:
return SProcAppleDRIDestroySurface(client);
case X_AppleDRICreatePixmap:
return SProcAppleDRICreatePixmap(client);
case X_AppleDRIDestroyPixmap:
return SProcAppleDRIDestroyPixmap(client);
default:
return BadRequest;
}