2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Copyright 1995 Kaleb S. KEITHLEY
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
a copy of this software and associated documentation files (the
|
|
|
|
"Software"), to deal in the Software without restriction, including
|
|
|
|
without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be
|
|
|
|
included in all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES
|
|
|
|
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
Except as contained in this notice, the name of Kaleb S. KEITHLEY
|
|
|
|
shall not be used in advertising or otherwise to promote the sale, use
|
|
|
|
or other dealings in this Software without prior written authorization
|
|
|
|
from Kaleb S. KEITHLEY
|
|
|
|
|
|
|
|
*/
|
|
|
|
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
|
|
|
|
|
|
|
|
#ifdef HAVE_XORG_CONFIG_H
|
|
|
|
#include <xorg-config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xproto.h>
|
|
|
|
#include "misc.h"
|
|
|
|
#include "dixstruct.h"
|
|
|
|
#include "extnsionst.h"
|
2013-06-07 11:28:45 -06:00
|
|
|
#include "xf86Extensions.h"
|
2006-11-26 11:13:41 -07:00
|
|
|
#include "scrnintstr.h"
|
|
|
|
#include "servermd.h"
|
2010-07-27 13:02:24 -06:00
|
|
|
#include <X11/extensions/xf86vmproto.h>
|
2006-11-26 11:13:41 -07:00
|
|
|
#include "swaprep.h"
|
|
|
|
#include "xf86.h"
|
|
|
|
#include "vidmodeproc.h"
|
2009-09-06 13:44:18 -06:00
|
|
|
#include "globals.h"
|
2010-07-27 13:02:24 -06:00
|
|
|
#include "protocol-versions.h"
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
#define DEFAULT_XF86VIDMODE_VERBOSITY 3
|
|
|
|
|
|
|
|
static int VidModeErrorBase;
|
2010-12-05 08:36:02 -07:00
|
|
|
static DevPrivateKeyRec VidModeClientPrivateKeyRec;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
#define VidModeClientPrivateKey (&VidModeClientPrivateKeyRec)
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/* This holds the client's version information */
|
|
|
|
typedef struct {
|
2012-06-10 07:21:05 -06:00
|
|
|
int major;
|
|
|
|
int minor;
|
2006-11-26 11:13:41 -07:00
|
|
|
} VidModePrivRec, *VidModePrivPtr;
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
#define VM_GETPRIV(c) ((VidModePrivPtr) \
|
|
|
|
dixLookupPrivate(&(c)->devPrivates, VidModeClientPrivateKey))
|
|
|
|
#define VM_SETPRIV(c,p) \
|
|
|
|
dixSetPrivate(&(c)->devPrivates, VidModeClientPrivateKey, p)
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
static unsigned char XF86VidModeReqCode = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The XF86VIDMODE_EVENTS code is far from complete */
|
|
|
|
|
|
|
|
#ifdef XF86VIDMODE_EVENTS
|
|
|
|
static int XF86VidModeEventBase = 0;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static void SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * /* from */ , xXF86VidModeNotifyEvent * /* to */
|
|
|
|
);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static RESTYPE EventType; /* resource type for event masks */
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
typedef struct _XF86VidModeEvent *XF86VidModeEventPtr;
|
|
|
|
|
|
|
|
typedef struct _XF86VidModeEvent {
|
2012-06-10 07:21:05 -06:00
|
|
|
XF86VidModeEventPtr next;
|
|
|
|
ClientPtr client;
|
|
|
|
ScreenPtr screen;
|
|
|
|
XID resource;
|
|
|
|
CARD32 mask;
|
2006-11-26 11:13:41 -07:00
|
|
|
} XF86VidModeEventRec;
|
|
|
|
|
|
|
|
static int XF86VidModeFreeEvents();
|
|
|
|
|
|
|
|
typedef struct _XF86VidModeScreenPrivate {
|
2012-06-10 07:21:05 -06:00
|
|
|
XF86VidModeEventPtr events;
|
|
|
|
Bool hasWindow;
|
2006-11-26 11:13:41 -07:00
|
|
|
} XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
static DevPrivateKeyRec ScreenPrivateKeyRec;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
#define ScreenPrivateKey (&ScreenPrivateKeyRec)
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
|
|
|
|
dixLookupPrivate(&(s)->devPrivates, ScreenPrivateKey))
|
|
|
|
#define SetScreenPrivate(s,v) \
|
|
|
|
dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v)
|
2006-11-26 11:13:41 -07:00
|
|
|
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s)
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
#define New(t) (malloc(sizeof (t)))
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2012-06-10 07:21:05 -06:00
|
|
|
#define DEBUG_P(x) ErrorF(x"\n");
|
2006-11-26 11:13:41 -07:00
|
|
|
#else
|
2012-06-10 07:21:05 -06:00
|
|
|
#define DEBUG_P(x) /**/
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
2012-06-10 07:21:05 -06:00
|
|
|
static int
|
2006-11-26 11:13:41 -07:00
|
|
|
ClientMajorVersion(ClientPtr client)
|
|
|
|
{
|
|
|
|
VidModePrivPtr pPriv;
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
pPriv = VM_GETPRIV(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!pPriv)
|
2012-06-10 07:21:05 -06:00
|
|
|
return 0;
|
2006-11-26 11:13:41 -07:00
|
|
|
else
|
2012-06-10 07:21:05 -06:00
|
|
|
return pPriv->major;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef XF86VIDMODE_EVENTS
|
|
|
|
static void
|
2012-06-10 07:21:05 -06:00
|
|
|
CheckScreenPrivate(pScreen)
|
|
|
|
ScreenPtr
|
|
|
|
pScreen;
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
SetupScreen(pScreen);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (!pPriv)
|
2012-06-10 07:21:05 -06:00
|
|
|
return;
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!pPriv->events && !pPriv->hasWindow) {
|
2012-06-10 07:21:05 -06:00
|
|
|
free(pPriv);
|
|
|
|
SetScreenPrivate(pScreen, NULL);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
static XF86VidModeScreenPrivatePtr
|
2012-06-10 07:21:05 -06:00
|
|
|
MakeScreenPrivate(pScreen)
|
|
|
|
ScreenPtr
|
|
|
|
pScreen;
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
SetupScreen(pScreen);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (pPriv)
|
2012-06-10 07:21:05 -06:00
|
|
|
return pPriv;
|
|
|
|
pPriv = New(XF86VidModeScreenPrivateRec);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!pPriv)
|
2012-06-10 07:21:05 -06:00
|
|
|
return 0;
|
2006-11-26 11:13:41 -07:00
|
|
|
pPriv->events = 0;
|
|
|
|
pPriv->hasWindow = FALSE;
|
2012-06-10 07:21:05 -06:00
|
|
|
SetScreenPrivate(pScreen, pPriv);
|
2006-11-26 11:13:41 -07:00
|
|
|
return pPriv;
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned long
|
2012-06-10 07:21:05 -06:00
|
|
|
getEventMask(ScreenPtr pScreen, ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
SetupScreen(pScreen);
|
|
|
|
XF86VidModeEventPtr pEv;
|
|
|
|
|
|
|
|
if (!pPriv)
|
2012-06-10 07:21:05 -06:00
|
|
|
return 0;
|
2006-11-26 11:13:41 -07:00
|
|
|
for (pEv = pPriv->events; pEv; pEv = pEv->next)
|
2012-06-10 07:21:05 -06:00
|
|
|
if (pEv->client == client)
|
|
|
|
return pEv->mask;
|
2006-11-26 11:13:41 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
2012-06-10 07:21:05 -06:00
|
|
|
setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
SetupScreen(pScreen);
|
|
|
|
XF86VidModeEventPtr pEv, *pPrev;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (getEventMask(pScreen, client) == mask)
|
|
|
|
return TRUE;
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!pPriv) {
|
2012-06-10 07:21:05 -06:00
|
|
|
pPriv = MakeScreenPrivate(pScreen);
|
|
|
|
if (!pPriv)
|
|
|
|
return FALSE;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
|
2012-06-10 07:21:05 -06:00
|
|
|
if (pEv->client == client)
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
if (mask == 0) {
|
2012-06-10 07:21:05 -06:00
|
|
|
*pPrev = pEv->next;
|
|
|
|
free(pEv);
|
|
|
|
CheckScreenPrivate(pScreen);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (!pEv) {
|
|
|
|
pEv = New(ScreenSaverEventRec);
|
|
|
|
if (!pEv) {
|
|
|
|
CheckScreenPrivate(pScreen);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
*pPrev = pEv;
|
|
|
|
pEv->next = NULL;
|
|
|
|
pEv->client = client;
|
|
|
|
pEv->screen = pScreen;
|
|
|
|
pEv->resource = FakeClientID(client->index);
|
|
|
|
}
|
|
|
|
pEv->mask = mask;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
XF86VidModeFreeEvents(pointer value, XID id)
|
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
XF86VidModeEventPtr pOld = (XF86VidModeEventPtr) value;
|
2006-11-26 11:13:41 -07:00
|
|
|
ScreenPtr pScreen = pOld->screen;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
|
|
|
SetupScreen(pScreen);
|
|
|
|
XF86VidModeEventPtr pEv, *pPrev;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (!pPriv)
|
2012-06-10 07:21:05 -06:00
|
|
|
return TRUE;
|
2006-11-26 11:13:41 -07:00
|
|
|
for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
|
2012-06-10 07:21:05 -06:00
|
|
|
if (pEv == pOld)
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!pEv)
|
2012-06-10 07:21:05 -06:00
|
|
|
return TRUE;
|
2006-11-26 11:13:41 -07:00
|
|
|
*pPrev = pEv->next;
|
2010-12-05 08:36:02 -07:00
|
|
|
free(pEv);
|
2012-06-10 07:21:05 -06:00
|
|
|
CheckScreenPrivate(pScreen);
|
2006-11-26 11:13:41 -07:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
|
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
XF86VidModeScreenPrivatePtr pPriv;
|
|
|
|
unsigned long mask;
|
|
|
|
xXF86VidModeNotifyEvent ev;
|
|
|
|
int kind;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
UpdateCurrentTimeIf();
|
2006-11-26 11:13:41 -07:00
|
|
|
mask = XF86VidModeNotifyMask;
|
|
|
|
pScreen = screenInfo.screens[pScreen->myNum];
|
|
|
|
pPriv = GetScreenPrivate(pScreen);
|
|
|
|
if (!pPriv)
|
2012-06-10 07:21:05 -06:00
|
|
|
return;
|
2006-11-26 11:13:41 -07:00
|
|
|
kind = XF86VidModeModeChange;
|
2012-06-10 07:21:05 -06:00
|
|
|
for (pEv = pPriv->events; pEv; pEv = pEv->next) {
|
2013-06-07 11:28:45 -06:00
|
|
|
if (pEv->mask & mask) {
|
|
|
|
XF86VidModeEventPtr pEv = {
|
|
|
|
.type = XF86VidModeNotify + XF86VidModeEventBase,
|
|
|
|
.state = state,
|
|
|
|
.timestamp = currentTime.milliseconds,
|
|
|
|
.root = pScreen->root->drawable.id,
|
|
|
|
.kind = kind,
|
|
|
|
.forced = forced
|
|
|
|
};
|
|
|
|
WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
static void
|
2012-06-10 07:21:05 -06:00
|
|
|
SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * from,
|
|
|
|
xXF86VidModeNotifyEvent * to)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
to->type = from->type;
|
|
|
|
to->state = from->state;
|
2012-06-10 07:21:05 -06:00
|
|
|
cpswaps(from->sequenceNumber, to->sequenceNumber);
|
|
|
|
cpswapl(from->timestamp, to->timestamp);
|
|
|
|
cpswapl(from->root, to->root);
|
2006-11-26 11:13:41 -07:00
|
|
|
to->kind = from->kind;
|
|
|
|
to->forced = from->forced;
|
|
|
|
}
|
|
|
|
#endif
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
static int
|
|
|
|
ProcXF86VidModeQueryVersion(ClientPtr client)
|
|
|
|
{
|
2013-06-07 11:28:45 -06:00
|
|
|
xXF86VidModeQueryVersionReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION,
|
|
|
|
.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeQueryVersion");
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
|
2013-06-07 11:28:45 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swaps(&rep.majorVersion);
|
|
|
|
swaps(&rep.minorVersion);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), &rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeGetModeLine(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeGetModeLineReq);
|
2013-06-07 11:28:45 -06:00
|
|
|
xXF86VidModeGetModeLineReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
pointer mode;
|
|
|
|
int dotClock;
|
|
|
|
int ver;
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeGetModeline");
|
|
|
|
|
|
|
|
ver = ClientMajorVersion(client);
|
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
|
2013-06-07 11:28:45 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
rep.length = bytes_to_int32(SIZEOF(xXF86OldVidModeGetModeLineReply) -
|
|
|
|
SIZEOF(xGenericReply));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetModeLineReply) -
|
|
|
|
SIZEOF(xGenericReply));
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
rep.dotclock = dotClock;
|
|
|
|
rep.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
|
|
|
|
rep.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
|
|
|
|
rep.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
|
|
|
|
rep.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
|
|
|
|
rep.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
|
|
|
|
rep.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
|
|
|
|
rep.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
|
|
|
|
rep.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
|
|
|
|
rep.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
|
|
|
|
rep.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
|
|
|
|
|
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
|
2012-06-10 07:21:05 -06:00
|
|
|
ErrorF("GetModeLine - scrn: %d clock: %ld\n",
|
|
|
|
stuff->screen, (unsigned long) rep.dotclock);
|
|
|
|
ErrorF("GetModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
|
|
|
|
rep.hdisplay, rep.hsyncstart, rep.hsyncend, rep.htotal);
|
|
|
|
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
|
|
|
|
rep.vdisplay, rep.vsyncstart, rep.vsyncend,
|
|
|
|
rep.vtotal, (unsigned long) rep.flags);
|
|
|
|
}
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
/*
|
|
|
|
* Older servers sometimes had server privates that the VidMode
|
|
|
|
* extention made available. So to be compatiable pretend that
|
|
|
|
* there are no server privates to pass to the client
|
|
|
|
*/
|
|
|
|
rep.privsize = 0;
|
|
|
|
|
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.dotclock);
|
|
|
|
swaps(&rep.hdisplay);
|
|
|
|
swaps(&rep.hsyncstart);
|
|
|
|
swaps(&rep.hsyncend);
|
|
|
|
swaps(&rep.htotal);
|
|
|
|
swaps(&rep.hskew);
|
|
|
|
swaps(&rep.vdisplay);
|
|
|
|
swaps(&rep.vsyncstart);
|
|
|
|
swaps(&rep.vsyncend);
|
|
|
|
swaps(&rep.vtotal);
|
|
|
|
swapl(&rep.flags);
|
|
|
|
swapl(&rep.privsize);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (ver < 2) {
|
2013-06-07 11:28:45 -06:00
|
|
|
xXF86OldVidModeGetModeLineReply oldrep = {
|
|
|
|
.type = rep.type,
|
|
|
|
.sequenceNumber = rep.sequenceNumber,
|
|
|
|
.length = rep.length,
|
|
|
|
.dotclock = rep.dotclock,
|
|
|
|
.hdisplay = rep.hdisplay,
|
|
|
|
.hsyncstart = rep.hsyncstart,
|
|
|
|
.hsyncend = rep.hsyncend,
|
|
|
|
.htotal = rep.htotal,
|
|
|
|
.vdisplay = rep.vdisplay,
|
|
|
|
.vsyncstart = rep.vsyncstart,
|
|
|
|
.vsyncend = rep.vsyncend,
|
|
|
|
.vtotal = rep.vtotal,
|
|
|
|
.flags = rep.flags,
|
|
|
|
.privsize = rep.privsize
|
|
|
|
};
|
|
|
|
WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply), &oldrep);
|
2012-06-10 07:21:05 -06:00
|
|
|
}
|
|
|
|
else {
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply), &rep);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeGetAllModeLines(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeGetAllModeLinesReq);
|
|
|
|
xXF86VidModeGetAllModeLinesReply rep;
|
|
|
|
pointer mode;
|
|
|
|
int modecount, dotClock;
|
|
|
|
int ver;
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeGetAllModelines");
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
ver = ClientMajorVersion(client);
|
|
|
|
|
|
|
|
modecount = VidModeGetNumOfModes(stuff->screen);
|
|
|
|
if (modecount < 1)
|
2012-06-10 07:21:05 -06:00
|
|
|
return VidModeErrorBase + XF86VidModeExtensionDisabled;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = (xXF86VidModeGetAllModeLinesReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
|
|
|
|
SIZEOF(xGenericReply),
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.modecount = modecount
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
if (ver < 2)
|
2012-06-10 07:21:05 -06:00
|
|
|
rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
|
2006-11-26 11:13:41 -07:00
|
|
|
else
|
2012-06-10 07:21:05 -06:00
|
|
|
rep.length += modecount * sizeof(xXF86VidModeModeInfo);
|
2006-11-26 11:13:41 -07:00
|
|
|
rep.length >>= 2;
|
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.modecount);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), &rep);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
do {
|
2013-06-07 11:28:45 -06:00
|
|
|
xXF86VidModeModeInfo mdinf = {
|
|
|
|
.dotclock = dotClock,
|
|
|
|
.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
|
|
|
|
.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
|
|
|
|
.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
|
|
|
|
.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL),
|
|
|
|
.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW),
|
|
|
|
.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
|
|
|
|
.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
|
|
|
|
.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
|
|
|
|
.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
|
|
|
|
.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS),
|
|
|
|
.privsize = 0
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&mdinf.dotclock);
|
|
|
|
swaps(&mdinf.hdisplay);
|
|
|
|
swaps(&mdinf.hsyncstart);
|
|
|
|
swaps(&mdinf.hsyncend);
|
|
|
|
swaps(&mdinf.htotal);
|
|
|
|
swapl(&mdinf.hskew);
|
|
|
|
swaps(&mdinf.vdisplay);
|
|
|
|
swaps(&mdinf.vsyncstart);
|
|
|
|
swaps(&mdinf.vsyncend);
|
|
|
|
swaps(&mdinf.vtotal);
|
|
|
|
swapl(&mdinf.flags);
|
|
|
|
swapl(&mdinf.privsize);
|
|
|
|
}
|
|
|
|
if (ver < 2) {
|
2013-06-07 11:28:45 -06:00
|
|
|
xXF86OldVidModeModeInfo oldmdinf = {
|
|
|
|
.dotclock = mdinf.dotclock,
|
|
|
|
.hdisplay = mdinf.hdisplay,
|
|
|
|
.hsyncstart = mdinf.hsyncstart,
|
|
|
|
.hsyncend = mdinf.hsyncend,
|
|
|
|
.htotal = mdinf.htotal,
|
|
|
|
.vdisplay = mdinf.vdisplay,
|
|
|
|
.vsyncstart = mdinf.vsyncstart,
|
|
|
|
.vsyncend = mdinf.vsyncend,
|
|
|
|
.vtotal = mdinf.vtotal,
|
|
|
|
.flags = mdinf.flags,
|
|
|
|
.privsize = mdinf.privsize
|
|
|
|
};
|
|
|
|
WriteToClient(client, sizeof(xXF86OldVidModeModeInfo), &oldmdinf);
|
2012-06-10 07:21:05 -06:00
|
|
|
}
|
|
|
|
else {
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xXF86VidModeModeInfo), &mdinf);
|
2012-06-10 07:21:05 -06:00
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
} while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#define MODEMATCH(mode,stuff) \
|
|
|
|
(VidModeGetModeValue(mode, VIDMODE_H_DISPLAY) == stuff->hdisplay \
|
|
|
|
&& VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART) == stuff->hsyncstart \
|
|
|
|
&& VidModeGetModeValue(mode, VIDMODE_H_SYNCEND) == stuff->hsyncend \
|
|
|
|
&& VidModeGetModeValue(mode, VIDMODE_H_TOTAL) == stuff->htotal \
|
|
|
|
&& VidModeGetModeValue(mode, VIDMODE_V_DISPLAY) == stuff->vdisplay \
|
|
|
|
&& VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART) == stuff->vsyncstart \
|
|
|
|
&& VidModeGetModeValue(mode, VIDMODE_V_SYNCEND) == stuff->vsyncend \
|
|
|
|
&& VidModeGetModeValue(mode, VIDMODE_V_TOTAL) == stuff->vtotal \
|
|
|
|
&& VidModeGetModeValue(mode, VIDMODE_FLAGS) == stuff->flags )
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeAddModeLine(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeAddModeLineReq);
|
|
|
|
xXF86OldVidModeAddModeLineReq *oldstuff =
|
2012-06-10 07:21:05 -06:00
|
|
|
(xXF86OldVidModeAddModeLineReq *) client->requestBuffer;
|
2006-11-26 11:13:41 -07:00
|
|
|
xXF86VidModeAddModeLineReq newstuff;
|
|
|
|
pointer mode;
|
|
|
|
int len;
|
|
|
|
int dotClock;
|
|
|
|
int ver;
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeAddModeline");
|
|
|
|
|
|
|
|
ver = ClientMajorVersion(client);
|
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
/* convert from old format */
|
|
|
|
stuff = &newstuff;
|
|
|
|
stuff->length = oldstuff->length;
|
|
|
|
stuff->screen = oldstuff->screen;
|
|
|
|
stuff->dotclock = oldstuff->dotclock;
|
|
|
|
stuff->hdisplay = oldstuff->hdisplay;
|
|
|
|
stuff->hsyncstart = oldstuff->hsyncstart;
|
|
|
|
stuff->hsyncend = oldstuff->hsyncend;
|
|
|
|
stuff->htotal = oldstuff->htotal;
|
|
|
|
stuff->hskew = 0;
|
|
|
|
stuff->vdisplay = oldstuff->vdisplay;
|
|
|
|
stuff->vsyncstart = oldstuff->vsyncstart;
|
|
|
|
stuff->vsyncend = oldstuff->vsyncend;
|
|
|
|
stuff->vtotal = oldstuff->vtotal;
|
|
|
|
stuff->flags = oldstuff->flags;
|
|
|
|
stuff->privsize = oldstuff->privsize;
|
|
|
|
stuff->after_dotclock = oldstuff->after_dotclock;
|
|
|
|
stuff->after_hdisplay = oldstuff->after_hdisplay;
|
|
|
|
stuff->after_hsyncstart = oldstuff->after_hsyncstart;
|
|
|
|
stuff->after_hsyncend = oldstuff->after_hsyncend;
|
|
|
|
stuff->after_htotal = oldstuff->after_htotal;
|
|
|
|
stuff->after_hskew = 0;
|
|
|
|
stuff->after_vdisplay = oldstuff->after_vdisplay;
|
|
|
|
stuff->after_vsyncstart = oldstuff->after_vsyncstart;
|
|
|
|
stuff->after_vsyncend = oldstuff->after_vsyncend;
|
|
|
|
stuff->after_vtotal = oldstuff->after_vtotal;
|
|
|
|
stuff->after_flags = oldstuff->after_flags;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
|
2012-06-10 07:21:05 -06:00
|
|
|
ErrorF("AddModeLine - scrn: %d clock: %ld\n",
|
|
|
|
(int) stuff->screen, (unsigned long) stuff->dotclock);
|
|
|
|
ErrorF("AddModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
|
|
|
|
stuff->hdisplay, stuff->hsyncstart,
|
|
|
|
stuff->hsyncend, stuff->htotal);
|
|
|
|
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
|
|
|
|
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
|
|
|
|
stuff->vtotal, (unsigned long) stuff->flags);
|
|
|
|
ErrorF(" after - scrn: %d clock: %ld\n",
|
|
|
|
(int) stuff->screen, (unsigned long) stuff->after_dotclock);
|
|
|
|
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
|
|
|
|
stuff->after_hdisplay, stuff->after_hsyncstart,
|
|
|
|
stuff->after_hsyncend, stuff->after_htotal);
|
|
|
|
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
|
|
|
|
stuff->after_vdisplay, stuff->after_vsyncstart,
|
|
|
|
stuff->after_vsyncend, stuff->after_vtotal,
|
|
|
|
(unsigned long) stuff->after_flags);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
|
|
|
|
len =
|
|
|
|
client->req_len -
|
|
|
|
bytes_to_int32(sizeof(xXF86OldVidModeAddModeLineReq));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
|
|
|
|
len =
|
|
|
|
client->req_len -
|
|
|
|
bytes_to_int32(sizeof(xXF86VidModeAddModeLineReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (len != stuff->privsize)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadLength;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->hsyncstart < stuff->hdisplay ||
|
|
|
|
stuff->hsyncend < stuff->hsyncstart ||
|
|
|
|
stuff->htotal < stuff->hsyncend ||
|
|
|
|
stuff->vsyncstart < stuff->vdisplay ||
|
|
|
|
stuff->vsyncend < stuff->vsyncstart || stuff->vtotal < stuff->vsyncend)
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
if (stuff->after_hsyncstart < stuff->after_hdisplay ||
|
|
|
|
stuff->after_hsyncend < stuff->after_hsyncstart ||
|
|
|
|
stuff->after_htotal < stuff->after_hsyncend ||
|
|
|
|
stuff->after_vsyncstart < stuff->after_vdisplay ||
|
|
|
|
stuff->after_vsyncend < stuff->after_vsyncstart ||
|
|
|
|
stuff->after_vtotal < stuff->after_vsyncend)
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (stuff->after_htotal != 0 || stuff->after_vtotal != 0) {
|
2012-06-10 07:21:05 -06:00
|
|
|
Bool found = FALSE;
|
|
|
|
|
|
|
|
if (VidModeGetFirstModeline(stuff->screen, &mode, &dotClock)) {
|
|
|
|
do {
|
|
|
|
if ((VidModeGetDotClock(stuff->screen, stuff->dotclock)
|
|
|
|
== dotClock) && MODEMATCH(mode, stuff)) {
|
|
|
|
found = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
|
|
|
|
}
|
|
|
|
if (!found)
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
mode = VidModeCreateMode();
|
|
|
|
if (mode == NULL)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
VidModeSetModeValue(mode, VIDMODE_CLOCK, stuff->dotclock);
|
|
|
|
VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
|
2012-06-10 07:21:05 -06:00
|
|
|
VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
|
2006-11-26 11:13:41 -07:00
|
|
|
VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
|
|
|
|
VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
|
|
|
|
VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
|
|
|
|
VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
|
2012-06-10 07:21:05 -06:00
|
|
|
VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
|
2006-11-26 11:13:41 -07:00
|
|
|
VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
|
|
|
|
VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
|
|
|
|
VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
|
|
|
|
|
|
|
|
if (stuff->privsize)
|
2012-06-10 07:21:05 -06:00
|
|
|
ErrorF("AddModeLine - Privates in request have been ignored\n");
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/* Check that the mode is consistent with the monitor specs */
|
|
|
|
switch (VidModeCheckModeForMonitor(stuff->screen, mode)) {
|
2012-06-10 07:21:05 -06:00
|
|
|
case MODE_OK:
|
|
|
|
break;
|
|
|
|
case MODE_HSYNC:
|
|
|
|
case MODE_H_ILLEGAL:
|
|
|
|
free(mode);
|
|
|
|
return VidModeErrorBase + XF86VidModeBadHTimings;
|
|
|
|
case MODE_VSYNC:
|
|
|
|
case MODE_V_ILLEGAL:
|
|
|
|
free(mode);
|
|
|
|
return VidModeErrorBase + XF86VidModeBadVTimings;
|
|
|
|
default:
|
|
|
|
free(mode);
|
|
|
|
return VidModeErrorBase + XF86VidModeModeUnsuitable;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check that the driver is happy with the mode */
|
|
|
|
if (VidModeCheckModeForDriver(stuff->screen, mode) != MODE_OK) {
|
2012-06-10 07:21:05 -06:00
|
|
|
free(mode);
|
|
|
|
return VidModeErrorBase + XF86VidModeModeUnsuitable;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
VidModeSetCrtcForMode(stuff->screen, mode);
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
VidModeAddModeline(stuff->screen, mode);
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
|
2012-06-10 07:21:05 -06:00
|
|
|
ErrorF("AddModeLine - Succeeded\n");
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeDeleteModeLine(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeDeleteModeLineReq);
|
|
|
|
xXF86OldVidModeDeleteModeLineReq *oldstuff =
|
2012-06-10 07:21:05 -06:00
|
|
|
(xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer;
|
2006-11-26 11:13:41 -07:00
|
|
|
xXF86VidModeDeleteModeLineReq newstuff;
|
|
|
|
pointer mode;
|
|
|
|
int len, dotClock;
|
|
|
|
int ver;
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeDeleteModeline");
|
|
|
|
|
|
|
|
ver = ClientMajorVersion(client);
|
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
/* convert from old format */
|
|
|
|
stuff = &newstuff;
|
|
|
|
stuff->length = oldstuff->length;
|
|
|
|
stuff->screen = oldstuff->screen;
|
|
|
|
stuff->dotclock = oldstuff->dotclock;
|
|
|
|
stuff->hdisplay = oldstuff->hdisplay;
|
|
|
|
stuff->hsyncstart = oldstuff->hsyncstart;
|
|
|
|
stuff->hsyncend = oldstuff->hsyncend;
|
|
|
|
stuff->htotal = oldstuff->htotal;
|
|
|
|
stuff->hskew = 0;
|
|
|
|
stuff->vdisplay = oldstuff->vdisplay;
|
|
|
|
stuff->vsyncstart = oldstuff->vsyncstart;
|
|
|
|
stuff->vsyncend = oldstuff->vsyncend;
|
|
|
|
stuff->vtotal = oldstuff->vtotal;
|
|
|
|
stuff->flags = oldstuff->flags;
|
|
|
|
stuff->privsize = oldstuff->privsize;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
|
2012-06-10 07:21:05 -06:00
|
|
|
ErrorF("DeleteModeLine - scrn: %d clock: %ld\n",
|
|
|
|
(int) stuff->screen, (unsigned long) stuff->dotclock);
|
|
|
|
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
|
|
|
|
stuff->hdisplay, stuff->hsyncstart,
|
|
|
|
stuff->hsyncend, stuff->htotal);
|
|
|
|
ErrorF
|
|
|
|
(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
|
|
|
|
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal,
|
|
|
|
(unsigned long) stuff->flags);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
|
|
|
|
len =
|
|
|
|
client->req_len -
|
|
|
|
bytes_to_int32(sizeof(xXF86OldVidModeDeleteModeLineReq));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
|
|
|
|
len =
|
|
|
|
client->req_len -
|
|
|
|
bytes_to_int32(sizeof(xXF86VidModeDeleteModeLineReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (len != stuff->privsize) {
|
2012-06-10 07:21:05 -06:00
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
|
|
|
|
ErrorF("req_len = %ld, sizeof(Req) = %d, privsize = %ld, "
|
|
|
|
"len = %d, length = %d\n",
|
|
|
|
(unsigned long) client->req_len,
|
|
|
|
(int) sizeof(xXF86VidModeDeleteModeLineReq) >> 2,
|
|
|
|
(unsigned long) stuff->privsize, len, stuff->length);
|
|
|
|
}
|
|
|
|
return BadLength;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
|
2012-06-10 07:21:05 -06:00
|
|
|
ErrorF("Checking against clock: %d (%d)\n",
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
|
|
|
|
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
|
|
|
|
ErrorF
|
|
|
|
(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_FLAGS));
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
|
2012-06-10 07:21:05 -06:00
|
|
|
MODEMATCH(mode, stuff))
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
|
|
|
|
ErrorF("Checking against clock: %d (%d)\n",
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
|
|
|
|
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
|
|
|
|
ErrorF
|
|
|
|
(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_FLAGS));
|
|
|
|
}
|
|
|
|
if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
|
|
|
|
MODEMATCH(mode, stuff)) {
|
|
|
|
VidModeDeleteModeline(stuff->screen, mode);
|
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
|
|
|
|
ErrorF("DeleteModeLine - Succeeded\n");
|
|
|
|
return Success;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
} while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
|
|
|
|
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeModModeLine(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeModModeLineReq);
|
|
|
|
xXF86OldVidModeModModeLineReq *oldstuff =
|
2012-06-10 07:21:05 -06:00
|
|
|
(xXF86OldVidModeModModeLineReq *) client->requestBuffer;
|
2006-11-26 11:13:41 -07:00
|
|
|
xXF86VidModeModModeLineReq newstuff;
|
|
|
|
pointer mode, modetmp;
|
|
|
|
int len, dotClock;
|
|
|
|
int ver;
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeModModeline");
|
|
|
|
|
|
|
|
ver = ClientMajorVersion(client);
|
2012-06-10 07:21:05 -06:00
|
|
|
if (ver < 2) {
|
|
|
|
/* convert from old format */
|
|
|
|
stuff = &newstuff;
|
|
|
|
stuff->length = oldstuff->length;
|
|
|
|
stuff->screen = oldstuff->screen;
|
|
|
|
stuff->hdisplay = oldstuff->hdisplay;
|
|
|
|
stuff->hsyncstart = oldstuff->hsyncstart;
|
|
|
|
stuff->hsyncend = oldstuff->hsyncend;
|
|
|
|
stuff->htotal = oldstuff->htotal;
|
|
|
|
stuff->hskew = 0;
|
|
|
|
stuff->vdisplay = oldstuff->vdisplay;
|
|
|
|
stuff->vsyncstart = oldstuff->vsyncstart;
|
|
|
|
stuff->vsyncend = oldstuff->vsyncend;
|
|
|
|
stuff->vtotal = oldstuff->vtotal;
|
|
|
|
stuff->flags = oldstuff->flags;
|
|
|
|
stuff->privsize = oldstuff->privsize;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
|
2012-06-10 07:21:05 -06:00
|
|
|
ErrorF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n",
|
|
|
|
(int) stuff->screen, stuff->hdisplay, stuff->hsyncstart,
|
|
|
|
stuff->hsyncend, stuff->htotal);
|
|
|
|
ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
|
|
|
|
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
|
|
|
|
stuff->vtotal, (unsigned long) stuff->flags);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
|
|
|
|
len =
|
|
|
|
client->req_len -
|
|
|
|
bytes_to_int32(sizeof(xXF86OldVidModeModModeLineReq));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
|
|
|
|
len =
|
|
|
|
client->req_len -
|
|
|
|
bytes_to_int32(sizeof(xXF86VidModeModModeLineReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (len != stuff->privsize)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadLength;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->hsyncstart < stuff->hdisplay ||
|
|
|
|
stuff->hsyncend < stuff->hsyncstart ||
|
|
|
|
stuff->htotal < stuff->hsyncend ||
|
|
|
|
stuff->vsyncstart < stuff->vdisplay ||
|
|
|
|
stuff->vsyncend < stuff->vsyncstart || stuff->vtotal < stuff->vsyncend)
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
modetmp = VidModeCreateMode();
|
|
|
|
VidModeCopyMode(mode, modetmp);
|
|
|
|
|
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
|
2012-06-10 07:21:05 -06:00
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
|
2006-11-26 11:13:41 -07:00
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
|
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
|
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
|
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
|
2012-06-10 07:21:05 -06:00
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
|
2006-11-26 11:13:41 -07:00
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
|
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
|
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
|
|
|
|
|
|
|
|
if (stuff->privsize)
|
2012-06-10 07:21:05 -06:00
|
|
|
ErrorF("ModModeLine - Privates in request have been ignored\n");
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/* Check that the mode is consistent with the monitor specs */
|
|
|
|
switch (VidModeCheckModeForMonitor(stuff->screen, modetmp)) {
|
2012-06-10 07:21:05 -06:00
|
|
|
case MODE_OK:
|
|
|
|
break;
|
|
|
|
case MODE_HSYNC:
|
|
|
|
case MODE_H_ILLEGAL:
|
|
|
|
free(modetmp);
|
|
|
|
return VidModeErrorBase + XF86VidModeBadHTimings;
|
|
|
|
case MODE_VSYNC:
|
|
|
|
case MODE_V_ILLEGAL:
|
|
|
|
free(modetmp);
|
|
|
|
return VidModeErrorBase + XF86VidModeBadVTimings;
|
|
|
|
default:
|
|
|
|
free(modetmp);
|
|
|
|
return VidModeErrorBase + XF86VidModeModeUnsuitable;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check that the driver is happy with the mode */
|
|
|
|
if (VidModeCheckModeForDriver(stuff->screen, modetmp) != MODE_OK) {
|
2012-06-10 07:21:05 -06:00
|
|
|
free(modetmp);
|
|
|
|
return VidModeErrorBase + XF86VidModeModeUnsuitable;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
free(modetmp);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
|
2012-06-10 07:21:05 -06:00
|
|
|
VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
|
2006-11-26 11:13:41 -07:00
|
|
|
VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
|
|
|
|
VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
|
|
|
|
VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
|
|
|
|
VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
|
2012-06-10 07:21:05 -06:00
|
|
|
VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
|
2006-11-26 11:13:41 -07:00
|
|
|
VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
|
|
|
|
VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
|
|
|
|
VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
|
|
|
|
|
|
|
|
VidModeSetCrtcForMode(stuff->screen, mode);
|
|
|
|
VidModeSwitchMode(stuff->screen, mode);
|
|
|
|
|
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
|
2012-06-10 07:21:05 -06:00
|
|
|
ErrorF("ModModeLine - Succeeded\n");
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeValidateModeLine(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeValidateModeLineReq);
|
|
|
|
xXF86OldVidModeValidateModeLineReq *oldstuff =
|
2012-06-10 07:21:05 -06:00
|
|
|
(xXF86OldVidModeValidateModeLineReq *) client->requestBuffer;
|
2006-11-26 11:13:41 -07:00
|
|
|
xXF86VidModeValidateModeLineReq newstuff;
|
|
|
|
xXF86VidModeValidateModeLineReply rep;
|
|
|
|
pointer mode, modetmp = NULL;
|
|
|
|
int len, status, dotClock;
|
|
|
|
int ver;
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeValidateModeline");
|
|
|
|
|
|
|
|
ver = ClientMajorVersion(client);
|
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
/* convert from old format */
|
|
|
|
stuff = &newstuff;
|
|
|
|
stuff->length = oldstuff->length;
|
|
|
|
stuff->screen = oldstuff->screen;
|
|
|
|
stuff->dotclock = oldstuff->dotclock;
|
|
|
|
stuff->hdisplay = oldstuff->hdisplay;
|
|
|
|
stuff->hsyncstart = oldstuff->hsyncstart;
|
|
|
|
stuff->hsyncend = oldstuff->hsyncend;
|
|
|
|
stuff->htotal = oldstuff->htotal;
|
|
|
|
stuff->hskew = 0;
|
|
|
|
stuff->vdisplay = oldstuff->vdisplay;
|
|
|
|
stuff->vsyncstart = oldstuff->vsyncstart;
|
|
|
|
stuff->vsyncend = oldstuff->vsyncend;
|
|
|
|
stuff->vtotal = oldstuff->vtotal;
|
|
|
|
stuff->flags = oldstuff->flags;
|
|
|
|
stuff->privsize = oldstuff->privsize;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
|
2012-06-10 07:21:05 -06:00
|
|
|
ErrorF("ValidateModeLine - scrn: %d clock: %ld\n",
|
|
|
|
(int) stuff->screen, (unsigned long) stuff->dotclock);
|
|
|
|
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
|
|
|
|
stuff->hdisplay, stuff->hsyncstart,
|
|
|
|
stuff->hsyncend, stuff->htotal);
|
|
|
|
ErrorF
|
|
|
|
(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
|
|
|
|
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal,
|
|
|
|
(unsigned long) stuff->flags);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
|
|
|
|
len = client->req_len -
|
|
|
|
bytes_to_int32(sizeof(xXF86OldVidModeValidateModeLineReq));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
|
|
|
|
len =
|
|
|
|
client->req_len -
|
|
|
|
bytes_to_int32(sizeof(xXF86VidModeValidateModeLineReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (len != stuff->privsize)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadLength;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
status = MODE_OK;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->hsyncstart < stuff->hdisplay ||
|
|
|
|
stuff->hsyncend < stuff->hsyncstart ||
|
|
|
|
stuff->htotal < stuff->hsyncend ||
|
|
|
|
stuff->vsyncstart < stuff->vdisplay ||
|
|
|
|
stuff->vsyncend < stuff->vsyncstart ||
|
|
|
|
stuff->vtotal < stuff->vsyncend) {
|
|
|
|
status = MODE_BAD;
|
|
|
|
goto status_reply;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
modetmp = VidModeCreateMode();
|
|
|
|
VidModeCopyMode(mode, modetmp);
|
|
|
|
|
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
|
2012-06-10 07:21:05 -06:00
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
|
2006-11-26 11:13:41 -07:00
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
|
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
|
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
|
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
|
2012-06-10 07:21:05 -06:00
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
|
2006-11-26 11:13:41 -07:00
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
|
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
|
|
|
|
VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
|
|
|
|
if (stuff->privsize)
|
2012-06-10 07:21:05 -06:00
|
|
|
ErrorF("ValidateModeLine - Privates in request have been ignored\n");
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/* Check that the mode is consistent with the monitor specs */
|
2012-06-10 07:21:05 -06:00
|
|
|
if ((status =
|
|
|
|
VidModeCheckModeForMonitor(stuff->screen, modetmp)) != MODE_OK)
|
|
|
|
goto status_reply;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/* Check that the driver is happy with the mode */
|
|
|
|
status = VidModeCheckModeForDriver(stuff->screen, modetmp);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
status_reply:
|
2010-12-05 08:36:02 -07:00
|
|
|
free(modetmp);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = (xXF86VidModeValidateModeLineReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply)
|
|
|
|
- SIZEOF(xGenericReply)),
|
|
|
|
.status = status
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.status);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply), &rep);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
|
2012-06-10 07:21:05 -06:00
|
|
|
ErrorF("ValidateModeLine - Succeeded (status = %d)\n", status);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeSwitchMode(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeSwitchModeReq);
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeSwitchMode");
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
VidModeZoomViewport(stuff->screen, (short) stuff->zoom);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeSwitchToMode(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeSwitchToModeReq);
|
|
|
|
xXF86OldVidModeSwitchToModeReq *oldstuff =
|
2012-06-10 07:21:05 -06:00
|
|
|
(xXF86OldVidModeSwitchToModeReq *) client->requestBuffer;
|
2006-11-26 11:13:41 -07:00
|
|
|
xXF86VidModeSwitchToModeReq newstuff;
|
|
|
|
pointer mode;
|
|
|
|
int len, dotClock;
|
|
|
|
int ver;
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeSwitchToMode");
|
|
|
|
|
|
|
|
ver = ClientMajorVersion(client);
|
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
/* convert from old format */
|
|
|
|
stuff = &newstuff;
|
|
|
|
stuff->length = oldstuff->length;
|
|
|
|
stuff->screen = oldstuff->screen;
|
|
|
|
stuff->dotclock = oldstuff->dotclock;
|
|
|
|
stuff->hdisplay = oldstuff->hdisplay;
|
|
|
|
stuff->hsyncstart = oldstuff->hsyncstart;
|
|
|
|
stuff->hsyncend = oldstuff->hsyncend;
|
|
|
|
stuff->htotal = oldstuff->htotal;
|
|
|
|
stuff->hskew = 0;
|
|
|
|
stuff->vdisplay = oldstuff->vdisplay;
|
|
|
|
stuff->vsyncstart = oldstuff->vsyncstart;
|
|
|
|
stuff->vsyncend = oldstuff->vsyncend;
|
|
|
|
stuff->vtotal = oldstuff->vtotal;
|
|
|
|
stuff->flags = oldstuff->flags;
|
|
|
|
stuff->privsize = oldstuff->privsize;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
|
2012-06-10 07:21:05 -06:00
|
|
|
ErrorF("SwitchToMode - scrn: %d clock: %ld\n",
|
|
|
|
(int) stuff->screen, (unsigned long) stuff->dotclock);
|
|
|
|
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
|
|
|
|
stuff->hdisplay, stuff->hsyncstart,
|
|
|
|
stuff->hsyncend, stuff->htotal);
|
|
|
|
ErrorF
|
|
|
|
(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
|
|
|
|
stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal,
|
|
|
|
(unsigned long) stuff->flags);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq);
|
|
|
|
len =
|
|
|
|
client->req_len -
|
|
|
|
bytes_to_int32(sizeof(xXF86OldVidModeSwitchToModeReq));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq);
|
|
|
|
len =
|
|
|
|
client->req_len -
|
|
|
|
bytes_to_int32(sizeof(xXF86VidModeSwitchToModeReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (len != stuff->privsize)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadLength;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock)
|
2012-06-10 07:21:05 -06:00
|
|
|
&& MODEMATCH(mode, stuff))
|
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
do {
|
2012-06-10 07:21:05 -06:00
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
|
|
|
|
ErrorF("Checking against clock: %d (%d)\n",
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
|
|
|
|
ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
|
|
|
|
ErrorF
|
|
|
|
(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
|
|
|
|
VidModeGetModeValue(mode, VIDMODE_FLAGS));
|
|
|
|
}
|
|
|
|
if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
|
|
|
|
MODEMATCH(mode, stuff)) {
|
|
|
|
|
|
|
|
if (!VidModeSwitchMode(stuff->screen, mode))
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
|
|
|
|
ErrorF("SwitchToMode - Succeeded\n");
|
|
|
|
return Success;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
} while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
|
|
|
|
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeLockModeSwitch(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeLockModeSwitchReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeLockModeSwitch");
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!VidModeLockZoom(stuff->screen, (short) stuff->lock))
|
|
|
|
return VidModeErrorBase + XF86VidModeZoomLocked;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeGetMonitor(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeGetMonitorReq);
|
2013-06-07 11:28:45 -06:00
|
|
|
xXF86VidModeGetMonitorReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
CARD32 *hsyncdata, *vsyncdata;
|
|
|
|
int i, nHsync, nVrefresh;
|
|
|
|
pointer monitor;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
DEBUG_P("XF86VidModeGetMonitor");
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
if (!VidModeGetMonitor(stuff->screen, &monitor))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
|
|
|
|
nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
|
|
|
if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr)
|
|
|
|
rep.vendorLength = strlen((char *) (VidModeGetMonitorValue(monitor,
|
|
|
|
VIDMODE_MON_VENDOR,
|
|
|
|
0)).ptr);
|
2006-11-26 11:13:41 -07:00
|
|
|
else
|
2012-06-10 07:21:05 -06:00
|
|
|
rep.vendorLength = 0;
|
|
|
|
if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr)
|
|
|
|
rep.modelLength = strlen((char *) (VidModeGetMonitorValue(monitor,
|
|
|
|
VIDMODE_MON_MODEL,
|
|
|
|
0)).ptr);
|
2006-11-26 11:13:41 -07:00
|
|
|
else
|
2012-06-10 07:21:05 -06:00
|
|
|
rep.modelLength = 0;
|
|
|
|
rep.length =
|
|
|
|
bytes_to_int32(SIZEOF(xXF86VidModeGetMonitorReply) -
|
|
|
|
SIZEOF(xGenericReply) + (nHsync +
|
|
|
|
nVrefresh) * sizeof(CARD32) +
|
|
|
|
pad_to_int32(rep.vendorLength) +
|
|
|
|
pad_to_int32(rep.modelLength));
|
2006-11-26 11:13:41 -07:00
|
|
|
rep.nhsync = nHsync;
|
|
|
|
rep.nvsync = nVrefresh;
|
2010-12-05 08:36:02 -07:00
|
|
|
hsyncdata = malloc(nHsync * sizeof(CARD32));
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!hsyncdata) {
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
vsyncdata = malloc(nVrefresh * sizeof(CARD32));
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!vsyncdata) {
|
2012-06-10 07:21:05 -06:00
|
|
|
free(hsyncdata);
|
|
|
|
return BadAlloc;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < nHsync; i++) {
|
2012-06-10 07:21:05 -06:00
|
|
|
hsyncdata[i] = (unsigned short) (VidModeGetMonitorValue(monitor,
|
|
|
|
VIDMODE_MON_HSYNC_LO,
|
|
|
|
i)).f |
|
|
|
|
(unsigned
|
|
|
|
short) (VidModeGetMonitorValue(monitor, VIDMODE_MON_HSYNC_HI,
|
|
|
|
i)).f << 16;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
for (i = 0; i < nVrefresh; i++) {
|
2012-06-10 07:21:05 -06:00
|
|
|
vsyncdata[i] = (unsigned short) (VidModeGetMonitorValue(monitor,
|
|
|
|
VIDMODE_MON_VREFRESH_LO,
|
|
|
|
i)).f |
|
|
|
|
(unsigned
|
|
|
|
short) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VREFRESH_HI,
|
|
|
|
i)).f << 16;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), &rep);
|
2006-11-26 11:13:41 -07:00
|
|
|
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
2012-06-10 07:21:05 -06:00
|
|
|
WriteSwappedDataToClient(client, nHsync * sizeof(CARD32), hsyncdata);
|
|
|
|
WriteSwappedDataToClient(client, nVrefresh * sizeof(CARD32), vsyncdata);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (rep.vendorLength)
|
2012-06-10 07:21:05 -06:00
|
|
|
WriteToClient(client, rep.vendorLength,
|
2013-06-07 11:28:45 -06:00
|
|
|
(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (rep.modelLength)
|
2012-06-10 07:21:05 -06:00
|
|
|
WriteToClient(client, rep.modelLength,
|
2013-06-07 11:28:45 -06:00
|
|
|
(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
free(hsyncdata);
|
|
|
|
free(vsyncdata);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeGetViewPort(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeGetViewPortReq);
|
|
|
|
xXF86VidModeGetViewPortReply rep;
|
2012-06-10 07:21:05 -06:00
|
|
|
int x, y;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeGetViewPort");
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
VidModeGetViewPort(stuff->screen, &x, &y);
|
2013-06-07 11:28:45 -06:00
|
|
|
|
|
|
|
rep = (xXF86VidModeGetViewPortReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.x = x,
|
|
|
|
.y = y
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.x);
|
|
|
|
swapl(&rep.y);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), &rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeSetViewPort(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeSetViewPortReq);
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeSetViewPort");
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
if (!VidModeSetViewPort(stuff->screen, stuff->x, stuff->y))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeGetDotClocks(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeGetDotClocksReq);
|
|
|
|
xXF86VidModeGetDotClocksReply rep;
|
2012-06-10 07:21:05 -06:00
|
|
|
int n;
|
2006-11-26 11:13:41 -07:00
|
|
|
int numClocks;
|
|
|
|
CARD32 dotclock;
|
|
|
|
int *Clocks = NULL;
|
|
|
|
Bool ClockProg;
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeGetDotClocks");
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = (xXF86VidModeGetDotClocksReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply)
|
|
|
|
- SIZEOF(xGenericReply) + numClocks),
|
|
|
|
.clocks = numClocks,
|
|
|
|
.maxclocks = MAXCLOCKS,
|
|
|
|
.flags = 0
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (!ClockProg) {
|
2013-06-07 11:28:45 -06:00
|
|
|
Clocks = calloc(numClocks, sizeof(int));
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!Clocks)
|
|
|
|
return BadValue;
|
|
|
|
if (!VidModeGetClocks(stuff->screen, Clocks)) {
|
|
|
|
free(Clocks);
|
|
|
|
return BadValue;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (ClockProg) {
|
2012-06-10 07:21:05 -06:00
|
|
|
rep.flags |= CLKFLAG_PROGRAMABLE;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.clocks);
|
|
|
|
swapl(&rep.maxclocks);
|
|
|
|
swapl(&rep.flags);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), &rep);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!ClockProg) {
|
2012-06-10 07:21:05 -06:00
|
|
|
for (n = 0; n < numClocks; n++) {
|
|
|
|
dotclock = *Clocks++;
|
|
|
|
if (client->swapped) {
|
|
|
|
WriteSwappedDataToClient(client, 4, (char *) &dotclock);
|
|
|
|
}
|
|
|
|
else {
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, 4, &dotclock);
|
2012-06-10 07:21:05 -06:00
|
|
|
}
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
free(Clocks);
|
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeSetGamma(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeSetGammaReq);
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeSetGamma");
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!VidModeSetGamma(stuff->screen, ((float) stuff->red) / 10000.,
|
|
|
|
((float) stuff->green) / 10000.,
|
|
|
|
((float) stuff->blue) / 10000.))
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeGetGamma(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeGetGammaReq);
|
|
|
|
xXF86VidModeGetGammaReply rep;
|
|
|
|
float red, green, blue;
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeGetGamma");
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
if (!VidModeGetGamma(stuff->screen, &red, &green, &blue))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = (xXF86VidModeGetGammaReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.red = (CARD32) (red * 10000.),
|
|
|
|
.green = (CARD32) (green * 10000.),
|
|
|
|
.blue = (CARD32) (blue * 10000.)
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.red);
|
|
|
|
swapl(&rep.green);
|
|
|
|
swapl(&rep.blue);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), &rep);
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeSetGammaRamp(ClientPtr client)
|
|
|
|
{
|
|
|
|
CARD16 *r, *g, *b;
|
|
|
|
int length;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXF86VidModeSetGammaRampReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->size != VidModeGetGammaRampSize(stuff->screen))
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
length = (stuff->size + 1) & ~1;
|
|
|
|
|
|
|
|
REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length * 6);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
r = (CARD16 *) &stuff[1];
|
2006-11-26 11:13:41 -07:00
|
|
|
g = r + length;
|
|
|
|
b = g + length;
|
|
|
|
|
|
|
|
if (!VidModeSetGammaRamp(stuff->screen, stuff->size, r, g, b))
|
|
|
|
return BadValue;
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeGetGammaRamp(ClientPtr client)
|
|
|
|
{
|
|
|
|
CARD16 *ramp = NULL;
|
2012-06-10 07:21:05 -06:00
|
|
|
int length;
|
2010-07-27 13:02:24 -06:00
|
|
|
size_t ramplen = 0;
|
2006-11-26 11:13:41 -07:00
|
|
|
xXF86VidModeGetGammaRampReply rep;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXF86VidModeGetGammaRampReq);
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->size != VidModeGetGammaRampSize(stuff->screen))
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
length = (stuff->size + 1) & ~1;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->size) {
|
|
|
|
ramplen = length * 3 * sizeof(CARD16);
|
|
|
|
if (!(ramp = malloc(ramplen)))
|
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
if (!VidModeGetGammaRamp(stuff->screen, stuff->size,
|
|
|
|
ramp, ramp + length, ramp + (length * 2))) {
|
|
|
|
free(ramp);
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
2012-06-10 07:21:05 -06:00
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = (xXF86VidModeGetGammaRampReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = (length >> 1) * 3,
|
|
|
|
.size = stuff->size
|
|
|
|
};
|
2012-06-10 07:21:05 -06:00
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swaps(&rep.size);
|
|
|
|
SwapShorts((short *) ramp, length * 3);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), &rep);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->size) {
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, ramplen, ramp);
|
2010-12-05 08:36:02 -07:00
|
|
|
free(ramp);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeGetGammaRampSize(ClientPtr client)
|
|
|
|
{
|
|
|
|
xXF86VidModeGetGammaRampSizeReply rep;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXF86VidModeGetGammaRampSizeReq);
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = (xXF86VidModeGetGammaRampSizeReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.size = VidModeGetGammaRampSize(stuff->screen)
|
|
|
|
};
|
2012-06-10 07:21:05 -06:00
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swaps(&rep.size);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xXF86VidModeGetGammaRampSizeReply), &rep);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeGetPermissions(ClientPtr client)
|
|
|
|
{
|
2013-06-07 11:28:45 -06:00
|
|
|
xXF86VidModeGetPermissionsReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.permissions = XF86VM_READ_PERMISSION
|
|
|
|
};
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXF86VidModeGetPermissionsReq);
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->screen >= screenInfo.numScreens)
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
if (xf86GetVidModeEnabled() &&
|
2013-06-07 11:28:45 -06:00
|
|
|
(xf86GetVidModeAllowNonLocal() || client->local)) {
|
2012-06-10 07:21:05 -06:00
|
|
|
rep.permissions |= XF86VM_WRITE_PERMISSION;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.permissions);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xXF86VidModeGetPermissionsReply), &rep);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeSetClientVersion(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeSetClientVersionReq);
|
|
|
|
|
|
|
|
VidModePrivPtr pPriv;
|
|
|
|
|
|
|
|
DEBUG_P("XF86VidModeSetClientVersion");
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
if ((pPriv = VM_GETPRIV(client)) == NULL) {
|
2012-06-10 07:21:05 -06:00
|
|
|
pPriv = malloc(sizeof(VidModePrivRec));
|
|
|
|
if (!pPriv)
|
|
|
|
return BadAlloc;
|
|
|
|
VM_SETPRIV(client, pPriv);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
pPriv->major = stuff->major;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
pPriv->minor = stuff->minor;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ProcXF86VidModeDispatch(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
switch (stuff->data) {
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeQueryVersion:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcXF86VidModeQueryVersion(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetModeLine:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcXF86VidModeGetModeLine(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetMonitor:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcXF86VidModeGetMonitor(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetAllModeLines:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcXF86VidModeGetAllModeLines(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeValidateModeLine:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcXF86VidModeValidateModeLine(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetViewPort:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcXF86VidModeGetViewPort(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetDotClocks:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcXF86VidModeGetDotClocks(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeSetClientVersion:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcXF86VidModeSetClientVersion(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetGamma:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcXF86VidModeGetGamma(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetGammaRamp:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcXF86VidModeGetGammaRamp(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetGammaRampSize:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcXF86VidModeGetGammaRampSize(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetPermissions:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcXF86VidModeGetPermissions(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!xf86GetVidModeEnabled())
|
|
|
|
return VidModeErrorBase + XF86VidModeExtensionDisabled;
|
2013-06-07 11:28:45 -06:00
|
|
|
if (xf86GetVidModeAllowNonLocal() || client->local) {
|
2012-06-10 07:21:05 -06:00
|
|
|
switch (stuff->data) {
|
|
|
|
case X_XF86VidModeAddModeLine:
|
|
|
|
return ProcXF86VidModeAddModeLine(client);
|
|
|
|
case X_XF86VidModeDeleteModeLine:
|
|
|
|
return ProcXF86VidModeDeleteModeLine(client);
|
|
|
|
case X_XF86VidModeModModeLine:
|
|
|
|
return ProcXF86VidModeModModeLine(client);
|
|
|
|
case X_XF86VidModeSwitchMode:
|
|
|
|
return ProcXF86VidModeSwitchMode(client);
|
|
|
|
case X_XF86VidModeSwitchToMode:
|
|
|
|
return ProcXF86VidModeSwitchToMode(client);
|
|
|
|
case X_XF86VidModeLockModeSwitch:
|
|
|
|
return ProcXF86VidModeLockModeSwitch(client);
|
|
|
|
case X_XF86VidModeSetViewPort:
|
|
|
|
return ProcXF86VidModeSetViewPort(client);
|
|
|
|
case X_XF86VidModeSetGamma:
|
|
|
|
return ProcXF86VidModeSetGamma(client);
|
|
|
|
case X_XF86VidModeSetGammaRamp:
|
|
|
|
return ProcXF86VidModeSetGammaRamp(client);
|
|
|
|
default:
|
|
|
|
return BadRequest;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeQueryVersion(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeQueryVersionReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeQueryVersion(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeGetModeLine(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeGetModeLineReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->screen);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeGetModeLine(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeGetAllModeLines(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeGetAllModeLinesReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->screen);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeGetAllModeLines(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeAddModeLine(ClientPtr client)
|
|
|
|
{
|
|
|
|
xXF86OldVidModeAddModeLineReq *oldstuff =
|
2012-06-10 07:21:05 -06:00
|
|
|
(xXF86OldVidModeAddModeLineReq *) client->requestBuffer;
|
2006-11-26 11:13:41 -07:00
|
|
|
int ver;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXF86VidModeAddModeLineReq);
|
|
|
|
ver = ClientMajorVersion(client);
|
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&oldstuff->length);
|
|
|
|
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 {
|
|
|
|
swaps(&stuff->length);
|
|
|
|
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);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
return ProcXF86VidModeAddModeLine(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeDeleteModeLine(ClientPtr client)
|
|
|
|
{
|
|
|
|
xXF86OldVidModeDeleteModeLineReq *oldstuff =
|
2012-06-10 07:21:05 -06:00
|
|
|
(xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer;
|
2006-11-26 11:13:41 -07:00
|
|
|
int ver;
|
|
|
|
|
|
|
|
REQUEST(xXF86VidModeDeleteModeLineReq);
|
|
|
|
ver = ClientMajorVersion(client);
|
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&oldstuff->length);
|
|
|
|
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 {
|
|
|
|
swaps(&stuff->length);
|
|
|
|
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);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
return ProcXF86VidModeDeleteModeLine(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeModModeLine(ClientPtr client)
|
|
|
|
{
|
|
|
|
xXF86OldVidModeModModeLineReq *oldstuff =
|
2012-06-10 07:21:05 -06:00
|
|
|
(xXF86OldVidModeModModeLineReq *) client->requestBuffer;
|
2006-11-26 11:13:41 -07:00
|
|
|
int ver;
|
|
|
|
|
|
|
|
REQUEST(xXF86VidModeModModeLineReq);
|
|
|
|
ver = ClientMajorVersion(client);
|
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&oldstuff->length);
|
|
|
|
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 {
|
|
|
|
swaps(&stuff->length);
|
|
|
|
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);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
return ProcXF86VidModeModModeLine(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeValidateModeLine(ClientPtr client)
|
|
|
|
{
|
|
|
|
xXF86OldVidModeValidateModeLineReq *oldstuff =
|
2012-06-10 07:21:05 -06:00
|
|
|
(xXF86OldVidModeValidateModeLineReq *) client->requestBuffer;
|
2006-11-26 11:13:41 -07:00
|
|
|
int ver;
|
|
|
|
|
|
|
|
REQUEST(xXF86VidModeValidateModeLineReq);
|
|
|
|
ver = ClientMajorVersion(client);
|
|
|
|
if (ver < 2) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&oldstuff->length);
|
|
|
|
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 {
|
|
|
|
swaps(&stuff->length);
|
|
|
|
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);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
return ProcXF86VidModeValidateModeLine(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeSwitchMode(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeSwitchModeReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->screen);
|
|
|
|
swaps(&stuff->zoom);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeSwitchMode(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeSwitchToMode(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeSwitchToModeReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->screen);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeSwitchToMode(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeLockModeSwitch(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeLockModeSwitchReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->screen);
|
|
|
|
swaps(&stuff->lock);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeLockModeSwitch(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeGetMonitor(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeGetMonitorReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->screen);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeGetMonitor(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeGetViewPort(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeGetViewPortReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->screen);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeGetViewPort(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeSetViewPort(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeSetViewPortReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->screen);
|
|
|
|
swapl(&stuff->x);
|
|
|
|
swapl(&stuff->y);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeSetViewPort(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeGetDotClocks(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeGetDotClocksReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->screen);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeGetDotClocks(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeSetClientVersion(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeSetClientVersionReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->major);
|
|
|
|
swaps(&stuff->minor);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeSetClientVersion(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeSetGamma(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeSetGammaReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->screen);
|
|
|
|
swapl(&stuff->red);
|
|
|
|
swapl(&stuff->green);
|
|
|
|
swapl(&stuff->blue);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeSetGamma(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeGetGamma(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeGetGammaReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->screen);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeGetGamma(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeSetGammaRamp(ClientPtr client)
|
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
int length;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXF86VidModeSetGammaRampReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->size);
|
|
|
|
swaps(&stuff->screen);
|
2006-11-26 11:13:41 -07:00
|
|
|
length = ((stuff->size + 1) & ~1) * 6;
|
|
|
|
REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
|
2009-09-06 13:44:18 -06:00
|
|
|
SwapRestS(stuff);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeSetGammaRamp(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeGetGammaRamp(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xXF86VidModeGetGammaRampReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->size);
|
|
|
|
swaps(&stuff->screen);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeGetGammaRamp(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeGetGammaRampSize(ClientPtr client)
|
2012-06-10 07:21:05 -06:00
|
|
|
{
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXF86VidModeGetGammaRampSizeReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->screen);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeGetGammaRampSize(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeGetPermissions(ClientPtr client)
|
2012-06-10 07:21:05 -06:00
|
|
|
{
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXF86VidModeGetPermissionsReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->screen);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcXF86VidModeGetPermissions(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
SProcXF86VidModeDispatch(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
switch (stuff->data) {
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeQueryVersion:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcXF86VidModeQueryVersion(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetModeLine:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcXF86VidModeGetModeLine(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetMonitor:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcXF86VidModeGetMonitor(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetAllModeLines:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcXF86VidModeGetAllModeLines(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetViewPort:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcXF86VidModeGetViewPort(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeValidateModeLine:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcXF86VidModeValidateModeLine(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetDotClocks:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcXF86VidModeGetDotClocks(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeSetClientVersion:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcXF86VidModeSetClientVersion(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetGamma:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcXF86VidModeGetGamma(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetGammaRamp:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcXF86VidModeGetGammaRamp(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetGammaRampSize:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcXF86VidModeGetGammaRampSize(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_XF86VidModeGetPermissions:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcXF86VidModeGetPermissions(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!xf86GetVidModeEnabled())
|
|
|
|
return VidModeErrorBase + XF86VidModeExtensionDisabled;
|
2013-06-07 11:28:45 -06:00
|
|
|
if (xf86GetVidModeAllowNonLocal() || client->local) {
|
2012-06-10 07:21:05 -06:00
|
|
|
switch (stuff->data) {
|
|
|
|
case X_XF86VidModeAddModeLine:
|
|
|
|
return SProcXF86VidModeAddModeLine(client);
|
|
|
|
case X_XF86VidModeDeleteModeLine:
|
|
|
|
return SProcXF86VidModeDeleteModeLine(client);
|
|
|
|
case X_XF86VidModeModModeLine:
|
|
|
|
return SProcXF86VidModeModModeLine(client);
|
|
|
|
case X_XF86VidModeSwitchMode:
|
|
|
|
return SProcXF86VidModeSwitchMode(client);
|
|
|
|
case X_XF86VidModeSwitchToMode:
|
|
|
|
return SProcXF86VidModeSwitchToMode(client);
|
|
|
|
case X_XF86VidModeLockModeSwitch:
|
|
|
|
return SProcXF86VidModeLockModeSwitch(client);
|
|
|
|
case X_XF86VidModeSetViewPort:
|
|
|
|
return SProcXF86VidModeSetViewPort(client);
|
|
|
|
case X_XF86VidModeSetGamma:
|
|
|
|
return SProcXF86VidModeSetGamma(client);
|
|
|
|
case X_XF86VidModeSetGammaRamp:
|
|
|
|
return SProcXF86VidModeSetGammaRamp(client);
|
|
|
|
default:
|
|
|
|
return BadRequest;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
2011-11-05 07:32:40 -06:00
|
|
|
|
|
|
|
void
|
|
|
|
XFree86VidModeExtensionInit(void)
|
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ExtensionEntry *extEntry;
|
2011-11-05 07:32:40 -06:00
|
|
|
ScreenPtr pScreen;
|
2012-06-10 07:21:05 -06:00
|
|
|
int i;
|
|
|
|
Bool enabled = FALSE;
|
2011-11-05 07:32:40 -06:00
|
|
|
|
|
|
|
DEBUG_P("XFree86VidModeExtensionInit");
|
|
|
|
|
|
|
|
if (!dixRegisterPrivateKey(&VidModeClientPrivateKeyRec, PRIVATE_CLIENT, 0))
|
2012-06-10 07:21:05 -06:00
|
|
|
return;
|
2011-11-05 07:32:40 -06:00
|
|
|
#ifdef XF86VIDMODE_EVENTS
|
|
|
|
if (!dixRegisterPrivateKey(&ScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
|
2012-06-10 07:21:05 -06:00
|
|
|
return;
|
2011-11-05 07:32:40 -06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XF86VIDMODE_EVENTS
|
|
|
|
EventType = CreateNewResourceType(XF86VidModeFreeEvents, "VidModeEvent");
|
|
|
|
#endif
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
for (i = 0; i < screenInfo.numScreens; i++) {
|
2011-11-05 07:32:40 -06:00
|
|
|
pScreen = screenInfo.screens[i];
|
2012-06-10 07:21:05 -06:00
|
|
|
if (VidModeExtensionInit(pScreen))
|
|
|
|
enabled = TRUE;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
/* This means that the DDX doesn't want the vidmode extension enabled */
|
|
|
|
if (!enabled)
|
2012-06-10 07:21:05 -06:00
|
|
|
return;
|
2011-11-05 07:32:40 -06:00
|
|
|
|
|
|
|
if (
|
|
|
|
#ifdef XF86VIDMODE_EVENTS
|
2012-06-10 07:21:05 -06:00
|
|
|
EventType &&
|
2011-11-05 07:32:40 -06:00
|
|
|
#endif
|
2012-06-10 07:21:05 -06:00
|
|
|
(extEntry = AddExtension(XF86VIDMODENAME,
|
|
|
|
XF86VidModeNumberEvents,
|
|
|
|
XF86VidModeNumberErrors,
|
|
|
|
ProcXF86VidModeDispatch,
|
|
|
|
SProcXF86VidModeDispatch,
|
|
|
|
NULL, StandardMinorOpcode))) {
|
2011-11-05 07:32:40 -06:00
|
|
|
#if 0
|
2012-06-10 07:21:05 -06:00
|
|
|
XF86VidModeReqCode = (unsigned char) extEntry->base;
|
2011-11-05 07:32:40 -06:00
|
|
|
#endif
|
2012-06-10 07:21:05 -06:00
|
|
|
VidModeErrorBase = extEntry->errorBase;
|
2011-11-05 07:32:40 -06:00
|
|
|
#ifdef XF86VIDMODE_EVENTS
|
2012-06-10 07:21:05 -06:00
|
|
|
XF86VidModeEventBase = extEntry->eventBase;
|
|
|
|
EventSwapVector[XF86VidModeEventBase] =
|
|
|
|
(EventSwapPtr) SXF86VidModeNotifyEvent;
|
2011-11-05 07:32:40 -06:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|