(submit/cleanup-vidmode-dispatch) Xext: vidmode: tidy up multi-version request control flow, part 2
Some requests using different structs dependending on which protocol version (v1 vs. v2) had been selected. That's is handled by coverting v1 structs into v2, before proceeding with the actual handling. The code flow of this is very complex and hard to understand. Cleaning this up in several smaller steps, that are easier to digest. This part is splitting the huge request handlers into upper and lower half, where the upper is doing the version check and converting v1 requests into v2, while the lower one is doing the actual request processing, operating on the struct pointer passed in from the upper one, instead of the client struct's request buffer. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
2eaafbbb62
commit
ad6c086e12
|
@ -437,6 +437,8 @@ ProcVidModeGetAllModeLines(ClientPtr client)
|
|||
&& VidModeGetModeValue(mode, VIDMODE_V_TOTAL) == stuff->vtotal \
|
||||
&& VidModeGetModeValue(mode, VIDMODE_FLAGS) == stuff->flags )
|
||||
|
||||
static int VidModeAddModeLine(ClientPtr client, xXF86VidModeAddModeLineReq* stuff);
|
||||
|
||||
static int
|
||||
ProcVidModeAddModeLine(ClientPtr client)
|
||||
{
|
||||
|
@ -444,11 +446,7 @@ ProcVidModeAddModeLine(ClientPtr client)
|
|||
xXF86OldVidModeAddModeLineReq *oldstuff =
|
||||
(xXF86OldVidModeAddModeLineReq *) client->requestBuffer;
|
||||
xXF86VidModeAddModeLineReq newstuff;
|
||||
ScreenPtr pScreen;
|
||||
VidModePtr pVidMode;
|
||||
DisplayModePtr mode;
|
||||
int len;
|
||||
int dotClock;
|
||||
int ver;
|
||||
|
||||
/* limited to local-only connections */
|
||||
|
@ -505,6 +503,16 @@ ProcVidModeAddModeLine(ClientPtr client)
|
|||
stuff->after_vtotal = oldstuff->after_vtotal;
|
||||
stuff->after_flags = oldstuff->after_flags;
|
||||
}
|
||||
return VidModeAddModeLine(client, stuff);
|
||||
}
|
||||
|
||||
static int VidModeAddModeLine(ClientPtr client, xXF86VidModeAddModeLineReq* stuff)
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
DisplayModePtr mode;
|
||||
VidModePtr pVidMode;
|
||||
int dotClock;
|
||||
|
||||
DebugF("AddModeLine - scrn: %d clock: %ld\n",
|
||||
(int) stuff->screen, (unsigned long) stuff->dotclock);
|
||||
DebugF("AddModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
|
||||
|
@ -613,6 +621,9 @@ ProcVidModeAddModeLine(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
VidModeDeleteModeLine(ClientPtr client, xXF86VidModeDeleteModeLineReq* stuff);
|
||||
|
||||
static int
|
||||
ProcVidModeDeleteModeLine(ClientPtr client)
|
||||
{
|
||||
|
@ -620,10 +631,7 @@ ProcVidModeDeleteModeLine(ClientPtr client)
|
|||
xXF86OldVidModeDeleteModeLineReq *oldstuff =
|
||||
(xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer;
|
||||
xXF86VidModeDeleteModeLineReq newstuff;
|
||||
ScreenPtr pScreen;
|
||||
VidModePtr pVidMode;
|
||||
DisplayModePtr mode;
|
||||
int len, dotClock;
|
||||
int len;
|
||||
int ver;
|
||||
|
||||
/* limited to local-only connections */
|
||||
|
@ -681,6 +689,17 @@ ProcVidModeDeleteModeLine(ClientPtr client)
|
|||
stuff->flags = oldstuff->flags;
|
||||
stuff->privsize = oldstuff->privsize;
|
||||
}
|
||||
return VidModeDeleteModeLine(client, stuff);
|
||||
}
|
||||
|
||||
static int
|
||||
VidModeDeleteModeLine(ClientPtr client, xXF86VidModeDeleteModeLineReq* stuff)
|
||||
{
|
||||
int dotClock;
|
||||
DisplayModePtr mode;
|
||||
VidModePtr pVidMode;
|
||||
ScreenPtr pScreen;
|
||||
|
||||
DebugF("DeleteModeLine - scrn: %d clock: %ld\n",
|
||||
(int) stuff->screen, (unsigned long) stuff->dotclock);
|
||||
DebugF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
|
||||
|
@ -748,6 +767,9 @@ ProcVidModeDeleteModeLine(ClientPtr client)
|
|||
return BadValue;
|
||||
}
|
||||
|
||||
static int
|
||||
VidModeModModeLine(ClientPtr client, xXF86VidModeModModeLineReq *stuff);
|
||||
|
||||
static int
|
||||
ProcVidModeModModeLine(ClientPtr client)
|
||||
{
|
||||
|
@ -755,10 +777,7 @@ ProcVidModeModModeLine(ClientPtr client)
|
|||
xXF86OldVidModeModModeLineReq *oldstuff =
|
||||
(xXF86OldVidModeModModeLineReq *) client->requestBuffer;
|
||||
xXF86VidModeModModeLineReq newstuff;
|
||||
ScreenPtr pScreen;
|
||||
VidModePtr pVidMode;
|
||||
DisplayModePtr mode, modetmp;
|
||||
int len, dotClock;
|
||||
int len;
|
||||
int ver;
|
||||
|
||||
/* limited to local-only connections */
|
||||
|
@ -803,6 +822,17 @@ ProcVidModeModModeLine(ClientPtr client)
|
|||
stuff->flags = oldstuff->flags;
|
||||
stuff->privsize = oldstuff->privsize;
|
||||
}
|
||||
return VidModeModModeLine(client, stuff);
|
||||
}
|
||||
|
||||
static int
|
||||
VidModeModModeLine(ClientPtr client, xXF86VidModeModModeLineReq *stuff)
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
VidModePtr pVidMode;
|
||||
DisplayModePtr mode, modetmp;
|
||||
int dotClock;
|
||||
|
||||
DebugF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n",
|
||||
(int) stuff->screen, stuff->hdisplay, stuff->hsyncstart,
|
||||
stuff->hsyncend, stuff->htotal);
|
||||
|
@ -887,6 +917,9 @@ ProcVidModeModModeLine(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
VidModeValidateModeLine(ClientPtr client, xXF86VidModeValidateModeLineReq *stuff);
|
||||
|
||||
static int
|
||||
ProcVidModeValidateModeLine(ClientPtr client)
|
||||
{
|
||||
|
@ -894,11 +927,7 @@ ProcVidModeValidateModeLine(ClientPtr client)
|
|||
xXF86OldVidModeValidateModeLineReq *oldstuff =
|
||||
(xXF86OldVidModeValidateModeLineReq *) client->requestBuffer;
|
||||
xXF86VidModeValidateModeLineReq newstuff;
|
||||
xXF86VidModeValidateModeLineReply rep;
|
||||
ScreenPtr pScreen;
|
||||
VidModePtr pVidMode;
|
||||
DisplayModePtr mode, modetmp = NULL;
|
||||
int len, status, dotClock;
|
||||
int len;
|
||||
int ver;
|
||||
|
||||
DEBUG_P("XF86VidModeValidateModeline");
|
||||
|
@ -939,6 +968,17 @@ ProcVidModeValidateModeLine(ClientPtr client)
|
|||
stuff->flags = oldstuff->flags;
|
||||
stuff->privsize = oldstuff->privsize;
|
||||
}
|
||||
return VidModeValidateModeLine(client, stuff);
|
||||
}
|
||||
|
||||
static int
|
||||
VidModeValidateModeLine(ClientPtr client, xXF86VidModeValidateModeLineReq *stuff)
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
VidModePtr pVidMode;
|
||||
DisplayModePtr mode, modetmp = NULL;
|
||||
int status, dotClock;
|
||||
xXF86VidModeValidateModeLineReply rep = { 0 };
|
||||
|
||||
DebugF("ValidateModeLine - scrn: %d clock: %ld\n",
|
||||
(int) stuff->screen, (unsigned long) stuff->dotclock);
|
||||
|
@ -949,9 +989,6 @@ ProcVidModeValidateModeLine(ClientPtr client)
|
|||
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal,
|
||||
(unsigned long) stuff->flags);
|
||||
|
||||
if (len != stuff->privsize)
|
||||
return BadLength;
|
||||
|
||||
if (stuff->screen >= screenInfo.numScreens)
|
||||
return BadValue;
|
||||
pScreen = screenInfo.screens[stuff->screen];
|
||||
|
@ -1048,6 +1085,9 @@ ProcVidModeSwitchMode(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
VidModeSwitchToMode(ClientPtr client, xXF86VidModeSwitchToModeReq *stuff);
|
||||
|
||||
static int
|
||||
ProcVidModeSwitchToMode(ClientPtr client)
|
||||
{
|
||||
|
@ -1055,10 +1095,7 @@ ProcVidModeSwitchToMode(ClientPtr client)
|
|||
xXF86OldVidModeSwitchToModeReq *oldstuff =
|
||||
(xXF86OldVidModeSwitchToModeReq *) client->requestBuffer;
|
||||
xXF86VidModeSwitchToModeReq newstuff;
|
||||
ScreenPtr pScreen;
|
||||
VidModePtr pVidMode;
|
||||
DisplayModePtr mode;
|
||||
int len, dotClock;
|
||||
int len;
|
||||
int ver;
|
||||
|
||||
DEBUG_P("XF86VidModeSwitchToMode");
|
||||
|
@ -1104,6 +1141,16 @@ ProcVidModeSwitchToMode(ClientPtr client)
|
|||
stuff->flags = oldstuff->flags;
|
||||
stuff->privsize = oldstuff->privsize;
|
||||
}
|
||||
return VidModeSwitchToMode(client, stuff);
|
||||
}
|
||||
|
||||
static int
|
||||
VidModeSwitchToMode(ClientPtr client, xXF86VidModeSwitchToModeReq *stuff)
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
VidModePtr pVidMode;
|
||||
DisplayModePtr mode;
|
||||
int dotClock;
|
||||
|
||||
DebugF("SwitchToMode - scrn: %d clock: %ld\n",
|
||||
(int) stuff->screen, (unsigned long) stuff->dotclock);
|
||||
|
|
Loading…
Reference in New Issue