aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/dixmods/extmod
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/dixmods/extmod')
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h128
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/modinit.c361
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/modinit.h179
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c552
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c2458
5 files changed, 1781 insertions, 1897 deletions
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h b/xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h
index a13a51794..b4e0ddfea 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h
+++ b/xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h
@@ -23,58 +23,45 @@
#define DGA_NEED_ROOT 0x00000001
typedef struct {
- int num; /* A unique identifier for the mode (num > 0) */
- char *name; /* name of mode given in the XF86Config */
- int VSync_num;
- int VSync_den;
- int flags; /* DGA_CONCURRENT_ACCESS, etc... */
- int imageWidth; /* linear accessible portion (pixels) */
- int imageHeight;
- int pixmapWidth; /* Xlib accessible portion (pixels) */
- int pixmapHeight; /* both fields ignored if no concurrent access */
- int bytesPerScanline;
- int byteOrder; /* MSBFirst, LSBFirst */
- int depth;
- int bitsPerPixel;
- unsigned long red_mask;
- unsigned long green_mask;
- unsigned long blue_mask;
- short visualClass;
- int viewportWidth;
- int viewportHeight;
- int xViewportStep; /* viewport position granularity */
- int yViewportStep;
- int maxViewportX; /* max viewport origin */
- int maxViewportY;
- int viewportFlags; /* types of page flipping possible */
- int offset;
- int reserved1;
- int reserved2;
+ int num; /* A unique identifier for the mode (num > 0) */
+ char *name; /* name of mode given in the XF86Config */
+ int VSync_num;
+ int VSync_den;
+ int flags; /* DGA_CONCURRENT_ACCESS, etc... */
+ int imageWidth; /* linear accessible portion (pixels) */
+ int imageHeight;
+ int pixmapWidth; /* Xlib accessible portion (pixels) */
+ int pixmapHeight; /* both fields ignored if no concurrent access */
+ int bytesPerScanline;
+ int byteOrder; /* MSBFirst, LSBFirst */
+ int depth;
+ int bitsPerPixel;
+ unsigned long red_mask;
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ short visualClass;
+ int viewportWidth;
+ int viewportHeight;
+ int xViewportStep; /* viewport position granularity */
+ int yViewportStep;
+ int maxViewportX; /* max viewport origin */
+ int maxViewportY;
+ int viewportFlags; /* types of page flipping possible */
+ int offset;
+ int reserved1;
+ int reserved2;
} XDGAModeRec, *XDGAModePtr;
/* DDX interface */
extern _X_EXPORT int
-DGASetMode(
- int Index,
- int num,
- XDGAModePtr mode,
- PixmapPtr *pPix
-);
+ DGASetMode(int Index, int num, XDGAModePtr mode, PixmapPtr *pPix);
extern _X_EXPORT void
-DGASetInputMode(
- int Index,
- Bool keyboard,
- Bool mouse
-);
+ DGASetInputMode(int Index, Bool keyboard, Bool mouse);
extern _X_EXPORT void
-DGASelectInput(
- int Index,
- ClientPtr client,
- long mask
-);
+ DGASelectInput(int Index, ClientPtr client, long mask);
extern _X_EXPORT Bool DGAAvailable(int Index);
extern _X_EXPORT Bool DGAActive(int Index);
@@ -84,35 +71,19 @@ extern _X_EXPORT int DGAGetViewportStatus(int Index);
extern _X_EXPORT int DGASync(int Index);
extern _X_EXPORT int
-DGAFillRect(
- int Index,
- int x, int y, int w, int h,
- unsigned long color
-);
+ DGAFillRect(int Index, int x, int y, int w, int h, unsigned long color);
extern _X_EXPORT int
-DGABlitRect(
- int Index,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty
-);
+ DGABlitRect(int Index, int srcx, int srcy, int w, int h, int dstx, int dsty);
extern _X_EXPORT int
-DGABlitTransRect(
- int Index,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty,
- unsigned long color
-);
+
+DGABlitTransRect(int Index,
+ int srcx, int srcy,
+ int w, int h, int dstx, int dsty, unsigned long color);
extern _X_EXPORT int
-DGASetViewport(
- int Index,
- int x, int y,
- int mode
-);
+ DGASetViewport(int Index, int x, int y, int mode);
extern _X_EXPORT int DGAGetModes(int Index);
extern _X_EXPORT int DGAGetOldDGAMode(int Index);
@@ -120,23 +91,24 @@ extern _X_EXPORT int DGAGetOldDGAMode(int Index);
extern _X_EXPORT int DGAGetModeInfo(int Index, XDGAModePtr mode, int num);
extern _X_EXPORT Bool DGAVTSwitch(void);
-extern _X_EXPORT Bool DGAStealButtonEvent(DeviceIntPtr dev, int Index, int button,
- int is_down);
-extern _X_EXPORT Bool DGAStealMotionEvent(DeviceIntPtr dev, int Index, int dx, int dy);
-extern _X_EXPORT Bool DGAStealKeyEvent(DeviceIntPtr dev, int Index, int key_code, int is_down);
-
-extern _X_EXPORT Bool DGAOpenFramebuffer(int Index, char **name, unsigned char **mem,
- int *size, int *offset, int *flags);
+extern _X_EXPORT Bool DGAStealButtonEvent(DeviceIntPtr dev, int Index,
+ int button, int is_down);
+extern _X_EXPORT Bool DGAStealMotionEvent(DeviceIntPtr dev, int Index, int dx,
+ int dy);
+extern _X_EXPORT Bool DGAStealKeyEvent(DeviceIntPtr dev, int Index,
+ int key_code, int is_down);
+
+extern _X_EXPORT Bool DGAOpenFramebuffer(int Index, char **name,
+ unsigned char **mem, int *size,
+ int *offset, int *flags);
extern _X_EXPORT void DGACloseFramebuffer(int Index);
extern _X_EXPORT Bool DGAChangePixmapMode(int Index, int *x, int *y, int mode);
-extern _X_EXPORT int DGACreateColormap(int Index, ClientPtr client, int id, int mode,
- int alloc);
+extern _X_EXPORT int DGACreateColormap(int Index, ClientPtr client, int id,
+ int mode, int alloc);
extern _X_EXPORT unsigned char DGAReqCode;
extern _X_EXPORT int DGAErrorBase;
extern _X_EXPORT int DGAEventBase;
extern _X_EXPORT int *XDGAEventBase;
-
-
-#endif /* __DGAPROC_H */
+#endif /* __DGAPROC_H */
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/modinit.c b/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
index 632454f37..ca15ee0e7 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
+++ b/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
@@ -1,184 +1,177 @@
-/*
- * Copyright (c) 1997 Matthieu Herrb
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Matthieu Herrb not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Matthieu Herrb makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * MATTHIEU HERRB DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL MATTHIEU HERRB BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-#include "xf86Opt.h"
-
-#include <X11/Xproto.h>
-
-#include "modinit.h"
-#include "globals.h"
-
-static MODULESETUPPROTO(extmodSetup);
-
-/*
- * Array describing extensions to be initialized
- */
-static ExtensionModule extensionModules[] = {
-#ifdef XSELINUX
- {
- SELinuxExtensionInit,
- SELINUX_EXTENSION_NAME,
- &noSELinuxExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef SCREENSAVER
- {
- ScreenSaverExtensionInit,
- ScreenSaverName,
- &noScreenSaverExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef XF86VIDMODE
- {
- XFree86VidModeExtensionInit,
- XF86VIDMODENAME,
- &noXFree86VidModeExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef XFreeXDGA
- {
- XFree86DGAExtensionInit,
- XF86DGANAME,
- &noXFree86DGAExtension,
- XFree86DGARegister,
- NULL
- },
-#endif
-#ifdef DPMSExtension
- {
- DPMSExtensionInit,
- DPMSExtensionName,
- &noDPMSExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef XV
- {
- XvExtensionInit,
- XvName,
- &noXvExtension,
- XvRegister,
- NULL
- },
- {
- XvMCExtensionInit,
- XvMCName,
- &noXvExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef RES
- {
- ResExtensionInit,
- XRES_NAME,
- &noResExtension,
- NULL,
- NULL
- },
-#endif
- { /* DON'T delete this entry ! */
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- }
-};
-
-static XF86ModuleVersionInfo VersRec =
-{
- "extmod",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_EXTENSION,
- ABI_EXTENSION_VERSION,
- MOD_CLASS_EXTENSION,
- {0,0,0,0}
-};
-
-/*
- * Data for the loader
- */
-_X_EXPORT XF86ModuleData extmodModuleData = { &VersRec, extmodSetup, NULL };
-
-static pointer
-extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- int i;
-
- /* XXX the option stuff here is largely a sample/test case */
-
- for (i = 0; extensionModules[i].name != NULL; i++) {
- if (opts) {
- char *s;
- if (asprintf(&s, "omit%s", extensionModules[i].name) != -1) {
- pointer o;
- o = xf86FindOption(opts, s);
- free(s);
- if (o) {
- xf86MarkOptionUsed(o);
- continue;
- }
- }
- }
-
-#ifdef XSELINUX
- if (! strcmp(SELINUX_EXTENSION_NAME, extensionModules[i].name)) {
- pointer o;
- selinuxEnforcingState = SELINUX_MODE_DEFAULT;
-
- if ((o = xf86FindOption(opts, "SELinux mode disabled"))) {
- xf86MarkOptionUsed(o);
- selinuxEnforcingState = SELINUX_MODE_DISABLED;
- }
- if ((o = xf86FindOption(opts, "SELinux mode permissive"))) {
- xf86MarkOptionUsed(o);
- selinuxEnforcingState = SELINUX_MODE_PERMISSIVE;
- }
- if ((o = xf86FindOption(opts, "SELinux mode enforcing"))) {
- xf86MarkOptionUsed(o);
- selinuxEnforcingState = SELINUX_MODE_ENFORCING;
- }
- }
-#endif
-
- LoadExtension(&extensionModules[i], FALSE);
- }
- /* Need a non-NULL return */
- return (pointer)1;
-}
+/*
+ * Copyright (c) 1997 Matthieu Herrb
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Matthieu Herrb not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Matthieu Herrb makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * MATTHIEU HERRB DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL MATTHIEU HERRB BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+#include "xf86Opt.h"
+
+#include <X11/Xproto.h>
+
+#include "modinit.h"
+#include "globals.h"
+
+static MODULESETUPPROTO(extmodSetup);
+
+/*
+ * Array describing extensions to be initialized
+ */
+static ExtensionModule extensionModules[] = {
+#ifdef XSELINUX
+ {
+ SELinuxExtensionInit,
+ SELINUX_EXTENSION_NAME,
+ &noSELinuxExtension,
+ NULL,
+ NULL},
+#endif
+#ifdef SCREENSAVER
+ {
+ ScreenSaverExtensionInit,
+ ScreenSaverName,
+ &noScreenSaverExtension,
+ NULL,
+ NULL},
+#endif
+#ifdef XF86VIDMODE
+ {
+ XFree86VidModeExtensionInit,
+ XF86VIDMODENAME,
+ &noXFree86VidModeExtension,
+ NULL,
+ NULL},
+#endif
+#ifdef XFreeXDGA
+ {
+ XFree86DGAExtensionInit,
+ XF86DGANAME,
+ &noXFree86DGAExtension,
+ XFree86DGARegister,
+ NULL},
+#endif
+#ifdef DPMSExtension
+ {
+ DPMSExtensionInit,
+ DPMSExtensionName,
+ &noDPMSExtension,
+ NULL,
+ NULL},
+#endif
+#ifdef XV
+ {
+ XvExtensionInit,
+ XvName,
+ &noXvExtension,
+ XvRegister,
+ NULL},
+ {
+ XvMCExtensionInit,
+ XvMCName,
+ &noXvExtension,
+ NULL,
+ NULL},
+#endif
+#ifdef RES
+ {
+ ResExtensionInit,
+ XRES_NAME,
+ &noResExtension,
+ NULL,
+ NULL},
+#endif
+ { /* DON'T delete this entry ! */
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL}
+};
+
+static XF86ModuleVersionInfo VersRec = {
+ "extmod",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_EXTENSION,
+ {0, 0, 0, 0}
+};
+
+/*
+ * Data for the loader
+ */
+_X_EXPORT XF86ModuleData extmodModuleData = { &VersRec, extmodSetup, NULL };
+
+static pointer
+extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ int i;
+
+ /* XXX the option stuff here is largely a sample/test case */
+
+ for (i = 0; extensionModules[i].name != NULL; i++) {
+ if (opts) {
+ char *s;
+
+ if (asprintf(&s, "omit%s", extensionModules[i].name) != -1) {
+ pointer o;
+
+ o = xf86FindOption(opts, s);
+ free(s);
+ if (o) {
+ xf86MarkOptionUsed(o);
+ continue;
+ }
+ }
+ }
+
+#ifdef XSELINUX
+ if (!strcmp(SELINUX_EXTENSION_NAME, extensionModules[i].name)) {
+ pointer o;
+
+ selinuxEnforcingState = SELINUX_MODE_DEFAULT;
+
+ if ((o = xf86FindOption(opts, "SELinux mode disabled"))) {
+ xf86MarkOptionUsed(o);
+ selinuxEnforcingState = SELINUX_MODE_DISABLED;
+ }
+ if ((o = xf86FindOption(opts, "SELinux mode permissive"))) {
+ xf86MarkOptionUsed(o);
+ selinuxEnforcingState = SELINUX_MODE_PERMISSIVE;
+ }
+ if ((o = xf86FindOption(opts, "SELinux mode enforcing"))) {
+ xf86MarkOptionUsed(o);
+ selinuxEnforcingState = SELINUX_MODE_ENFORCING;
+ }
+ }
+#endif
+
+ LoadExtension(&extensionModules[i], FALSE);
+ }
+ /* Need a non-NULL return */
+ return (pointer) 1;
+}
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/modinit.h b/xorg-server/hw/xfree86/dixmods/extmod/modinit.h
index 9753e6f14..9753fe0fd 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/modinit.h
+++ b/xorg-server/hw/xfree86/dixmods/extmod/modinit.h
@@ -1,86 +1,93 @@
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef INITARGS
-#define INITARGS void
-#endif
-
-#include <X11/extensions/shapeproto.h>
-
-#ifdef XTEST
-extern void XTestExtensionInit(INITARGS);
-#include <X11/extensions/xtestproto.h>
-#endif
-
-#if 1
-extern void XTestExtension1Init(INITARGS);
-#endif
-
-#if 1
-extern void XCMiscExtensionInit(INITARGS);
-#endif
-
-#ifdef SCREENSAVER
-extern void ScreenSaverExtensionInit (INITARGS);
-#include <X11/extensions/saver.h>
-#endif
-
-#ifdef XF86VIDMODE
-extern void XFree86VidModeExtensionInit(INITARGS);
-#include <X11/extensions/xf86vmproto.h>
-#endif
-
-#ifdef XFreeXDGA
-extern void XFree86DGAExtensionInit(INITARGS);
-extern void XFree86DGARegister(INITARGS);
-#include <X11/extensions/xf86dgaproto.h>
-#endif
-
-#ifdef DPMSExtension
-extern void DPMSExtensionInit(INITARGS);
-#include <X11/extensions/dpmsconst.h>
-#endif
-
-#ifdef XV
-extern void XvExtensionInit(INITARGS);
-extern void XvMCExtensionInit(INITARGS);
-extern void XvRegister(INITARGS);
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/XvMC.h>
-#endif
-
-#ifdef RES
-extern void ResExtensionInit(INITARGS);
-#include <X11/extensions/XResproto.h>
-#endif
-
-#ifdef SHM
-extern void ShmExtensionInit(INITARGS);
-#include <X11/extensions/shmproto.h>
-extern void ShmRegisterFuncs(
- ScreenPtr pScreen,
- ShmFuncsPtr funcs);
-#endif
-
-#ifdef XSELINUX
-extern void SELinuxExtensionInit(INITARGS);
-#include "xselinux.h"
-#endif
-
-#ifdef XEVIE
-extern void XevieExtensionInit(INITARGS);
-#endif
-
-#if 1
-extern void SecurityExtensionInit(INITARGS);
-#endif
-
-#if 1
-extern void PanoramiXExtensionInit(int argc, char *argv[]);
-#endif
-
-#if 1
-extern void XkbExtensionInit(INITARGS);
-#endif
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef INITARGS
+#define INITARGS void
+#endif
+
+#include <X11/extensions/shapeproto.h>
+
+#ifdef XTEST
+extern void XTestExtensionInit(INITARGS);
+
+#include <X11/extensions/xtestproto.h>
+#endif
+
+#if 1
+extern void XTestExtension1Init(INITARGS);
+#endif
+
+#if 1
+extern void XCMiscExtensionInit(INITARGS);
+#endif
+
+#ifdef SCREENSAVER
+extern void ScreenSaverExtensionInit(INITARGS);
+
+#include <X11/extensions/saver.h>
+#endif
+
+#ifdef XF86VIDMODE
+extern void XFree86VidModeExtensionInit(INITARGS);
+
+#include <X11/extensions/xf86vmproto.h>
+#endif
+
+#ifdef XFreeXDGA
+extern void XFree86DGAExtensionInit(INITARGS);
+extern void XFree86DGARegister(INITARGS);
+
+#include <X11/extensions/xf86dgaproto.h>
+#endif
+
+#ifdef DPMSExtension
+extern void DPMSExtensionInit(INITARGS);
+
+#include <X11/extensions/dpmsconst.h>
+#endif
+
+#ifdef XV
+extern void XvExtensionInit(INITARGS);
+extern void XvMCExtensionInit(INITARGS);
+extern void XvRegister(INITARGS);
+
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/XvMC.h>
+#endif
+
+#ifdef RES
+extern void ResExtensionInit(INITARGS);
+
+#include <X11/extensions/XResproto.h>
+#endif
+
+#ifdef SHM
+extern void ShmExtensionInit(INITARGS);
+
+#include <X11/extensions/shmproto.h>
+extern void ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
+#endif
+
+#ifdef XSELINUX
+extern void SELinuxExtensionInit(INITARGS);
+
+#include "xselinux.h"
+#endif
+
+#ifdef XEVIE
+extern void XevieExtensionInit(INITARGS);
+#endif
+
+#if 1
+extern void SecurityExtensionInit(INITARGS);
+#endif
+
+#if 1
+extern void PanoramiXExtensionInit(int argc, char *argv[]);
+#endif
+
+#if 1
+extern void XkbExtensionInit(INITARGS);
+#endif
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c
index 4bcf77efd..6b33941ef 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -6,7 +6,6 @@
* Written by Mark Vojkovich
*/
-
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
@@ -33,26 +32,27 @@
#define DGA_PROTOCOL_OLD_SUPPORT 1
+static void XDGAResetProc(ExtensionEntry * extEntry);
-static void XDGAResetProc(ExtensionEntry *extEntry);
-
-static void DGAClientStateChange (CallbackListPtr*, pointer, pointer);
+static void DGAClientStateChange(CallbackListPtr *, pointer, pointer);
unsigned char DGAReqCode = 0;
int DGAErrorBase;
int DGAEventBase;
static DevPrivateKeyRec DGAScreenPrivateKeyRec;
+
#define DGAScreenPrivateKey (&DGAScreenPrivateKeyRec)
#define DGAScreenPrivateKeyRegistered (DGAScreenPrivateKeyRec.initialized)
static DevPrivateKeyRec DGAClientPrivateKeyRec;
+
#define DGAClientPrivateKey (&DGAClientPrivateKeyRec)
static int DGACallbackRefCount = 0;
/* This holds the client's version information */
typedef struct {
- int major;
- int minor;
+ int major;
+ int minor;
} DGAPrivRec, *DGAPrivPtr;
#define DGA_GETCLIENT(idx) ((ClientPtr) \
@@ -65,15 +65,13 @@ typedef struct {
#define DGA_SETPRIV(c,p) \
dixSetPrivate(&(c)->devPrivates, DGAClientPrivateKey, p)
-
static void
-XDGAResetProc (ExtensionEntry *extEntry)
+XDGAResetProc(ExtensionEntry * extEntry)
{
- DeleteCallback (&ClientStateCallback, DGAClientStateChange, NULL);
- DGACallbackRefCount = 0;
+ DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
+ DGACallbackRefCount = 0;
}
-
static int
ProcXDGAQueryVersion(ClientPtr client)
{
@@ -86,11 +84,10 @@ ProcXDGAQueryVersion(ClientPtr client)
rep.majorVersion = SERVER_XDGA_MAJOR_VERSION;
rep.minorVersion = SERVER_XDGA_MINOR_VERSION;
- WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *) &rep);
return Success;
}
-
static int
ProcXDGAOpenFramebuffer(ClientPtr client)
{
@@ -110,24 +107,23 @@ ProcXDGAOpenFramebuffer(ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
- if(!DGAOpenFramebuffer(stuff->screen, &deviceName,
- (unsigned char**)(&rep.mem1),
- (int*)&rep.size, (int*)&rep.offset, (int*)&rep.extra))
- {
- return BadAlloc;
+ if (!DGAOpenFramebuffer(stuff->screen, &deviceName,
+ (unsigned char **) (&rep.mem1),
+ (int *) &rep.size, (int *) &rep.offset,
+ (int *) &rep.extra)) {
+ return BadAlloc;
}
nameSize = deviceName ? (strlen(deviceName) + 1) : 0;
rep.length = bytes_to_int32(nameSize);
- WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), (char *)&rep);
- if(rep.length)
- WriteToClient(client, nameSize, deviceName);
+ WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), (char *) &rep);
+ if (rep.length)
+ WriteToClient(client, nameSize, deviceName);
return Success;
}
-
static int
ProcXDGACloseFramebuffer(ClientPtr client)
{
@@ -150,6 +146,7 @@ static int
ProcXDGAQueryModes(ClientPtr client)
{
int i, num, size;
+
REQUEST(xXDGAQueryModesReq);
xXDGAQueryModesReply rep;
xXDGAModeInfo info;
@@ -165,64 +162,64 @@ ProcXDGAQueryModes(ClientPtr client)
rep.sequenceNumber = client->sequence;
if (!DGAAvailable(stuff->screen)) {
- rep.number = 0;
- rep.length = 0;
- WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
- return Success;
+ rep.number = 0;
+ rep.length = 0;
+ WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep);
+ return Success;
}
- if(!(num = DGAGetModes(stuff->screen))) {
- WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
- return Success;
+ if (!(num = DGAGetModes(stuff->screen))) {
+ WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep);
+ return Success;
}
- if(!(mode = (XDGAModePtr)malloc(num * sizeof(XDGAModeRec))))
- return BadAlloc;
+ if (!(mode = (XDGAModePtr) malloc(num * sizeof(XDGAModeRec))))
+ return BadAlloc;
- for(i = 0; i < num; i++)
- DGAGetModeInfo(stuff->screen, mode + i, i + 1);
+ for (i = 0; i < num; i++)
+ DGAGetModeInfo(stuff->screen, mode + i, i + 1);
size = num * sz_xXDGAModeInfo;
- for(i = 0; i < num; i++)
- size += pad_to_int32(strlen(mode[i].name) + 1); /* plus NULL */
+ for (i = 0; i < num; i++)
+ size += pad_to_int32(strlen(mode[i].name) + 1); /* plus NULL */
rep.number = num;
rep.length = bytes_to_int32(size);
- WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
-
- for(i = 0; i < num; i++) {
- size = strlen(mode[i].name) + 1;
-
- info.byte_order = mode[i].byteOrder;
- info.depth = mode[i].depth;
- info.num = mode[i].num;
- info.bpp = mode[i].bitsPerPixel;
- info.name_size = (size + 3) & ~3L;
- info.vsync_num = mode[i].VSync_num;
- info.vsync_den = mode[i].VSync_den;
- info.flags = mode[i].flags;
- info.image_width = mode[i].imageWidth;
- info.image_height = mode[i].imageHeight;
- info.pixmap_width = mode[i].pixmapWidth;
- info.pixmap_height = mode[i].pixmapHeight;
- info.bytes_per_scanline = mode[i].bytesPerScanline;
- info.red_mask = mode[i].red_mask;
- info.green_mask = mode[i].green_mask;
- info.blue_mask = mode[i].blue_mask;
- info.visual_class = mode[i].visualClass;
- info.viewport_width = mode[i].viewportWidth;
- info.viewport_height = mode[i].viewportHeight;
- info.viewport_xstep = mode[i].xViewportStep;
- info.viewport_ystep = mode[i].yViewportStep;
- info.viewport_xmax = mode[i].maxViewportX;
- info.viewport_ymax = mode[i].maxViewportY;
- info.viewport_flags = mode[i].viewportFlags;
- info.reserved1 = mode[i].reserved1;
- info.reserved2 = mode[i].reserved2;
-
- WriteToClient(client, sz_xXDGAModeInfo, (char*)(&info));
- WriteToClient(client, size, mode[i].name);
+ WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep);
+
+ for (i = 0; i < num; i++) {
+ size = strlen(mode[i].name) + 1;
+
+ info.byte_order = mode[i].byteOrder;
+ info.depth = mode[i].depth;
+ info.num = mode[i].num;
+ info.bpp = mode[i].bitsPerPixel;
+ info.name_size = (size + 3) & ~3L;
+ info.vsync_num = mode[i].VSync_num;
+ info.vsync_den = mode[i].VSync_den;
+ info.flags = mode[i].flags;
+ info.image_width = mode[i].imageWidth;
+ info.image_height = mode[i].imageHeight;
+ info.pixmap_width = mode[i].pixmapWidth;
+ info.pixmap_height = mode[i].pixmapHeight;
+ info.bytes_per_scanline = mode[i].bytesPerScanline;
+ info.red_mask = mode[i].red_mask;
+ info.green_mask = mode[i].green_mask;
+ info.blue_mask = mode[i].blue_mask;
+ info.visual_class = mode[i].visualClass;
+ info.viewport_width = mode[i].viewportWidth;
+ info.viewport_height = mode[i].viewportHeight;
+ info.viewport_xstep = mode[i].xViewportStep;
+ info.viewport_ystep = mode[i].yViewportStep;
+ info.viewport_xmax = mode[i].maxViewportX;
+ info.viewport_ymax = mode[i].maxViewportY;
+ info.viewport_flags = mode[i].viewportFlags;
+ info.reserved1 = mode[i].reserved1;
+ info.reserved2 = mode[i].reserved2;
+
+ WriteToClient(client, sz_xXDGAModeInfo, (char *) (&info));
+ WriteToClient(client, size, mode[i].name);
}
free(mode);
@@ -230,36 +227,32 @@ ProcXDGAQueryModes(ClientPtr client)
return Success;
}
-
static void
-DGAClientStateChange (
- CallbackListPtr* pcbl,
- pointer nulldata,
- pointer calldata
-){
- NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
+DGAClientStateChange(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
+{
+ NewClientInfoRec *pci = (NewClientInfoRec *) calldata;
ClientPtr client = NULL;
int i;
- for(i = 0; i < screenInfo.numScreens; i++) {
- if(DGA_GETCLIENT(i) == pci->client) {
- client = pci->client;
- break;
- }
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ if (DGA_GETCLIENT(i) == pci->client) {
+ client = pci->client;
+ break;
+ }
}
- if(client &&
- ((client->clientState == ClientStateGone) ||
- (client->clientState == ClientStateRetained))) {
- XDGAModeRec mode;
- PixmapPtr pPix;
+ if (client &&
+ ((client->clientState == ClientStateGone) ||
+ (client->clientState == ClientStateRetained))) {
+ XDGAModeRec mode;
+ PixmapPtr pPix;
- DGA_SETCLIENT(i, NULL);
- DGASelectInput(i, NULL, 0);
- DGASetMode(i, 0, &mode, &pPix);
+ DGA_SETCLIENT(i, NULL);
+ DGASelectInput(i, NULL, 0);
+ DGASetMode(i, 0, &mode, &pPix);
- if(--DGACallbackRefCount == 0)
- DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
+ if (--DGACallbackRefCount == 0)
+ DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
}
}
@@ -288,36 +281,37 @@ ProcXDGASetMode(ClientPtr client)
if (!DGAAvailable(stuff->screen))
return DGAErrorBase + XF86DGANoDirectVideoMode;
- if(owner && owner != client)
+ if (owner && owner != client)
return DGAErrorBase + XF86DGANoDirectVideoMode;
- if(!stuff->mode) {
- if(owner) {
- if(--DGACallbackRefCount == 0)
- DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
- }
- DGA_SETCLIENT(stuff->screen, NULL);
- DGASelectInput(stuff->screen, NULL, 0);
- DGASetMode(stuff->screen, 0, &mode, &pPix);
- WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep);
- return Success;
+ if (!stuff->mode) {
+ if (owner) {
+ if (--DGACallbackRefCount == 0)
+ DeleteCallback(&ClientStateCallback, DGAClientStateChange,
+ NULL);
+ }
+ DGA_SETCLIENT(stuff->screen, NULL);
+ DGASelectInput(stuff->screen, NULL, 0);
+ DGASetMode(stuff->screen, 0, &mode, &pPix);
+ WriteToClient(client, sz_xXDGASetModeReply, (char *) &rep);
+ return Success;
}
- if(Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix))
- return BadValue;
+ if (Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix))
+ return BadValue;
- if(!owner) {
- if(DGACallbackRefCount++ == 0)
- AddCallback (&ClientStateCallback, DGAClientStateChange, NULL);
+ if (!owner) {
+ if (DGACallbackRefCount++ == 0)
+ AddCallback(&ClientStateCallback, DGAClientStateChange, NULL);
}
DGA_SETCLIENT(stuff->screen, client);
- if(pPix) {
- if(AddResource(stuff->pid, RT_PIXMAP, (pointer)(pPix))) {
- pPix->drawable.id = (int)stuff->pid;
- rep.flags = DGA_PIXMAP_AVAILABLE;
- }
+ if (pPix) {
+ if (AddResource(stuff->pid, RT_PIXMAP, (pointer) (pPix))) {
+ pPix->drawable.id = (int) stuff->pid;
+ rep.flags = DGA_PIXMAP_AVAILABLE;
+ }
}
size = strlen(mode.name) + 1;
@@ -351,8 +345,8 @@ ProcXDGASetMode(ClientPtr client)
rep.length = bytes_to_int32(sz_xXDGAModeInfo + info.name_size);
- WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep);
- WriteToClient(client, sz_xXDGAModeInfo, (char*)(&info));
+ WriteToClient(client, sz_xXDGASetModeReply, (char *) &rep);
+ WriteToClient(client, sz_xXDGAModeInfo, (char *) (&info));
WriteToClient(client, size, mode.name);
return Success;
@@ -366,7 +360,7 @@ ProcXDGASetViewport(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGASetViewportReq);
@@ -381,25 +375,25 @@ ProcXDGAInstallColormap(ClientPtr client)
{
ColormapPtr cmap;
int rc;
+
REQUEST(xXDGAInstallColormapReq);
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
- rc = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, RT_COLORMAP,
- client, DixInstallAccess);
+ rc = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, RT_COLORMAP,
+ client, DixInstallAccess);
if (rc != Success)
return rc;
DGAInstallCmap(cmap);
return Success;
}
-
static int
ProcXDGASelectInput(ClientPtr client)
{
@@ -408,18 +402,17 @@ ProcXDGASelectInput(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGASelectInputReq);
- if(DGA_GETCLIENT(stuff->screen) == client)
- DGASelectInput(stuff->screen, client, stuff->mask);
+ if (DGA_GETCLIENT(stuff->screen) == client)
+ DGASelectInput(stuff->screen, client, stuff->mask);
return Success;
}
-
static int
ProcXDGAFillRectangle(ClientPtr client)
{
@@ -428,14 +421,14 @@ ProcXDGAFillRectangle(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
- if(Success != DGAFillRect(stuff->screen, stuff->x, stuff->y,
- stuff->width, stuff->height, stuff->color))
- return BadMatch;
+ if (Success != DGAFillRect(stuff->screen, stuff->x, stuff->y,
+ stuff->width, stuff->height, stuff->color))
+ return BadMatch;
return Success;
}
@@ -448,19 +441,19 @@ ProcXDGACopyArea(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
- if(Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy,
- stuff->width, stuff->height, stuff->dstx, stuff->dsty))
- return BadMatch;
+ if (Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy,
+ stuff->width, stuff->height, stuff->dstx,
+ stuff->dsty))
+ return BadMatch;
return Success;
}
-
static int
ProcXDGACopyTransparentArea(ClientPtr client)
{
@@ -469,19 +462,19 @@ ProcXDGACopyTransparentArea(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
- if(Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy,
- stuff->width, stuff->height, stuff->dstx, stuff->dsty, stuff->key))
- return BadMatch;
+ if (Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy,
+ stuff->width, stuff->height, stuff->dstx,
+ stuff->dsty, stuff->key))
+ return BadMatch;
return Success;
}
-
static int
ProcXDGAGetViewportStatus(ClientPtr client)
{
@@ -491,7 +484,7 @@ ProcXDGAGetViewportStatus(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
@@ -501,7 +494,7 @@ ProcXDGAGetViewportStatus(ClientPtr client)
rep.status = DGAGetViewportStatus(stuff->screen);
- WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), (char *) &rep);
return Success;
}
@@ -514,7 +507,7 @@ ProcXDGASync(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGASyncReq);
@@ -524,7 +517,7 @@ ProcXDGASync(ClientPtr client)
DGASync(stuff->screen);
- WriteToClient(client, sizeof(xXDGASyncReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXDGASyncReply), (char *) &rep);
return Success;
}
@@ -537,11 +530,11 @@ ProcXDGASetClientVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xXDGASetClientVersionReq);
if ((pPriv = DGA_GETPRIV(client)) == NULL) {
- pPriv = malloc(sizeof(DGAPrivRec));
- /* XXX Need to look into freeing this */
- if (!pPriv)
- return BadAlloc;
- DGA_SETPRIV(client, pPriv);
+ pPriv = malloc(sizeof(DGAPrivRec));
+ /* XXX Need to look into freeing this */
+ if (!pPriv)
+ return BadAlloc;
+ DGA_SETPRIV(client, pPriv);
}
pPriv->major = stuff->major;
pPriv->minor = stuff->minor;
@@ -559,7 +552,7 @@ ProcXDGAChangePixmapMode(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
@@ -570,17 +563,16 @@ ProcXDGAChangePixmapMode(ClientPtr client)
x = stuff->x;
y = stuff->y;
- if(!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags))
- return BadMatch;
+ if (!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags))
+ return BadMatch;
rep.x = x;
rep.y = y;
- WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), (char *) &rep);
return Success;
}
-
static int
ProcXDGACreateColormap(ClientPtr client)
{
@@ -590,18 +582,18 @@ ProcXDGACreateColormap(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if(DGA_GETCLIENT(stuff->screen) != client)
+ if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
- if(!stuff->mode)
- return BadValue;
+ if (!stuff->mode)
+ return BadValue;
result = DGACreateColormap(stuff->screen, client, stuff->id,
- stuff->mode, stuff->alloc);
- if(result != Success)
- return result;
+ stuff->mode, stuff->alloc);
+ if (result != Success)
+ return result;
return Success;
}
@@ -614,8 +606,6 @@ ProcXDGACreateColormap(ClientPtr client)
#ifdef DGA_PROTOCOL_OLD_SUPPORT
-
-
static int
ProcXF86DGAGetVideoLL(ClientPtr client)
{
@@ -626,32 +616,32 @@ ProcXF86DGAGetVideoLL(ClientPtr client)
char *name;
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- if(!DGAAvailable(stuff->screen))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
+ if (!DGAAvailable(stuff->screen))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
- if(!(num = DGAGetOldDGAMode(stuff->screen)))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
+ if (!(num = DGAGetOldDGAMode(stuff->screen)))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
/* get the parameters for the mode that best matches */
DGAGetModeInfo(stuff->screen, &mode, num);
- if(!DGAOpenFramebuffer(stuff->screen, &name,
- (unsigned char**)(&rep.offset),
- (int*)(&rep.bank_size), &offset, &flags))
- return BadAlloc;
+ if (!DGAOpenFramebuffer(stuff->screen, &name,
+ (unsigned char **) (&rep.offset),
+ (int *) (&rep.bank_size), &offset, &flags))
+ return BadAlloc;
rep.offset += mode.offset;
rep.width = mode.bytesPerScanline / (mode.bitsPerPixel >> 3);
rep.ram_size = rep.bank_size >> 10;
- WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), (char *) &rep);
return Success;
}
@@ -662,14 +652,15 @@ ProcXF86DGADirectVideo(ClientPtr client)
PixmapPtr pix;
XDGAModeRec mode;
ClientPtr owner;
+
REQUEST(xXF86DGADirectVideoReq);
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
if (!DGAAvailable(stuff->screen))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
owner = DGA_GETCLIENT(stuff->screen);
@@ -677,34 +668,37 @@ ProcXF86DGADirectVideo(ClientPtr client)
return DGAErrorBase + XF86DGANoDirectVideoMode;
if (stuff->enable & XF86DGADirectGraphics) {
- if(!(num = DGAGetOldDGAMode(stuff->screen)))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
- } else
- num = 0;
+ if (!(num = DGAGetOldDGAMode(stuff->screen)))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+ }
+ else
+ num = 0;
- if(Success != DGASetMode(stuff->screen, num, &mode, &pix))
- return DGAErrorBase + XF86DGAScreenNotActive;
+ if (Success != DGASetMode(stuff->screen, num, &mode, &pix))
+ return DGAErrorBase + XF86DGAScreenNotActive;
- DGASetInputMode (stuff->screen,
- (stuff->enable & XF86DGADirectKeyb) != 0,
- (stuff->enable & XF86DGADirectMouse) != 0);
+ DGASetInputMode(stuff->screen,
+ (stuff->enable & XF86DGADirectKeyb) != 0,
+ (stuff->enable & XF86DGADirectMouse) != 0);
/* We need to track the client and attach the teardown callback */
if (stuff->enable &
- (XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse)) {
- if (!owner) {
- if (DGACallbackRefCount++ == 0)
- AddCallback (&ClientStateCallback, DGAClientStateChange, NULL);
- }
-
- DGA_SETCLIENT(stuff->screen, client);
- } else {
- if (owner) {
- if (--DGACallbackRefCount == 0)
- DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
- }
-
- DGA_SETCLIENT(stuff->screen, NULL);
+ (XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse)) {
+ if (!owner) {
+ if (DGACallbackRefCount++ == 0)
+ AddCallback(&ClientStateCallback, DGAClientStateChange, NULL);
+ }
+
+ DGA_SETCLIENT(stuff->screen, client);
+ }
+ else {
+ if (owner) {
+ if (--DGACallbackRefCount == 0)
+ DeleteCallback(&ClientStateCallback, DGAClientStateChange,
+ NULL);
+ }
+
+ DGA_SETCLIENT(stuff->screen, NULL);
}
return Success;
@@ -715,11 +709,12 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
{
int num;
XDGAModeRec mode;
+
REQUEST(xXF86DGAGetViewPortSizeReq);
xXF86DGAGetViewPortSizeReply rep;
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
rep.type = X_Reply;
@@ -727,17 +722,17 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
rep.sequenceNumber = client->sequence;
if (!DGAAvailable(stuff->screen))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
- if(!(num = DGAGetOldDGAMode(stuff->screen)))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
+ if (!(num = DGAGetOldDGAMode(stuff->screen)))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
DGAGetModeInfo(stuff->screen, &mode, num);
rep.width = mode.viewportWidth;
rep.height = mode.viewportHeight;
- WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), (char *) &rep);
return Success;
}
@@ -747,7 +742,7 @@ ProcXF86DGASetViewPort(ClientPtr client)
REQUEST(xXF86DGASetViewPortReq);
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
@@ -755,14 +750,14 @@ ProcXF86DGASetViewPort(ClientPtr client)
REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
if (!DGAAvailable(stuff->screen))
- return DGAErrorBase + XF86DGANoDirectVideoMode;
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
if (!DGAActive(stuff->screen))
- return DGAErrorBase + XF86DGADirectNotActivated;
+ return DGAErrorBase + XF86DGADirectNotActivated;
if (DGASetViewport(stuff->screen, stuff->x, stuff->y, DGA_FLIP_RETRACE)
- != Success)
- return DGAErrorBase + XF86DGADirectNotActivated;
+ != Success)
+ return DGAErrorBase + XF86DGADirectNotActivated;
return Success;
}
@@ -774,26 +769,25 @@ ProcXF86DGAGetVidPage(ClientPtr client)
xXF86DGAGetVidPageReply rep;
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.vpage = 0; /* silently fail */
+ rep.vpage = 0; /* silently fail */
- WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), (char *) &rep);
return Success;
}
-
static int
ProcXF86DGASetVidPage(ClientPtr client)
{
REQUEST(xXF86DGASetVidPageReq);
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
@@ -802,16 +796,16 @@ ProcXF86DGASetVidPage(ClientPtr client)
return Success;
}
-
static int
ProcXF86DGAInstallColormap(ClientPtr client)
{
ColormapPtr pcmp;
int rc;
+
REQUEST(xXF86DGAInstallColormapReq);
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
@@ -819,14 +813,15 @@ ProcXF86DGAInstallColormap(ClientPtr client)
REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
if (!DGAActive(stuff->screen))
- return DGAErrorBase + XF86DGADirectNotActivated;
+ return DGAErrorBase + XF86DGADirectNotActivated;
- rc = dixLookupResourceByType((pointer *)&pcmp, stuff->id, RT_COLORMAP,
- client, DixInstallAccess);
+ rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP,
+ client, DixInstallAccess);
if (rc == Success) {
- DGAInstallCmap(pcmp);
+ DGAInstallCmap(pcmp);
return Success;
- } else {
+ }
+ else {
return rc;
}
}
@@ -838,7 +833,7 @@ ProcXF86DGAQueryDirectVideo(ClientPtr client)
xXF86DGAQueryDirectVideoReply rep;
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
rep.type = X_Reply;
@@ -847,9 +842,9 @@ ProcXF86DGAQueryDirectVideo(ClientPtr client)
rep.flags = 0;
if (DGAAvailable(stuff->screen))
- rep.flags = XF86DGADirectPresent;
+ rep.flags = XF86DGADirectPresent;
- WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), (char *) &rep);
return Success;
}
@@ -860,7 +855,7 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
xXF86DGAViewPortChangedReply rep;
if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ return BadValue;
if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
@@ -868,23 +863,23 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
if (!DGAActive(stuff->screen))
- return DGAErrorBase + XF86DGADirectNotActivated;
+ return DGAErrorBase + XF86DGADirectNotActivated;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.result = 1;
- WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), (char *) &rep);
return Success;
}
-#endif /* DGA_PROTOCOL_OLD_SUPPORT */
+#endif /* DGA_PROTOCOL_OLD_SUPPORT */
static int
-SProcXDGADispatch (ClientPtr client)
+SProcXDGADispatch(ClientPtr client)
{
- return DGAErrorBase + XF86DGAClientNotLocal;
+ return DGAErrorBase + XF86DGAClientNotLocal;
}
#if 0
@@ -924,112 +919,111 @@ static char *dgaMinor[] = {
#endif
static int
-ProcXDGADispatch (ClientPtr client)
+ProcXDGADispatch(ClientPtr client)
{
REQUEST(xReq);
if (!LocalClient(client))
- return DGAErrorBase + XF86DGAClientNotLocal;
+ return DGAErrorBase + XF86DGAClientNotLocal;
#ifdef DGA_REQ_DEBUG
if (stuff->data <= X_XDGACreateColormap)
- fprintf (stderr, " DGA %s\n", dgaMinor[stuff->data]);
+ fprintf(stderr, " DGA %s\n", dgaMinor[stuff->data]);
#endif
- switch (stuff->data){
- /*
- * DGA2 Protocol
- */
+ switch (stuff->data) {
+ /*
+ * DGA2 Protocol
+ */
case X_XDGAQueryVersion:
- return ProcXDGAQueryVersion(client);
+ return ProcXDGAQueryVersion(client);
case X_XDGAQueryModes:
- return ProcXDGAQueryModes(client);
+ return ProcXDGAQueryModes(client);
case X_XDGASetMode:
- return ProcXDGASetMode(client);
+ return ProcXDGASetMode(client);
case X_XDGAOpenFramebuffer:
- return ProcXDGAOpenFramebuffer(client);
+ return ProcXDGAOpenFramebuffer(client);
case X_XDGACloseFramebuffer:
- return ProcXDGACloseFramebuffer(client);
+ return ProcXDGACloseFramebuffer(client);
case X_XDGASetViewport:
- return ProcXDGASetViewport(client);
+ return ProcXDGASetViewport(client);
case X_XDGAInstallColormap:
- return ProcXDGAInstallColormap(client);
+ return ProcXDGAInstallColormap(client);
case X_XDGASelectInput:
- return ProcXDGASelectInput(client);
+ return ProcXDGASelectInput(client);
case X_XDGAFillRectangle:
- return ProcXDGAFillRectangle(client);
+ return ProcXDGAFillRectangle(client);
case X_XDGACopyArea:
- return ProcXDGACopyArea(client);
+ return ProcXDGACopyArea(client);
case X_XDGACopyTransparentArea:
- return ProcXDGACopyTransparentArea(client);
+ return ProcXDGACopyTransparentArea(client);
case X_XDGAGetViewportStatus:
- return ProcXDGAGetViewportStatus(client);
+ return ProcXDGAGetViewportStatus(client);
case X_XDGASync:
- return ProcXDGASync(client);
+ return ProcXDGASync(client);
case X_XDGASetClientVersion:
- return ProcXDGASetClientVersion(client);
+ return ProcXDGASetClientVersion(client);
case X_XDGAChangePixmapMode:
- return ProcXDGAChangePixmapMode(client);
+ return ProcXDGAChangePixmapMode(client);
case X_XDGACreateColormap:
- return ProcXDGACreateColormap(client);
- /*
- * Old DGA Protocol
- */
+ return ProcXDGACreateColormap(client);
+ /*
+ * Old DGA Protocol
+ */
#ifdef DGA_PROTOCOL_OLD_SUPPORT
case X_XF86DGAGetVideoLL:
- return ProcXF86DGAGetVideoLL(client);
+ return ProcXF86DGAGetVideoLL(client);
case X_XF86DGADirectVideo:
- return ProcXF86DGADirectVideo(client);
+ return ProcXF86DGADirectVideo(client);
case X_XF86DGAGetViewPortSize:
- return ProcXF86DGAGetViewPortSize(client);
+ return ProcXF86DGAGetViewPortSize(client);
case X_XF86DGASetViewPort:
- return ProcXF86DGASetViewPort(client);
+ return ProcXF86DGASetViewPort(client);
case X_XF86DGAGetVidPage:
- return ProcXF86DGAGetVidPage(client);
+ return ProcXF86DGAGetVidPage(client);
case X_XF86DGASetVidPage:
- return ProcXF86DGASetVidPage(client);
+ return ProcXF86DGASetVidPage(client);
case X_XF86DGAInstallColormap:
- return ProcXF86DGAInstallColormap(client);
+ return ProcXF86DGAInstallColormap(client);
case X_XF86DGAQueryDirectVideo:
- return ProcXF86DGAQueryDirectVideo(client);
+ return ProcXF86DGAQueryDirectVideo(client);
case X_XF86DGAViewPortChanged:
- return ProcXF86DGAViewPortChanged(client);
-#endif /* DGA_PROTOCOL_OLD_SUPPORT */
+ return ProcXF86DGAViewPortChanged(client);
+#endif /* DGA_PROTOCOL_OLD_SUPPORT */
default:
- return BadRequest;
+ return BadRequest;
}
}
void
XFree86DGARegister(INITARGS)
{
- XDGAEventBase = &DGAEventBase;
+ XDGAEventBase = &DGAEventBase;
}
void
XFree86DGAExtensionInit(INITARGS)
{
- ExtensionEntry* extEntry;
+ ExtensionEntry *extEntry;
if (!dixRegisterPrivateKey(&DGAClientPrivateKeyRec, PRIVATE_CLIENT, 0))
- return;
+ return;
if (!dixRegisterPrivateKey(&DGAScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return;
+ return;
if ((extEntry = AddExtension(XF86DGANAME,
- XF86DGANumberEvents,
- XF86DGANumberErrors,
- ProcXDGADispatch,
- SProcXDGADispatch,
- XDGAResetProc,
- StandardMinorOpcode))) {
- int i;
-
- DGAReqCode = (unsigned char)extEntry->base;
- DGAErrorBase = extEntry->errorBase;
- DGAEventBase = extEntry->eventBase;
- for (i = KeyPress; i <= MotionNotify; i++)
- SetCriticalEvent (DGAEventBase + i);
+ XF86DGANumberEvents,
+ XF86DGANumberErrors,
+ ProcXDGADispatch,
+ SProcXDGADispatch,
+ XDGAResetProc, StandardMinorOpcode))) {
+ int i;
+
+ DGAReqCode = (unsigned char) extEntry->base;
+ DGAErrorBase = extEntry->errorBase;
+ DGAEventBase = extEntry->eventBase;
+ for (i = KeyPress; i <= MotionNotify; i++)
+ SetCriticalEvent(DGAEventBase + i);
}
}
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c
index 6d3d5fcbc..6e2a8e9b2 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -52,12 +52,13 @@ from Kaleb S. KEITHLEY
static int VidModeErrorBase;
static DevPrivateKeyRec VidModeClientPrivateKeyRec;
+
#define VidModeClientPrivateKey (&VidModeClientPrivateKeyRec)
/* This holds the client's version information */
typedef struct {
- int major;
- int minor;
+ int major;
+ int minor;
} VidModePrivRec, *VidModePrivPtr;
#define VM_GETPRIV(c) ((VidModePrivPtr) \
@@ -65,7 +66,6 @@ typedef struct {
#define VM_SETPRIV(c,p) \
dixSetPrivate(&(c)->devPrivates, VidModeClientPrivateKey, p)
-
#if 0
static unsigned char XF86VidModeReqCode = 0;
#endif
@@ -76,30 +76,30 @@ static unsigned char XF86VidModeReqCode = 0;
static int XF86VidModeEventBase = 0;
static void SXF86VidModeNotifyEvent();
- xXF86VidModeNotifyEvent * /* from */,
- xXF86VidModeNotifyEvent * /* to */
-);
+xXF86VidModeNotifyEvent * /* from */ , xXF86VidModeNotifyEvent * /* to */
+ );
-static RESTYPE EventType; /* resource type for event masks */
+static RESTYPE EventType; /* resource type for event masks */
typedef struct _XF86VidModeEvent *XF86VidModeEventPtr;
typedef struct _XF86VidModeEvent {
- XF86VidModeEventPtr next;
- ClientPtr client;
- ScreenPtr screen;
- XID resource;
- CARD32 mask;
+ XF86VidModeEventPtr next;
+ ClientPtr client;
+ ScreenPtr screen;
+ XID resource;
+ CARD32 mask;
} XF86VidModeEventRec;
static int XF86VidModeFreeEvents();
typedef struct _XF86VidModeScreenPrivate {
- XF86VidModeEventPtr events;
- Bool hasWindow;
+ XF86VidModeEventPtr events;
+ Bool hasWindow;
} XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr;
static DevPrivateKeyRec ScreenPrivateKeyRec;
+
#define ScreenPrivateKey (&ScreenPrivateKeyRec)
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
@@ -112,198 +112,181 @@ static DevPrivateKeyRec ScreenPrivateKeyRec;
#endif
#ifdef DEBUG
-# define DEBUG_P(x) ErrorF(x"\n");
+#define DEBUG_P(x) ErrorF(x"\n");
#else
-# define DEBUG_P(x) /**/
+#define DEBUG_P(x) /**/
#endif
-
-static int
-ClientMajorVersion(ClientPtr client)
-{
+ static int
+ ClientMajorVersion(ClientPtr client) {
VidModePrivPtr pPriv;
- pPriv = VM_GETPRIV(client);
+ pPriv = VM_GETPRIV(client);
if (!pPriv)
- return 0;
+ return 0;
else
- return pPriv->major;
+ return pPriv->major;
}
-
#ifdef XF86VIDMODE_EVENTS
static void
-CheckScreenPrivate (pScreen)
- ScreenPtr pScreen;
+ CheckScreenPrivate(pScreen)
+ScreenPtr
+ pScreen;
{
- SetupScreen (pScreen);
+ SetupScreen(pScreen);
if (!pPriv)
- return;
+ return;
if (!pPriv->events && !pPriv->hasWindow) {
- free(pPriv);
- SetScreenPrivate (pScreen, NULL);
+ free(pPriv);
+ SetScreenPrivate(pScreen, NULL);
}
}
-
-static XF86VidModeScreenPrivatePtr
-MakeScreenPrivate (pScreen)
- ScreenPtr pScreen;
+
+static XF86VidModeScreenPrivatePtr MakeScreenPrivate(pScreen)
+ScreenPtr
+ pScreen;
{
- SetupScreen (pScreen);
+ SetupScreen(pScreen);
if (pPriv)
- return pPriv;
- pPriv = New (XF86VidModeScreenPrivateRec);
+ return pPriv;
+ pPriv = New(XF86VidModeScreenPrivateRec);
if (!pPriv)
- return 0;
+ return 0;
pPriv->events = 0;
pPriv->hasWindow = FALSE;
- SetScreenPrivate (pScreen, pPriv);
+ SetScreenPrivate(pScreen, pPriv);
return pPriv;
}
static unsigned long
-getEventMask (ScreenPtr pScreen, ClientPtr client)
-{
+ getEventMask(ScreenPtr pScreen, ClientPtr client) {
SetupScreen(pScreen);
XF86VidModeEventPtr pEv;
if (!pPriv)
- return 0;
+ return 0;
for (pEv = pPriv->events; pEv; pEv = pEv->next)
- if (pEv->client == client)
- return pEv->mask;
- return 0;
-}
-
-static Bool
-setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
-{
+ if (pEv->client == client)
+ return pEv->mask;
+ return 0;
+} static Bool
+ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask) {
SetupScreen(pScreen);
XF86VidModeEventPtr pEv, *pPrev;
- if (getEventMask (pScreen, client) == mask)
- return TRUE;
+ if (getEventMask(pScreen, client) == mask)
+ return TRUE;
if (!pPriv) {
- pPriv = MakeScreenPrivate (pScreen);
- if (!pPriv)
- return FALSE;
- }
- for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
- if (pEv->client == client)
- break;
+ pPriv = MakeScreenPrivate(pScreen);
+ if (!pPriv)
+ return FALSE;
+ } for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
+ if (pEv->client == client)
+ break;
if (mask == 0) {
- *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;
+ *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;
}
return TRUE;
}
static int
-XF86VidModeFreeEvents(pointer value, XID id)
-{
- XF86VidModeEventPtr pOld = (XF86VidModeEventPtr)value;
+ XF86VidModeFreeEvents(pointer value, XID id) {
+ XF86VidModeEventPtr pOld = (XF86VidModeEventPtr) value;
ScreenPtr pScreen = pOld->screen;
- SetupScreen (pScreen);
- XF86VidModeEventPtr pEv, *pPrev;
+ SetupScreen(pScreen);
+ XF86VidModeEventPtr pEv, *pPrev;
if (!pPriv)
- return TRUE;
+ return TRUE;
for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
- if (pEv == pOld)
- break;
+ if (pEv == pOld)
+ break;
if (!pEv)
- return TRUE;
+ return TRUE;
*pPrev = pEv->next;
- free(pEv);
- CheckScreenPrivate (pScreen);
- return TRUE;
-}
-
-static void
-SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
-{
- XF86VidModeScreenPrivatePtr pPriv;
- XF86VidModeEventPtr pEv;
- unsigned long mask;
- xXF86VidModeNotifyEvent ev;
- int kind;
-
- UpdateCurrentTimeIf ();
- mask = XF86VidModeNotifyMask;
- pScreen = screenInfo.screens[pScreen->myNum];
- pPriv = GetScreenPrivate(pScreen);
+ free(pEv);
+ CheckScreenPrivate(pScreen);
+ return TRUE;
+} static void
+ SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced) {
+ XF86VidModeScreenPrivatePtr pPriv;
+ XF86VidModeEventPtr pEv;
+ unsigned long mask;
+ xXF86VidModeNotifyEvent ev;
+ int kind;
+
+ UpdateCurrentTimeIf();
+ mask = XF86VidModeNotifyMask;
+ pScreen = screenInfo.screens[pScreen->myNum];
+ pPriv = GetScreenPrivate(pScreen);
if (!pPriv)
- return;
- kind = XF86VidModeModeChange;
- for (pEv = pPriv->events; pEv; pEv = pEv->next)
- {
- if (!(pEv->mask & mask))
- continue;
- ev.type = XF86VidModeNotify + XF86VidModeEventBase;
- ev.state = state;
- ev.timestamp = currentTime.milliseconds;
- ev.root = pScreen->root->drawable.id;
- ev.kind = kind;
- ev.forced = forced;
- WriteEventsToClient (pEv->client, 1, (xEvent *) &ev);
- }
-}
-
-static void
-SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent *from,
- xXF86VidModeNotifyEvent *to)
-{
+ return;
+ kind = XF86VidModeModeChange;
+ for (pEv = pPriv->events; pEv; pEv = pEv->next) {
+ if (!(pEv->mask & mask))
+ continue;
+ ev.type = XF86VidModeNotify + XF86VidModeEventBase;
+ ev.state = state;
+ ev.timestamp = currentTime.milliseconds;
+ ev.root = pScreen->root->drawable.id;
+ ev.kind = kind;
+ ev.forced = forced;
+ WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
+}} static void
+ SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * from,
+ xXF86VidModeNotifyEvent * to) {
to->type = from->type;
to->state = from->state;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->timestamp, to->timestamp);
- cpswapl (from->root, to->root);
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->root, to->root);
to->kind = from->kind;
to->forced = from->forced;
}
#endif
-
+
static int
-ProcXF86VidModeQueryVersion(ClientPtr client)
-{
+ ProcXF86VidModeQueryVersion(ClientPtr client) {
xXF86VidModeQueryVersionReply rep;
- DEBUG_P("XF86VidModeQueryVersion");
+ DEBUG_P("XF86VidModeQueryVersion");
- REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION;
- rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION;
+ REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION;
+ rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.majorVersion);
- swaps(&rep.minorVersion);
- }
- WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), (char *)&rep);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
+ } WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply),
+ (char *) &rep);
return Success;
}
static int
-ProcXF86VidModeGetModeLine(ClientPtr client)
-{
+ ProcXF86VidModeGetModeLine(ClientPtr client) {
REQUEST(xXF86VidModeGetModeLineReq);
xXF86VidModeGetModeLineReply rep;
xXF86OldVidModeGetModeLineReply oldrep;
@@ -311,25 +294,26 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
int dotClock;
int ver;
- DEBUG_P("XF86VidModeGetModeline");
+ DEBUG_P("XF86VidModeGetModeline");
- ver = ClientMajorVersion(client);
- REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
- rep.type = X_Reply;
+ ver = ClientMajorVersion(client);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
+ rep.type = X_Reply;
if (ver < 2) {
- rep.length = bytes_to_int32(SIZEOF(xXF86OldVidModeGetModeLineReply) -
- SIZEOF(xGenericReply));
- } else {
- rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetModeLineReply) -
- SIZEOF(xGenericReply));
+ rep.length = bytes_to_int32(SIZEOF(xXF86OldVidModeGetModeLineReply) -
+ SIZEOF(xGenericReply));
+ }
+ else {
+ rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetModeLineReply) -
+ SIZEOF(xGenericReply));
}
rep.sequenceNumber = client->sequence;
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
+ return BadValue;
rep.dotclock = dotClock;
rep.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
@@ -344,16 +328,15 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
rep.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- 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);
+ 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);
}
-
+
/*
* Older servers sometimes had server privates that the VidMode
* extention made available. So to be compatiable pretend that
@@ -362,48 +345,48 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
rep.privsize = 0;
if (client->swapped) {
- 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);
+ 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);
}
if (ver < 2) {
- oldrep.type = rep.type;
- oldrep.sequenceNumber = rep.sequenceNumber;
- oldrep.length = rep.length;
- oldrep.dotclock = rep.dotclock;
- oldrep.hdisplay = rep.hdisplay;
- oldrep.hsyncstart = rep.hsyncstart;
- oldrep.hsyncend = rep.hsyncend;
- oldrep.htotal = rep.htotal;
- oldrep.vdisplay = rep.vdisplay;
- oldrep.vsyncstart = rep.vsyncstart;
- oldrep.vsyncend = rep.vsyncend;
- oldrep.vtotal = rep.vtotal;
- oldrep.flags = rep.flags;
- oldrep.privsize = rep.privsize;
- WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply),
- (char *)&oldrep);
- } else {
- WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply),
- (char *)&rep);
+ oldrep.type = rep.type;
+ oldrep.sequenceNumber = rep.sequenceNumber;
+ oldrep.length = rep.length;
+ oldrep.dotclock = rep.dotclock;
+ oldrep.hdisplay = rep.hdisplay;
+ oldrep.hsyncstart = rep.hsyncstart;
+ oldrep.hsyncend = rep.hsyncend;
+ oldrep.htotal = rep.htotal;
+ oldrep.vdisplay = rep.vdisplay;
+ oldrep.vsyncstart = rep.vsyncstart;
+ oldrep.vsyncend = rep.vsyncend;
+ oldrep.vtotal = rep.vtotal;
+ oldrep.flags = rep.flags;
+ oldrep.privsize = rep.privsize;
+ WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply),
+ (char *) &oldrep);
+ }
+ else {
+ WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply),
+ (char *) &rep);
}
return Success;
}
static int
-ProcXF86VidModeGetAllModeLines(ClientPtr client)
-{
+ ProcXF86VidModeGetAllModeLines(ClientPtr client) {
REQUEST(xXF86VidModeGetAllModeLinesReq);
xXF86VidModeGetAllModeLinesReply rep;
xXF86VidModeModeInfo mdinf;
@@ -412,85 +395,87 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
int modecount, dotClock;
int ver;
- DEBUG_P("XF86VidModeGetAllModelines");
+ DEBUG_P("XF86VidModeGetAllModelines");
- REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- ver = ClientMajorVersion(client);
+ ver = ClientMajorVersion(client);
- modecount = VidModeGetNumOfModes(stuff->screen);
+ modecount = VidModeGetNumOfModes(stuff->screen);
if (modecount < 1)
- return VidModeErrorBase + XF86VidModeExtensionDisabled;
+ return VidModeErrorBase + XF86VidModeExtensionDisabled;
if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
-
- rep.type = X_Reply;
- rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
- SIZEOF(xGenericReply);
+ return BadValue;
+
+ rep.type = X_Reply;
+ rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
+ SIZEOF(xGenericReply);
if (ver < 2)
- rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
+ rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
else
- rep.length += modecount * sizeof(xXF86VidModeModeInfo);
- rep.length >>= 2;
- rep.sequenceNumber = client->sequence;
- rep.modecount = modecount;
+ rep.length += modecount * sizeof(xXF86VidModeModeInfo);
+ rep.length >>= 2;
+ rep.sequenceNumber = client->sequence;
+ rep.modecount = modecount;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.modecount);
- }
- WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), (char *)&rep);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.modecount);
+ } WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply),
+ (char *) &rep);
do {
- mdinf.dotclock = dotClock;
- mdinf.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
- mdinf.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
- mdinf.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
- mdinf.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
- mdinf.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
- mdinf.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
- mdinf.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
- mdinf.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
- mdinf.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
- mdinf.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
- mdinf.privsize = 0;
+ mdinf.dotclock = dotClock;
+ mdinf.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
+ mdinf.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
+ mdinf.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
+ mdinf.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
+ mdinf.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
+ mdinf.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
+ mdinf.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
+ mdinf.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
+ mdinf.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
+ mdinf.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
+ mdinf.privsize = 0;
if (client->swapped) {
- 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) {
- oldmdinf.dotclock = mdinf.dotclock;
- oldmdinf.hdisplay = mdinf.hdisplay;
- oldmdinf.hsyncstart = mdinf.hsyncstart;
- oldmdinf.hsyncend = mdinf.hsyncend;
- oldmdinf.htotal = mdinf.htotal;
- oldmdinf.vdisplay = mdinf.vdisplay;
- oldmdinf.vsyncstart = mdinf.vsyncstart;
- oldmdinf.vsyncend = mdinf.vsyncend;
- oldmdinf.vtotal = mdinf.vtotal;
- oldmdinf.flags = mdinf.flags;
- oldmdinf.privsize = mdinf.privsize;
+ 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) {
+ oldmdinf.dotclock = mdinf.dotclock;
+ oldmdinf.hdisplay = mdinf.hdisplay;
+ oldmdinf.hsyncstart = mdinf.hsyncstart;
+ oldmdinf.hsyncend = mdinf.hsyncend;
+ oldmdinf.htotal = mdinf.htotal;
+ oldmdinf.vdisplay = mdinf.vdisplay;
+ oldmdinf.vsyncstart = mdinf.vsyncstart;
+ oldmdinf.vsyncend = mdinf.vsyncend;
+ oldmdinf.vtotal = mdinf.vtotal;
+ oldmdinf.flags = mdinf.flags;
+ oldmdinf.privsize = mdinf.privsize;
WriteToClient(client, sizeof(xXF86OldVidModeModeInfo),
- (char *)&oldmdinf);
- } else {
- WriteToClient(client, sizeof(xXF86VidModeModeInfo), (char *)&mdinf);
- }
+ (char *) &oldmdinf);
+ }
+ else {
+ WriteToClient(client, sizeof(xXF86VidModeModeInfo),
+ (char *) &mdinf);
+ }
- } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
return Success;
}
@@ -507,394 +492,404 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
&& VidModeGetModeValue(mode, VIDMODE_FLAGS) == stuff->flags )
static int
-ProcXF86VidModeAddModeLine(ClientPtr client)
-{
+ ProcXF86VidModeAddModeLine(ClientPtr client) {
REQUEST(xXF86VidModeAddModeLineReq);
xXF86OldVidModeAddModeLineReq *oldstuff =
- (xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeAddModeLineReq *) client->requestBuffer;
xXF86VidModeAddModeLineReq newstuff;
pointer mode;
int len;
int dotClock;
int ver;
- DEBUG_P("XF86VidModeAddModeline");
+ DEBUG_P("XF86VidModeAddModeline");
- ver = ClientMajorVersion(client);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- /* 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;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- 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);
+ /* 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;
+ } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ 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);
}
if (ver < 2) {
- 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));
+ 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));
}
if (len != stuff->privsize)
- return BadLength;
+ return BadLength;
+
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- if(stuff->screen >= screenInfo.numScreens)
+ 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->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;
+ 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;
if (stuff->after_htotal != 0 || stuff->after_vtotal != 0) {
- 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;
+ 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;
}
-
mode = VidModeCreateMode();
if (mode == NULL)
- return BadValue;
+ return BadValue;
VidModeSetModeValue(mode, VIDMODE_CLOCK, stuff->dotclock);
VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
- VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
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);
- VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
if (stuff->privsize)
- ErrorF("AddModeLine - Privates in request have been ignored\n");
+ ErrorF("AddModeLine - Privates in request have been ignored\n");
/* Check that the mode is consistent with the monitor specs */
switch (VidModeCheckModeForMonitor(stuff->screen, mode)) {
- 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;
+ 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;
}
/* Check that the driver is happy with the mode */
if (VidModeCheckModeForDriver(stuff->screen, mode) != MODE_OK) {
- free(mode);
- return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ free(mode);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
VidModeSetCrtcForMode(stuff->screen, mode);
-
+
VidModeAddModeline(stuff->screen, mode);
-
+
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("AddModeLine - Succeeded\n");
+ ErrorF("AddModeLine - Succeeded\n");
return Success;
}
static int
-ProcXF86VidModeDeleteModeLine(ClientPtr client)
-{
+ ProcXF86VidModeDeleteModeLine(ClientPtr client) {
REQUEST(xXF86VidModeDeleteModeLineReq);
xXF86OldVidModeDeleteModeLineReq *oldstuff =
- (xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer;
xXF86VidModeDeleteModeLineReq newstuff;
pointer mode;
int len, dotClock;
int ver;
- DEBUG_P("XF86VidModeDeleteModeline");
+ DEBUG_P("XF86VidModeDeleteModeline");
- ver = ClientMajorVersion(client);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- /* 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;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- 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);
+ /* 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;
+ } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ 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);
}
if (ver < 2) {
- 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));
+ 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));
}
if (len != stuff->privsize) {
- 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;
+ 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;
}
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
+ return BadValue;
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));
+ 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))
- return BadValue;
+ MODEMATCH(mode, stuff))
+ return BadValue;
if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
- 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;
- }
+ 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;
+ }
} while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
return BadValue;
}
static int
-ProcXF86VidModeModModeLine(ClientPtr client)
-{
+ ProcXF86VidModeModModeLine(ClientPtr client) {
REQUEST(xXF86VidModeModModeLineReq);
xXF86OldVidModeModModeLineReq *oldstuff =
- (xXF86OldVidModeModModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeModModeLineReq *) client->requestBuffer;
xXF86VidModeModModeLineReq newstuff;
pointer mode, modetmp;
int len, dotClock;
int ver;
- DEBUG_P("XF86VidModeModModeline");
-
- ver = ClientMajorVersion(client);
- 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;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- 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);
+ DEBUG_P("XF86VidModeModModeline");
+
+ ver = ClientMajorVersion(client);
+ 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;
+ } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ 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);
}
if (ver < 2) {
- 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));
+ 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));
}
if (len != stuff->privsize)
- return BadLength;
+ return BadLength;
- 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->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->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
+ return BadValue;
modetmp = VidModeCreateMode();
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
- VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
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);
- VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
if (stuff->privsize)
- ErrorF("ModModeLine - Privates in request have been ignored\n");
+ ErrorF("ModModeLine - Privates in request have been ignored\n");
/* Check that the mode is consistent with the monitor specs */
switch (VidModeCheckModeForMonitor(stuff->screen, modetmp)) {
- 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;
+ 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;
}
/* Check that the driver is happy with the mode */
if (VidModeCheckModeForDriver(stuff->screen, modetmp) != MODE_OK) {
- free(modetmp);
- return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ free(modetmp);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
}
free(modetmp);
VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
- VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
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);
- VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
@@ -903,337 +898,349 @@ ProcXF86VidModeModModeLine(ClientPtr client)
VidModeSwitchMode(stuff->screen, mode);
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("ModModeLine - Succeeded\n");
+ ErrorF("ModModeLine - Succeeded\n");
return Success;
}
static int
-ProcXF86VidModeValidateModeLine(ClientPtr client)
-{
+ ProcXF86VidModeValidateModeLine(ClientPtr client) {
REQUEST(xXF86VidModeValidateModeLineReq);
xXF86OldVidModeValidateModeLineReq *oldstuff =
- (xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeValidateModeLineReq *) client->requestBuffer;
xXF86VidModeValidateModeLineReq newstuff;
xXF86VidModeValidateModeLineReply rep;
pointer mode, modetmp = NULL;
int len, status, dotClock;
int ver;
- DEBUG_P("XF86VidModeValidateModeline");
+ DEBUG_P("XF86VidModeValidateModeline");
- ver = ClientMajorVersion(client);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- /* 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;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- 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);
+ /* 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;
+ } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ 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);
}
if (ver < 2) {
- 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));
+ 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));
}
if (len != stuff->privsize)
- return BadLength;
+ return BadLength;
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
status = MODE_OK;
- 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;
+ 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;
}
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
+ return BadValue;
modetmp = VidModeCreateMode();
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
- VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
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);
- VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
if (stuff->privsize)
- ErrorF("ValidateModeLine - Privates in request have been ignored\n");
+ ErrorF("ValidateModeLine - Privates in request have been ignored\n");
/* Check that the mode is consistent with the monitor specs */
- if ((status = VidModeCheckModeForMonitor(stuff->screen, modetmp)) != MODE_OK)
- goto status_reply;
+ if ((status =
+ VidModeCheckModeForMonitor(stuff->screen, modetmp)) != MODE_OK)
+ goto status_reply;
/* Check that the driver is happy with the mode */
status = VidModeCheckModeForDriver(stuff->screen, modetmp);
-status_reply:
+ status_reply:
free(modetmp);
rep.type = X_Reply;
rep.length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply)
- - SIZEOF(xGenericReply));
+ - SIZEOF(xGenericReply));
rep.sequenceNumber = client->sequence;
rep.status = status;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.status);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.status);
}
- WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply),
+ (char *) &rep);
if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("ValidateModeLine - Succeeded (status = %d)\n", status);
+ ErrorF("ValidateModeLine - Succeeded (status = %d)\n", status);
return Success;
}
static int
-ProcXF86VidModeSwitchMode(ClientPtr client)
-{
+ ProcXF86VidModeSwitchMode(ClientPtr client) {
REQUEST(xXF86VidModeSwitchModeReq);
DEBUG_P("XF86VidModeSwitchMode");
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- VidModeZoomViewport(stuff->screen, (short)stuff->zoom);
+ VidModeZoomViewport(stuff->screen, (short) stuff->zoom);
return Success;
-}
-
-static int
-ProcXF86VidModeSwitchToMode(ClientPtr client)
-{
+} static int
+ ProcXF86VidModeSwitchToMode(ClientPtr client) {
REQUEST(xXF86VidModeSwitchToModeReq);
xXF86OldVidModeSwitchToModeReq *oldstuff =
- (xXF86OldVidModeSwitchToModeReq *)client->requestBuffer;
+ (xXF86OldVidModeSwitchToModeReq *) client->requestBuffer;
xXF86VidModeSwitchToModeReq newstuff;
pointer mode;
int len, dotClock;
int ver;
- DEBUG_P("XF86VidModeSwitchToMode");
+ DEBUG_P("XF86VidModeSwitchToMode");
- ver = ClientMajorVersion(client);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- /* 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;
- }
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
- 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);
+ /* 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;
+ } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ 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);
}
if (ver < 2) {
- 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));
+ 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));
}
if (len != stuff->privsize)
- return BadLength;
+ return BadLength;
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
+ return BadValue;
if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock)
- && MODEMATCH(mode, stuff))
- return Success;
+ && MODEMATCH(mode, stuff))
+ return Success;
if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
- return BadValue;
+ 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)) {
-
- if (!VidModeSwitchMode(stuff->screen, mode))
- return BadValue;
-
- if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
- ErrorF("SwitchToMode - Succeeded\n");
- return Success;
- }
+ 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;
+ }
} while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
return BadValue;
}
static int
-ProcXF86VidModeLockModeSwitch(ClientPtr client)
-{
+ ProcXF86VidModeLockModeSwitch(ClientPtr client) {
REQUEST(xXF86VidModeLockModeSwitchReq);
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
DEBUG_P("XF86VidModeLockModeSwitch");
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if (!VidModeLockZoom(stuff->screen, (short)stuff->lock))
- return VidModeErrorBase + XF86VidModeZoomLocked;
+ if (!VidModeLockZoom(stuff->screen, (short) stuff->lock))
+ return VidModeErrorBase + XF86VidModeZoomLocked;
return Success;
-}
-
-static int
-ProcXF86VidModeGetMonitor(ClientPtr client)
-{
+} static int
+ ProcXF86VidModeGetMonitor(ClientPtr client) {
REQUEST(xXF86VidModeGetMonitorReq);
xXF86VidModeGetMonitorReply rep;
CARD32 *hsyncdata, *vsyncdata;
int i, nHsync, nVrefresh;
pointer monitor;
-
- DEBUG_P("XF86VidModeGetMonitor");
- REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
+ DEBUG_P("XF86VidModeGetMonitor");
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
+
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
if (!VidModeGetMonitor(stuff->screen, &monitor))
- return BadValue;
+ return BadValue;
- nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
- nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i;
-
- rep.type = X_Reply;
- if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr)
- rep.vendorLength = strlen((char *)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_VENDOR, 0)).ptr);
+ nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
+ nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i;
+
+ rep.type = X_Reply;
+ if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr)
+ rep.vendorLength = strlen((char *) (VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VENDOR,
+ 0)).ptr);
else
- rep.vendorLength = 0;
- if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr)
- rep.modelLength = strlen((char *)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_MODEL, 0)).ptr);
+ rep.vendorLength = 0;
+ if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr)
+ rep.modelLength = strlen((char *) (VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_MODEL,
+ 0)).ptr);
else
- 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));
- rep.sequenceNumber = client->sequence;
- rep.nhsync = nHsync;
- rep.nvsync = nVrefresh;
- hsyncdata = malloc(nHsync * sizeof(CARD32));
+ 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));
+ rep.sequenceNumber = client->sequence;
+ rep.nhsync = nHsync;
+ rep.nvsync = nVrefresh;
+ hsyncdata = malloc(nHsync * sizeof(CARD32));
if (!hsyncdata) {
- return BadAlloc;
- }
+ return BadAlloc;
+ } vsyncdata = malloc(nVrefresh * sizeof(CARD32));
- vsyncdata = malloc(nVrefresh * sizeof(CARD32));
if (!vsyncdata) {
- free(hsyncdata);
- return BadAlloc;
+ free(hsyncdata);
+ return BadAlloc;
}
for (i = 0; i < nHsync; i++) {
- hsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_HSYNC_LO, i)).f |
- (unsigned short)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_HSYNC_HI, i)).f << 16;
+ hsyncdata[i] = (unsigned short) (VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_HSYNC_LO,
+ i)).
+ f | (unsigned
+ short) (VidModeGetMonitorValue(monitor, VIDMODE_MON_HSYNC_HI,
+ i)).f << 16;
}
for (i = 0; i < nVrefresh; i++) {
- vsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_VREFRESH_LO, i)).f |
- (unsigned short)(VidModeGetMonitorValue(monitor,
- VIDMODE_MON_VREFRESH_HI, i)).f << 16;
+ vsyncdata[i] = (unsigned short) (VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VREFRESH_LO,
+ i)).
+ f | (unsigned
+ short) (VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VREFRESH_HI,
+ i)).f << 16;
}
-
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
}
- WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), (char *)&rep);
+ WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), (char *) &rep);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
- WriteSwappedDataToClient(client, nHsync * sizeof(CARD32),
- hsyncdata);
- WriteSwappedDataToClient(client, nVrefresh * sizeof(CARD32),
- vsyncdata);
+ WriteSwappedDataToClient(client, nHsync * sizeof(CARD32), hsyncdata);
+ WriteSwappedDataToClient(client, nVrefresh * sizeof(CARD32), vsyncdata);
if (rep.vendorLength)
- WriteToClient(client, rep.vendorLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr);
+ WriteToClient(client, rep.vendorLength,
+ (char
+ *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR,
+ 0)).ptr);
if (rep.modelLength)
- WriteToClient(client, rep.modelLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr);
+ WriteToClient(client, rep.modelLength,
+ (char
+ *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL,
+ 0)).ptr);
free(hsyncdata);
free(vsyncdata);
@@ -1242,113 +1249,106 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
}
static int
-ProcXF86VidModeGetViewPort(ClientPtr client)
-{
+ ProcXF86VidModeGetViewPort(ClientPtr client) {
REQUEST(xXF86VidModeGetViewPortReq);
xXF86VidModeGetViewPortReply rep;
int x, y;
- DEBUG_P("XF86VidModeGetViewPort");
+ DEBUG_P("XF86VidModeGetViewPort");
- REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
- VidModeGetViewPort(stuff->screen, &x, &y);
- rep.x = x;
- rep.y = y;
+ VidModeGetViewPort(stuff->screen, &x, &y);
+ rep.x = x;
+ rep.y = y;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.x);
- swapl(&rep.y);
- }
- WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), (char *)&rep);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.x);
+ swapl(&rep.y);
+ } WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply),
+ (char *) &rep);
return Success;
}
static int
-ProcXF86VidModeSetViewPort(ClientPtr client)
-{
+ ProcXF86VidModeSetViewPort(ClientPtr client) {
REQUEST(xXF86VidModeSetViewPortReq);
DEBUG_P("XF86VidModeSetViewPort");
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
if (!VidModeSetViewPort(stuff->screen, stuff->x, stuff->y))
- return BadValue;
+ return BadValue;
return Success;
-}
-
-static int
-ProcXF86VidModeGetDotClocks(ClientPtr client)
-{
+} static int
+ ProcXF86VidModeGetDotClocks(ClientPtr client) {
REQUEST(xXF86VidModeGetDotClocksReq);
xXF86VidModeGetDotClocksReply rep;
- int n;
+ int n;
int numClocks;
CARD32 dotclock;
int *Clocks = NULL;
Bool ClockProg;
- DEBUG_P("XF86VidModeGetDotClocks");
+ DEBUG_P("XF86VidModeGetDotClocks");
- REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
+ numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
- rep.type = X_Reply;
- rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply)
- - SIZEOF(xGenericReply) + numClocks);
- rep.sequenceNumber = client->sequence;
- rep.clocks = numClocks;
- rep.maxclocks = MAXCLOCKS;
- rep.flags = 0;
+ rep.type = X_Reply;
+ rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply)
+ - SIZEOF(xGenericReply) + numClocks);
+ rep.sequenceNumber = client->sequence;
+ rep.clocks = numClocks;
+ rep.maxclocks = MAXCLOCKS;
+ rep.flags = 0;
if (!ClockProg) {
- Clocks = malloc(numClocks * sizeof(int));
- if (!Clocks)
- return BadValue;
- if (!VidModeGetClocks(stuff->screen, Clocks)) {
- free(Clocks);
- return BadValue;
- }
- }
-
- if (ClockProg) {
- rep.flags |= CLKFLAG_PROGRAMABLE;
+ Clocks = malloc(numClocks * sizeof(int));
+ if (!Clocks)
+ return BadValue;
+ if (!VidModeGetClocks(stuff->screen, Clocks)) {
+ free(Clocks);
+ return BadValue;
+ }} if (ClockProg) {
+ rep.flags |= CLKFLAG_PROGRAMABLE;
}
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.clocks);
- swapl(&rep.maxclocks);
- swapl(&rep.flags);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.clocks);
+ swapl(&rep.maxclocks);
+ swapl(&rep.flags);
}
- WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), (char *) &rep);
if (!ClockProg) {
- for (n = 0; n < numClocks; n++) {
- dotclock = *Clocks++;
- if (client->swapped) {
- WriteSwappedDataToClient(client, 4, (char *)&dotclock);
- } else {
- WriteToClient(client, 4, (char *)&dotclock);
- }
- }
+ for (n = 0; n < numClocks; n++) {
+ dotclock = *Clocks++;
+ if (client->swapped) {
+ WriteSwappedDataToClient(client, 4, (char *) &dotclock);
+ }
+ else {
+ WriteToClient(client, 4, (char *) &dotclock);
+ }
+ }
}
free(Clocks);
@@ -1356,534 +1356,486 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
}
static int
-ProcXF86VidModeSetGamma(ClientPtr client)
-{
+ ProcXF86VidModeSetGamma(ClientPtr client) {
REQUEST(xXF86VidModeSetGammaReq);
DEBUG_P("XF86VidModeSetGamma");
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
- if(stuff->screen >= screenInfo.numScreens)
+ if (stuff->screen >= screenInfo.numScreens)
return BadValue;
- if (!VidModeSetGamma(stuff->screen, ((float)stuff->red)/10000.,
- ((float)stuff->green)/10000., ((float)stuff->blue)/10000.))
- return BadValue;
+ if (!VidModeSetGamma(stuff->screen, ((float) stuff->red) / 10000.,
+ ((float) stuff->green) / 10000.,
+ ((float) stuff->blue) / 10000.))
+ return BadValue;
return Success;
-}
-
-static int
-ProcXF86VidModeGetGamma(ClientPtr client)
-{
+} static int
+ ProcXF86VidModeGetGamma(ClientPtr client) {
REQUEST(xXF86VidModeGetGammaReq);
xXF86VidModeGetGammaReply rep;
float red, green, blue;
- DEBUG_P("XF86VidModeGetGamma");
+ DEBUG_P("XF86VidModeGetGamma");
- REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
if (!VidModeGetGamma(stuff->screen, &red, &green, &blue))
- return BadValue;
- rep.red = (CARD32)(red * 10000.);
- rep.green = (CARD32)(green * 10000.);
- rep.blue = (CARD32)(blue * 10000.);
+ return BadValue;
+ rep.red = (CARD32) (red * 10000.);
+ rep.green = (CARD32) (green * 10000.);
+ rep.blue = (CARD32) (blue * 10000.);
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.red);
- swapl(&rep.green);
- swapl(&rep.blue);
- }
- WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *)&rep);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.red);
+ swapl(&rep.green);
+ swapl(&rep.blue);
+ } WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *) &rep);
+
return Success;
}
static int
-ProcXF86VidModeSetGammaRamp(ClientPtr client)
-{
+ ProcXF86VidModeSetGammaRamp(ClientPtr client) {
CARD16 *r, *g, *b;
int length;
- REQUEST(xXF86VidModeSetGammaRampReq);
+ REQUEST(xXF86VidModeSetGammaRampReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- if(stuff->size != VidModeGetGammaRampSize(stuff->screen))
- return BadValue;
+ if (stuff->size != VidModeGetGammaRampSize(stuff->screen))
+ return BadValue;
- length = (stuff->size + 1) & ~1;
+ length = (stuff->size + 1) & ~1;
- REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length * 6);
+ REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length * 6);
- r = (CARD16*)&stuff[1];
- g = r + length;
- b = g + length;
+ r = (CARD16 *) &stuff[1];
+ g = r + length;
+ b = g + length;
if (!VidModeSetGammaRamp(stuff->screen, stuff->size, r, g, b))
- return BadValue;
-
- return Success;
-}
+ return BadValue;
-static int
-ProcXF86VidModeGetGammaRamp(ClientPtr client)
-{
+ return Success;
+} static int
+ ProcXF86VidModeGetGammaRamp(ClientPtr client) {
CARD16 *ramp = NULL;
int length;
size_t ramplen = 0;
xXF86VidModeGetGammaRampReply rep;
- REQUEST(xXF86VidModeGetGammaRampReq);
+ REQUEST(xXF86VidModeGetGammaRampReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- if(stuff->size != VidModeGetGammaRampSize(stuff->screen))
- return BadValue;
+ if (stuff->size != VidModeGetGammaRampSize(stuff->screen))
+ return BadValue;
- REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
- length = (stuff->size + 1) & ~1;
+ length = (stuff->size + 1) & ~1;
- 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);
- return BadValue;
- }
- }
+ if (stuff->size) {
+ ramplen = length * 3 * sizeof(CARD16);
+ if (!(ramp = malloc(ramplen)))
+ return BadAlloc;
- rep.type = X_Reply;
+ if (!VidModeGetGammaRamp(stuff->screen, stuff->size,
+ ramp, ramp + length, ramp + (length * 2))) {
+ free(ramp);
+ return BadValue;
+ }} rep.type = X_Reply;
rep.length = (length >> 1) * 3;
rep.sequenceNumber = client->sequence;
rep.size = stuff->size;
- if(client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.size);
- SwapShorts((short*)ramp, length * 3);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.size);
+ SwapShorts((short *) ramp, length * 3);
}
- WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), (char *)&rep);
+ WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), (char *) &rep);
- if(stuff->size) {
- WriteToClient(client, ramplen, (char*)ramp);
+ if (stuff->size) {
+ WriteToClient(client, ramplen, (char *) ramp);
free(ramp);
}
return Success;
}
-
static int
-ProcXF86VidModeGetGammaRampSize(ClientPtr client)
-{
+ ProcXF86VidModeGetGammaRampSize(ClientPtr client) {
xXF86VidModeGetGammaRampSizeReply rep;
- REQUEST(xXF86VidModeGetGammaRampSizeReq);
+ REQUEST(xXF86VidModeGetGammaRampSizeReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.size = VidModeGetGammaRampSize(stuff->screen);
- if(client->swapped) {
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.size = VidModeGetGammaRampSize(stuff->screen);
+ if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.size);
- }
- WriteToClient(client,sizeof(xXF86VidModeGetGammaRampSizeReply),(char*)&rep);
+ } WriteToClient(client, sizeof(xXF86VidModeGetGammaRampSizeReply),
+ (char *) &rep);
return Success;
}
static int
-ProcXF86VidModeGetPermissions(ClientPtr client)
-{
+ ProcXF86VidModeGetPermissions(ClientPtr client) {
xXF86VidModeGetPermissionsReply rep;
- REQUEST(xXF86VidModeGetPermissionsReq);
+ REQUEST(xXF86VidModeGetPermissionsReq);
- if(stuff->screen >= screenInfo.numScreens)
- return BadValue;
+ if (stuff->screen >= screenInfo.numScreens)
+ return BadValue;
- REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.permissions = XF86VM_READ_PERMISSION;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.permissions = XF86VM_READ_PERMISSION;
if (xf86GetVidModeEnabled() &&
- (xf86GetVidModeAllowNonLocal() || LocalClient (client))) {
- rep.permissions |= XF86VM_WRITE_PERMISSION;
- }
- if(client->swapped) {
+ (xf86GetVidModeAllowNonLocal() || LocalClient(client))) {
+ rep.permissions |= XF86VM_WRITE_PERMISSION;
+ } if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.permissions);
}
- WriteToClient(client,sizeof(xXF86VidModeGetPermissionsReply),(char*)&rep);
+ WriteToClient(client, sizeof(xXF86VidModeGetPermissionsReply),
+ (char *) &rep);
return Success;
}
-
static int
-ProcXF86VidModeSetClientVersion(ClientPtr client)
-{
+ ProcXF86VidModeSetClientVersion(ClientPtr client) {
REQUEST(xXF86VidModeSetClientVersionReq);
VidModePrivPtr pPriv;
- DEBUG_P("XF86VidModeSetClientVersion");
+ DEBUG_P("XF86VidModeSetClientVersion");
- REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
+ REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
if ((pPriv = VM_GETPRIV(client)) == NULL) {
- pPriv = malloc(sizeof(VidModePrivRec));
- if (!pPriv)
- return BadAlloc;
- VM_SETPRIV(client, pPriv);
- }
- pPriv->major = stuff->major;
+ pPriv = malloc(sizeof(VidModePrivRec));
+ if (!pPriv)
+ return BadAlloc;
+ VM_SETPRIV(client, pPriv);
+ } pPriv->major = stuff->major;
+
pPriv->minor = stuff->minor;
-
+
return Success;
}
static int
-ProcXF86VidModeDispatch(ClientPtr client)
-{
+ ProcXF86VidModeDispatch(ClientPtr client) {
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_XF86VidModeQueryVersion:
- return ProcXF86VidModeQueryVersion(client);
- case X_XF86VidModeGetModeLine:
- return ProcXF86VidModeGetModeLine(client);
- case X_XF86VidModeGetMonitor:
- return ProcXF86VidModeGetMonitor(client);
- case X_XF86VidModeGetAllModeLines:
- return ProcXF86VidModeGetAllModeLines(client);
- case X_XF86VidModeValidateModeLine:
- return ProcXF86VidModeValidateModeLine(client);
- case X_XF86VidModeGetViewPort:
- return ProcXF86VidModeGetViewPort(client);
- case X_XF86VidModeGetDotClocks:
- return ProcXF86VidModeGetDotClocks(client);
- case X_XF86VidModeSetClientVersion:
- return ProcXF86VidModeSetClientVersion(client);
- case X_XF86VidModeGetGamma:
- return ProcXF86VidModeGetGamma(client);
- case X_XF86VidModeGetGammaRamp:
- return ProcXF86VidModeGetGammaRamp(client);
- case X_XF86VidModeGetGammaRampSize:
- return ProcXF86VidModeGetGammaRampSize(client);
- case X_XF86VidModeGetPermissions:
- return ProcXF86VidModeGetPermissions(client);
- default:
- if (!xf86GetVidModeEnabled())
- return VidModeErrorBase + XF86VidModeExtensionDisabled;
- if (xf86GetVidModeAllowNonLocal() || LocalClient (client)) {
- 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;
+ return ProcXF86VidModeQueryVersion(client);
+ case X_XF86VidModeGetModeLine:return ProcXF86VidModeGetModeLine(client);
+ case X_XF86VidModeGetMonitor:return ProcXF86VidModeGetMonitor(client);
+ case X_XF86VidModeGetAllModeLines:return
+ ProcXF86VidModeGetAllModeLines(client);
+ case X_XF86VidModeValidateModeLine:return
+ ProcXF86VidModeValidateModeLine(client);
+ case X_XF86VidModeGetViewPort:return ProcXF86VidModeGetViewPort(client);
+ case X_XF86VidModeGetDotClocks:return
+ ProcXF86VidModeGetDotClocks(client);
+ case X_XF86VidModeSetClientVersion:return
+ ProcXF86VidModeSetClientVersion(client);
+ case X_XF86VidModeGetGamma:return ProcXF86VidModeGetGamma(client);
+ case X_XF86VidModeGetGammaRamp:return
+ ProcXF86VidModeGetGammaRamp(client);
+ case X_XF86VidModeGetGammaRampSize:return
+ ProcXF86VidModeGetGammaRampSize(client);
+ case X_XF86VidModeGetPermissions:return
+ ProcXF86VidModeGetPermissions(client);
+ default:if (!xf86GetVidModeEnabled())
+ return VidModeErrorBase + XF86VidModeExtensionDisabled;
+ if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
+ 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;
}
}
static int
-SProcXF86VidModeQueryVersion(ClientPtr client)
-{
+ SProcXF86VidModeQueryVersion(ClientPtr client) {
REQUEST(xXF86VidModeQueryVersionReq);
swaps(&stuff->length);
return ProcXF86VidModeQueryVersion(client);
-}
-
-static int
-SProcXF86VidModeGetModeLine(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetModeLine(ClientPtr client) {
REQUEST(xXF86VidModeGetModeLineReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetModeLine(client);
-}
-
-static int
-SProcXF86VidModeGetAllModeLines(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetAllModeLines(ClientPtr client) {
REQUEST(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetAllModeLines(client);
-}
-
-static int
-SProcXF86VidModeAddModeLine(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeAddModeLine(ClientPtr client) {
xXF86OldVidModeAddModeLineReq *oldstuff =
- (xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeAddModeLineReq *) client->requestBuffer;
int ver;
-
- REQUEST(xXF86VidModeAddModeLineReq);
- ver = ClientMajorVersion(client);
+
+ REQUEST(xXF86VidModeAddModeLineReq);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- 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);
+ 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);
}
return ProcXF86VidModeAddModeLine(client);
}
static int
-SProcXF86VidModeDeleteModeLine(ClientPtr client)
-{
+ SProcXF86VidModeDeleteModeLine(ClientPtr client) {
xXF86OldVidModeDeleteModeLineReq *oldstuff =
- (xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer;
int ver;
- REQUEST(xXF86VidModeDeleteModeLineReq);
- ver = ClientMajorVersion(client);
+ REQUEST(xXF86VidModeDeleteModeLineReq);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- 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);
+ 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);
}
return ProcXF86VidModeDeleteModeLine(client);
}
static int
-SProcXF86VidModeModModeLine(ClientPtr client)
-{
+ SProcXF86VidModeModModeLine(ClientPtr client) {
xXF86OldVidModeModModeLineReq *oldstuff =
- (xXF86OldVidModeModModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeModModeLineReq *) client->requestBuffer;
int ver;
- REQUEST(xXF86VidModeModModeLineReq);
- ver = ClientMajorVersion(client);
+ REQUEST(xXF86VidModeModModeLineReq);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- 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);
+ 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);
}
return ProcXF86VidModeModModeLine(client);
}
static int
-SProcXF86VidModeValidateModeLine(ClientPtr client)
-{
+ SProcXF86VidModeValidateModeLine(ClientPtr client) {
xXF86OldVidModeValidateModeLineReq *oldstuff =
- (xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
+ (xXF86OldVidModeValidateModeLineReq *) client->requestBuffer;
int ver;
- REQUEST(xXF86VidModeValidateModeLineReq);
- ver = ClientMajorVersion(client);
+ REQUEST(xXF86VidModeValidateModeLineReq);
+ ver = ClientMajorVersion(client);
if (ver < 2) {
- 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);
+ 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);
}
return ProcXF86VidModeValidateModeLine(client);
}
static int
-SProcXF86VidModeSwitchMode(ClientPtr client)
-{
+ SProcXF86VidModeSwitchMode(ClientPtr client) {
REQUEST(xXF86VidModeSwitchModeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
swaps(&stuff->screen);
swaps(&stuff->zoom);
return ProcXF86VidModeSwitchMode(client);
-}
-
-static int
-SProcXF86VidModeSwitchToMode(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeSwitchToMode(ClientPtr client) {
REQUEST(xXF86VidModeSwitchToModeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
swapl(&stuff->screen);
return ProcXF86VidModeSwitchToMode(client);
-}
-
-static int
-SProcXF86VidModeLockModeSwitch(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeLockModeSwitch(ClientPtr client) {
REQUEST(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
swaps(&stuff->screen);
swaps(&stuff->lock);
return ProcXF86VidModeLockModeSwitch(client);
-}
-
-static int
-SProcXF86VidModeGetMonitor(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetMonitor(ClientPtr client) {
REQUEST(xXF86VidModeGetMonitorReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetMonitor(client);
-}
-
-static int
-SProcXF86VidModeGetViewPort(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetViewPort(ClientPtr client) {
REQUEST(xXF86VidModeGetViewPortReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetViewPort(client);
-}
-
-static int
-SProcXF86VidModeSetViewPort(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeSetViewPort(ClientPtr client) {
REQUEST(xXF86VidModeSetViewPortReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
@@ -1891,32 +1843,23 @@ SProcXF86VidModeSetViewPort(ClientPtr client)
swapl(&stuff->x);
swapl(&stuff->y);
return ProcXF86VidModeSetViewPort(client);
-}
-
-static int
-SProcXF86VidModeGetDotClocks(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetDotClocks(ClientPtr client) {
REQUEST(xXF86VidModeGetDotClocksReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetDotClocks(client);
-}
-
-static int
-SProcXF86VidModeSetClientVersion(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeSetClientVersion(ClientPtr client) {
REQUEST(xXF86VidModeSetClientVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
swaps(&stuff->major);
swaps(&stuff->minor);
return ProcXF86VidModeSetClientVersion(client);
-}
-
-static int
-SProcXF86VidModeSetGamma(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeSetGamma(ClientPtr client) {
REQUEST(xXF86VidModeSetGammaReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
@@ -1925,174 +1868,149 @@ SProcXF86VidModeSetGamma(ClientPtr client)
swapl(&stuff->green);
swapl(&stuff->blue);
return ProcXF86VidModeSetGamma(client);
-}
-
-static int
-SProcXF86VidModeGetGamma(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetGamma(ClientPtr client) {
REQUEST(xXF86VidModeGetGammaReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetGamma(client);
-}
-
-static int
-SProcXF86VidModeSetGammaRamp(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeSetGammaRamp(ClientPtr client) {
int length;
- REQUEST(xXF86VidModeSetGammaRampReq);
- swaps(&stuff->length);
- REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
- swaps(&stuff->size);
- swaps(&stuff->screen);
- length = ((stuff->size + 1) & ~1) * 6;
- REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
- SwapRestS(stuff);
- return ProcXF86VidModeSetGammaRamp(client);
-}
-
-static int
-SProcXF86VidModeGetGammaRamp(ClientPtr client)
-{
+ REQUEST(xXF86VidModeSetGammaRampReq);
+ swaps(&stuff->length);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
+ swaps(&stuff->size);
+ swaps(&stuff->screen);
+ length = ((stuff->size + 1) & ~1) * 6;
+ REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
+ SwapRestS(stuff);
+ return ProcXF86VidModeSetGammaRamp(client);
+} static int
+ SProcXF86VidModeGetGammaRamp(ClientPtr client) {
REQUEST(xXF86VidModeGetGammaRampReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
swaps(&stuff->size);
swaps(&stuff->screen);
return ProcXF86VidModeGetGammaRamp(client);
-}
-
-static int
-SProcXF86VidModeGetGammaRampSize(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetGammaRampSize(ClientPtr client) {
REQUEST(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetGammaRampSize(client);
-}
-
-static int
-SProcXF86VidModeGetPermissions(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeGetPermissions(ClientPtr client) {
REQUEST(xXF86VidModeGetPermissionsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
swaps(&stuff->screen);
return ProcXF86VidModeGetPermissions(client);
-}
-
-
-static int
-SProcXF86VidModeDispatch(ClientPtr client)
-{
+} static int
+ SProcXF86VidModeDispatch(ClientPtr client) {
REQUEST(xReq);
- switch (stuff->data)
- {
+ switch (stuff->data) {
case X_XF86VidModeQueryVersion:
- return SProcXF86VidModeQueryVersion(client);
- case X_XF86VidModeGetModeLine:
- return SProcXF86VidModeGetModeLine(client);
- case X_XF86VidModeGetMonitor:
- return SProcXF86VidModeGetMonitor(client);
- case X_XF86VidModeGetAllModeLines:
- return SProcXF86VidModeGetAllModeLines(client);
- case X_XF86VidModeGetViewPort:
- return SProcXF86VidModeGetViewPort(client);
- case X_XF86VidModeValidateModeLine:
- return SProcXF86VidModeValidateModeLine(client);
- case X_XF86VidModeGetDotClocks:
- return SProcXF86VidModeGetDotClocks(client);
- case X_XF86VidModeSetClientVersion:
- return SProcXF86VidModeSetClientVersion(client);
- case X_XF86VidModeGetGamma:
- return SProcXF86VidModeGetGamma(client);
- case X_XF86VidModeGetGammaRamp:
- return SProcXF86VidModeGetGammaRamp(client);
- case X_XF86VidModeGetGammaRampSize:
- return SProcXF86VidModeGetGammaRampSize(client);
- case X_XF86VidModeGetPermissions:
- return SProcXF86VidModeGetPermissions(client);
- default:
- if (!xf86GetVidModeEnabled())
- return VidModeErrorBase + XF86VidModeExtensionDisabled;
- if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
- 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;
+ return SProcXF86VidModeQueryVersion(client);
+ case X_XF86VidModeGetModeLine:return
+ SProcXF86VidModeGetModeLine(client);
+ case X_XF86VidModeGetMonitor:return SProcXF86VidModeGetMonitor(client);
+ case X_XF86VidModeGetAllModeLines:return
+ SProcXF86VidModeGetAllModeLines(client);
+ case X_XF86VidModeGetViewPort:return
+ SProcXF86VidModeGetViewPort(client);
+ case X_XF86VidModeValidateModeLine:return
+ SProcXF86VidModeValidateModeLine(client);
+ case X_XF86VidModeGetDotClocks:return
+ SProcXF86VidModeGetDotClocks(client);
+ case X_XF86VidModeSetClientVersion:return
+ SProcXF86VidModeSetClientVersion(client);
+ case X_XF86VidModeGetGamma:return SProcXF86VidModeGetGamma(client);
+ case X_XF86VidModeGetGammaRamp:return
+ SProcXF86VidModeGetGammaRamp(client);
+ case X_XF86VidModeGetGammaRampSize:return
+ SProcXF86VidModeGetGammaRampSize(client);
+ case X_XF86VidModeGetPermissions:return
+ SProcXF86VidModeGetPermissions(client);
+ default:if (!xf86GetVidModeEnabled())
+ return VidModeErrorBase + XF86VidModeExtensionDisabled;
+ if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
+ 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;
}
}
void
-XFree86VidModeExtensionInit(void)
-{
- ExtensionEntry* extEntry;
+ XFree86VidModeExtensionInit(void) {
+ ExtensionEntry *extEntry;
ScreenPtr pScreen;
- int i;
- Bool enabled = FALSE;
+ int i;
+ Bool enabled = FALSE;
- DEBUG_P("XFree86VidModeExtensionInit");
+ DEBUG_P("XFree86VidModeExtensionInit");
if (!dixRegisterPrivateKey(&VidModeClientPrivateKeyRec, PRIVATE_CLIENT, 0))
- return;
+ return;
#ifdef XF86VIDMODE_EVENTS
if (!dixRegisterPrivateKey(&ScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return;
+ return;
#endif
#ifdef XF86VIDMODE_EVENTS
- EventType = CreateNewResourceType(XF86VidModeFreeEvents, "VidModeEvent");
+ EventType = CreateNewResourceType(XF86VidModeFreeEvents, "VidModeEvent");
#endif
- for(i = 0; i < screenInfo.numScreens; i++) {
+ for (i = 0; i < screenInfo.numScreens; i++) {
pScreen = screenInfo.screens[i];
- if (VidModeExtensionInit(pScreen))
- enabled = TRUE;
+ if (VidModeExtensionInit(pScreen))
+ enabled = TRUE;
}
/* This means that the DDX doesn't want the vidmode extension enabled */
- if (!enabled)
- return;
+ if (!enabled)
+ return;
if (
#ifdef XF86VIDMODE_EVENTS
- EventType &&
+ EventType &&
#endif
- (extEntry = AddExtension(XF86VIDMODENAME,
- XF86VidModeNumberEvents,
- XF86VidModeNumberErrors,
- ProcXF86VidModeDispatch,
- SProcXF86VidModeDispatch,
- NULL,
- StandardMinorOpcode))) {
+ (extEntry = AddExtension(XF86VIDMODENAME,
+ XF86VidModeNumberEvents,
+ XF86VidModeNumberErrors,
+ ProcXF86VidModeDispatch,
+ SProcXF86VidModeDispatch,
+ NULL, StandardMinorOpcode))) {
#if 0
- XF86VidModeReqCode = (unsigned char)extEntry->base;
+ XF86VidModeReqCode = (unsigned char) extEntry->base;
#endif
- VidModeErrorBase = extEntry->errorBase;
+ VidModeErrorBase = extEntry->errorBase;
#ifdef XF86VIDMODE_EVENTS
- XF86VidModeEventBase = extEntry->eventBase;
- EventSwapVector[XF86VidModeEventBase] = (EventSwapPtr)SXF86VidModeNotifyEvent;
+ XF86VidModeEventBase = extEntry->eventBase;
+ EventSwapVector[XF86VidModeEventBase] =
+ (EventSwapPtr) SXF86VidModeNotifyEvent;
#endif
}
}