Xext: vidmode: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping much easier. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
75328e8356
commit
99e8b56421
641
Xext/vidmode.c
641
Xext/vidmode.c
|
@ -36,6 +36,9 @@ from Kaleb S. KEITHLEY
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
#include <X11/extensions/xf86vmproto.h>
|
#include <X11/extensions/xf86vmproto.h>
|
||||||
|
|
||||||
|
#include "dix/request_priv.h"
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "dixstruct.h"
|
#include "dixstruct.h"
|
||||||
#include "extnsionst.h"
|
#include "extnsionst.h"
|
||||||
|
@ -191,7 +194,7 @@ static int
|
||||||
ProcVidModeQueryVersion(ClientPtr client)
|
ProcVidModeQueryVersion(ClientPtr client)
|
||||||
{
|
{
|
||||||
DEBUG_P("XF86VidModeQueryVersion");
|
DEBUG_P("XF86VidModeQueryVersion");
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
|
REQUEST_HEAD_STRUCT(xXF86VidModeQueryVersionReq);
|
||||||
|
|
||||||
xXF86VidModeQueryVersionReply rep = {
|
xXF86VidModeQueryVersionReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
|
@ -214,7 +217,9 @@ ProcVidModeQueryVersion(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeGetModeLine(ClientPtr client)
|
ProcVidModeGetModeLine(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeGetModeLineReq);
|
REQUEST_HEAD_STRUCT(xXF86VidModeGetModeLineReq);
|
||||||
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
DisplayModePtr mode;
|
DisplayModePtr mode;
|
||||||
|
@ -379,7 +384,9 @@ static char *fillModeInfoV2(ClientPtr client, char *buf, int dotClock, DisplayMo
|
||||||
static int
|
static int
|
||||||
ProcVidModeGetAllModeLines(ClientPtr client)
|
ProcVidModeGetAllModeLines(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeGetAllModeLinesReq);
|
REQUEST_HEAD_STRUCT(xXF86VidModeGetAllModeLinesReq);
|
||||||
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
DisplayModePtr mode;
|
DisplayModePtr mode;
|
||||||
|
@ -388,8 +395,6 @@ ProcVidModeGetAllModeLines(ClientPtr client)
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeGetAllModelines");
|
DEBUG_P("XF86VidModeGetAllModelines");
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
|
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
|
@ -461,11 +466,24 @@ ProcVidModeAddModeLine(ClientPtr client)
|
||||||
DEBUG_P("XF86VidModeAddModeline");
|
DEBUG_P("XF86VidModeAddModeline");
|
||||||
|
|
||||||
if (ClientMajorVersion(client) < 2) {
|
if (ClientMajorVersion(client) < 2) {
|
||||||
REQUEST(xXF86OldVidModeAddModeLineReq);
|
REQUEST_HEAD_AT_LEAST(xXF86OldVidModeAddModeLineReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
|
|
||||||
len =
|
len =
|
||||||
client->req_len -
|
client->req_len -
|
||||||
bytes_to_int32(sizeof(xXF86OldVidModeAddModeLineReq));
|
bytes_to_int32(sizeof(xXF86OldVidModeAddModeLineReq));
|
||||||
|
|
||||||
|
REQUEST_FIELD_CARD32(screen);
|
||||||
|
REQUEST_FIELD_CARD16(hdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(htotal);
|
||||||
|
REQUEST_FIELD_CARD16(vdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(vtotal);
|
||||||
|
REQUEST_FIELD_CARD32(flags);
|
||||||
|
REQUEST_FIELD_CARD32(privsize);
|
||||||
|
REQUEST_REST_CARD32();
|
||||||
|
|
||||||
if (len != stuff->privsize)
|
if (len != stuff->privsize)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
|
|
||||||
|
@ -499,13 +517,29 @@ ProcVidModeAddModeLine(ClientPtr client)
|
||||||
return VidModeAddModeLine(client, &newstuff);
|
return VidModeAddModeLine(client, &newstuff);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
REQUEST(xXF86VidModeAddModeLineReq);
|
REQUEST_HEAD_AT_LEAST(xXF86VidModeAddModeLineReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
|
|
||||||
len =
|
len =
|
||||||
client->req_len -
|
client->req_len -
|
||||||
bytes_to_int32(sizeof(xXF86VidModeAddModeLineReq));
|
bytes_to_int32(sizeof(xXF86VidModeAddModeLineReq));
|
||||||
|
|
||||||
|
REQUEST_FIELD_CARD16(length);
|
||||||
|
REQUEST_FIELD_CARD32(screen);
|
||||||
|
REQUEST_FIELD_CARD16(hdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(htotal);
|
||||||
|
REQUEST_FIELD_CARD16(hskew);
|
||||||
|
REQUEST_FIELD_CARD16(vdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(vtotal);
|
||||||
|
REQUEST_FIELD_CARD32(flags);
|
||||||
|
REQUEST_FIELD_CARD32(privsize);
|
||||||
|
REQUEST_REST_CARD32();
|
||||||
|
|
||||||
if (len != stuff->privsize)
|
if (len != stuff->privsize)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
|
|
||||||
return VidModeAddModeLine(client, stuff);
|
return VidModeAddModeLine(client, stuff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -640,8 +674,20 @@ ProcVidModeDeleteModeLine(ClientPtr client)
|
||||||
DEBUG_P("XF86VidModeDeleteModeline");
|
DEBUG_P("XF86VidModeDeleteModeline");
|
||||||
|
|
||||||
if (ClientMajorVersion(client) < 2) {
|
if (ClientMajorVersion(client) < 2) {
|
||||||
REQUEST(xXF86OldVidModeDeleteModeLineReq);
|
REQUEST_HEAD_AT_LEAST(xXF86OldVidModeDeleteModeLineReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
|
REQUEST_FIELD_CARD32(screen);
|
||||||
|
REQUEST_FIELD_CARD16(hdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(htotal);
|
||||||
|
REQUEST_FIELD_CARD16(vdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(vtotal);
|
||||||
|
REQUEST_FIELD_CARD32(flags);
|
||||||
|
REQUEST_FIELD_CARD32(privsize);
|
||||||
|
REQUEST_REST_CARD32();
|
||||||
|
|
||||||
len =
|
len =
|
||||||
client->req_len -
|
client->req_len -
|
||||||
bytes_to_int32(sizeof(xXF86OldVidModeDeleteModeLineReq));
|
bytes_to_int32(sizeof(xXF86OldVidModeDeleteModeLineReq));
|
||||||
|
@ -674,8 +720,21 @@ ProcVidModeDeleteModeLine(ClientPtr client)
|
||||||
return VidModeDeleteModeLine(client, &newstuff);
|
return VidModeDeleteModeLine(client, &newstuff);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
REQUEST(xXF86VidModeDeleteModeLineReq);
|
REQUEST_HEAD_AT_LEAST(xXF86VidModeDeleteModeLineReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
|
REQUEST_FIELD_CARD32(screen);
|
||||||
|
REQUEST_FIELD_CARD16(hdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(htotal);
|
||||||
|
REQUEST_FIELD_CARD16(hskew);
|
||||||
|
REQUEST_FIELD_CARD16(vdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(vtotal);
|
||||||
|
REQUEST_FIELD_CARD32(flags);
|
||||||
|
REQUEST_FIELD_CARD32(privsize);
|
||||||
|
REQUEST_REST_CARD32();
|
||||||
|
|
||||||
len =
|
len =
|
||||||
client->req_len -
|
client->req_len -
|
||||||
bytes_to_int32(sizeof(xXF86VidModeDeleteModeLineReq));
|
bytes_to_int32(sizeof(xXF86VidModeDeleteModeLineReq));
|
||||||
|
@ -779,8 +838,20 @@ ProcVidModeModModeLine(ClientPtr client)
|
||||||
DEBUG_P("XF86VidModeModModeline");
|
DEBUG_P("XF86VidModeModModeline");
|
||||||
|
|
||||||
if (ClientMajorVersion(client) < 2) {
|
if (ClientMajorVersion(client) < 2) {
|
||||||
REQUEST(xXF86OldVidModeModModeLineReq)
|
REQUEST_HEAD_AT_LEAST(xXF86OldVidModeModModeLineReq)
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
|
REQUEST_FIELD_CARD32(screen);
|
||||||
|
REQUEST_FIELD_CARD16(hdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(htotal);
|
||||||
|
REQUEST_FIELD_CARD16(vdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(vtotal);
|
||||||
|
REQUEST_FIELD_CARD32(flags);
|
||||||
|
REQUEST_FIELD_CARD32(privsize);
|
||||||
|
REQUEST_REST_CARD32();
|
||||||
|
|
||||||
int len =
|
int len =
|
||||||
client->req_len -
|
client->req_len -
|
||||||
bytes_to_int32(sizeof(xXF86OldVidModeModModeLineReq));
|
bytes_to_int32(sizeof(xXF86OldVidModeModModeLineReq));
|
||||||
|
@ -806,8 +877,21 @@ ProcVidModeModModeLine(ClientPtr client)
|
||||||
return VidModeModModeLine(client, &newstuff);
|
return VidModeModModeLine(client, &newstuff);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
REQUEST(xXF86VidModeModModeLineReq);
|
REQUEST_HEAD_AT_LEAST(xXF86VidModeModModeLineReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
|
REQUEST_FIELD_CARD32(screen);
|
||||||
|
REQUEST_FIELD_CARD16(hdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(htotal);
|
||||||
|
REQUEST_FIELD_CARD16(hskew);
|
||||||
|
REQUEST_FIELD_CARD16(vdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(vtotal);
|
||||||
|
REQUEST_FIELD_CARD32(flags);
|
||||||
|
REQUEST_FIELD_CARD32(privsize);
|
||||||
|
REQUEST_REST_CARD32();
|
||||||
|
|
||||||
int len =
|
int len =
|
||||||
client->req_len -
|
client->req_len -
|
||||||
bytes_to_int32(sizeof(xXF86VidModeModModeLineReq));
|
bytes_to_int32(sizeof(xXF86VidModeModModeLineReq));
|
||||||
|
@ -923,8 +1007,20 @@ ProcVidModeValidateModeLine(ClientPtr client)
|
||||||
DEBUG_P("XF86VidModeValidateModeline");
|
DEBUG_P("XF86VidModeValidateModeline");
|
||||||
|
|
||||||
if (ClientMajorVersion(client) < 2) {
|
if (ClientMajorVersion(client) < 2) {
|
||||||
REQUEST(xXF86OldVidModeValidateModeLineReq);
|
REQUEST_HEAD_AT_LEAST(xXF86OldVidModeValidateModeLineReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
|
REQUEST_FIELD_CARD32(screen);
|
||||||
|
REQUEST_FIELD_CARD16(hdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(htotal);
|
||||||
|
REQUEST_FIELD_CARD16(vdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(vtotal);
|
||||||
|
REQUEST_FIELD_CARD32(flags);
|
||||||
|
REQUEST_FIELD_CARD32(privsize);
|
||||||
|
REQUEST_REST_CARD32();
|
||||||
|
|
||||||
len = client->req_len -
|
len = client->req_len -
|
||||||
bytes_to_int32(sizeof(xXF86OldVidModeValidateModeLineReq));
|
bytes_to_int32(sizeof(xXF86OldVidModeValidateModeLineReq));
|
||||||
if (len != stuff->privsize)
|
if (len != stuff->privsize)
|
||||||
|
@ -949,8 +1045,21 @@ ProcVidModeValidateModeLine(ClientPtr client)
|
||||||
return VidModeValidateModeLine(client, &newstuff);
|
return VidModeValidateModeLine(client, &newstuff);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
REQUEST(xXF86VidModeValidateModeLineReq);
|
REQUEST_HEAD_AT_LEAST(xXF86VidModeValidateModeLineReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
|
REQUEST_FIELD_CARD32(screen);
|
||||||
|
REQUEST_FIELD_CARD16(hdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(hsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(htotal);
|
||||||
|
REQUEST_FIELD_CARD16(hskew);
|
||||||
|
REQUEST_FIELD_CARD16(vdisplay);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncstart);
|
||||||
|
REQUEST_FIELD_CARD16(vsyncend);
|
||||||
|
REQUEST_FIELD_CARD16(vtotal);
|
||||||
|
REQUEST_FIELD_CARD32(flags);
|
||||||
|
REQUEST_FIELD_CARD32(privsize);
|
||||||
|
REQUEST_REST_CARD32();
|
||||||
|
|
||||||
len =
|
len =
|
||||||
client->req_len -
|
client->req_len -
|
||||||
bytes_to_int32(sizeof(xXF86VidModeValidateModeLineReq));
|
bytes_to_int32(sizeof(xXF86VidModeValidateModeLineReq));
|
||||||
|
@ -1051,14 +1160,15 @@ VidModeValidateModeLine(ClientPtr client, xXF86VidModeValidateModeLineReq *stuff
|
||||||
static int
|
static int
|
||||||
ProcVidModeSwitchMode(ClientPtr client)
|
ProcVidModeSwitchMode(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeSwitchModeReq);
|
REQUEST_HEAD_STRUCT(xXF86VidModeSwitchModeReq);
|
||||||
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
REQUEST_FIELD_CARD16(zoom);
|
||||||
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeSwitchMode");
|
DEBUG_P("XF86VidModeSwitchMode");
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
|
|
||||||
|
|
||||||
/* limited to local-only connections */
|
/* limited to local-only connections */
|
||||||
if (!VidModeAllowNonLocal && !client->local)
|
if (!VidModeAllowNonLocal && !client->local)
|
||||||
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
@ -1091,8 +1201,9 @@ ProcVidModeSwitchToMode(ClientPtr client)
|
||||||
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
|
||||||
if (ClientMajorVersion(client) < 2) {
|
if (ClientMajorVersion(client) < 2) {
|
||||||
REQUEST(xXF86OldVidModeSwitchToModeReq);
|
REQUEST_HEAD_AT_LEAST(xXF86OldVidModeSwitchToModeReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq);
|
REQUEST_FIELD_CARD32(screen);
|
||||||
|
|
||||||
len =
|
len =
|
||||||
client->req_len -
|
client->req_len -
|
||||||
bytes_to_int32(sizeof(xXF86OldVidModeSwitchToModeReq));
|
bytes_to_int32(sizeof(xXF86OldVidModeSwitchToModeReq));
|
||||||
|
@ -1118,8 +1229,9 @@ ProcVidModeSwitchToMode(ClientPtr client)
|
||||||
return VidModeSwitchToMode(client, &newstuff);
|
return VidModeSwitchToMode(client, &newstuff);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
REQUEST(xXF86VidModeSwitchToModeReq);
|
REQUEST_HEAD_AT_LEAST(xXF86VidModeSwitchToModeReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq);
|
REQUEST_FIELD_CARD32(screen);
|
||||||
|
|
||||||
len =
|
len =
|
||||||
client->req_len -
|
client->req_len -
|
||||||
bytes_to_int32(sizeof(xXF86VidModeSwitchToModeReq));
|
bytes_to_int32(sizeof(xXF86VidModeSwitchToModeReq));
|
||||||
|
@ -1196,12 +1308,13 @@ VidModeSwitchToMode(ClientPtr client, xXF86VidModeSwitchToModeReq *stuff)
|
||||||
static int
|
static int
|
||||||
ProcVidModeLockModeSwitch(ClientPtr client)
|
ProcVidModeLockModeSwitch(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeLockModeSwitchReq);
|
REQUEST_HEAD_STRUCT(xXF86VidModeLockModeSwitchReq);
|
||||||
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
REQUEST_FIELD_CARD16(lock);
|
||||||
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
|
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeLockModeSwitch");
|
DEBUG_P("XF86VidModeLockModeSwitch");
|
||||||
|
|
||||||
/* limited to local-only connections */
|
/* limited to local-only connections */
|
||||||
|
@ -1225,16 +1338,15 @@ ProcVidModeLockModeSwitch(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeGetMonitor(ClientPtr client)
|
ProcVidModeGetMonitor(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeGetMonitorReq);
|
REQUEST_HEAD_STRUCT(xXF86VidModeGetMonitorReq);
|
||||||
CARD32 *hsyncdata, *vsyncdata;
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
int i, nHsync, nVrefresh, vendorLength = 0, modelLength = 0;
|
int i, nHsync, nVrefresh, vendorLength = 0, modelLength = 0;
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeGetMonitor");
|
DEBUG_P("XF86VidModeGetMonitor");
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
|
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
|
@ -1274,7 +1386,7 @@ ProcVidModeGetMonitor(ClientPtr client)
|
||||||
if (!hsyncdata) {
|
if (!hsyncdata) {
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
vsyncdata = &hsyncdata[nHsync];
|
CARD32 *vsyncdata = &hsyncdata[nHsync];
|
||||||
|
|
||||||
for (i = 0; i < nHsync; i++) {
|
for (i = 0; i < nHsync; i++) {
|
||||||
hsyncdata[i] = (unsigned short) (pVidMode->GetMonitorValue(pScreen,
|
hsyncdata[i] = (unsigned short) (pVidMode->GetMonitorValue(pScreen,
|
||||||
|
@ -1308,15 +1420,15 @@ ProcVidModeGetMonitor(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeGetViewPort(ClientPtr client)
|
ProcVidModeGetViewPort(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeGetViewPortReq);
|
REQUEST_HEAD_STRUCT(xXF86VidModeGetViewPortReq);
|
||||||
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeGetViewPort");
|
DEBUG_P("XF86VidModeGetViewPort");
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
|
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
|
@ -1347,14 +1459,16 @@ ProcVidModeGetViewPort(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeSetViewPort(ClientPtr client)
|
ProcVidModeSetViewPort(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeSetViewPortReq);
|
REQUEST_HEAD_STRUCT(xXF86VidModeSetViewPortReq);
|
||||||
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
REQUEST_FIELD_CARD32(x);
|
||||||
|
REQUEST_FIELD_CARD32(y);
|
||||||
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeSetViewPort");
|
DEBUG_P("XF86VidModeSetViewPort");
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
|
|
||||||
|
|
||||||
/* limited to local-only connections */
|
/* limited to local-only connections */
|
||||||
if (!VidModeAllowNonLocal && !client->local)
|
if (!VidModeAllowNonLocal && !client->local)
|
||||||
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
@ -1376,7 +1490,9 @@ ProcVidModeSetViewPort(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeGetDotClocks(ClientPtr client)
|
ProcVidModeGetDotClocks(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeGetDotClocksReq);
|
REQUEST_HEAD_STRUCT(xXF86VidModeGetDotClocksReq);
|
||||||
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
int n;
|
int n;
|
||||||
|
@ -1387,8 +1503,6 @@ ProcVidModeGetDotClocks(ClientPtr client)
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeGetDotClocks");
|
DEBUG_P("XF86VidModeGetDotClocks");
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
|
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
|
@ -1441,14 +1555,17 @@ ProcVidModeGetDotClocks(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeSetGamma(ClientPtr client)
|
ProcVidModeSetGamma(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeSetGammaReq);
|
REQUEST_HEAD_STRUCT(xXF86VidModeSetGammaReq);
|
||||||
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
REQUEST_FIELD_CARD32(red);
|
||||||
|
REQUEST_FIELD_CARD32(green);
|
||||||
|
REQUEST_FIELD_CARD32(blue);
|
||||||
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeSetGamma");
|
DEBUG_P("XF86VidModeSetGamma");
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
|
|
||||||
|
|
||||||
/* limited to local-only connections */
|
/* limited to local-only connections */
|
||||||
if (!VidModeAllowNonLocal && !client->local)
|
if (!VidModeAllowNonLocal && !client->local)
|
||||||
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
@ -1472,15 +1589,15 @@ ProcVidModeSetGamma(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeGetGamma(ClientPtr client)
|
ProcVidModeGetGamma(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeGetGammaReq);
|
REQUEST_HEAD_STRUCT(xXF86VidModeGetGammaReq);
|
||||||
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
float red, green, blue;
|
float red, green, blue;
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeGetGamma");
|
DEBUG_P("XF86VidModeGetGamma");
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
|
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
|
@ -1514,6 +1631,14 @@ ProcVidModeGetGamma(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeSetGammaRamp(ClientPtr client)
|
ProcVidModeSetGammaRamp(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_AT_LEAST(xXF86VidModeSetGammaRampReq);
|
||||||
|
REQUEST_FIELD_CARD16(size);
|
||||||
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
|
||||||
|
int l = ((stuff->size + 1) & ~1) * 6;
|
||||||
|
REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, l);
|
||||||
|
REQUEST_REST_CARD16();
|
||||||
|
|
||||||
CARD16 *r, *g, *b;
|
CARD16 *r, *g, *b;
|
||||||
int length;
|
int length;
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
|
@ -1523,9 +1648,6 @@ ProcVidModeSetGammaRamp(ClientPtr client)
|
||||||
if (!VidModeAllowNonLocal && !client->local)
|
if (!VidModeAllowNonLocal && !client->local)
|
||||||
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
|
||||||
REQUEST(xXF86VidModeSetGammaRampReq);
|
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
|
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
|
@ -1554,16 +1676,16 @@ ProcVidModeSetGammaRamp(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeGetGammaRamp(ClientPtr client)
|
ProcVidModeGetGammaRamp(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xXF86VidModeGetGammaRampReq);
|
||||||
|
REQUEST_FIELD_CARD16(size);
|
||||||
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
|
||||||
CARD16 *ramp = NULL;
|
CARD16 *ramp = NULL;
|
||||||
int length;
|
int length;
|
||||||
size_t ramplen = 0;
|
size_t ramplen = 0;
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
|
|
||||||
REQUEST(xXF86VidModeGetGammaRampReq);
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
|
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
|
@ -1615,13 +1737,12 @@ ProcVidModeGetGammaRamp(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeGetGammaRampSize(ClientPtr client)
|
ProcVidModeGetGammaRampSize(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xXF86VidModeGetGammaRampSizeReq);
|
||||||
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
|
|
||||||
REQUEST(xXF86VidModeGetGammaRampSizeReq);
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
|
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
|
@ -1648,8 +1769,8 @@ ProcVidModeGetGammaRampSize(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeGetPermissions(ClientPtr client)
|
ProcVidModeGetPermissions(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeGetPermissionsReq);
|
REQUEST_HEAD_STRUCT(xXF86VidModeGetPermissionsReq);
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
|
REQUEST_FIELD_CARD16(screen);
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
@ -1675,14 +1796,14 @@ ProcVidModeGetPermissions(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeSetClientVersion(ClientPtr client)
|
ProcVidModeSetClientVersion(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeSetClientVersionReq);
|
REQUEST_HEAD_STRUCT(xXF86VidModeSetClientVersionReq);
|
||||||
|
REQUEST_FIELD_CARD16(major);
|
||||||
|
REQUEST_FIELD_CARD16(minor);
|
||||||
|
|
||||||
VidModePrivPtr pPriv;
|
VidModePrivPtr pPriv;
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeSetClientVersion");
|
DEBUG_P("XF86VidModeSetClientVersion");
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
|
|
||||||
|
|
||||||
if ((pPriv = VM_GETPRIV(client)) == NULL) {
|
if ((pPriv = VM_GETPRIV(client)) == NULL) {
|
||||||
pPriv = calloc(1, sizeof(VidModePrivRec));
|
pPriv = calloc(1, sizeof(VidModePrivRec));
|
||||||
if (!pPriv)
|
if (!pPriv)
|
||||||
|
@ -1696,6 +1817,7 @@ ProcVidModeSetClientVersion(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcVidModeDispatch(ClientPtr client)
|
ProcVidModeDispatch(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -1748,389 +1870,6 @@ ProcVidModeDispatch(ClientPtr client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeGetModeLine(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeGetModeLineReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
return ProcVidModeGetModeLine(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeGetAllModeLines(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeGetAllModeLinesReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
return ProcVidModeGetAllModeLines(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeAddModeLine(ClientPtr client)
|
|
||||||
{
|
|
||||||
xXF86OldVidModeAddModeLineReq *oldstuff =
|
|
||||||
(xXF86OldVidModeAddModeLineReq *) client->requestBuffer;
|
|
||||||
int ver;
|
|
||||||
|
|
||||||
REQUEST(xXF86VidModeAddModeLineReq);
|
|
||||||
ver = ClientMajorVersion(client);
|
|
||||||
if (ver < 2) {
|
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
|
|
||||||
swapl(&oldstuff->screen);
|
|
||||||
swaps(&oldstuff->hdisplay);
|
|
||||||
swaps(&oldstuff->hsyncstart);
|
|
||||||
swaps(&oldstuff->hsyncend);
|
|
||||||
swaps(&oldstuff->htotal);
|
|
||||||
swaps(&oldstuff->vdisplay);
|
|
||||||
swaps(&oldstuff->vsyncstart);
|
|
||||||
swaps(&oldstuff->vsyncend);
|
|
||||||
swaps(&oldstuff->vtotal);
|
|
||||||
swapl(&oldstuff->flags);
|
|
||||||
swapl(&oldstuff->privsize);
|
|
||||||
SwapRestL(oldstuff);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
|
|
||||||
swapl(&stuff->screen);
|
|
||||||
swaps(&stuff->hdisplay);
|
|
||||||
swaps(&stuff->hsyncstart);
|
|
||||||
swaps(&stuff->hsyncend);
|
|
||||||
swaps(&stuff->htotal);
|
|
||||||
swaps(&stuff->hskew);
|
|
||||||
swaps(&stuff->vdisplay);
|
|
||||||
swaps(&stuff->vsyncstart);
|
|
||||||
swaps(&stuff->vsyncend);
|
|
||||||
swaps(&stuff->vtotal);
|
|
||||||
swapl(&stuff->flags);
|
|
||||||
swapl(&stuff->privsize);
|
|
||||||
SwapRestL(stuff);
|
|
||||||
}
|
|
||||||
return ProcVidModeAddModeLine(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeDeleteModeLine(ClientPtr client)
|
|
||||||
{
|
|
||||||
xXF86OldVidModeDeleteModeLineReq *oldstuff =
|
|
||||||
(xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer;
|
|
||||||
int ver;
|
|
||||||
|
|
||||||
REQUEST(xXF86VidModeDeleteModeLineReq);
|
|
||||||
ver = ClientMajorVersion(client);
|
|
||||||
if (ver < 2) {
|
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
|
|
||||||
swapl(&oldstuff->screen);
|
|
||||||
swaps(&oldstuff->hdisplay);
|
|
||||||
swaps(&oldstuff->hsyncstart);
|
|
||||||
swaps(&oldstuff->hsyncend);
|
|
||||||
swaps(&oldstuff->htotal);
|
|
||||||
swaps(&oldstuff->vdisplay);
|
|
||||||
swaps(&oldstuff->vsyncstart);
|
|
||||||
swaps(&oldstuff->vsyncend);
|
|
||||||
swaps(&oldstuff->vtotal);
|
|
||||||
swapl(&oldstuff->flags);
|
|
||||||
swapl(&oldstuff->privsize);
|
|
||||||
SwapRestL(oldstuff);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
|
|
||||||
swapl(&stuff->screen);
|
|
||||||
swaps(&stuff->hdisplay);
|
|
||||||
swaps(&stuff->hsyncstart);
|
|
||||||
swaps(&stuff->hsyncend);
|
|
||||||
swaps(&stuff->htotal);
|
|
||||||
swaps(&stuff->hskew);
|
|
||||||
swaps(&stuff->vdisplay);
|
|
||||||
swaps(&stuff->vsyncstart);
|
|
||||||
swaps(&stuff->vsyncend);
|
|
||||||
swaps(&stuff->vtotal);
|
|
||||||
swapl(&stuff->flags);
|
|
||||||
swapl(&stuff->privsize);
|
|
||||||
SwapRestL(stuff);
|
|
||||||
}
|
|
||||||
return ProcVidModeDeleteModeLine(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeModModeLine(ClientPtr client)
|
|
||||||
{
|
|
||||||
xXF86OldVidModeModModeLineReq *oldstuff =
|
|
||||||
(xXF86OldVidModeModModeLineReq *) client->requestBuffer;
|
|
||||||
int ver;
|
|
||||||
|
|
||||||
REQUEST(xXF86VidModeModModeLineReq);
|
|
||||||
ver = ClientMajorVersion(client);
|
|
||||||
if (ver < 2) {
|
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
|
|
||||||
swapl(&oldstuff->screen);
|
|
||||||
swaps(&oldstuff->hdisplay);
|
|
||||||
swaps(&oldstuff->hsyncstart);
|
|
||||||
swaps(&oldstuff->hsyncend);
|
|
||||||
swaps(&oldstuff->htotal);
|
|
||||||
swaps(&oldstuff->vdisplay);
|
|
||||||
swaps(&oldstuff->vsyncstart);
|
|
||||||
swaps(&oldstuff->vsyncend);
|
|
||||||
swaps(&oldstuff->vtotal);
|
|
||||||
swapl(&oldstuff->flags);
|
|
||||||
swapl(&oldstuff->privsize);
|
|
||||||
SwapRestL(oldstuff);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
|
|
||||||
swapl(&stuff->screen);
|
|
||||||
swaps(&stuff->hdisplay);
|
|
||||||
swaps(&stuff->hsyncstart);
|
|
||||||
swaps(&stuff->hsyncend);
|
|
||||||
swaps(&stuff->htotal);
|
|
||||||
swaps(&stuff->hskew);
|
|
||||||
swaps(&stuff->vdisplay);
|
|
||||||
swaps(&stuff->vsyncstart);
|
|
||||||
swaps(&stuff->vsyncend);
|
|
||||||
swaps(&stuff->vtotal);
|
|
||||||
swapl(&stuff->flags);
|
|
||||||
swapl(&stuff->privsize);
|
|
||||||
SwapRestL(stuff);
|
|
||||||
}
|
|
||||||
return ProcVidModeModModeLine(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeValidateModeLine(ClientPtr client)
|
|
||||||
{
|
|
||||||
xXF86OldVidModeValidateModeLineReq *oldstuff =
|
|
||||||
(xXF86OldVidModeValidateModeLineReq *) client->requestBuffer;
|
|
||||||
int ver;
|
|
||||||
|
|
||||||
REQUEST(xXF86VidModeValidateModeLineReq);
|
|
||||||
ver = ClientMajorVersion(client);
|
|
||||||
if (ver < 2) {
|
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
|
|
||||||
swapl(&oldstuff->screen);
|
|
||||||
swaps(&oldstuff->hdisplay);
|
|
||||||
swaps(&oldstuff->hsyncstart);
|
|
||||||
swaps(&oldstuff->hsyncend);
|
|
||||||
swaps(&oldstuff->htotal);
|
|
||||||
swaps(&oldstuff->vdisplay);
|
|
||||||
swaps(&oldstuff->vsyncstart);
|
|
||||||
swaps(&oldstuff->vsyncend);
|
|
||||||
swaps(&oldstuff->vtotal);
|
|
||||||
swapl(&oldstuff->flags);
|
|
||||||
swapl(&oldstuff->privsize);
|
|
||||||
SwapRestL(oldstuff);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
|
|
||||||
swapl(&stuff->screen);
|
|
||||||
swaps(&stuff->hdisplay);
|
|
||||||
swaps(&stuff->hsyncstart);
|
|
||||||
swaps(&stuff->hsyncend);
|
|
||||||
swaps(&stuff->htotal);
|
|
||||||
swaps(&stuff->hskew);
|
|
||||||
swaps(&stuff->vdisplay);
|
|
||||||
swaps(&stuff->vsyncstart);
|
|
||||||
swaps(&stuff->vsyncend);
|
|
||||||
swaps(&stuff->vtotal);
|
|
||||||
swapl(&stuff->flags);
|
|
||||||
swapl(&stuff->privsize);
|
|
||||||
SwapRestL(stuff);
|
|
||||||
}
|
|
||||||
return ProcVidModeValidateModeLine(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeSwitchMode(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeSwitchModeReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
swaps(&stuff->zoom);
|
|
||||||
return ProcVidModeSwitchMode(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeSwitchToMode(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeSwitchToModeReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
|
|
||||||
swapl(&stuff->screen);
|
|
||||||
return ProcVidModeSwitchToMode(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeLockModeSwitch(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeLockModeSwitchReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
swaps(&stuff->lock);
|
|
||||||
return ProcVidModeLockModeSwitch(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeGetMonitor(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeGetMonitorReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
return ProcVidModeGetMonitor(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeGetViewPort(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeGetViewPortReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
return ProcVidModeGetViewPort(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeSetViewPort(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeSetViewPortReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
swapl(&stuff->x);
|
|
||||||
swapl(&stuff->y);
|
|
||||||
return ProcVidModeSetViewPort(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeGetDotClocks(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeGetDotClocksReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
return ProcVidModeGetDotClocks(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeSetClientVersion(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeSetClientVersionReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
|
|
||||||
swaps(&stuff->major);
|
|
||||||
swaps(&stuff->minor);
|
|
||||||
return ProcVidModeSetClientVersion(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeSetGamma(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeSetGammaReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
swapl(&stuff->red);
|
|
||||||
swapl(&stuff->green);
|
|
||||||
swapl(&stuff->blue);
|
|
||||||
return ProcVidModeSetGamma(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeGetGamma(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeGetGammaReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
return ProcVidModeGetGamma(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeSetGammaRamp(ClientPtr client)
|
|
||||||
{
|
|
||||||
int length;
|
|
||||||
|
|
||||||
REQUEST(xXF86VidModeSetGammaRampReq);
|
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
|
|
||||||
swaps(&stuff->size);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
length = ((stuff->size + 1) & ~1) * 6;
|
|
||||||
REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
|
|
||||||
SwapRestS(stuff);
|
|
||||||
return ProcVidModeSetGammaRamp(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeGetGammaRamp(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeGetGammaRampReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
|
|
||||||
swaps(&stuff->size);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
return ProcVidModeGetGammaRamp(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeGetGammaRampSize(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeGetGammaRampSizeReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
return ProcVidModeGetGammaRampSize(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeGetPermissions(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXF86VidModeGetPermissionsReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
|
|
||||||
swaps(&stuff->screen);
|
|
||||||
return ProcVidModeGetPermissions(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcVidModeDispatch(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xReq);
|
|
||||||
switch (stuff->data) {
|
|
||||||
case X_XF86VidModeQueryVersion:
|
|
||||||
return ProcVidModeQueryVersion(client);
|
|
||||||
case X_XF86VidModeGetModeLine:
|
|
||||||
return SProcVidModeGetModeLine(client);
|
|
||||||
case X_XF86VidModeGetMonitor:
|
|
||||||
return SProcVidModeGetMonitor(client);
|
|
||||||
case X_XF86VidModeGetAllModeLines:
|
|
||||||
return SProcVidModeGetAllModeLines(client);
|
|
||||||
case X_XF86VidModeGetViewPort:
|
|
||||||
return SProcVidModeGetViewPort(client);
|
|
||||||
case X_XF86VidModeValidateModeLine:
|
|
||||||
return SProcVidModeValidateModeLine(client);
|
|
||||||
case X_XF86VidModeGetDotClocks:
|
|
||||||
return SProcVidModeGetDotClocks(client);
|
|
||||||
case X_XF86VidModeSetClientVersion:
|
|
||||||
return SProcVidModeSetClientVersion(client);
|
|
||||||
case X_XF86VidModeGetGamma:
|
|
||||||
return SProcVidModeGetGamma(client);
|
|
||||||
case X_XF86VidModeGetGammaRamp:
|
|
||||||
return SProcVidModeGetGammaRamp(client);
|
|
||||||
case X_XF86VidModeGetGammaRampSize:
|
|
||||||
return SProcVidModeGetGammaRampSize(client);
|
|
||||||
case X_XF86VidModeGetPermissions:
|
|
||||||
return SProcVidModeGetPermissions(client);
|
|
||||||
case X_XF86VidModeAddModeLine:
|
|
||||||
return SProcVidModeAddModeLine(client);
|
|
||||||
case X_XF86VidModeDeleteModeLine:
|
|
||||||
return SProcVidModeDeleteModeLine(client);
|
|
||||||
case X_XF86VidModeModModeLine:
|
|
||||||
return SProcVidModeModModeLine(client);
|
|
||||||
case X_XF86VidModeSwitchMode:
|
|
||||||
return SProcVidModeSwitchMode(client);
|
|
||||||
case X_XF86VidModeSwitchToMode:
|
|
||||||
return SProcVidModeSwitchToMode(client);
|
|
||||||
case X_XF86VidModeLockModeSwitch:
|
|
||||||
return SProcVidModeLockModeSwitch(client);
|
|
||||||
case X_XF86VidModeSetViewPort:
|
|
||||||
return SProcVidModeSetViewPort(client);
|
|
||||||
case X_XF86VidModeSetGamma:
|
|
||||||
return SProcVidModeSetGamma(client);
|
|
||||||
case X_XF86VidModeSetGammaRamp:
|
|
||||||
return SProcVidModeSetGammaRamp(client);
|
|
||||||
default:
|
|
||||||
return BadRequest;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VidModeAddExtension(Bool allow_non_local)
|
VidModeAddExtension(Bool allow_non_local)
|
||||||
{
|
{
|
||||||
|
@ -2145,7 +1884,7 @@ VidModeAddExtension(Bool allow_non_local)
|
||||||
XF86VidModeNumberEvents,
|
XF86VidModeNumberEvents,
|
||||||
XF86VidModeNumberErrors,
|
XF86VidModeNumberErrors,
|
||||||
ProcVidModeDispatch,
|
ProcVidModeDispatch,
|
||||||
SProcVidModeDispatch,
|
ProcVidModeDispatch,
|
||||||
NULL, StandardMinorOpcode))) {
|
NULL, StandardMinorOpcode))) {
|
||||||
VidModeErrorBase = extEntry->errorBase;
|
VidModeErrorBase = extEntry->errorBase;
|
||||||
VidModeAllowNonLocal = allow_non_local;
|
VidModeAllowNonLocal = allow_non_local;
|
||||||
|
|
Loading…
Reference in New Issue