From eca05b85f99d67caf6e47bfc6c02b21615734d7a Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:35:44 -0700 Subject: [PATCH 01/20] Revert "randr: fix RRGetCrtcTransform reply length, part 2" This reverts commit 53876f1ef10eb9d513b126feda25e9fba5b375df. Part-of: --- randr/rrcrtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index b828b7301..cbdc74e4d 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -1831,7 +1831,7 @@ ProcRRGetCrtcTransform(ClientPtr client) xRRGetCrtcTransformReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, - .length = bytes_to_int32(sizeof(xRRGetCrtcTransformReply) - sizeof(xGenericReply) + nextra), + .length = bytes_to_int32(sizeof(xRRGetCrtcTransformReply) - sizeof(xReq) + nextra), .hasTransforms = crtc->transforms, }; From 36af7a5f9c0eaffc85fd3605bd3c0cc2b177549d Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:36:22 -0700 Subject: [PATCH 02/20] Revert "randr: fix RRGetCrtcTransform reply length" This reverts commit 0ca5aaba500a4791b91f8237cbd74709331f8676. Part-of: --- randr/rrcrtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index cbdc74e4d..4eaded726 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -1831,7 +1831,7 @@ ProcRRGetCrtcTransform(ClientPtr client) xRRGetCrtcTransformReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, - .length = bytes_to_int32(sizeof(xRRGetCrtcTransformReply) - sizeof(xReq) + nextra), + .length = bytes_to_int32(sizeof(xRRGetCrtcTransformReply) - sizeof(xReq)), .hasTransforms = crtc->transforms, }; From fc7858a458dc47733ec37bbec9249d7c3a487d3c Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:36:45 -0700 Subject: [PATCH 03/20] Revert "randr: RRScreenInit(): drop unnecessary zero'ing" This reverts commit 6fad884ce7c4767d2dd403ac8dfb8a6a107017ac. Part-of: --- randr/randr.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/randr/randr.c b/randr/randr.c index 56fb453d2..b314f0411 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -315,6 +315,7 @@ RRScreenInit(ScreenPtr pScreen) /* * Calling function best set these function vectors */ + pScrPriv->rrGetInfo = 0; pScrPriv->maxWidth = pScrPriv->minWidth = pScreen->width; pScrPriv->maxHeight = pScrPriv->minHeight = pScreen->height; @@ -322,11 +323,21 @@ RRScreenInit(ScreenPtr pScreen) pScrPriv->height = pScreen->height; pScrPriv->mmWidth = pScreen->mmWidth; pScrPriv->mmHeight = pScreen->mmHeight; +#if RANDR_12_INTERFACE + pScrPriv->rrScreenSetSize = NULL; + pScrPriv->rrCrtcSet = NULL; + pScrPriv->rrCrtcSetGamma = NULL; +#endif #if RANDR_10_INTERFACE + pScrPriv->rrSetConfig = 0; pScrPriv->rotations = RR_Rotate_0; pScrPriv->reqWidth = pScreen->width; pScrPriv->reqHeight = pScreen->height; + pScrPriv->nSizes = 0; + pScrPriv->pSizes = NULL; pScrPriv->rotation = RR_Rotate_0; + pScrPriv->rate = 0; + pScrPriv->size = 0; #endif /* @@ -341,6 +352,10 @@ RRScreenInit(ScreenPtr pScreen) pScreen->ConstrainCursorHarder = RRConstrainCursorHarder; pScreen->ReplaceScanoutPixmap = RRReplaceScanoutPixmap; + pScrPriv->numOutputs = 0; + pScrPriv->outputs = NULL; + pScrPriv->numCrtcs = 0; + pScrPriv->crtcs = NULL; xorg_list_init(&pScrPriv->leases); From 8650028e59af9bcff0e7aba751a3f820756d20a6 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:37:57 -0700 Subject: [PATCH 04/20] Revert "randr: ProcRRQueryOutputProperty(): use SwapShort()/SwapLong()" This reverts commit 73467faeb26b2fb628b7c6980c4573c27e0ee955. Part-of: --- randr/rrproperty.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/randr/rrproperty.c b/randr/rrproperty.c index 8df9790f1..610f5bb8d 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -495,16 +495,14 @@ ProcRRQueryOutputProperty(ClientPtr client) swaps(&rep.sequenceNumber); swapl(&rep.length); } + WriteToClient(client, sizeof(xRRQueryOutputPropertyReply), &rep); if (prop->num_valid) { memcpy(extra, prop->valid_values, prop->num_valid * sizeof(INT32)); - if (client->swapped) - SwapLongs((CARD32*)extra, prop->num_valid); + client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; + WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32), + extra); + free(extra); } - - WriteToClient(client, sizeof(xRRQueryOutputPropertyReply), &rep); - WriteToClient(client, prop->num_valid * sizeof(INT32), extra); - free(extra); - return Success; } From 6a0c430b2505328a26f90e8635400b358a7777ab Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:38:12 -0700 Subject: [PATCH 05/20] Revert "randr: ProcRRListOutputProperties(): use SwapShort()/SwapLong()" This reverts commit e3001b71b31b2cf1327fbc86e6403bc3db044409. Part-of: --- randr/rrproperty.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/randr/rrproperty.c b/randr/rrproperty.c index 610f5bb8d..122f5ab64 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -416,6 +416,7 @@ int ProcRRListOutputProperties(ClientPtr client) { REQUEST(xRRListOutputPropertiesReq); + Atom *pAtoms = NULL; int numProps = 0; RROutputPtr output; RRPropertyPtr prop; @@ -426,6 +427,9 @@ ProcRRListOutputProperties(ClientPtr client) for (prop = output->properties; prop; prop = prop->next) numProps++; + if (numProps) + if (!(pAtoms = xallocarray(numProps, sizeof(Atom)))) + return BadAlloc; xRRListOutputPropertiesReply rep = { .type = X_Reply, @@ -438,25 +442,18 @@ ProcRRListOutputProperties(ClientPtr client) swapl(&rep.length); swaps(&rep.nAtoms); } + WriteToClient(client, sizeof(xRRListOutputPropertiesReply), &rep); - Atom* pAtoms = calloc(sizeof(Atom), numProps); if (numProps) { - if (!pAtoms) - return BadAlloc; - /* Copy property name atoms to reply buffer */ Atom *temppAtoms = pAtoms; for (prop = output->properties; prop; prop = prop->next) *temppAtoms++ = prop->propertyName; - if (client->swapped) - SwapLongs(pAtoms, numProps); + client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; + WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); + free(pAtoms); } - - WriteToClient(client, sizeof(xRRListOutputPropertiesReply), &rep); - WriteToClient(client, sizeof(Atom) * numProps, pAtoms); - free(pAtoms); - return Success; } From bddafe4001734e002b73923675db41bfa8d82f68 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:38:23 -0700 Subject: [PATCH 06/20] Revert "randr: ProcRRGetCrtcGamma(): use SwapShort()/SwapLong()" This reverts commit d9863f7cb0f669e5c0943b6038a656ce34b8ea55. Part-of: --- randr/rrcrtc.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 4eaded726..75ae0eea5 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -1676,16 +1676,13 @@ ProcRRGetCrtcGamma(ClientPtr client) swapl(&reply.length); swaps(&reply.size); } + WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &reply); if (crtc->gammaSize) { memcpy(extra, crtc->gammaRed, len); - if (client->swapped) - SwapShorts((short*)extra, len/sizeof(CARD16)); + client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write; + WriteSwappedDataToClient(client, len, extra); + free(extra); } - - WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &reply); - WriteToClient(client, len, extra); - free(extra); - return Success; } From 3a76d12ef061a0487c95b4daf58bacc79c432d34 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:40:33 -0700 Subject: [PATCH 07/20] Revert "randr: ProcRRGetProviderProperty(): use SwapShort()/SwapLong()" This reverts commit 62b849799983d6154261c6662d5d8c40fafa67f4. Part-of: --- randr/rrproviderproperty.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/randr/rrproviderproperty.c b/randr/rrproviderproperty.c index 23a105c02..45e9a63e6 100644 --- a/randr/rrproviderproperty.c +++ b/randr/rrproviderproperty.c @@ -685,26 +685,24 @@ ProcRRGetProviderProperty(ClientPtr client) swapl(&reply.bytesAfter); swapl(&reply.nItems); } + WriteToClient(client, sizeof(xGenericReply), &reply); if (len) { memcpy(extra, (char *) prop_value->data + ind, len); switch (reply.format) { case 32: - if (client->swapped) - SwapLongs((CARD32*) extra, len/sizeof(CARD32)); + client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; break; case 16: - if (client->swapped) - SwapShorts((short*) extra, len/sizeof(CARD16)); + client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write; break; default: + client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient; break; } + WriteSwappedDataToClient(client, len, extra); + free(extra); } - WriteToClient(client, sizeof(xGenericReply), &reply); - WriteToClient(client, len, extra); - free(extra); - if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */ *prev = prop->next; RRDestroyProviderProperty(prop); From 01914b1c5379fefcc9dc68d59f8c84b9eeeebe7e Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:41:13 -0700 Subject: [PATCH 08/20] Revert "randr: ProcRRGetOutputProperty(): use SwapShort()/SwapLong()" This reverts commit 8789be52a4ce4a285636f8c4efc2bd196fe571a2. Part-of: --- randr/rrproperty.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/randr/rrproperty.c b/randr/rrproperty.c index 122f5ab64..315e5b275 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -727,26 +727,24 @@ ProcRRGetOutputProperty(ClientPtr client) swapl(&rep.bytesAfter); swapl(&rep.nItems); } + WriteToClient(client, sizeof(rep), &rep); if (len) { memcpy(extra, (char *) prop_value->data + ind, len); switch (rep.format) { case 32: - if (client->swapped) - SwapLongs((CARD32*)extra, len / sizeof(CARD32)); + client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; break; case 16: - if (client->swapped) - SwapShorts((short*)extra, len / sizeof(CARD16)); + client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write; break; default: + client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient; break; } + WriteSwappedDataToClient(client, len, extra); + free(extra); } - WriteToClient(client, sizeof(rep), &rep); - WriteToClient(client, len, extra); - free(extra); - if (stuff->delete && (rep.bytesAfter == 0)) { /* delete the Property */ *prev = prop->next; RRDestroyOutputProperty(prop); From e77b465eb6a9aaf429af3aa6eed247648e31d715 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:41:29 -0700 Subject: [PATCH 09/20] Revert "randr: ProcRRGetOutputProperty(): rename reply struct to "rep"" This reverts commit 53d43bd8dcdc17fba6a42809ae67341c5310dc0e. Part-of: --- randr/rrproperty.c | 48 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/randr/rrproperty.c b/randr/rrproperty.c index 315e5b275..668dee40c 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -643,16 +643,16 @@ ProcRRGetOutputProperty(ClientPtr client) if (prop->propertyName == stuff->property) break; - xRRGetOutputPropertyReply rep = { + xRRGetOutputPropertyReply reply = { .type = X_Reply, .sequenceNumber = client->sequence }; if (!prop) { if (client->swapped) { - swaps(&rep.sequenceNumber); + swaps(&reply.sequenceNumber); } - WriteToClient(client, sizeof(rep), &rep); + WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply); return Success; } @@ -668,15 +668,15 @@ ProcRRGetOutputProperty(ClientPtr client) if (((stuff->type != prop_value->type) && (stuff->type != AnyPropertyType)) ) { - rep.bytesAfter = prop_value->size; - rep.format = prop_value->format; - rep.propertyType = prop_value->type; + reply.bytesAfter = prop_value->size; + reply.format = prop_value->format; + reply.propertyType = prop_value->type; if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.propertyType); - swapl(&rep.bytesAfter); + swaps(&reply.sequenceNumber); + swapl(&reply.propertyType); + swapl(&reply.bytesAfter); } - WriteToClient(client, sizeof(rep), &rep); + WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply); return Success; } @@ -701,14 +701,14 @@ ProcRRGetOutputProperty(ClientPtr client) if (!extra) return BadAlloc; } - rep.bytesAfter = n - (ind + len); - rep.format = prop_value->format; - rep.length = bytes_to_int32(len); + reply.bytesAfter = n - (ind + len); + reply.format = prop_value->format; + reply.length = bytes_to_int32(len); if (prop_value->format) - rep.nItems = len / (prop_value->format / 8); - rep.propertyType = prop_value->type; + reply.nItems = len / (prop_value->format / 8); + reply.propertyType = prop_value->type; - if (stuff->delete && (rep.bytesAfter == 0)) { + if (stuff->delete && (reply.bytesAfter == 0)) { xRROutputPropertyNotifyEvent event = { .type = RREventBase + RRNotify, .subCode = RRNotify_OutputProperty, @@ -721,16 +721,16 @@ ProcRRGetOutputProperty(ClientPtr client) } if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.propertyType); - swapl(&rep.bytesAfter); - swapl(&rep.nItems); + swaps(&reply.sequenceNumber); + swapl(&reply.length); + swapl(&reply.propertyType); + swapl(&reply.bytesAfter); + swapl(&reply.nItems); } - WriteToClient(client, sizeof(rep), &rep); + WriteToClient(client, sizeof(xGenericReply), &reply); if (len) { memcpy(extra, (char *) prop_value->data + ind, len); - switch (rep.format) { + switch (reply.format) { case 32: client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; break; @@ -745,7 +745,7 @@ ProcRRGetOutputProperty(ClientPtr client) free(extra); } - if (stuff->delete && (rep.bytesAfter == 0)) { /* delete the Property */ + if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */ *prev = prop->next; RRDestroyOutputProperty(prop); } From 9f2b9adbe3264a252034e261411dce2884ae91af Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:41:53 -0700 Subject: [PATCH 10/20] Revert "randr: RRCreateProviderProperty(): use calloc()" This reverts commit 05188ccec1cad52ebe78f67bebcbe85a7a1e27d5. Part-of: --- randr/rrproviderproperty.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/randr/rrproviderproperty.c b/randr/rrproviderproperty.c index 45e9a63e6..27444ea8a 100644 --- a/randr/rrproviderproperty.c +++ b/randr/rrproviderproperty.c @@ -107,10 +107,16 @@ RRCreateProviderProperty(Atom property) { RRPropertyPtr prop; - prop = (RRPropertyPtr) calloc(1, sizeof(RRPropertyRec)); + prop = (RRPropertyPtr) malloc(sizeof(RRPropertyRec)); if (!prop) return NULL; + prop->next = NULL; prop->propertyName = property; + prop->is_pending = FALSE; + prop->range = FALSE; + prop->immutable = FALSE; + prop->num_valid = 0; + prop->valid_values = NULL; RRInitProviderPropertyValue(&prop->current); RRInitProviderPropertyValue(&prop->pending); return prop; From 896d9d3be8974994e6561ce8d09773911d53ec1f Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:42:13 -0700 Subject: [PATCH 11/20] Revert "randr: RROutputCreate(): use calloc()" This reverts commit 3d3137513a64ab7045198fa8acdae7ec8effa2b9. Part-of: --- randr/rroutput.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/randr/rroutput.c b/randr/rroutput.c index 8d0f05498..0e414b27b 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -83,7 +83,7 @@ RROutputCreate(ScreenPtr pScreen, pScrPriv->outputs = outputs; - output = calloc(1, sizeof(RROutputRec) + nameLength + 1); + output = malloc(sizeof(RROutputRec) + nameLength + 1); if (!output) return NULL; output->id = FakeClientID(0); @@ -94,6 +94,22 @@ RROutputCreate(ScreenPtr pScreen, output->name[nameLength] = '\0'; output->connection = RR_UnknownConnection; output->subpixelOrder = SubPixelUnknown; + output->mmWidth = 0; + output->mmHeight = 0; + output->crtc = NULL; + output->numCrtcs = 0; + output->crtcs = NULL; + output->numClones = 0; + output->clones = NULL; + output->numModes = 0; + output->numPreferred = 0; + output->modes = NULL; + output->numUserModes = 0; + output->userModes = NULL; + output->properties = NULL; + output->pendingProperties = FALSE; + output->changed = FALSE; + output->nonDesktop = FALSE; output->devPrivate = devPrivate; if (!AddResource(output->id, RROutputType, (void *) output)) From a205917752827e8b4a020152b8de3abf2f7270ff Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:42:33 -0700 Subject: [PATCH 12/20] Revert "randr: ProcRRGetMonitors(): collect reply payload in temporary buffer" This reverts commit 1bc6ca30a924e36893b0a604051762821163b66a. Part-of: --- randr/rrmonitor.c | 46 +++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/randr/rrmonitor.c b/randr/rrmonitor.c index 661dee32e..db33d117c 100644 --- a/randr/rrmonitor.c +++ b/randr/rrmonitor.c @@ -604,13 +604,11 @@ ProcRRGetMonitors(ClientPtr client) noutputs += monitors[m].numOutputs; } - int payload_len = noutputs * sizeof(CARD32) + nmonitors * sizeof(xRRMonitorInfo); - xRRGetMonitorsReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .timestamp = RRMonitorTimestamp(screen), - .length = bytes_to_int32(payload_len), + .length = noutputs + nmonitors * bytes_to_int32(sizeof(xRRMonitorInfo)), .nmonitors = nmonitors, .noutputs = noutputs, }; @@ -624,18 +622,9 @@ ProcRRGetMonitors(ClientPtr client) } WriteToClient(client, sizeof(xRRGetMonitorsReply), &rep); - char *payload_buf = calloc(1, payload_len); - if (!payload_buf) { - RRMonitorFreeList(monitors, nmonitors); - return BadAlloc; - } - - char *walk = payload_buf; - for (m = 0; m < nmonitors; m++) { RRMonitorPtr monitor = &monitors[m]; - xRRMonitorInfo *info = (xRRMonitorInfo*) walk; - *info = (xRRMonitorInfo) { + xRRMonitorInfo info = { .name = monitor->name, .primary = monitor->primary, .automatic = monitor->automatic, @@ -648,27 +637,26 @@ ProcRRGetMonitors(ClientPtr client) .heightInMillimeters = monitor->geometry.mmHeight, }; if (client->swapped) { - swapl(&info->name); - swaps(&info->noutput); - swaps(&info->x); - swaps(&info->y); - swaps(&info->width); - swaps(&info->height); - swapl(&info->widthInMillimeters); - swapl(&info->heightInMillimeters); + swapl(&info.name); + swaps(&info.noutput); + swaps(&info.x); + swaps(&info.y); + swaps(&info.width); + swaps(&info.height); + swapl(&info.widthInMillimeters); + swapl(&info.heightInMillimeters); } - walk += sizeof(xRRMonitorInfo); - memcpy(walk, monitor->outputs, monitor->numOutputs * sizeof (RROutput)); - if (client->swapped) - SwapLongs((CARD32*)walk, monitor->numOutputs); + RROutput outputs[monitor->numOutputs]; + memcpy(outputs, monitor->outputs, monitor->numOutputs * sizeof (RROutput)); - walk += monitor->numOutputs * sizeof (RROutput); + if (client->swapped) + SwapLongs(outputs, monitor->numOutputs); + + WriteToClient(client, sizeof(xRRMonitorInfo), &info); + WriteToClient(client, sizeof(outputs), outputs); } - WriteToClient(client, payload_len, payload_buf); - - free(payload_buf); RRMonitorFreeList(monitors, nmonitors); return Success; From 9b753c397075dde0855e279252e4d8db29dc2e55 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:43:00 -0700 Subject: [PATCH 13/20] Revert "randr: ProcRRGetMonitors() use SwapLongs instead of callbacks" This reverts commit 203f59c6d3a47b0cf4be6cff7ca9ef99c9933f00. Part-of: --- randr/rrmonitor.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/randr/rrmonitor.c b/randr/rrmonitor.c index db33d117c..c77978e33 100644 --- a/randr/rrmonitor.c +++ b/randr/rrmonitor.c @@ -622,6 +622,8 @@ ProcRRGetMonitors(ClientPtr client) } WriteToClient(client, sizeof(xRRGetMonitorsReply), &rep); + client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; + for (m = 0; m < nmonitors; m++) { RRMonitorPtr monitor = &monitors[m]; xRRMonitorInfo info = { @@ -647,14 +649,8 @@ ProcRRGetMonitors(ClientPtr client) swapl(&info.heightInMillimeters); } - RROutput outputs[monitor->numOutputs]; - memcpy(outputs, monitor->outputs, monitor->numOutputs * sizeof (RROutput)); - - if (client->swapped) - SwapLongs(outputs, monitor->numOutputs); - WriteToClient(client, sizeof(xRRMonitorInfo), &info); - WriteToClient(client, sizeof(outputs), outputs); + WriteSwappedDataToClient(client, monitor->numOutputs * sizeof (RROutput), monitor->outputs); } RRMonitorFreeList(monitors, nmonitors); From c371d11af00919207e28c50cc025dca36584dd03 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:43:23 -0700 Subject: [PATCH 14/20] Revert "randr: ProcRRGetCrtcTransform(): split reply header and payload" This reverts commit c6f1b8a735d3c6ba80ca552b79e2dbe8a358ff40. Part-of: --- randr/rrcrtc.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 75ae0eea5..c0127534a 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -1752,6 +1752,8 @@ ProcRRSetCrtcTransform(ClientPtr client) filter, nbytes, params, nparams); } +#define CrtcTransformExtra (SIZEOF(xRRGetCrtcTransformReply) - 32) + static int transform_filter_length(RRTransformPtr transform) { @@ -1806,9 +1808,11 @@ int ProcRRGetCrtcTransform(ClientPtr client) { REQUEST(xRRGetCrtcTransformReq); + xRRGetCrtcTransformReply *reply; RRCrtcPtr crtc; int nextra; RRTransformPtr current, pending; + char *extra; REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); @@ -1819,36 +1823,33 @@ ProcRRGetCrtcTransform(ClientPtr client) nextra = (transform_filter_length(pending) + transform_filter_length(current)); - char *extra_buf = calloc(1, nextra); - if (!extra_buf) + reply = calloc(1, sizeof(xRRGetCrtcTransformReply) + nextra); + if (!reply) return BadAlloc; - char *extra = extra_buf; + extra = (char *) (reply + 1); + reply->type = X_Reply; + reply->sequenceNumber = client->sequence; + reply->length = bytes_to_int32(CrtcTransformExtra + nextra); - xRRGetCrtcTransformReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(sizeof(xRRGetCrtcTransformReply) - sizeof(xReq)), - .hasTransforms = crtc->transforms, - }; + reply->hasTransforms = crtc->transforms; - transform_encode(client, &rep.pendingTransform, &pending->transform); + transform_encode(client, &reply->pendingTransform, &pending->transform); extra += transform_filter_encode(client, extra, - &rep.pendingNbytesFilter, - &rep.pendingNparamsFilter, pending); + &reply->pendingNbytesFilter, + &reply->pendingNparamsFilter, pending); - transform_encode(client, &rep.currentTransform, ¤t->transform); + transform_encode(client, &reply->currentTransform, ¤t->transform); extra += transform_filter_encode(client, extra, - &rep.currentNbytesFilter, - &rep.currentNparamsFilter, current); + &reply->currentNbytesFilter, + &reply->currentNparamsFilter, current); if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); + swaps(&reply->sequenceNumber); + swapl(&reply->length); } - WriteToClient(client, sizeof(xRRGetCrtcTransformReply), &rep); - WriteToClient(client, nextra, extra_buf); - free(extra_buf); + WriteToClient(client, sizeof(xRRGetCrtcTransformReply) + nextra, reply); + free(reply); return Success; } From 9c53c6cf76bbf6e28da4a822e2666a4af53dc498 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:43:36 -0700 Subject: [PATCH 15/20] Revert "randr: ProcRRGetCrtcInfo(): use locally scoped variables" This reverts commit 90abc95c85020a2d2e02246a297d26261dd06c33. Part-of: --- randr/rrcrtc.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index c0127534a..4feccbb87 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -1148,19 +1148,28 @@ ProcRRGetCrtcInfo(ClientPtr client) RRCrtcPtr crtc; CARD8 *extra = NULL; unsigned long extraLen = 0; + ScreenPtr pScreen; + rrScrPrivPtr pScrPriv; + RRModePtr mode; + RROutput *outputs; + RROutput *possible; + int i, j, k; + int width, height; + BoxRec panned_area; + Bool leased; REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); - Bool leased = RRCrtcIsLeased(crtc); + leased = RRCrtcIsLeased(crtc); /* All crtcs must be associated with screens before client * requests are processed */ - ScreenPtr pScreen = crtc->pScreen; - rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); + pScreen = crtc->pScreen; + pScrPriv = rrGetScrPriv(pScreen); - RRModePtr mode = crtc->mode; + mode = crtc->mode; xRRGetCrtcInfoReply rep = { .type = X_Reply, @@ -1174,7 +1183,6 @@ ProcRRGetCrtcInfo(ClientPtr client) rep.rotation = RR_Rotate_0; rep.rotations = RR_Rotate_0; } else { - BoxRec panned_area; if (pScrPriv->rrGetPanning && pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) && (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1)) @@ -1185,7 +1193,6 @@ ProcRRGetCrtcInfo(ClientPtr client) rep.height = panned_area.y2 - panned_area.y1; } else { - int width, height; RRCrtcGetScanoutSize(crtc, &width, &height); rep.x = crtc->x; rep.y = crtc->y; @@ -1194,9 +1201,9 @@ ProcRRGetCrtcInfo(ClientPtr client) } rep.mode = mode ? mode->mode.id : 0; rep.nOutput = crtc->numOutputs; - for (int i = 0; i < pScrPriv->numOutputs; i++) { + for (i = 0; i < pScrPriv->numOutputs; i++) { if (!RROutputIsLeased(pScrPriv->outputs[i])) { - for (int j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++) + for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++) if (pScrPriv->outputs[i]->crtcs[j] == crtc) rep.nPossibleOutput++; } @@ -1211,19 +1218,18 @@ ProcRRGetCrtcInfo(ClientPtr client) return BadAlloc; } - RROutput *outputs = (RROutput *) extra; - RROutput *possible = (RROutput *) (outputs + rep.nOutput); + outputs = (RROutput *) extra; + possible = (RROutput *) (outputs + rep.nOutput); - for (int i = 0; i < crtc->numOutputs; i++) { + for (i = 0; i < crtc->numOutputs; i++) { outputs[i] = crtc->outputs[i]->id; if (client->swapped) swapl(&outputs[i]); } - - int k = 0; - for (int i = 0; i < pScrPriv->numOutputs; i++) { + k = 0; + for (i = 0; i < pScrPriv->numOutputs; i++) { if (!RROutputIsLeased(pScrPriv->outputs[i])) { - for (int j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++) + for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++) if (pScrPriv->outputs[i]->crtcs[j] == crtc) { possible[k] = pScrPriv->outputs[i]->id; if (client->swapped) From 160abf285c1280455b99ce35c94f808cdaf2e370 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:43:47 -0700 Subject: [PATCH 16/20] Revert "randr: use struct initializer for reply structs" This reverts commit 7eff742ef2138696c28ca6c234592ff6a24fe788. Part-of: --- randr/rrcrtc.c | 51 ++++++++++++++++++++++++----------- randr/rrdispatch.c | 1 + randr/rrinfo.c | 15 ++++++----- randr/rrlease.c | 4 ++- randr/rrmode.c | 7 ++--- randr/rrmonitor.c | 19 ++++++++------ randr/rroutput.c | 10 ++++++- randr/rrproperty.c | 25 +++++++++++++++--- randr/rrprovider.c | 54 ++++++++++++++++++++------------------ randr/rrproviderproperty.c | 22 +++++++++++++--- randr/rrscreen.c | 43 ++++++++++++++++++++++++------ randr/rrxinerama.c | 32 ++++++++++++++-------- 12 files changed, 196 insertions(+), 87 deletions(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 4feccbb87..3974c350d 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -1022,16 +1022,18 @@ static void RRModeGetScanoutSize(RRModePtr mode, PictTransformPtr transform, int *width, int *height) { + BoxRec box; + if (mode == NULL) { *width = 0; *height = 0; return; } - BoxRec box = { - .x2 = mode->mode.width, - .y2 = mode->mode.height, - }; + box.x1 = 0; + box.y1 = 0; + box.x2 = mode->mode.width; + box.y2 = mode->mode.height; pixman_transform_bounds(transform, &box); *width = box.x2 - box.x1; @@ -1145,9 +1147,10 @@ int ProcRRGetCrtcInfo(ClientPtr client) { REQUEST(xRRGetCrtcInfoReq); + xRRGetCrtcInfoReply rep; RRCrtcPtr crtc; CARD8 *extra = NULL; - unsigned long extraLen = 0; + unsigned long extraLen; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; RRModePtr mode; @@ -1171,17 +1174,22 @@ ProcRRGetCrtcInfo(ClientPtr client) mode = crtc->mode; - xRRGetCrtcInfoReply rep = { + rep = (xRRGetCrtcInfoReply) { .type = X_Reply, .status = RRSetConfigSuccess, .sequenceNumber = client->sequence, - .timestamp = pScrPriv->lastSetTime.milliseconds, - .rotation = crtc->rotation, - .rotations = crtc->rotations, + .length = 0, + .timestamp = pScrPriv->lastSetTime.milliseconds }; if (leased) { + rep.x = rep.y = rep.width = rep.height = 0; + rep.mode = 0; rep.rotation = RR_Rotate_0; rep.rotations = RR_Rotate_0; + rep.nOutput = 0; + rep.nPossibleOutput = 0; + rep.length = 0; + extraLen = 0; } else { if (pScrPriv->rrGetPanning && pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) && @@ -1200,18 +1208,23 @@ ProcRRGetCrtcInfo(ClientPtr client) rep.height = height; } rep.mode = mode ? mode->mode.id : 0; + rep.rotation = crtc->rotation; + rep.rotations = crtc->rotations; rep.nOutput = crtc->numOutputs; + k = 0; for (i = 0; i < pScrPriv->numOutputs; i++) { if (!RROutputIsLeased(pScrPriv->outputs[i])) { for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++) if (pScrPriv->outputs[i]->crtcs[j] == crtc) - rep.nPossibleOutput++; + k++; } } - extraLen = (rep.nOutput + rep.nPossibleOutput) * sizeof(CARD32); - rep.length = bytes_to_int32(extraLen); + rep.nPossibleOutput = k; + rep.length = rep.nOutput + rep.nPossibleOutput; + + extraLen = rep.length << 2; if (extraLen) { extra = malloc(extraLen); if (!extra) @@ -1270,6 +1283,7 @@ int ProcRRSetCrtcConfig(ClientPtr client) { REQUEST(xRRSetCrtcConfigReq); + xRRSetCrtcConfigReply rep; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; RRCrtcPtr crtc; @@ -1461,10 +1475,11 @@ ProcRRSetCrtcConfig(ClientPtr client) sendReply: free(outputs); - xRRSetCrtcConfigReply rep = { + rep = (xRRSetCrtcConfigReply) { .type = X_Reply, .status = status, .sequenceNumber = client->sequence, + .length = 0, .newTimestamp = pScrPriv->lastSetTime.milliseconds }; @@ -1482,6 +1497,7 @@ int ProcRRGetPanning(ClientPtr client) { REQUEST(xRRGetPanningReq); + xRRGetPanningReply rep; RRCrtcPtr crtc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; @@ -1501,7 +1517,7 @@ ProcRRGetPanning(ClientPtr client) if (!pScrPriv) return RRErrorBase + BadRRCrtc; - xRRGetPanningReply rep = { + rep = (xRRGetPanningReply) { .type = X_Reply, .status = RRSetConfigSuccess, .sequenceNumber = client->sequence, @@ -1625,6 +1641,7 @@ int ProcRRGetCrtcGammaSize(ClientPtr client) { REQUEST(xRRGetCrtcGammaSizeReq); + xRRGetCrtcGammaSizeReply reply; RRCrtcPtr crtc; REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq); @@ -1634,9 +1651,10 @@ ProcRRGetCrtcGammaSize(ClientPtr client) if (!RRCrtcGammaGet(crtc)) return RRErrorBase + BadRRCrtc; - xRRGetCrtcGammaSizeReply reply = { + reply = (xRRGetCrtcGammaSizeReply) { .type = X_Reply, .sequenceNumber = client->sequence, + .length = 0, .size = crtc->gammaSize }; if (client->swapped) { @@ -1652,6 +1670,7 @@ int ProcRRGetCrtcGamma(ClientPtr client) { REQUEST(xRRGetCrtcGammaReq); + xRRGetCrtcGammaReply reply; RRCrtcPtr crtc; unsigned long len; char *extra = NULL; @@ -1671,7 +1690,7 @@ ProcRRGetCrtcGamma(ClientPtr client) return BadAlloc; } - xRRGetCrtcGammaReply reply = { + reply = (xRRGetCrtcGammaReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(len), diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c index c51d510a7..866c6f252 100644 --- a/randr/rrdispatch.c +++ b/randr/rrdispatch.c @@ -42,6 +42,7 @@ ProcRRQueryVersion(ClientPtr client) xRRQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, + .length = 0 }; REQUEST(xRRQueryVersionReq); rrClientPriv(client); diff --git a/randr/rrinfo.c b/randr/rrinfo.c index 68861dd1c..24245b7b6 100644 --- a/randr/rrinfo.c +++ b/randr/rrinfo.c @@ -250,18 +250,19 @@ RRRegisterSize(ScreenPtr pScreen, { rrScrPriv(pScreen); int i; + RRScreenSize tmp; RRScreenSizePtr pNew; if (!pScrPriv) return 0; - RRScreenSize tmp = { - .width = width, - .height = height, - .mmWidth = mmWidth, - .mmHeight = mmHeight, - }; - + tmp.id = 0; + tmp.width = width; + tmp.height = height; + tmp.mmWidth = mmWidth; + tmp.mmHeight = mmHeight; + tmp.pRates = 0; + tmp.nRates = 0; for (i = 0; i < pScrPriv->nSizes; i++) if (RRScreenSizeMatches(&tmp, &pScrPriv->pSizes[i])) return &pScrPriv->pSizes[i]; diff --git a/randr/rrlease.c b/randr/rrlease.c index e73307807..b6083cd2a 100644 --- a/randr/rrlease.c +++ b/randr/rrlease.c @@ -213,6 +213,7 @@ int ProcRRCreateLease(ClientPtr client) { REQUEST(xRRCreateLeaseReq); + xRRCreateLeaseReply rep; WindowPtr window; ScreenPtr screen; rrScrPrivPtr scr_priv; @@ -333,10 +334,11 @@ leaseReturned: RRLeaseChangeState(lease, RRLeaseCreating, RRLeaseRunning); - xRRCreateLeaseReply rep = { + rep = (xRRCreateLeaseReply) { .type = X_Reply, .nfd = 1, .sequenceNumber = client->sequence, + .length = 0, }; if (client->swapped) { diff --git a/randr/rrmode.c b/randr/rrmode.c index dbf4daed0..20ff4525d 100644 --- a/randr/rrmode.c +++ b/randr/rrmode.c @@ -286,6 +286,7 @@ int ProcRRCreateMode(ClientPtr client) { REQUEST(xRRCreateModeReq); + xRRCreateModeReply rep; WindowPtr pWin; ScreenPtr pScreen; xRRModeInfo *modeInfo; @@ -313,12 +314,12 @@ ProcRRCreateMode(ClientPtr client) if (!mode) return error; - xRRCreateModeReply rep = { + rep = (xRRCreateModeReply) { .type = X_Reply, .sequenceNumber = client->sequence, + .length = 0, .mode = mode->mode.id - }; - + }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); diff --git a/randr/rrmonitor.c b/randr/rrmonitor.c index c77978e33..b3712c0ca 100644 --- a/randr/rrmonitor.c +++ b/randr/rrmonitor.c @@ -581,6 +581,11 @@ int ProcRRGetMonitors(ClientPtr client) { REQUEST(xRRGetMonitorsReq); + xRRGetMonitorsReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + }; WindowPtr window; ScreenPtr screen; int r; @@ -599,19 +604,17 @@ ProcRRGetMonitors(ClientPtr client) if (!RRMonitorMakeList(screen, get_active, &monitors, &nmonitors)) return BadAlloc; + rep.timestamp = RRMonitorTimestamp(screen); + noutputs = 0; for (m = 0; m < nmonitors; m++) { + rep.length += SIZEOF(xRRMonitorInfo) >> 2; + rep.length += monitors[m].numOutputs; noutputs += monitors[m].numOutputs; } - xRRGetMonitorsReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .timestamp = RRMonitorTimestamp(screen), - .length = noutputs + nmonitors * bytes_to_int32(sizeof(xRRMonitorInfo)), - .nmonitors = nmonitors, - .noutputs = noutputs, - }; + rep.nmonitors = nmonitors; + rep.noutputs = noutputs; if (client->swapped) { swaps(&rep.sequenceNumber); diff --git a/randr/rroutput.c b/randr/rroutput.c index 0e414b27b..0b4639aa6 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -481,8 +481,15 @@ ProcRRGetOutputInfo(ClientPtr client) .sequenceNumber = client->sequence, .length = bytes_to_int32(OutputInfoExtra), .timestamp = pScrPriv->lastSetTime.milliseconds, + .crtc = None, + .mmWidth = 0, + .mmHeight = 0, .connection = RR_Disconnected, .subpixelOrder = SubPixelUnknown, + .nCrtcs = 0, + .nModes = 0, + .nPreferred = 0, + .nClones = 0, .nameLength = output->nameLength }; extraLen = bytes_to_int32(rep.nameLength) << 2; @@ -651,6 +658,7 @@ ProcRRGetOutputPrimary(ClientPtr client) REQUEST(xRRGetOutputPrimaryReq); WindowPtr pWin; rrScrPrivPtr pScrPriv; + xRRGetOutputPrimaryReply rep; RROutputPtr primary = NULL; int rc; @@ -664,7 +672,7 @@ ProcRRGetOutputPrimary(ClientPtr client) if (pScrPriv) primary = pScrPriv->primaryOutput; - xRRGetOutputPrimaryReply rep = { + rep = (xRRGetOutputPrimaryReply) { .type = X_Reply, .sequenceNumber = client->sequence, .output = primary ? primary->id : None diff --git a/randr/rrproperty.c b/randr/rrproperty.c index 668dee40c..f97c3464f 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -417,6 +417,7 @@ ProcRRListOutputProperties(ClientPtr client) { REQUEST(xRRListOutputPropertiesReq); Atom *pAtoms = NULL; + xRRListOutputPropertiesReply rep; int numProps = 0; RROutputPtr output; RRPropertyPtr prop; @@ -431,7 +432,7 @@ ProcRRListOutputProperties(ClientPtr client) if (!(pAtoms = xallocarray(numProps, sizeof(Atom)))) return BadAlloc; - xRRListOutputPropertiesReply rep = { + rep = (xRRListOutputPropertiesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(numProps * sizeof(Atom)), @@ -461,6 +462,7 @@ int ProcRRQueryOutputProperty(ClientPtr client) { REQUEST(xRRQueryOutputPropertyReq); + xRRQueryOutputPropertyReply rep; RROutputPtr output; RRPropertyPtr prop; char *extra = NULL; @@ -479,7 +481,7 @@ ProcRRQueryOutputProperty(ClientPtr client) return BadAlloc; } - xRRQueryOutputPropertyReply rep = { + rep = (xRRQueryOutputPropertyReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = prop->num_valid, @@ -618,6 +620,7 @@ ProcRRGetOutputProperty(ClientPtr client) RRPropertyValuePtr prop_value; unsigned long n, len, ind; RROutputPtr output; + xRRGetOutputPropertyReply reply; char *extra = NULL; REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq); @@ -643,14 +646,22 @@ ProcRRGetOutputProperty(ClientPtr client) if (prop->propertyName == stuff->property) break; - xRRGetOutputPropertyReply reply = { + reply = (xRRGetOutputPropertyReply) { .type = X_Reply, .sequenceNumber = client->sequence }; - if (!prop) { + reply.nItems = 0; + reply.length = 0; + reply.bytesAfter = 0; + reply.propertyType = None; + reply.format = 0; if (client->swapped) { swaps(&reply.sequenceNumber); + swapl(&reply.length); + swapl(&reply.propertyType); + swapl(&reply.bytesAfter); + swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply); return Success; @@ -670,11 +681,15 @@ ProcRRGetOutputProperty(ClientPtr client) ) { reply.bytesAfter = prop_value->size; reply.format = prop_value->format; + reply.length = 0; + reply.nItems = 0; reply.propertyType = prop_value->type; if (client->swapped) { swaps(&reply.sequenceNumber); + swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); + swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply); return Success; @@ -706,6 +721,8 @@ ProcRRGetOutputProperty(ClientPtr client) reply.length = bytes_to_int32(len); if (prop_value->format) reply.nItems = len / (prop_value->format / 8); + else + reply.nItems = 0; reply.propertyType = prop_value->type; if (stuff->delete && (reply.bytesAfter == 0)) { diff --git a/randr/rrprovider.c b/randr/rrprovider.c index 61e9001b4..c67de88ae 100644 --- a/randr/rrprovider.c +++ b/randr/rrprovider.c @@ -56,6 +56,7 @@ int ProcRRGetProviders (ClientPtr client) { REQUEST(xRRGetProvidersReq); + xRRGetProvidersReply rep; WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; @@ -86,36 +87,36 @@ ProcRRGetProviders (ClientPtr client) if (!pScrPriv) { - xRRGetProvidersReply rep = { + rep = (xRRGetProvidersReply) { .type = X_Reply, .sequenceNumber = client->sequence, + .length = 0, .timestamp = currentTime.milliseconds, + .nProviders = 0 }; - WriteToClient(client, sizeof(rep), &rep); - return Success; - } - - extraLen = total_providers * sizeof(CARD32); - - xRRGetProvidersReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .timestamp = pScrPriv->lastSetTime.milliseconds, - .nProviders = total_providers, - .length = bytes_to_int32(extraLen), - }; - - if (extraLen) { - extra = malloc(extraLen); - if (!extra) - return BadAlloc; - } else extra = NULL; + extraLen = 0; + } else { + rep = (xRRGetProvidersReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .timestamp = pScrPriv->lastSetTime.milliseconds, + .nProviders = total_providers, + .length = total_providers + }; + extraLen = rep.length << 2; + if (extraLen) { + extra = malloc(extraLen); + if (!extra) + return BadAlloc; + } else + extra = NULL; - providers = (RRProvider *)extra; - ADD_PROVIDER(pScreen); - xorg_list_for_each_entry(iter, &pScreen->secondary_list, secondary_head) { - ADD_PROVIDER(iter); + providers = (RRProvider *)extra; + ADD_PROVIDER(pScreen); + xorg_list_for_each_entry(iter, &pScreen->secondary_list, secondary_head) { + ADD_PROVIDER(iter); + } } if (client->swapped) { @@ -137,6 +138,7 @@ int ProcRRGetProviderInfo (ClientPtr client) { REQUEST(xRRGetProviderInfoReq); + xRRGetProviderInfoReply rep; rrScrPrivPtr pScrPriv, pScrProvPriv; RRProviderPtr provider; ScreenPtr pScreen; @@ -156,15 +158,17 @@ ProcRRGetProviderInfo (ClientPtr client) pScreen = provider->pScreen; pScrPriv = rrGetScrPriv(pScreen); - xRRGetProviderInfoReply rep = { + rep = (xRRGetProviderInfoReply) { .type = X_Reply, .status = RRSetConfigSuccess, .sequenceNumber = client->sequence, + .length = 0, .capabilities = provider->capabilities, .nameLength = provider->nameLength, .timestamp = pScrPriv->lastSetTime.milliseconds, .nCrtcs = pScrPriv->numCrtcs, .nOutputs = pScrPriv->numOutputs, + .nAssociatedProviders = 0 }; /* count associated providers */ diff --git a/randr/rrproviderproperty.c b/randr/rrproviderproperty.c index 27444ea8a..69f66ed27 100644 --- a/randr/rrproviderproperty.c +++ b/randr/rrproviderproperty.c @@ -391,6 +391,7 @@ ProcRRListProviderProperties(ClientPtr client) { REQUEST(xRRListProviderPropertiesReq); Atom *pAtoms = NULL, *temppAtoms; + xRRListProviderPropertiesReply rep; int numProps = 0; RRProviderPtr provider; RRPropertyPtr prop; @@ -405,7 +406,7 @@ ProcRRListProviderProperties(ClientPtr client) if (!(pAtoms = xallocarray(numProps, sizeof(Atom)))) return BadAlloc; - xRRListProviderPropertiesReply rep = { + rep = (xRRListProviderPropertiesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(numProps * sizeof(Atom)), @@ -433,6 +434,7 @@ int ProcRRQueryProviderProperty(ClientPtr client) { REQUEST(xRRQueryProviderPropertyReq); + xRRQueryProviderPropertyReply rep; RRProviderPtr provider; RRPropertyPtr prop; char *extra = NULL; @@ -450,8 +452,7 @@ ProcRRQueryProviderProperty(ClientPtr client) if (!extra) return BadAlloc; } - - xRRQueryProviderPropertyReply rep = { + rep = (xRRQueryProviderPropertyReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = prop->num_valid, @@ -613,8 +614,17 @@ ProcRRGetProviderProperty(ClientPtr client) break; if (!prop) { + reply.nItems = 0; + reply.length = 0; + reply.bytesAfter = 0; + reply.propertyType = None; + reply.format = 0; if (client->swapped) { swaps(&reply.sequenceNumber); + swapl(&reply.length); + swapl(&reply.propertyType); + swapl(&reply.bytesAfter); + swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetProviderPropertyReply), &reply); return Success; @@ -634,11 +644,15 @@ ProcRRGetProviderProperty(ClientPtr client) ) { reply.bytesAfter = prop_value->size; reply.format = prop_value->format; + reply.length = 0; + reply.nItems = 0; reply.propertyType = prop_value->type; if (client->swapped) { swaps(&reply.sequenceNumber); + swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); + swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetProviderPropertyReply), &reply); return Success; @@ -670,6 +684,8 @@ ProcRRGetProviderProperty(ClientPtr client) reply.length = bytes_to_int32(len); if (prop_value->format) reply.nItems = len / (prop_value->format / 8); + else + reply.nItems = 0; reply.propertyType = prop_value->type; if (stuff->delete && (reply.bytesAfter == 0)) { diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 184b30f32..1403a3cf4 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -76,6 +76,8 @@ RRSendConfigNotify(ScreenPtr pScreen) xEvent event = { .u.configureNotify.window = pWin->drawable.id, .u.configureNotify.aboveSibling = None, + .u.configureNotify.x = 0, + .u.configureNotify.y = 0, /* XXX xinerama stuff ? */ @@ -190,6 +192,7 @@ int ProcRRGetScreenSizeRange(ClientPtr client) { REQUEST(xRRGetScreenSizeRangeReq); + xRRGetScreenSizeRangeReply rep; WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; @@ -203,9 +206,11 @@ ProcRRGetScreenSizeRange(ClientPtr client) pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); - xRRGetScreenSizeRangeReply rep = { + rep = (xRRGetScreenSizeRangeReply) { .type = X_Reply, + .pad = 0, .sequenceNumber = client->sequence, + .length = 0 }; if (pScrPriv) { @@ -367,6 +372,7 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) rrScrPrivPtr pScrPriv; int num_modes; RRModePtr *modes; + xRRGetScreenResourcesReply rep; unsigned long extraLen; CARD8 *extra; RRCrtc *crtcs; @@ -403,10 +409,10 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) } pScrPriv = rrGetScrPriv(pScreen); - - xRRGetScreenResourcesReply rep = { + rep = (xRRGetScreenResourcesReply) { .type = X_Reply, .sequenceNumber = client->sequence, + .length = 0, .timestamp = pScrPriv->lastSetTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds, .nCrtcs = total_crtcs, @@ -485,8 +491,8 @@ rrGetScreenResources(ClientPtr client, Bool query) WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; - CARD8 *extra = NULL; - unsigned long extraLen = 0; + CARD8 *extra; + unsigned long extraLen; int i, rc, has_primary = 0; RRCrtc *crtcs; RROutput *outputs; @@ -512,9 +518,16 @@ rrGetScreenResources(ClientPtr client, Bool query) rep = (xRRGetScreenResourcesReply) { .type = X_Reply, .sequenceNumber = client->sequence, + .length = 0, .timestamp = currentTime.milliseconds, .configTimestamp = currentTime.milliseconds, + .nCrtcs = 0, + .nOutputs = 0, + .nModes = 0, + .nbytesNames = 0 }; + extra = NULL; + extraLen = 0; } else { RRModePtr *modes; @@ -527,13 +540,16 @@ rrGetScreenResources(ClientPtr client, Bool query) rep = (xRRGetScreenResourcesReply) { .type = X_Reply, .sequenceNumber = client->sequence, + .length = 0, .timestamp = pScrPriv->lastSetTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds, .nCrtcs = pScrPriv->numCrtcs, .nOutputs = pScrPriv->numOutputs, .nModes = num_modes, + .nbytesNames = 0 }; + for (i = 0; i < num_modes; i++) rep.nbytesNames += modes[i]->mode.nameLength; @@ -746,8 +762,8 @@ ProcRRGetScreenInfo(ClientPtr client) int rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; - CARD8 *extra = NULL; - unsigned long extraLen = 0; + CARD8 *extra; + unsigned long extraLen; RROutputPtr output; REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); @@ -769,11 +785,18 @@ ProcRRGetScreenInfo(ClientPtr client) .type = X_Reply, .setOfRotations = RR_Rotate_0, .sequenceNumber = client->sequence, + .length = 0, .root = pWin->drawable.pScreen->root->drawable.id, .timestamp = currentTime.milliseconds, .configTimestamp = currentTime.milliseconds, + .nSizes = 0, + .sizeID = 0, .rotation = RR_Rotate_0, + .rate = 0, + .nrateEnts = 0 }; + extra = 0; + extraLen = 0; } else { int i, j; @@ -792,6 +815,7 @@ ProcRRGetScreenInfo(ClientPtr client) .type = X_Reply, .setOfRotations = output->crtc->rotations, .sequenceNumber = client->sequence, + .length = 0, .root = pWin->drawable.pScreen->root->drawable.id, .timestamp = pScrPriv->lastSetTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds, @@ -881,6 +905,7 @@ int ProcRRSetScreenConfig(ClientPtr client) { REQUEST(xRRSetScreenConfigReq); + xRRSetScreenConfigReply rep; DrawablePtr pDraw; int rc; ScreenPtr pScreen; @@ -1085,10 +1110,12 @@ ProcRRSetScreenConfig(ClientPtr client) free(pData); - xRRSetScreenConfigReply rep = { + rep = (xRRSetScreenConfigReply) { .type = X_Reply, .status = status, .sequenceNumber = client->sequence, + .length = 0, + .newTimestamp = pScrPriv->lastSetTime.milliseconds, .newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds, .root = pDraw->pScreen->root->drawable.id, diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c index 22c23a0e9..e2f489ae0 100644 --- a/randr/rrxinerama.c +++ b/randr/rrxinerama.c @@ -99,6 +99,7 @@ ProcRRXineramaQueryVersion(ClientPtr client) xPanoramiXQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, + .length = 0, .majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION, .minorVersion = SERVER_RRXINERAMA_MINOR_VERSION }; @@ -119,6 +120,7 @@ ProcRRXineramaGetState(ClientPtr client) { REQUEST(xPanoramiXGetStateReq); WindowPtr pWin; + xPanoramiXGetStateReply rep; register int rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; @@ -136,10 +138,11 @@ ProcRRXineramaGetState(ClientPtr client) active = TRUE; } - xPanoramiXGetStateReply rep = { + rep = (xPanoramiXGetStateReply) { .type = X_Reply, .state = active, .sequenceNumber = client->sequence, + .length = 0, .window = stuff->window }; if (client->swapped) { @@ -168,6 +171,7 @@ ProcRRXineramaGetScreenCount(ClientPtr client) { REQUEST(xPanoramiXGetScreenCountReq); WindowPtr pWin; + xPanoramiXGetScreenCountReply rep; register int rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); @@ -175,10 +179,11 @@ ProcRRXineramaGetScreenCount(ClientPtr client) if (rc != Success) return rc; - xPanoramiXGetScreenCountReply rep = { + rep = (xPanoramiXGetScreenCountReply) { .type = X_Reply, .ScreenCount = RRXineramaScreenCount(pWin->drawable.pScreen), .sequenceNumber = client->sequence, + .length = 0, .window = stuff->window }; if (client->swapped) { @@ -196,6 +201,7 @@ ProcRRXineramaGetScreenSize(ClientPtr client) REQUEST(xPanoramiXGetScreenSizeReq); WindowPtr pWin, pRoot; ScreenPtr pScreen; + xPanoramiXGetScreenSizeReply rep; register int rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); @@ -206,9 +212,10 @@ ProcRRXineramaGetScreenSize(ClientPtr client) pScreen = pWin->drawable.pScreen; pRoot = pScreen->root; - xPanoramiXGetScreenSizeReply rep = { + rep = (xPanoramiXGetScreenSizeReply) { .type = X_Reply, .sequenceNumber = client->sequence, + .length = 0, .width = pRoot->drawable.width, .height = pRoot->drawable.height, .window = stuff->window, @@ -229,11 +236,13 @@ ProcRRXineramaGetScreenSize(ClientPtr client) int ProcRRXineramaIsActive(ClientPtr client) { + xXineramaIsActiveReply rep; REQUEST_SIZE_MATCH(xXineramaIsActiveReq); - xXineramaIsActiveReply rep = { + rep = (xXineramaIsActiveReply) { .type = X_Reply, + .length = 0, .sequenceNumber = client->sequence, .state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN]) }; @@ -249,12 +258,12 @@ ProcRRXineramaIsActive(ClientPtr client) static void RRXineramaWriteMonitor(ClientPtr client, RRMonitorPtr monitor) { - xXineramaScreenInfo scratch = { - .x_org = monitor->geometry.box.x1, - .y_org = monitor->geometry.box.y1, - .width = monitor->geometry.box.x2 - monitor->geometry.box.x1, - .height = monitor->geometry.box.y2 - monitor->geometry.box.y1, - }; + xXineramaScreenInfo scratch; + + scratch.x_org = monitor->geometry.box.x1; + scratch.y_org = monitor->geometry.box.y1; + scratch.width = monitor->geometry.box.x2 - monitor->geometry.box.x1; + scratch.height = monitor->geometry.box.y2 - monitor->geometry.box.y1; if (client->swapped) { swaps(&scratch.x_org); @@ -269,6 +278,7 @@ RRXineramaWriteMonitor(ClientPtr client, RRMonitorPtr monitor) int ProcRRXineramaQueryScreens(ClientPtr client) { + xXineramaQueryScreensReply rep; ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN]; int m; RRMonitorPtr monitors = NULL; @@ -282,7 +292,7 @@ ProcRRXineramaQueryScreens(ClientPtr client) return BadAlloc; } - xXineramaQueryScreensReply rep = { + rep = (xXineramaQueryScreensReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(nmonitors * sz_XineramaScreenInfo), From 9f72353a51f09d8cf7b951a35136f4a746609224 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:44:02 -0700 Subject: [PATCH 17/20] Revert "randr: RRCrtcCreate(): drop unnecessary zero assigments" This reverts commit 6d2c42d0c8fd814e60a04babef96efa86922224f. Part-of: --- randr/rrcrtc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 3974c350d..2fb92b053 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -77,8 +77,16 @@ RRCrtcCreate(ScreenPtr pScreen, void *devPrivate) return NULL; crtc->id = FakeClientID(0); crtc->pScreen = pScreen; + crtc->mode = NULL; + crtc->x = 0; + crtc->y = 0; crtc->rotation = RR_Rotate_0; crtc->rotations = RR_Rotate_0; + crtc->outputs = NULL; + crtc->numOutputs = 0; + crtc->gammaSize = 0; + crtc->gammaRed = crtc->gammaBlue = crtc->gammaGreen = NULL; + crtc->changed = FALSE; crtc->devPrivate = devPrivate; RRTransformInit(&crtc->client_pending_transform); RRTransformInit(&crtc->client_current_transform); From bc76e25994f070adbb5a749c70bd2ff70f2b1a45 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:44:17 -0700 Subject: [PATCH 18/20] Revert "randr: use explicit case statement instead of SProcRandrVector table" This reverts commit 058815bed1bac2d9fc6ce15e001132806fb9ab14. Part-of: --- randr/randr.c | 12 +++++ randr/randrstr_priv.h | 4 +- randr/rrsdispatch.c | 123 ++++++++++++++++++++---------------------- 3 files changed, 71 insertions(+), 68 deletions(-) diff --git a/randr/randr.c b/randr/randr.c index b314f0411..078514a3c 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -50,6 +50,8 @@ static int RRNScreens; real->mem = priv->mem; \ } +static int SProcRRDispatch(ClientPtr pClient); + int RREventBase; int RRErrorBase; RESTYPE RRClientType, RREventType; /* resource types for event masks */ @@ -734,3 +736,13 @@ RRVerticalRefresh(xRRModeInfo * mode) refresh = 0xffff; return (CARD16) refresh; } + +static int _X_COLD +SProcRRDispatch(ClientPtr client) +{ + REQUEST(xReq); + if (stuff->data >= RRNumberRequests || !SProcRandrVector[stuff->data]) + return BadRequest; + UpdateCurrentTimeIf(); + return (*SProcRandrVector[stuff->data]) (client); +} diff --git a/randr/randrstr_priv.h b/randr/randrstr_priv.h index f50a8eb94..a125f293a 100644 --- a/randr/randrstr_priv.h +++ b/randr/randrstr_priv.h @@ -33,6 +33,8 @@ extern int RREventBase, RRErrorBase; +extern int (*SProcRandrVector[RRNumberRequests]) (ClientPtr); + extern RESTYPE RRClientType, RREventType; /* resource types for event masks */ extern DevPrivateKeyRec RRClientPrivateKeyRec; @@ -139,6 +141,4 @@ int ProcRRSelectInput(ClientPtr client); int ProcRRDispatch(ClientPtr client); -int SProcRRDispatch(ClientPtr client); - #endif /* _XSERVER_RANDRSTR_PRIV_H_ */ diff --git a/randr/rrsdispatch.c b/randr/rrsdispatch.c index c447c5d63..48f908fd1 100644 --- a/randr/rrsdispatch.c +++ b/randr/rrsdispatch.c @@ -603,69 +603,60 @@ SProcRRFreeLease(ClientPtr client) { return ProcRRFreeLease(client); } -int -SProcRRDispatch(ClientPtr client) -{ - REQUEST(xReq); - UpdateCurrentTimeIf(); - - switch (stuff->data) { - case X_RRQueryVersion: return SProcRRQueryVersion(client); - case X_RRSetScreenConfig: return SProcRRSetScreenConfig(client); - case X_RRSelectInput: return SProcRRSelectInput(client); - case X_RRGetScreenInfo: return SProcRRGetScreenInfo(client); - - /* V1.2 additions */ - case X_RRGetScreenSizeRange: return SProcRRGetScreenSizeRange(client); - case X_RRSetScreenSize: return SProcRRSetScreenSize(client); - case X_RRGetScreenResources: return SProcRRGetScreenResources(client); - case X_RRGetOutputInfo: return SProcRRGetOutputInfo(client); - case X_RRListOutputProperties: return SProcRRListOutputProperties(client); - case X_RRQueryOutputProperty: return SProcRRQueryOutputProperty(client); - case X_RRConfigureOutputProperty: return SProcRRConfigureOutputProperty(client); - case X_RRChangeOutputProperty: return SProcRRChangeOutputProperty(client); - case X_RRDeleteOutputProperty: return SProcRRDeleteOutputProperty(client); - case X_RRGetOutputProperty: return SProcRRGetOutputProperty(client); - case X_RRCreateMode: return SProcRRCreateMode(client); - case X_RRDestroyMode: return SProcRRDestroyMode(client); - case X_RRAddOutputMode: return SProcRRAddOutputMode(client); - case X_RRDeleteOutputMode: return SProcRRDeleteOutputMode(client); - case X_RRGetCrtcInfo: return SProcRRGetCrtcInfo(client); - case X_RRSetCrtcConfig: return SProcRRSetCrtcConfig(client); - case X_RRGetCrtcGammaSize: return SProcRRGetCrtcGammaSize(client); - case X_RRGetCrtcGamma: return SProcRRGetCrtcGamma(client); - case X_RRSetCrtcGamma: return SProcRRSetCrtcGamma(client); - - /* V1.3 additions */ - case X_RRGetScreenResourcesCurrent: return SProcRRGetScreenResourcesCurrent(client); - case X_RRSetCrtcTransform: return SProcRRSetCrtcTransform(client); - case X_RRGetCrtcTransform: return SProcRRGetCrtcTransform(client); - case X_RRGetPanning: return SProcRRGetPanning(client); - case X_RRSetPanning: return SProcRRSetPanning(client); - case X_RRSetOutputPrimary: return SProcRRSetOutputPrimary(client); - case X_RRGetOutputPrimary: return SProcRRGetOutputPrimary(client); - - /* V1.4 additions */ - case X_RRGetProviders: return SProcRRGetProviders(client); - case X_RRGetProviderInfo: return SProcRRGetProviderInfo(client); - case X_RRSetProviderOffloadSink: return SProcRRSetProviderOffloadSink(client); - case X_RRSetProviderOutputSource: return SProcRRSetProviderOutputSource(client); - case X_RRListProviderProperties: return SProcRRListProviderProperties(client); - case X_RRQueryProviderProperty: return SProcRRQueryProviderProperty(client); - case X_RRConfigureProviderProperty: return SProcRRConfigureProviderProperty(client); - case X_RRChangeProviderProperty: return SProcRRChangeProviderProperty(client); - case X_RRDeleteProviderProperty: return SProcRRDeleteProviderProperty(client); - case X_RRGetProviderProperty: return SProcRRGetProviderProperty(client); - - /* V1.5 additions */ - case X_RRGetMonitors: return SProcRRGetMonitors(client); - case X_RRSetMonitor: return SProcRRSetMonitor(client); - case X_RRDeleteMonitor: return SProcRRDeleteMonitor(client); - - /* V1.6 additions */ - case X_RRCreateLease: return SProcRRCreateLease(client); - case X_RRFreeLease: return SProcRRFreeLease(client); - } - - return BadRequest; -} +int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = { + SProcRRQueryVersion, /* 0 */ +/* we skip 1 to make old clients fail pretty immediately */ + NULL, /* 1 SProcRandrOldGetScreenInfo */ +/* V1.0 apps share the same set screen config request id */ + SProcRRSetScreenConfig, /* 2 */ + NULL, /* 3 SProcRandrOldScreenChangeSelectInput */ +/* 3 used to be ScreenChangeSelectInput; deprecated */ + SProcRRSelectInput, /* 4 */ + SProcRRGetScreenInfo, /* 5 */ +/* V1.2 additions */ + SProcRRGetScreenSizeRange, /* 6 */ + SProcRRSetScreenSize, /* 7 */ + SProcRRGetScreenResources, /* 8 */ + SProcRRGetOutputInfo, /* 9 */ + SProcRRListOutputProperties, /* 10 */ + SProcRRQueryOutputProperty, /* 11 */ + SProcRRConfigureOutputProperty, /* 12 */ + SProcRRChangeOutputProperty, /* 13 */ + SProcRRDeleteOutputProperty, /* 14 */ + SProcRRGetOutputProperty, /* 15 */ + SProcRRCreateMode, /* 16 */ + SProcRRDestroyMode, /* 17 */ + SProcRRAddOutputMode, /* 18 */ + SProcRRDeleteOutputMode, /* 19 */ + SProcRRGetCrtcInfo, /* 20 */ + SProcRRSetCrtcConfig, /* 21 */ + SProcRRGetCrtcGammaSize, /* 22 */ + SProcRRGetCrtcGamma, /* 23 */ + SProcRRSetCrtcGamma, /* 24 */ +/* V1.3 additions */ + SProcRRGetScreenResourcesCurrent, /* 25 */ + SProcRRSetCrtcTransform, /* 26 */ + SProcRRGetCrtcTransform, /* 27 */ + SProcRRGetPanning, /* 28 */ + SProcRRSetPanning, /* 29 */ + SProcRRSetOutputPrimary, /* 30 */ + SProcRRGetOutputPrimary, /* 31 */ +/* V1.4 additions */ + SProcRRGetProviders, /* 32 */ + SProcRRGetProviderInfo, /* 33 */ + SProcRRSetProviderOffloadSink, /* 34 */ + SProcRRSetProviderOutputSource, /* 35 */ + SProcRRListProviderProperties, /* 36 */ + SProcRRQueryProviderProperty, /* 37 */ + SProcRRConfigureProviderProperty, /* 38 */ + SProcRRChangeProviderProperty, /* 39 */ + SProcRRDeleteProviderProperty, /* 40 */ + SProcRRGetProviderProperty, /* 41 */ +/* V1.5 additions */ + SProcRRGetMonitors, /* 42 */ + SProcRRSetMonitor, /* 43 */ + SProcRRDeleteMonitor, /* 44 */ +/* V1.6 additions */ + SProcRRCreateLease, /* 45 */ + SProcRRFreeLease, /* 46 */ +}; From c35a28539825c08b6f9042b19e6f78144f409183 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:44:30 -0700 Subject: [PATCH 19/20] Revert "randr: use explicit case statement instead of ProcRandrVector table" This reverts commit 42677ae1e391ce723fb9b967071ddc0862c62ebd. Part-of: --- randr/randr.c | 11 ++++ randr/randrstr_priv.h | 3 +- randr/rrdispatch.c | 123 ++++++++++++++++++++---------------------- 3 files changed, 69 insertions(+), 68 deletions(-) diff --git a/randr/randr.c b/randr/randr.c index 078514a3c..59d101ba7 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -50,6 +50,7 @@ static int RRNScreens; real->mem = priv->mem; \ } +static int ProcRRDispatch(ClientPtr pClient); static int SProcRRDispatch(ClientPtr pClient); int RREventBase; @@ -737,6 +738,16 @@ RRVerticalRefresh(xRRModeInfo * mode) return (CARD16) refresh; } +static int +ProcRRDispatch(ClientPtr client) +{ + REQUEST(xReq); + if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data]) + return BadRequest; + UpdateCurrentTimeIf(); + return (*ProcRandrVector[stuff->data]) (client); +} + static int _X_COLD SProcRRDispatch(ClientPtr client) { diff --git a/randr/randrstr_priv.h b/randr/randrstr_priv.h index a125f293a..7f802215f 100644 --- a/randr/randrstr_priv.h +++ b/randr/randrstr_priv.h @@ -33,6 +33,7 @@ extern int RREventBase, RRErrorBase; +extern int (*ProcRandrVector[RRNumberRequests]) (ClientPtr); extern int (*SProcRandrVector[RRNumberRequests]) (ClientPtr); extern RESTYPE RRClientType, RREventType; /* resource types for event masks */ @@ -139,6 +140,4 @@ int ProcRRQueryVersion(ClientPtr client); int ProcRRSelectInput(ClientPtr client); -int ProcRRDispatch(ClientPtr client); - #endif /* _XSERVER_RANDRSTR_PRIV_H_ */ diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c index 866c6f252..4381f52ca 100644 --- a/randr/rrdispatch.c +++ b/randr/rrdispatch.c @@ -211,69 +211,60 @@ ProcRRSelectInput(ClientPtr client) return Success; } -int -ProcRRDispatch(ClientPtr client) -{ - REQUEST(xReq); - UpdateCurrentTimeIf(); - - switch (stuff->data) { - case X_RRQueryVersion: return ProcRRQueryVersion(client); - case X_RRSetScreenConfig: return ProcRRSetScreenConfig(client); - case X_RRSelectInput: return ProcRRSelectInput(client); - case X_RRGetScreenInfo: return ProcRRGetScreenInfo(client); - - /* V1.2 additions */ - case X_RRGetScreenSizeRange: return ProcRRGetScreenSizeRange(client); - case X_RRSetScreenSize: return ProcRRSetScreenSize(client); - case X_RRGetScreenResources: return ProcRRGetScreenResources(client); - case X_RRGetOutputInfo: return ProcRRGetOutputInfo(client); - case X_RRListOutputProperties: return ProcRRListOutputProperties(client); - case X_RRQueryOutputProperty: return ProcRRQueryOutputProperty(client); - case X_RRConfigureOutputProperty: return ProcRRConfigureOutputProperty(client); - case X_RRChangeOutputProperty: return ProcRRChangeOutputProperty(client); - case X_RRDeleteOutputProperty: return ProcRRDeleteOutputProperty(client); - case X_RRGetOutputProperty: return ProcRRGetOutputProperty(client); - case X_RRCreateMode: return ProcRRCreateMode(client); - case X_RRDestroyMode: return ProcRRDestroyMode(client); - case X_RRAddOutputMode: return ProcRRAddOutputMode(client); - case X_RRDeleteOutputMode: return ProcRRDeleteOutputMode(client); - case X_RRGetCrtcInfo: return ProcRRGetCrtcInfo(client); - case X_RRSetCrtcConfig: return ProcRRSetCrtcConfig(client); - case X_RRGetCrtcGammaSize: return ProcRRGetCrtcGammaSize(client); - case X_RRGetCrtcGamma: return ProcRRGetCrtcGamma(client); - case X_RRSetCrtcGamma: return ProcRRSetCrtcGamma(client); - - /* V1.3 additions */ - case X_RRGetScreenResourcesCurrent: return ProcRRGetScreenResourcesCurrent(client); - case X_RRSetCrtcTransform: return ProcRRSetCrtcTransform(client); - case X_RRGetCrtcTransform: return ProcRRGetCrtcTransform(client); - case X_RRGetPanning: return ProcRRGetPanning(client); - case X_RRSetPanning: return ProcRRSetPanning(client); - case X_RRSetOutputPrimary: return ProcRRSetOutputPrimary(client); - case X_RRGetOutputPrimary: return ProcRRGetOutputPrimary(client); - - /* V1.4 additions */ - case X_RRGetProviders: return ProcRRGetProviders(client); - case X_RRGetProviderInfo: return ProcRRGetProviderInfo(client); - case X_RRSetProviderOffloadSink: return ProcRRSetProviderOffloadSink(client); - case X_RRSetProviderOutputSource: return ProcRRSetProviderOutputSource(client); - case X_RRListProviderProperties: return ProcRRListProviderProperties(client); - case X_RRQueryProviderProperty: return ProcRRQueryProviderProperty(client); - case X_RRConfigureProviderProperty: return ProcRRConfigureProviderProperty(client); - case X_RRChangeProviderProperty: return ProcRRChangeProviderProperty(client); - case X_RRDeleteProviderProperty: return ProcRRDeleteProviderProperty(client); - case X_RRGetProviderProperty: return ProcRRGetProviderProperty(client); - - /* V1.5 additions */ - case X_RRGetMonitors: return ProcRRGetMonitors(client); - case X_RRSetMonitor: return ProcRRSetMonitor(client); - case X_RRDeleteMonitor: return ProcRRDeleteMonitor(client); - - /* V1.6 additions */ - case X_RRCreateLease: return ProcRRCreateLease(client); - case X_RRFreeLease: return ProcRRFreeLease(client); - } - - return BadRequest; -} +int (*ProcRandrVector[RRNumberRequests]) (ClientPtr) = { + ProcRRQueryVersion, /* 0 */ +/* we skip 1 to make old clients fail pretty immediately */ + NULL, /* 1 ProcRandrOldGetScreenInfo */ +/* V1.0 apps share the same set screen config request id */ + ProcRRSetScreenConfig, /* 2 */ + NULL, /* 3 ProcRandrOldScreenChangeSelectInput */ +/* 3 used to be ScreenChangeSelectInput; deprecated */ + ProcRRSelectInput, /* 4 */ + ProcRRGetScreenInfo, /* 5 */ +/* V1.2 additions */ + ProcRRGetScreenSizeRange, /* 6 */ + ProcRRSetScreenSize, /* 7 */ + ProcRRGetScreenResources, /* 8 */ + ProcRRGetOutputInfo, /* 9 */ + ProcRRListOutputProperties, /* 10 */ + ProcRRQueryOutputProperty, /* 11 */ + ProcRRConfigureOutputProperty, /* 12 */ + ProcRRChangeOutputProperty, /* 13 */ + ProcRRDeleteOutputProperty, /* 14 */ + ProcRRGetOutputProperty, /* 15 */ + ProcRRCreateMode, /* 16 */ + ProcRRDestroyMode, /* 17 */ + ProcRRAddOutputMode, /* 18 */ + ProcRRDeleteOutputMode, /* 19 */ + ProcRRGetCrtcInfo, /* 20 */ + ProcRRSetCrtcConfig, /* 21 */ + ProcRRGetCrtcGammaSize, /* 22 */ + ProcRRGetCrtcGamma, /* 23 */ + ProcRRSetCrtcGamma, /* 24 */ +/* V1.3 additions */ + ProcRRGetScreenResourcesCurrent, /* 25 */ + ProcRRSetCrtcTransform, /* 26 */ + ProcRRGetCrtcTransform, /* 27 */ + ProcRRGetPanning, /* 28 */ + ProcRRSetPanning, /* 29 */ + ProcRRSetOutputPrimary, /* 30 */ + ProcRRGetOutputPrimary, /* 31 */ +/* V1.4 additions */ + ProcRRGetProviders, /* 32 */ + ProcRRGetProviderInfo, /* 33 */ + ProcRRSetProviderOffloadSink, /* 34 */ + ProcRRSetProviderOutputSource, /* 35 */ + ProcRRListProviderProperties, /* 36 */ + ProcRRQueryProviderProperty, /* 37 */ + ProcRRConfigureProviderProperty, /* 38 */ + ProcRRChangeProviderProperty, /* 39 */ + ProcRRDeleteProviderProperty, /* 40 */ + ProcRRGetProviderProperty, /* 41 */ +/* V1.5 additions */ + ProcRRGetMonitors, /* 42 */ + ProcRRSetMonitor, /* 43 */ + ProcRRDeleteMonitor, /* 44 */ +/* V1.6 additions */ + ProcRRCreateLease, /* 45 */ + ProcRRFreeLease, /* 46 */ +}; From e3d0666386d99d3ed1b9d2cf32c96cbbb0ab949d Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 13:44:43 -0700 Subject: [PATCH 20/20] Revert "randr: let SProc*'s call their Proc*'s directly" This reverts commit ed172244034f31d8e7e7eec2283bd825a48bb94e. Part-of: --- randr/randrstr_priv.h | 4 -- randr/rrdispatch.c | 4 +- randr/rrsdispatch.c | 90 +++++++++++++++++++++---------------------- 3 files changed, 47 insertions(+), 51 deletions(-) diff --git a/randr/randrstr_priv.h b/randr/randrstr_priv.h index 7f802215f..4864f5272 100644 --- a/randr/randrstr_priv.h +++ b/randr/randrstr_priv.h @@ -136,8 +136,4 @@ int ProcRRCreateLease(ClientPtr client); int ProcRRFreeLease(ClientPtr client); -int ProcRRQueryVersion(ClientPtr client); - -int ProcRRSelectInput(ClientPtr client); - #endif /* _XSERVER_RANDRSTR_PRIV_H_ */ diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c index 4381f52ca..615e89312 100644 --- a/randr/rrdispatch.c +++ b/randr/rrdispatch.c @@ -36,7 +36,7 @@ RRClientKnowsRates(ClientPtr pClient) 1, 1) >= 0; } -int +static int ProcRRQueryVersion(ClientPtr client) { xRRQueryVersionReply rep = { @@ -72,7 +72,7 @@ ProcRRQueryVersion(ClientPtr client) return Success; } -int +static int ProcRRSelectInput(ClientPtr client) { REQUEST(xRRSelectInputReq); diff --git a/randr/rrsdispatch.c b/randr/rrsdispatch.c index 48f908fd1..6de8775b0 100644 --- a/randr/rrsdispatch.c +++ b/randr/rrsdispatch.c @@ -30,7 +30,7 @@ SProcRRQueryVersion(ClientPtr client) REQUEST_SIZE_MATCH(xRRQueryVersionReq); swapl(&stuff->majorVersion); swapl(&stuff->minorVersion); - return ProcRRQueryVersion(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -40,7 +40,7 @@ SProcRRGetScreenInfo(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); swapl(&stuff->window); - return ProcRRGetScreenInfo(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -60,7 +60,7 @@ SProcRRSetScreenConfig(ClientPtr client) swapl(&stuff->timestamp); swaps(&stuff->sizeID); swaps(&stuff->rotation); - return ProcRRSetScreenConfig(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -71,7 +71,7 @@ SProcRRSelectInput(ClientPtr client) REQUEST_SIZE_MATCH(xRRSelectInputReq); swapl(&stuff->window); swaps(&stuff->enable); - return ProcRRSelectInput(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -81,7 +81,7 @@ SProcRRGetScreenSizeRange(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq); swapl(&stuff->window); - return ProcRRGetScreenSizeRange(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -95,7 +95,7 @@ SProcRRSetScreenSize(ClientPtr client) swaps(&stuff->height); swapl(&stuff->widthInMillimeters); swapl(&stuff->heightInMillimeters); - return ProcRRSetScreenSize(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -105,7 +105,7 @@ SProcRRGetScreenResources(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq); swapl(&stuff->window); - return ProcRRGetScreenResources(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -116,7 +116,7 @@ SProcRRGetScreenResourcesCurrent(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetScreenResourcesCurrentReq); swaps(&stuff->length); swapl(&stuff->window); - return ProcRRGetScreenResourcesCurrent(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -127,7 +127,7 @@ SProcRRGetOutputInfo(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetOutputInfoReq); swapl(&stuff->output); swapl(&stuff->configTimestamp); - return ProcRRGetScreenResources(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -137,7 +137,7 @@ SProcRRListOutputProperties(ClientPtr client) REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq); swapl(&stuff->output); - return ProcRRListOutputProperties(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -148,7 +148,7 @@ SProcRRQueryOutputProperty(ClientPtr client) REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq); swapl(&stuff->output); swapl(&stuff->property); - return ProcRRQueryOutputProperty(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -160,7 +160,7 @@ SProcRRConfigureOutputProperty(ClientPtr client) swapl(&stuff->output); swapl(&stuff->property); SwapRestL(stuff); - return ProcRRConfigureOutputProperty(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -186,7 +186,7 @@ SProcRRChangeOutputProperty(ClientPtr client) client->errorValue = stuff->format; return BadValue; } - return ProcRRChangeOutputProperty(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -197,7 +197,7 @@ SProcRRDeleteOutputProperty(ClientPtr client) REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq); swapl(&stuff->output); swapl(&stuff->property); - return ProcRRDeleteOutputProperty(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -211,7 +211,7 @@ SProcRRGetOutputProperty(ClientPtr client) swapl(&stuff->type); swapl(&stuff->longOffset); swapl(&stuff->longLength); - return ProcRRGetOutputProperty(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -237,7 +237,7 @@ SProcRRCreateMode(ClientPtr client) swaps(&modeinfo->vTotal); swaps(&modeinfo->nameLength); swapl(&modeinfo->modeFlags); - return ProcRRCreateMode(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -247,7 +247,7 @@ SProcRRDestroyMode(ClientPtr client) REQUEST_SIZE_MATCH(xRRDestroyModeReq); swapl(&stuff->mode); - return ProcRRDestroyMode(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -258,7 +258,7 @@ SProcRRAddOutputMode(ClientPtr client) REQUEST_SIZE_MATCH(xRRAddOutputModeReq); swapl(&stuff->output); swapl(&stuff->mode); - return ProcRRAddOutputMode(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -269,7 +269,7 @@ SProcRRDeleteOutputMode(ClientPtr client) REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq); swapl(&stuff->output); swapl(&stuff->mode); - return ProcRRDeleteOutputMode(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -280,7 +280,7 @@ SProcRRGetCrtcInfo(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); swapl(&stuff->crtc); swapl(&stuff->configTimestamp); - return ProcRRGetCrtcInfo(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -297,7 +297,7 @@ SProcRRSetCrtcConfig(ClientPtr client) swapl(&stuff->mode); swaps(&stuff->rotation); SwapRestL(stuff); - return ProcRRSetCrtcConfig(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -307,7 +307,7 @@ SProcRRGetCrtcGammaSize(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq); swapl(&stuff->crtc); - return ProcRRGetCrtcGammaSize(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -317,7 +317,7 @@ SProcRRGetCrtcGamma(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq); swapl(&stuff->crtc); - return ProcRRGetCrtcGamma(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -329,7 +329,7 @@ SProcRRSetCrtcGamma(ClientPtr client) swapl(&stuff->crtc); swaps(&stuff->size); SwapRestS(stuff); - return ProcRRSetCrtcGamma(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -353,7 +353,7 @@ SProcRRSetCrtcTransform(ClientPtr client) return BadLength; SwapLongs(params, nparams); - return ProcRRSetCrtcTransform(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -363,7 +363,7 @@ SProcRRGetCrtcTransform(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq); swapl(&stuff->crtc); - return ProcRRGetCrtcTransform(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -373,7 +373,7 @@ SProcRRGetPanning(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetPanningReq); swapl(&stuff->crtc); - return ProcRRGetPanning(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -396,7 +396,7 @@ SProcRRSetPanning(ClientPtr client) swaps(&stuff->border_top); swaps(&stuff->border_right); swaps(&stuff->border_bottom); - return ProcRRSetPanning(client); + return (*ProcRandrVector[stuff->randrReqType]) (client); } static int _X_COLD @@ -407,7 +407,7 @@ SProcRRSetOutputPrimary(ClientPtr client) REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq); swapl(&stuff->window); swapl(&stuff->output); - return ProcRRSetOutputPrimary(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -417,7 +417,7 @@ SProcRRGetOutputPrimary(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq); swapl(&stuff->window); - return ProcRRGetOutputPrimary(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -427,7 +427,7 @@ SProcRRGetProviders(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetProvidersReq); swapl(&stuff->window); - return ProcRRGetProviders(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -438,7 +438,7 @@ SProcRRGetProviderInfo(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetProviderInfoReq); swapl(&stuff->provider); swapl(&stuff->configTimestamp); - return ProcRRGetProviderInfo(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -450,7 +450,7 @@ SProcRRSetProviderOffloadSink(ClientPtr client) swapl(&stuff->provider); swapl(&stuff->sink_provider); swapl(&stuff->configTimestamp); - return ProcRRSetProviderOffloadSink(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -462,7 +462,7 @@ SProcRRSetProviderOutputSource(ClientPtr client) swapl(&stuff->provider); swapl(&stuff->source_provider); swapl(&stuff->configTimestamp); - return ProcRRSetProviderOutputSource(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -472,7 +472,7 @@ SProcRRListProviderProperties(ClientPtr client) REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq); swapl(&stuff->provider); - return ProcRRListProviderProperties(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -483,7 +483,7 @@ SProcRRQueryProviderProperty(ClientPtr client) REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq); swapl(&stuff->provider); swapl(&stuff->property); - return ProcRRQueryProviderProperty(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -496,7 +496,7 @@ SProcRRConfigureProviderProperty(ClientPtr client) swapl(&stuff->property); /* TODO: no way to specify format? */ SwapRestL(stuff); - return ProcRRConfigureProviderProperty(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -519,7 +519,7 @@ SProcRRChangeProviderProperty(ClientPtr client) SwapRestL(stuff); break; } - return ProcRRChangeProviderProperty(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -530,7 +530,7 @@ SProcRRDeleteProviderProperty(ClientPtr client) REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq); swapl(&stuff->provider); swapl(&stuff->property); - return ProcRRDeleteProviderProperty(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -544,7 +544,7 @@ SProcRRGetProviderProperty(ClientPtr client) swapl(&stuff->type); swapl(&stuff->longOffset); swapl(&stuff->longLength); - return ProcRRGetProviderProperty(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -553,7 +553,7 @@ SProcRRGetMonitors(ClientPtr client) { REQUEST_SIZE_MATCH(xRRGetMonitorsReq); swapl(&stuff->window); - return ProcRRGetMonitors(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -569,7 +569,7 @@ SProcRRSetMonitor(ClientPtr client) { swaps(&stuff->monitor.width); swaps(&stuff->monitor.height); SwapRestL(stuff); - return ProcRRSetMonitor(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -579,7 +579,7 @@ SProcRRDeleteMonitor(ClientPtr client) { REQUEST_SIZE_MATCH(xRRDeleteMonitorReq); swapl(&stuff->window); swapl(&stuff->name); - return ProcRRDeleteMonitor(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -591,7 +591,7 @@ SProcRRCreateLease(ClientPtr client) { swaps(&stuff->nCrtcs); swaps(&stuff->nOutputs); SwapRestL(stuff); - return ProcRRCreateLease(client); + return ProcRandrVector[stuff->randrReqType] (client); } static int _X_COLD @@ -600,7 +600,7 @@ SProcRRFreeLease(ClientPtr client) { REQUEST_SIZE_MATCH(xRRFreeLeaseReq); swapl(&stuff->lid); - return ProcRRFreeLease(client); + return ProcRandrVector[stuff->randrReqType] (client); } int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = {