randr: let SProc*'s call their Proc*'s directly

No need to go indirectly through an vector table. It's much clearer and
easier to understand when calling them directly. And a tiny bit performance
improvement as collateral benefit.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-29 15:01:08 +02:00 committed by Marge Bot
parent 1fc9a26afd
commit ed17224403
3 changed files with 51 additions and 47 deletions

View File

@ -136,4 +136,8 @@ int ProcRRCreateLease(ClientPtr client);
int ProcRRFreeLease(ClientPtr client); int ProcRRFreeLease(ClientPtr client);
int ProcRRQueryVersion(ClientPtr client);
int ProcRRSelectInput(ClientPtr client);
#endif /* _XSERVER_RANDRSTR_PRIV_H_ */ #endif /* _XSERVER_RANDRSTR_PRIV_H_ */

View File

@ -36,7 +36,7 @@ RRClientKnowsRates(ClientPtr pClient)
1, 1) >= 0; 1, 1) >= 0;
} }
static int int
ProcRRQueryVersion(ClientPtr client) ProcRRQueryVersion(ClientPtr client)
{ {
xRRQueryVersionReply rep = { xRRQueryVersionReply rep = {
@ -72,7 +72,7 @@ ProcRRQueryVersion(ClientPtr client)
return Success; return Success;
} }
static int int
ProcRRSelectInput(ClientPtr client) ProcRRSelectInput(ClientPtr client)
{ {
REQUEST(xRRSelectInputReq); REQUEST(xRRSelectInputReq);

View File

@ -30,7 +30,7 @@ SProcRRQueryVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xRRQueryVersionReq); REQUEST_SIZE_MATCH(xRRQueryVersionReq);
swapl(&stuff->majorVersion); swapl(&stuff->majorVersion);
swapl(&stuff->minorVersion); swapl(&stuff->minorVersion);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRQueryVersion(client);
} }
static int _X_COLD static int _X_COLD
@ -40,7 +40,7 @@ SProcRRGetScreenInfo(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
swapl(&stuff->window); swapl(&stuff->window);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRGetScreenInfo(client);
} }
static int _X_COLD static int _X_COLD
@ -60,7 +60,7 @@ SProcRRSetScreenConfig(ClientPtr client)
swapl(&stuff->timestamp); swapl(&stuff->timestamp);
swaps(&stuff->sizeID); swaps(&stuff->sizeID);
swaps(&stuff->rotation); swaps(&stuff->rotation);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRSetScreenConfig(client);
} }
static int _X_COLD static int _X_COLD
@ -71,7 +71,7 @@ SProcRRSelectInput(ClientPtr client)
REQUEST_SIZE_MATCH(xRRSelectInputReq); REQUEST_SIZE_MATCH(xRRSelectInputReq);
swapl(&stuff->window); swapl(&stuff->window);
swaps(&stuff->enable); swaps(&stuff->enable);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRSelectInput(client);
} }
static int _X_COLD static int _X_COLD
@ -81,7 +81,7 @@ SProcRRGetScreenSizeRange(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq); REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq);
swapl(&stuff->window); swapl(&stuff->window);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRGetScreenSizeRange(client);
} }
static int _X_COLD static int _X_COLD
@ -95,7 +95,7 @@ SProcRRSetScreenSize(ClientPtr client)
swaps(&stuff->height); swaps(&stuff->height);
swapl(&stuff->widthInMillimeters); swapl(&stuff->widthInMillimeters);
swapl(&stuff->heightInMillimeters); swapl(&stuff->heightInMillimeters);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRSetScreenSize(client);
} }
static int _X_COLD static int _X_COLD
@ -105,7 +105,7 @@ SProcRRGetScreenResources(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq); REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
swapl(&stuff->window); swapl(&stuff->window);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRGetScreenResources(client);
} }
static int _X_COLD static int _X_COLD
@ -116,7 +116,7 @@ SProcRRGetScreenResourcesCurrent(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetScreenResourcesCurrentReq); REQUEST_SIZE_MATCH(xRRGetScreenResourcesCurrentReq);
swaps(&stuff->length); swaps(&stuff->length);
swapl(&stuff->window); swapl(&stuff->window);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRGetScreenResourcesCurrent(client);
} }
static int _X_COLD static int _X_COLD
@ -127,7 +127,7 @@ SProcRRGetOutputInfo(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetOutputInfoReq); REQUEST_SIZE_MATCH(xRRGetOutputInfoReq);
swapl(&stuff->output); swapl(&stuff->output);
swapl(&stuff->configTimestamp); swapl(&stuff->configTimestamp);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRGetScreenResources(client);
} }
static int _X_COLD static int _X_COLD
@ -137,7 +137,7 @@ SProcRRListOutputProperties(ClientPtr client)
REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq); REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq);
swapl(&stuff->output); swapl(&stuff->output);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRListOutputProperties(client);
} }
static int _X_COLD static int _X_COLD
@ -148,7 +148,7 @@ SProcRRQueryOutputProperty(ClientPtr client)
REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq); REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq);
swapl(&stuff->output); swapl(&stuff->output);
swapl(&stuff->property); swapl(&stuff->property);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRQueryOutputProperty(client);
} }
static int _X_COLD static int _X_COLD
@ -160,7 +160,7 @@ SProcRRConfigureOutputProperty(ClientPtr client)
swapl(&stuff->output); swapl(&stuff->output);
swapl(&stuff->property); swapl(&stuff->property);
SwapRestL(stuff); SwapRestL(stuff);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRConfigureOutputProperty(client);
} }
static int _X_COLD static int _X_COLD
@ -186,7 +186,7 @@ SProcRRChangeOutputProperty(ClientPtr client)
client->errorValue = stuff->format; client->errorValue = stuff->format;
return BadValue; return BadValue;
} }
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRChangeOutputProperty(client);
} }
static int _X_COLD static int _X_COLD
@ -197,7 +197,7 @@ SProcRRDeleteOutputProperty(ClientPtr client)
REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq); REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq);
swapl(&stuff->output); swapl(&stuff->output);
swapl(&stuff->property); swapl(&stuff->property);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRDeleteOutputProperty(client);
} }
static int _X_COLD static int _X_COLD
@ -211,7 +211,7 @@ SProcRRGetOutputProperty(ClientPtr client)
swapl(&stuff->type); swapl(&stuff->type);
swapl(&stuff->longOffset); swapl(&stuff->longOffset);
swapl(&stuff->longLength); swapl(&stuff->longLength);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRGetOutputProperty(client);
} }
static int _X_COLD static int _X_COLD
@ -237,7 +237,7 @@ SProcRRCreateMode(ClientPtr client)
swaps(&modeinfo->vTotal); swaps(&modeinfo->vTotal);
swaps(&modeinfo->nameLength); swaps(&modeinfo->nameLength);
swapl(&modeinfo->modeFlags); swapl(&modeinfo->modeFlags);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRCreateMode(client);
} }
static int _X_COLD static int _X_COLD
@ -247,7 +247,7 @@ SProcRRDestroyMode(ClientPtr client)
REQUEST_SIZE_MATCH(xRRDestroyModeReq); REQUEST_SIZE_MATCH(xRRDestroyModeReq);
swapl(&stuff->mode); swapl(&stuff->mode);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRDestroyMode(client);
} }
static int _X_COLD static int _X_COLD
@ -258,7 +258,7 @@ SProcRRAddOutputMode(ClientPtr client)
REQUEST_SIZE_MATCH(xRRAddOutputModeReq); REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
swapl(&stuff->output); swapl(&stuff->output);
swapl(&stuff->mode); swapl(&stuff->mode);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRAddOutputMode(client);
} }
static int _X_COLD static int _X_COLD
@ -269,7 +269,7 @@ SProcRRDeleteOutputMode(ClientPtr client)
REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq); REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
swapl(&stuff->output); swapl(&stuff->output);
swapl(&stuff->mode); swapl(&stuff->mode);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRDeleteOutputMode(client);
} }
static int _X_COLD static int _X_COLD
@ -280,7 +280,7 @@ SProcRRGetCrtcInfo(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
swapl(&stuff->crtc); swapl(&stuff->crtc);
swapl(&stuff->configTimestamp); swapl(&stuff->configTimestamp);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRGetCrtcInfo(client);
} }
static int _X_COLD static int _X_COLD
@ -297,7 +297,7 @@ SProcRRSetCrtcConfig(ClientPtr client)
swapl(&stuff->mode); swapl(&stuff->mode);
swaps(&stuff->rotation); swaps(&stuff->rotation);
SwapRestL(stuff); SwapRestL(stuff);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRSetCrtcConfig(client);
} }
static int _X_COLD static int _X_COLD
@ -307,7 +307,7 @@ SProcRRGetCrtcGammaSize(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq); REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
swapl(&stuff->crtc); swapl(&stuff->crtc);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRGetCrtcGammaSize(client);
} }
static int _X_COLD static int _X_COLD
@ -317,7 +317,7 @@ SProcRRGetCrtcGamma(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq); REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
swapl(&stuff->crtc); swapl(&stuff->crtc);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRGetCrtcGamma(client);
} }
static int _X_COLD static int _X_COLD
@ -329,7 +329,7 @@ SProcRRSetCrtcGamma(ClientPtr client)
swapl(&stuff->crtc); swapl(&stuff->crtc);
swaps(&stuff->size); swaps(&stuff->size);
SwapRestS(stuff); SwapRestS(stuff);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRSetCrtcGamma(client);
} }
static int _X_COLD static int _X_COLD
@ -353,7 +353,7 @@ SProcRRSetCrtcTransform(ClientPtr client)
return BadLength; return BadLength;
SwapLongs(params, nparams); SwapLongs(params, nparams);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRSetCrtcTransform(client);
} }
static int _X_COLD static int _X_COLD
@ -363,7 +363,7 @@ SProcRRGetCrtcTransform(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq); REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq);
swapl(&stuff->crtc); swapl(&stuff->crtc);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRGetCrtcTransform(client);
} }
static int _X_COLD static int _X_COLD
@ -373,7 +373,7 @@ SProcRRGetPanning(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetPanningReq); REQUEST_SIZE_MATCH(xRRGetPanningReq);
swapl(&stuff->crtc); swapl(&stuff->crtc);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRGetPanning(client);
} }
static int _X_COLD static int _X_COLD
@ -396,7 +396,7 @@ SProcRRSetPanning(ClientPtr client)
swaps(&stuff->border_top); swaps(&stuff->border_top);
swaps(&stuff->border_right); swaps(&stuff->border_right);
swaps(&stuff->border_bottom); swaps(&stuff->border_bottom);
return (*ProcRandrVector[stuff->randrReqType]) (client); return ProcRRSetPanning(client);
} }
static int _X_COLD static int _X_COLD
@ -407,7 +407,7 @@ SProcRRSetOutputPrimary(ClientPtr client)
REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq); REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
swapl(&stuff->window); swapl(&stuff->window);
swapl(&stuff->output); swapl(&stuff->output);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRSetOutputPrimary(client);
} }
static int _X_COLD static int _X_COLD
@ -417,7 +417,7 @@ SProcRRGetOutputPrimary(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq); REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
swapl(&stuff->window); swapl(&stuff->window);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRGetOutputPrimary(client);
} }
static int _X_COLD static int _X_COLD
@ -427,7 +427,7 @@ SProcRRGetProviders(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetProvidersReq); REQUEST_SIZE_MATCH(xRRGetProvidersReq);
swapl(&stuff->window); swapl(&stuff->window);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRGetProviders(client);
} }
static int _X_COLD static int _X_COLD
@ -438,7 +438,7 @@ SProcRRGetProviderInfo(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetProviderInfoReq); REQUEST_SIZE_MATCH(xRRGetProviderInfoReq);
swapl(&stuff->provider); swapl(&stuff->provider);
swapl(&stuff->configTimestamp); swapl(&stuff->configTimestamp);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRGetProviderInfo(client);
} }
static int _X_COLD static int _X_COLD
@ -450,7 +450,7 @@ SProcRRSetProviderOffloadSink(ClientPtr client)
swapl(&stuff->provider); swapl(&stuff->provider);
swapl(&stuff->sink_provider); swapl(&stuff->sink_provider);
swapl(&stuff->configTimestamp); swapl(&stuff->configTimestamp);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRSetProviderOffloadSink(client);
} }
static int _X_COLD static int _X_COLD
@ -462,7 +462,7 @@ SProcRRSetProviderOutputSource(ClientPtr client)
swapl(&stuff->provider); swapl(&stuff->provider);
swapl(&stuff->source_provider); swapl(&stuff->source_provider);
swapl(&stuff->configTimestamp); swapl(&stuff->configTimestamp);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRSetProviderOutputSource(client);
} }
static int _X_COLD static int _X_COLD
@ -472,7 +472,7 @@ SProcRRListProviderProperties(ClientPtr client)
REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq); REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq);
swapl(&stuff->provider); swapl(&stuff->provider);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRListProviderProperties(client);
} }
static int _X_COLD static int _X_COLD
@ -483,7 +483,7 @@ SProcRRQueryProviderProperty(ClientPtr client)
REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq); REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq);
swapl(&stuff->provider); swapl(&stuff->provider);
swapl(&stuff->property); swapl(&stuff->property);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRQueryProviderProperty(client);
} }
static int _X_COLD static int _X_COLD
@ -496,7 +496,7 @@ SProcRRConfigureProviderProperty(ClientPtr client)
swapl(&stuff->property); swapl(&stuff->property);
/* TODO: no way to specify format? */ /* TODO: no way to specify format? */
SwapRestL(stuff); SwapRestL(stuff);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRConfigureProviderProperty(client);
} }
static int _X_COLD static int _X_COLD
@ -519,7 +519,7 @@ SProcRRChangeProviderProperty(ClientPtr client)
SwapRestL(stuff); SwapRestL(stuff);
break; break;
} }
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRChangeProviderProperty(client);
} }
static int _X_COLD static int _X_COLD
@ -530,7 +530,7 @@ SProcRRDeleteProviderProperty(ClientPtr client)
REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq); REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq);
swapl(&stuff->provider); swapl(&stuff->provider);
swapl(&stuff->property); swapl(&stuff->property);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRDeleteProviderProperty(client);
} }
static int _X_COLD static int _X_COLD
@ -544,7 +544,7 @@ SProcRRGetProviderProperty(ClientPtr client)
swapl(&stuff->type); swapl(&stuff->type);
swapl(&stuff->longOffset); swapl(&stuff->longOffset);
swapl(&stuff->longLength); swapl(&stuff->longLength);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRGetProviderProperty(client);
} }
static int _X_COLD static int _X_COLD
@ -553,7 +553,7 @@ SProcRRGetMonitors(ClientPtr client) {
REQUEST_SIZE_MATCH(xRRGetMonitorsReq); REQUEST_SIZE_MATCH(xRRGetMonitorsReq);
swapl(&stuff->window); swapl(&stuff->window);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRGetMonitors(client);
} }
static int _X_COLD static int _X_COLD
@ -569,7 +569,7 @@ SProcRRSetMonitor(ClientPtr client) {
swaps(&stuff->monitor.width); swaps(&stuff->monitor.width);
swaps(&stuff->monitor.height); swaps(&stuff->monitor.height);
SwapRestL(stuff); SwapRestL(stuff);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRSetMonitor(client);
} }
static int _X_COLD static int _X_COLD
@ -579,7 +579,7 @@ SProcRRDeleteMonitor(ClientPtr client) {
REQUEST_SIZE_MATCH(xRRDeleteMonitorReq); REQUEST_SIZE_MATCH(xRRDeleteMonitorReq);
swapl(&stuff->window); swapl(&stuff->window);
swapl(&stuff->name); swapl(&stuff->name);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRDeleteMonitor(client);
} }
static int _X_COLD static int _X_COLD
@ -591,7 +591,7 @@ SProcRRCreateLease(ClientPtr client) {
swaps(&stuff->nCrtcs); swaps(&stuff->nCrtcs);
swaps(&stuff->nOutputs); swaps(&stuff->nOutputs);
SwapRestL(stuff); SwapRestL(stuff);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRCreateLease(client);
} }
static int _X_COLD static int _X_COLD
@ -600,7 +600,7 @@ SProcRRFreeLease(ClientPtr client) {
REQUEST_SIZE_MATCH(xRRFreeLeaseReq); REQUEST_SIZE_MATCH(xRRFreeLeaseReq);
swapl(&stuff->lid); swapl(&stuff->lid);
return ProcRandrVector[stuff->randrReqType] (client); return ProcRRFreeLease(client);
} }
int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = { int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = {