From 4426215a6e99f84550aaac23ac9c2018668bfbc1 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Sat, 24 Jun 2006 15:02:56 +0200 Subject: 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. --- hw/xfree86/dri/xf86dri.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'hw') diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c index 4b0e35459..5e460361b 100644 --- a/hw/xfree86/dri/xf86dri.c +++ b/hw/xfree86/dri/xf86dri.c @@ -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; } } -- cgit v1.2.3