diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2011-10-21 10:27:16 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-10-24 18:25:10 -0700 |
commit | 7be5492bcfab540676d6f849b85ad3db64a5ada0 (patch) | |
tree | 7a1ca424299abcfe65b5e77fe2c2a5e9ab30f12b | |
parent | 0ad049706d2fa8ff2758c42bdd412fb62bb1e86a (diff) |
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>
(cherry picked from commit 1c8bda798b4480bab0f0da6f531e4770c7a1f771)
-rw-r--r-- | hw/xquartz/xpr/appledri.c | 102 |
1 files changed, 97 insertions, 5 deletions
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c index 1d37de279..129fc7836 100644 --- a/hw/xquartz/xpr/appledri.c +++ b/hw/xquartz/xpr/appledri.c @@ -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 @@ -416,21 +416,113 @@ SProcAppleDRIQueryVersion( } static int +SProcAppleDRIQueryDirectRenderingCapable( + register ClientPtr client +) +{ + register int n; + REQUEST(xAppleDRIQueryDirectRenderingCapableReq); + swaps(&stuff->length, n); + swapl(&stuff->screen, n); + return ProcAppleDRIQueryDirectRenderingCapable(client); +} + +static int +SProcAppleDRIAuthConnection( + register ClientPtr client +) +{ + register int n; + REQUEST(xAppleDRIAuthConnectionReq); + swaps(&stuff->length, n); + swapl(&stuff->screen, n); + swapl(&stuff->magic, n); + return ProcAppleDRIAuthConnection(client); +} + +static int +SProcAppleDRICreateSurface( + register ClientPtr client +) +{ + register int n; + REQUEST(xAppleDRICreateSurfaceReq); + swaps(&stuff->length, n); + swapl(&stuff->screen, n); + swapl(&stuff->drawable, n); + swapl(&stuff->client_id, n); + return ProcAppleDRICreateSurface(client); +} + +static int +SProcAppleDRIDestroySurface( + register ClientPtr client +) +{ + register int n; + REQUEST(xAppleDRIDestroySurfaceReq); + swaps(&stuff->length, n); + swapl(&stuff->screen, n); + swapl(&stuff->drawable, n); + return ProcAppleDRIDestroySurface(client); +} + +static int +SProcAppleDRICreatePixmap( + register ClientPtr client +) +{ + register int n; + REQUEST(xAppleDRICreatePixmapReq); + swaps(&stuff->length, n); + swapl(&stuff->screen, n); + swapl(&stuff->drawable, n); + return ProcAppleDRICreatePixmap(client); +} + +static int +SProcAppleDRIDestroyPixmap( + register ClientPtr client +) +{ + register int n; + REQUEST(xAppleDRIDestroyPixmapReq); + swaps(&stuff->length, n); + swapl(&stuff->drawable, n); + return ProcAppleDRIDestroyPixmap(client); +} + +static int SProcAppleDRIDispatch ( register ClientPtr client ) { REQUEST(xReq); - /* It is bound to be non-local when there is byte swapping */ + switch (stuff->data) + { + case X_AppleDRIQueryVersion: + return SProcAppleDRIQueryVersion(client); + case X_AppleDRIQueryDirectRenderingCapable: + return SProcAppleDRIQueryDirectRenderingCapable(client); + } + if (!LocalClient(client)) return DRIErrorBase + AppleDRIClientNotLocal; - /* only local clients are allowed DRI access */ switch (stuff->data) { - case X_AppleDRIQueryVersion: - return SProcAppleDRIQueryVersion(client); + 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; } |