aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/randr
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/randr')
-rw-r--r--xorg-server/randr/Makefile.in35
-rw-r--r--xorg-server/randr/randr.c8
-rw-r--r--xorg-server/randr/randrstr.h267
-rw-r--r--xorg-server/randr/rrcrtc.c110
-rw-r--r--xorg-server/randr/rrdispatch.c7
-rw-r--r--xorg-server/randr/rrmode.c46
-rw-r--r--xorg-server/randr/rroutput.c47
-rw-r--r--xorg-server/randr/rrproperty.c41
-rw-r--r--xorg-server/randr/rrscreen.c18
-rw-r--r--xorg-server/randr/rrsdispatch.c6
-rw-r--r--xorg-server/randr/rrtransform.h12
-rw-r--r--xorg-server/randr/rrxinerama.c5
12 files changed, 290 insertions, 312 deletions
diff --git a/xorg-server/randr/Makefile.in b/xorg-server/randr/Makefile.in
index 97313124a..b23cad6b1 100644
--- a/xorg-server/randr/Makefile.in
+++ b/xorg-server/randr/Makefile.in
@@ -40,8 +40,11 @@ subdir = randr
DIST_COMMON = $(am__sdk_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/dolt.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/shave.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -51,7 +54,8 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
$(top_builddir)/include/xorg-config.h \
$(top_builddir)/include/xkb-config.h \
$(top_builddir)/include/xwin-config.h \
- $(top_builddir)/include/kdrive-config.h
+ $(top_builddir)/include/kdrive-config.h \
+ $(top_builddir)/include/version-config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
@@ -110,6 +114,7 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
+AM_MAKEFLAGS = @AM_MAKEFLAGS@
APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@
APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@
@@ -130,9 +135,12 @@ CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CHANGELOG_CMD = @CHANGELOG_CMD@
COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
+CXX = @CXX@
CYGPATH_W = @CYGPATH_W@
DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
@@ -161,7 +169,9 @@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
DRIPROTO_LIBS = @DRIPROTO_LIBS@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_CFLAGS = @DRI_CFLAGS@
DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DRI_LIBS = @DRI_LIBS@
DSYMUTIL = @DSYMUTIL@
DTRACE = @DTRACE@
DUMPBIN = @DUMPBIN@
@@ -170,9 +180,13 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+F77 = @F77@
+FC = @FC@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GL_CFLAGS = @GL_CFLAGS@
@@ -211,12 +225,13 @@ LTCOMPILE = @LTCOMPILE@
LTCXXCOMPILE = @LTCXXCOMPILE@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
+MAIN_LIB = @MAIN_LIB@
+MAKEFLAGS = @MAKEFLAGS@
MAKEINFO = @MAKEINFO@
MAKE_HTML = @MAKE_HTML@
MAKE_PDF = @MAKE_PDF@
MAKE_PS = @MAKE_PS@
MAKE_TEXT = @MAKE_TEXT@
-MESA_SOURCE = @MESA_SOURCE@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
@@ -236,7 +251,6 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
@@ -246,6 +260,7 @@ PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
PROJECTROOT = @PROJECTROOT@
PS2PDF = @PS2PDF@
+Q = @Q@
RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
@@ -259,11 +274,10 @@ STRIP = @STRIP@
TSLIB_CFLAGS = @TSLIB_CFLAGS@
TSLIB_LIBS = @TSLIB_LIBS@
UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
-VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
-VENDOR_NAME = @VENDOR_NAME@
+V = @V@
VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
-VENDOR_RELEASE = @VENDOR_RELEASE@
VERSION = @VERSION@
+WINDRES = @WINDRES@
X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
XDMCP_CFLAGS = @XDMCP_CFLAGS@
@@ -299,6 +313,7 @@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
XORG_SYS_LIBS = @XORG_SYS_LIBS@
XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@
XPBPROXY_LIBS = @XPBPROXY_LIBS@
+XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@
XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
XSDL_INCS = @XSDL_INCS@
@@ -323,7 +338,6 @@ YFLAGS = @YFLAGS@
__XCONFIGFILE__ = @__XCONFIGFILE__@
abi_ansic = @abi_ansic@
abi_extension = @abi_extension@
-abi_font = @abi_font@
abi_videodrv = @abi_videodrv@
abi_xinput = @abi_xinput@
abs_builddir = @abs_builddir@
@@ -346,6 +360,7 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
+distcleancheck_listfiles = @distcleancheck_listfiles@
docdir = @docdir@
driverdir = @driverdir@
dvidir = @dvidir@
@@ -377,7 +392,9 @@ psdir = @psdir@
sbindir = @sbindir@
sdkdir = @sdkdir@
sharedstatedir = @sharedstatedir@
+shavedir = @shavedir@
srcdir = @srcdir@
+symbol_visibility = @symbol_visibility@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
diff --git a/xorg-server/randr/randr.c b/xorg-server/randr/randr.c
index 5bcb3597a..1c1d0c4f2 100644
--- a/xorg-server/randr/randr.c
+++ b/xorg-server/randr/randr.c
@@ -25,8 +25,6 @@
* Keith Packard, Intel Corporation
*/
-#define NEED_REPLIES
-#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -288,7 +286,8 @@ RRFreeClient (pointer data, XID id)
pRREvent = (RREventPtr) data;
pWin = pRREvent->window;
- pHead = (RREventPtr *) LookupIDByType(pWin->drawable.id, RREventType);
+ dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
+ RREventType, serverClient, DixDestroyAccess);
if (pHead) {
pPrev = 0;
for (pCur = *pHead; pCur && pCur != pRREvent; pCur=pCur->next)
@@ -366,7 +365,8 @@ TellChanged (WindowPtr pWin, pointer value)
rrScrPriv(pScreen);
int i;
- pHead = (RREventPtr *) LookupIDByType (pWin->drawable.id, RREventType);
+ dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
+ RREventType, serverClient, DixReadAccess);
if (!pHead)
return WT_WALKCHILDREN;
diff --git a/xorg-server/randr/randrstr.h b/xorg-server/randr/randrstr.h
index 9c9b7c074..af1437404 100644
--- a/xorg-server/randr/randrstr.h
+++ b/xorg-server/randr/randrstr.h
@@ -65,10 +65,10 @@ typedef XID RRMode;
typedef XID RROutput;
typedef XID RRCrtc;
-extern int RREventBase, RRErrorBase;
+extern _X_EXPORT int RREventBase, RRErrorBase;
-extern int (*ProcRandrVector[RRNumberRequests])(ClientPtr);
-extern int (*SProcRandrVector[RRNumberRequests])(ClientPtr);
+extern _X_EXPORT int (*ProcRandrVector[RRNumberRequests])(ClientPtr);
+extern _X_EXPORT int (*SProcRandrVector[RRNumberRequests])(ClientPtr);
/*
* Modeline for a monitor. Name follows directly after this struct
@@ -173,6 +173,9 @@ typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen,
RRCrtcPtr crtc);
+typedef Bool (*RRCrtcGetGammaProcPtr) (ScreenPtr pScreen,
+ RRCrtcPtr crtc);
+
typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen,
RROutputPtr output,
Atom property,
@@ -245,6 +248,7 @@ typedef struct _rrScrPriv {
RRScreenSetSizeProcPtr rrScreenSetSize;
RRCrtcSetProcPtr rrCrtcSet;
RRCrtcSetGammaProcPtr rrCrtcSetGamma;
+ RRCrtcGetGammaProcPtr rrCrtcGetGamma;
RROutputSetPropertyProcPtr rrOutputSetProperty;
RROutputValidateModeProcPtr rrOutputValidateMode;
RRModeDestroyProcPtr rrModeDestroy;
@@ -297,7 +301,7 @@ typedef struct _rrScrPriv {
#endif
} rrScrPrivRec, *rrScrPrivPtr;
-extern DevPrivateKey rrPrivKey;
+extern _X_EXPORT DevPrivateKey rrPrivKey;
#define rrGetScrPriv(pScr) ((rrScrPrivPtr)dixLookupPrivate(&(pScr)->devPrivates, rrPrivKey))
#define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr)
@@ -332,32 +336,46 @@ typedef struct _RRClient {
/* RRTimesRec times[0]; */
} RRClientRec, *RRClientPtr;
-extern RESTYPE RRClientType, RREventType; /* resource types for event masks */
-extern DevPrivateKey RRClientPrivateKey;
-extern RESTYPE RRCrtcType, RRModeType, RROutputType;
-
-#define LookupOutput(client,id,a) ((RROutputPtr) \
- (SecurityLookupIDByType (client, id, \
- RROutputType, a)))
-#define LookupCrtc(client,id,a) ((RRCrtcPtr) \
- (SecurityLookupIDByType (client, id, \
- RRCrtcType, a)))
-#define LookupMode(client,id,a) ((RRModePtr) \
- (SecurityLookupIDByType (client, id, \
- RRModeType, a)))
+extern _X_EXPORT RESTYPE RRClientType, RREventType; /* resource types for event masks */
+extern _X_EXPORT DevPrivateKey RRClientPrivateKey;
+extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType;
+
+#define VERIFY_RR_OUTPUT(id, ptr, a)\
+ {\
+ int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
+ RROutputType, client, a);\
+ if (rc != Success)\
+ return (rc == BadValue) ? RRErrorBase + BadRROutput : rc;\
+ }
+
+#define VERIFY_RR_CRTC(id, ptr, a)\
+ {\
+ int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
+ RRCrtcType, client, a);\
+ if (rc != Success)\
+ return (rc == BadValue) ? RRErrorBase + BadRRCrtc : rc;\
+ }
+
+#define VERIFY_RR_MODE(id, ptr, a)\
+ {\
+ int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
+ RRModeType, client, a);\
+ if (rc != Success)\
+ return (rc == BadValue) ? RRErrorBase + BadRRMode : rc;\
+ }
#define GetRRClient(pClient) ((RRClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RRClientPrivateKey))
#define rrClientPriv(pClient) RRClientPtr pRRClient = GetRRClient(pClient)
/* Initialize the extension */
-void
+extern _X_EXPORT void
RRExtensionInit (void);
#ifdef RANDR_12_INTERFACE
/*
* Set the range of sizes for the screen
*/
-void
+extern _X_EXPORT void
RRScreenSetSizeRange (ScreenPtr pScreen,
CARD16 minWidth,
CARD16 minHeight,
@@ -371,13 +389,13 @@ RRScreenSetSizeRange (ScreenPtr pScreen,
* The driver is responsible for calling this whenever it has changed
* the size of the screen
*/
-void
+extern _X_EXPORT void
RRScreenSizeNotify (ScreenPtr pScreen);
/*
* Request that the screen be resized
*/
-Bool
+extern _X_EXPORT Bool
RRScreenSizeSet (ScreenPtr pScreen,
CARD16 width,
CARD16 height,
@@ -387,47 +405,44 @@ RRScreenSizeSet (ScreenPtr pScreen,
/*
* Send ConfigureNotify event to root window when 'something' happens
*/
-void
+extern _X_EXPORT void
RRSendConfigNotify (ScreenPtr pScreen);
/*
* screen dispatch
*/
-int
+extern _X_EXPORT int
ProcRRGetScreenSizeRange (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRSetScreenSize (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRGetScreenResources (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRGetScreenResourcesCurrent (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRSetScreenConfig (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRGetScreenInfo (ClientPtr client);
/*
* Deliver a ScreenNotify event
*/
-void
+extern _X_EXPORT void
RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);
/* mirandr.c */
-Bool
+extern _X_EXPORT Bool
miRandRInit (ScreenPtr pScreen);
-Bool
+extern _X_EXPORT Bool
miRRGetInfo (ScreenPtr pScreen, Rotation *rotations);
-Bool
-miRRGetScreenInfo (ScreenPtr pScreen);
-
-Bool
+extern _X_EXPORT Bool
miRRCrtcSet (ScreenPtr pScreen,
RRCrtcPtr crtc,
RRModePtr mode,
@@ -437,23 +452,23 @@ miRRCrtcSet (ScreenPtr pScreen,
int numOutput,
RROutputPtr *outputs);
-Bool
+extern _X_EXPORT Bool
miRROutputSetProperty (ScreenPtr pScreen,
RROutputPtr output,
Atom property,
RRPropertyValuePtr value);
-Bool
+extern _X_EXPORT Bool
miRROutputGetProperty (ScreenPtr pScreen,
RROutputPtr output,
Atom property);
-Bool
+extern _X_EXPORT Bool
miRROutputValidateMode (ScreenPtr pScreen,
RROutputPtr output,
RRModePtr mode);
-void
+extern _X_EXPORT void
miRRModeDestroy (ScreenPtr pScreen,
RRModePtr mode);
@@ -461,26 +476,26 @@ miRRModeDestroy (ScreenPtr pScreen,
/*
* Send all pending events
*/
-void
+extern _X_EXPORT void
RRTellChanged (ScreenPtr pScreen);
/*
* Poll the driver for changed information
*/
-Bool
+extern _X_EXPORT Bool
RRGetInfo (ScreenPtr pScreen, Bool force_query);
-Bool RRInit (void);
+extern _X_EXPORT Bool RRInit (void);
-Bool RRScreenInit(ScreenPtr pScreen);
+extern _X_EXPORT Bool RRScreenInit(ScreenPtr pScreen);
-RROutputPtr
+extern _X_EXPORT RROutputPtr
RRFirstOutput (ScreenPtr pScreen);
-Rotation
+extern _X_EXPORT Rotation
RRGetRotation (ScreenPtr pScreen);
-CARD16
+extern _X_EXPORT CARD16
RRVerticalRefresh (xRRModeInfo *mode);
#ifdef RANDR_10_INTERFACE
@@ -493,14 +508,15 @@ RRVerticalRefresh (xRRModeInfo *mode);
* Then, register the specific size with the screen
*/
-RRScreenSizePtr
+extern _X_EXPORT RRScreenSizePtr
RRRegisterSize (ScreenPtr pScreen,
short width,
short height,
short mmWidth,
short mmHeight);
-Bool RRRegisterRate (ScreenPtr pScreen,
+extern _X_EXPORT Bool
+RRRegisterRate (ScreenPtr pScreen,
RRScreenSizePtr pSize,
int rate);
@@ -508,23 +524,17 @@ Bool RRRegisterRate (ScreenPtr pScreen,
* Finally, set the current configuration of the screen
*/
-void
+extern _X_EXPORT void
RRSetCurrentConfig (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr pSize);
-Bool RRScreenInit (ScreenPtr pScreen);
+extern _X_EXPORT Bool RRScreenInit (ScreenPtr pScreen);
-Rotation
+extern _X_EXPORT Rotation
RRGetRotation (ScreenPtr pScreen);
-int
-RRSetScreenConfig (ScreenPtr pScreen,
- Rotation rotation,
- int rate,
- RRScreenSizePtr pSize);
-
#endif
/* rrcrtc.c */
@@ -533,32 +543,32 @@ RRSetScreenConfig (ScreenPtr pScreen,
* Notify the CRTC of some change; layoutChanged indicates that
* some position or size element changed
*/
-void
+extern _X_EXPORT void
RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged);
/*
* Create a CRTC
*/
-RRCrtcPtr
+extern _X_EXPORT RRCrtcPtr
RRCrtcCreate (ScreenPtr pScreen, void *devPrivate);
/*
* Set the allowed rotations on a CRTC
*/
-void
+extern _X_EXPORT void
RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations);
/*
* Set whether transforms are allowed on a CRTC
*/
-void
+extern _X_EXPORT void
RRCrtcSetTransformSupport (RRCrtcPtr crtc, Bool transforms);
/*
* Notify the extension that the Crtc has been reconfigured,
* the driver calls this whenever it has updated the mode
*/
-Bool
+extern _X_EXPORT Bool
RRCrtcNotify (RRCrtcPtr crtc,
RRModePtr mode,
int x,
@@ -568,13 +578,13 @@ RRCrtcNotify (RRCrtcPtr crtc,
int numOutputs,
RROutputPtr *outputs);
-void
+extern _X_EXPORT void
RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc);
/*
* Request that the Crtc be reconfigured
*/
-Bool
+extern _X_EXPORT Bool
RRCrtcSet (RRCrtcPtr crtc,
RRModePtr mode,
int x,
@@ -587,26 +597,34 @@ RRCrtcSet (RRCrtcPtr crtc,
* Request that the Crtc gamma be changed
*/
-Bool
+extern _X_EXPORT Bool
RRCrtcGammaSet (RRCrtcPtr crtc,
CARD16 *red,
CARD16 *green,
CARD16 *blue);
/*
+ * Request current gamma back from the DDX (if possible).
+ * This includes gamma size.
+ */
+
+extern _X_EXPORT Bool
+RRCrtcGammaGet(RRCrtcPtr crtc);
+
+/*
* Notify the extension that the Crtc gamma has been changed
* The driver calls this whenever it has changed the gamma values
* in the RRCrtcRec
*/
-Bool
+extern _X_EXPORT Bool
RRCrtcGammaNotify (RRCrtcPtr crtc);
/*
* Set the size of the gamma table at server startup time
*/
-Bool
+extern _X_EXPORT Bool
RRCrtcGammaSetSize (RRCrtcPtr crtc,
int size);
@@ -615,7 +633,7 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc,
* taking into account the current mode and rotation
*/
-void
+extern _X_EXPORT void
RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
/*
@@ -625,7 +643,7 @@ RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
*
* Return TRUE if the resulting transform is not a simple translation.
*/
-Bool
+extern _X_EXPORT Bool
RRTransformCompute (int x,
int y,
int width,
@@ -640,19 +658,19 @@ RRTransformCompute (int x,
/*
* Return crtc transform
*/
-RRTransformPtr
+extern _X_EXPORT RRTransformPtr
RRCrtcGetTransform (RRCrtcPtr crtc);
/*
* Check whether the pending and current transforms are the same
*/
-Bool
+extern _X_EXPORT Bool
RRCrtcPendingTransform (RRCrtcPtr crtc);
/*
* Destroy a Crtc at shutdown
*/
-void
+extern _X_EXPORT void
RRCrtcDestroy (RRCrtcPtr crtc);
@@ -660,7 +678,7 @@ RRCrtcDestroy (RRCrtcPtr crtc);
* Set the pending CRTC transformation
*/
-int
+extern _X_EXPORT int
RRCrtcTransformSet (RRCrtcPtr crtc,
PictTransformPtr transform,
struct pict_f_transform *f_transform,
@@ -673,32 +691,32 @@ RRCrtcTransformSet (RRCrtcPtr crtc,
/*
* Initialize crtc type
*/
-Bool
+extern _X_EXPORT Bool
RRCrtcInit (void);
/*
* Crtc dispatch
*/
-int
+extern _X_EXPORT int
ProcRRGetCrtcInfo (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRSetCrtcConfig (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRGetCrtcGammaSize (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRGetCrtcGamma (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRSetCrtcGamma (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRSetCrtcTransform (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRGetCrtcTransform (ClientPtr client);
int
@@ -708,7 +726,7 @@ int
ProcRRSetPanning (ClientPtr client);
/* rrdispatch.c */
-Bool
+extern _X_EXPORT Bool
RRClientKnowsRates (ClientPtr pClient);
/* rrmode.c */
@@ -716,42 +734,39 @@ RRClientKnowsRates (ClientPtr pClient);
* Find, and if necessary, create a mode
*/
-RRModePtr
+extern _X_EXPORT RRModePtr
RRModeGet (xRRModeInfo *modeInfo,
const char *name);
-void
-RRModePruneUnused (ScreenPtr pScreen);
-
/*
* Destroy a mode.
*/
-void
+extern _X_EXPORT void
RRModeDestroy (RRModePtr mode);
/*
* Return a list of modes that are valid for some output in pScreen
*/
-RRModePtr *
+extern _X_EXPORT RRModePtr *
RRModesForScreen (ScreenPtr pScreen, int *num_ret);
/*
* Initialize mode type
*/
-Bool
+extern _X_EXPORT Bool
RRModeInit (void);
-int
+extern _X_EXPORT int
ProcRRCreateMode (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRDestroyMode (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRAddOutputMode (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRDeleteOutputMode (ClientPtr client);
/* rroutput.c */
@@ -762,14 +777,14 @@ ProcRRDeleteOutputMode (ClientPtr client);
* has changed, or whether the change was strictly internal
* (which crtc is in use)
*/
-void
+extern _X_EXPORT void
RROutputChanged (RROutputPtr output, Bool configChanged);
/*
* Create an output
*/
-RROutputPtr
+extern _X_EXPORT RROutputPtr
RROutputCreate (ScreenPtr pScreen,
const char *name,
int nameLength,
@@ -778,118 +793,120 @@ RROutputCreate (ScreenPtr pScreen,
/*
* Notify extension that output parameters have been changed
*/
-Bool
+extern _X_EXPORT Bool
RROutputSetClones (RROutputPtr output,
RROutputPtr *clones,
int numClones);
-Bool
+extern _X_EXPORT Bool
RROutputSetModes (RROutputPtr output,
RRModePtr *modes,
int numModes,
int numPreferred);
-int
+extern _X_EXPORT int
RROutputAddUserMode (RROutputPtr output,
RRModePtr mode);
-int
+extern _X_EXPORT int
RROutputDeleteUserMode (RROutputPtr output,
RRModePtr mode);
-Bool
+extern _X_EXPORT Bool
RROutputSetCrtcs (RROutputPtr output,
RRCrtcPtr *crtcs,
int numCrtcs);
-Bool
+extern _X_EXPORT Bool
RROutputSetConnection (RROutputPtr output,
CARD8 connection);
-Bool
+extern _X_EXPORT Bool
RROutputSetSubpixelOrder (RROutputPtr output,
int subpixelOrder);
-Bool
+extern _X_EXPORT Bool
RROutputSetPhysicalSize (RROutputPtr output,
int mmWidth,
int mmHeight);
-void
+extern _X_EXPORT void
RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
-void
+extern _X_EXPORT void
RROutputDestroy (RROutputPtr output);
-int
+extern _X_EXPORT int
ProcRRGetOutputInfo (ClientPtr client);
-extern int
+extern _X_EXPORT int
ProcRRSetOutputPrimary (ClientPtr client);
-extern int
+extern _X_EXPORT int
ProcRRGetOutputPrimary (ClientPtr client);
/*
* Initialize output type
*/
-Bool
+extern _X_EXPORT Bool
RROutputInit (void);
/* rrpointer.c */
-void
+extern _X_EXPORT void
RRPointerMoved (ScreenPtr pScreen, int x, int y);
-void
+extern _X_EXPORT void
RRPointerScreenConfigured (ScreenPtr pScreen);
/* rrproperty.c */
-void
+extern _X_EXPORT void
RRDeleteAllOutputProperties (RROutputPtr output);
-RRPropertyValuePtr
+extern _X_EXPORT RRPropertyValuePtr
RRGetOutputProperty (RROutputPtr output, Atom property, Bool pending);
-RRPropertyPtr
+extern _X_EXPORT RRPropertyPtr
RRQueryOutputProperty (RROutputPtr output, Atom property);
-void
+extern _X_EXPORT void
RRDeleteOutputProperty (RROutputPtr output, Atom property);
-Bool
+extern _X_EXPORT Bool
RRPostPendingProperties (RROutputPtr output);
-int
+extern _X_EXPORT int
RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
int format, int mode, unsigned long len,
pointer value, Bool sendevent, Bool pending);
-int
+extern _X_EXPORT int
RRConfigureOutputProperty (RROutputPtr output, Atom property,
Bool pending, Bool range, Bool immutable,
int num_values, INT32 *values);
-int
+extern _X_EXPORT int
ProcRRChangeOutputProperty (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRGetOutputProperty (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRListOutputProperties (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRQueryOutputProperty (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRConfigureOutputProperty (ClientPtr client);
-int
+extern _X_EXPORT int
ProcRRDeleteOutputProperty (ClientPtr client);
/* rrxinerama.c */
-void
+#ifdef XINERAMA
+extern _X_EXPORT void
RRXineramaExtensionInit(void);
+#endif
#endif /* _RANDRSTR_H_ */
diff --git a/xorg-server/randr/rrcrtc.c b/xorg-server/randr/rrcrtc.c
index 8a5738fc5..0e14b36dd 100644
--- a/xorg-server/randr/rrcrtc.c
+++ b/xorg-server/randr/rrcrtc.c
@@ -480,6 +480,29 @@ RRCrtcGammaSet (RRCrtcPtr crtc,
}
/*
+ * Request current gamma back from the DDX (if possible).
+ * This includes gamma size.
+ */
+Bool
+RRCrtcGammaGet(RRCrtcPtr crtc)
+{
+ Bool ret = TRUE;
+#if RANDR_12_INTERFACE
+ ScreenPtr pScreen = crtc->pScreen;
+#endif
+
+#if RANDR_12_INTERFACE
+ if (pScreen)
+ {
+ rrScrPriv(pScreen);
+ if (pScrPriv->rrCrtcGetGamma)
+ ret = (*pScrPriv->rrCrtcGetGamma) (pScreen, crtc);
+ }
+#endif
+ return ret;
+}
+
+/*
* Notify the extension that the Crtc gamma has been changed
* The driver calls this whenever it has changed the gamma values
* in the RRCrtcRec
@@ -635,10 +658,7 @@ ProcRRGetCrtcInfo (ClientPtr client)
BoxRec panned_area;
REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
- crtc = LookupCrtc(client, stuff->crtc, DixReadAccess);
-
- if (!crtc)
- return RRErrorBase + BadRRCrtc;
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
/* All crtcs must be associated with screens before client
* requests are processed
@@ -752,17 +772,13 @@ ProcRRSetCrtcConfig (ClientPtr client)
TimeStamp configTime;
TimeStamp time;
Rotation rotation;
- int i, j;
+ int rc, i, j;
REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
- numOutputs = (stuff->length - (SIZEOF (xRRSetCrtcConfigReq) >> 2));
+ numOutputs = (stuff->length - bytes_to_int32(SIZEOF (xRRSetCrtcConfigReq)));
- crtc = LookupIDByType (stuff->crtc, RRCrtcType);
- if (!crtc)
- {
- client->errorValue = stuff->crtc;
- return RRErrorBase + BadRRCrtc;
- }
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixSetAttrAccess);
+
if (stuff->mode == None)
{
mode = NULL;
@@ -771,12 +787,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
}
else
{
- mode = LookupIDByType (stuff->mode, RRModeType);
- if (!mode)
- {
- client->errorValue = stuff->mode;
- return RRErrorBase + BadRRMode;
- }
+ VERIFY_RR_MODE(stuff->mode, mode, DixSetAttrAccess);
if (numOutputs == 0)
return BadMatch;
}
@@ -792,13 +803,13 @@ ProcRRSetCrtcConfig (ClientPtr client)
outputIds = (RROutput *) (stuff + 1);
for (i = 0; i < numOutputs; i++)
{
- outputs[i] = (RROutputPtr) LookupIDByType (outputIds[i], RROutputType);
- if (!outputs[i])
+ rc = dixLookupResourceByType((pointer *)(outputs + i), outputIds[i],
+ RROutputType, client, DixSetAttrAccess);
+ if (rc != Success)
{
- client->errorValue = outputIds[i];
if (outputs)
xfree (outputs);
- return RRErrorBase + BadRROutput;
+ return (rc == BadValue) ? RRErrorBase + BadRROutput : rc;
}
/* validate crtc for this output */
for (j = 0; j < outputs[i]->numCrtcs; j++)
@@ -1005,10 +1016,7 @@ ProcRRGetPanning (ClientPtr client)
int n;
REQUEST_SIZE_MATCH(xRRGetPanningReq);
- crtc = LookupCrtc(client, stuff->crtc, DixReadAccess);
-
- if (!crtc)
- return RRErrorBase + BadRRCrtc;
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
/* All crtcs must be associated with screens before client
* requests are processed
@@ -1078,11 +1086,7 @@ ProcRRSetPanning (ClientPtr client)
int n;
REQUEST_SIZE_MATCH(xRRSetPanningReq);
- crtc = LookupCrtc(client, stuff->crtc, DixReadAccess);
-
- if (!crtc)
- return RRErrorBase + BadRRCrtc;
-
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
/* All crtcs must be associated with screens before client
* requests are processed
@@ -1155,10 +1159,12 @@ ProcRRGetCrtcGammaSize (ClientPtr client)
int n;
REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
- crtc = LookupCrtc (client, stuff->crtc, DixReadAccess);
- if (!crtc)
- return RRErrorBase + BadRRCrtc;
-
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
+
+ /* Gamma retrieval failed, any better error? */
+ if (!RRCrtcGammaGet(crtc))
+ return RRErrorBase + BadRRCrtc;
+
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.length = 0;
@@ -1183,10 +1189,12 @@ ProcRRGetCrtcGamma (ClientPtr client)
char *extra = NULL;
REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
- crtc = LookupCrtc (client, stuff->crtc, DixReadAccess);
- if (!crtc)
- return RRErrorBase + BadRRCrtc;
-
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
+
+ /* Gamma retrieval failed, any better error? */
+ if (!RRCrtcGammaGet(crtc))
+ return RRErrorBase + BadRRCrtc;
+
len = crtc->gammaSize * 3 * 2;
if (crtc->gammaSize) {
@@ -1197,7 +1205,7 @@ ProcRRGetCrtcGamma (ClientPtr client)
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
- reply.length = (len + 3) >> 2;
+ reply.length = bytes_to_int32(len);
reply.size = crtc->gammaSize;
if (client->swapped) {
swaps (&reply.sequenceNumber, n);
@@ -1224,11 +1232,9 @@ ProcRRSetCrtcGamma (ClientPtr client)
CARD16 *red, *green, *blue;
REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq);
- crtc = LookupCrtc (client, stuff->crtc, DixWriteAccess);
- if (!crtc)
- return RRErrorBase + BadRRCrtc;
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
- len = client->req_len - (sizeof (xRRSetCrtcGammaReq) >> 2);
+ len = client->req_len - bytes_to_int32(sizeof (xRRSetCrtcGammaReq));
if (len < (stuff->size * 3 + 1) >> 1)
return BadLength;
@@ -1259,9 +1265,7 @@ ProcRRSetCrtcTransform (ClientPtr client)
int nparams;
REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
- crtc = LookupCrtc (client, stuff->crtc, DixWriteAccess);
- if (!crtc)
- return RRErrorBase + BadRRCrtc;
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
PictTransform_from_xRenderTransform (&transform, &stuff->transform);
pixman_f_transform_from_pixman_transform (&f_transform, &transform);
@@ -1270,7 +1274,7 @@ ProcRRSetCrtcTransform (ClientPtr client)
filter = (char *) (stuff + 1);
nbytes = stuff->nbytesFilter;
- params = (xFixed *) (filter + ((nbytes + 3) & ~3));
+ params = (xFixed *) (filter + pad_to_int32(nbytes));
nparams = ((xFixed *) stuff + client->req_len) - params;
if (nparams < 0)
return BadLength;
@@ -1291,7 +1295,7 @@ transform_filter_length (RRTransformPtr transform)
return 0;
nbytes = strlen (transform->filter->name);
nparams = transform->nparams;
- return ((nbytes + 3) & ~3) + (nparams * sizeof (xFixed));
+ return pad_to_int32(nbytes) + (nparams * sizeof (xFixed));
}
static int
@@ -1330,7 +1334,7 @@ transform_encode (ClientPtr client, xRenderTransform *wire, PictTransform *pict)
{
xRenderTransform_from_PictTransform (wire, pict);
if (client->swapped)
- SwapLongs ((CARD32 *) wire, sizeof (xRenderTransform) >> 2);
+ SwapLongs ((CARD32 *) wire, bytes_to_int32(sizeof(xRenderTransform)));
}
int
@@ -1344,9 +1348,7 @@ ProcRRGetCrtcTransform (ClientPtr client)
char *extra;
REQUEST_SIZE_MATCH (xRRGetCrtcTransformReq);
- crtc = LookupCrtc (client, stuff->crtc, DixWriteAccess);
- if (!crtc)
- return RRErrorBase + BadRRCrtc;
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
pending = &crtc->client_pending_transform;
current = &crtc->client_current_transform;
@@ -1361,7 +1363,7 @@ ProcRRGetCrtcTransform (ClientPtr client)
extra = (char *) (reply + 1);
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
- reply->length = (CrtcTransformExtra + nextra) >> 2;
+ reply->length = bytes_to_int32(CrtcTransformExtra + nextra);
reply->hasTransforms = crtc->transforms;
diff --git a/xorg-server/randr/rrdispatch.c b/xorg-server/randr/rrdispatch.c
index 0925875bf..bec5b08af 100644
--- a/xorg-server/randr/rrdispatch.c
+++ b/xorg-server/randr/rrdispatch.c
@@ -79,9 +79,10 @@ ProcRRSelectInput (ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
if (rc != Success)
return rc;
- pHead = (RREventPtr *)SecurityLookupIDByType(client,
- pWin->drawable.id, RREventType,
- DixWriteAccess);
+ rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
+ RREventType, client, DixWriteAccess);
+ if (rc != Success && rc != BadValue)
+ return rc;
if (stuff->enable & (RRScreenChangeNotifyMask|
RRCrtcChangeNotifyMask|
diff --git a/xorg-server/randr/rrmode.c b/xorg-server/randr/rrmode.c
index 2fa440385..9642ddae3 100644
--- a/xorg-server/randr/rrmode.c
+++ b/xorg-server/randr/rrmode.c
@@ -288,7 +288,7 @@ ProcRRCreateMode (ClientPtr client)
RRModePtr mode;
REQUEST_AT_LEAST_SIZE (xRRCreateModeReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -297,10 +297,10 @@ ProcRRCreateMode (ClientPtr client)
modeInfo = &stuff->modeInfo;
name = (char *) (stuff + 1);
- units_after = (stuff->length - (sizeof (xRRCreateModeReq) >> 2));
+ units_after = (stuff->length - bytes_to_int32(sizeof (xRRCreateModeReq)));
/* check to make sure requested name fits within the data provided */
- if ((int) (modeInfo->nameLength + 3) >> 2 > units_after)
+ if (bytes_to_int32(modeInfo->nameLength) > units_after)
return BadLength;
mode = RRModeCreateUser (pScreen, modeInfo, name, &error);
@@ -332,12 +332,8 @@ ProcRRDestroyMode (ClientPtr client)
RRModePtr mode;
REQUEST_SIZE_MATCH(xRRDestroyModeReq);
- mode = LookupIDByType (stuff->mode, RRModeType);
- if (!mode)
- {
- client->errorValue = stuff->mode;
- return RRErrorBase + BadRRMode;
- }
+ VERIFY_RR_MODE(stuff->mode, mode, DixDestroyAccess);
+
if (!mode->userScreen)
return BadMatch;
if (mode->refcnt > 1)
@@ -354,20 +350,8 @@ ProcRRAddOutputMode (ClientPtr client)
RROutputPtr output;
REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
- output = LookupOutput(client, stuff->output, DixReadAccess);
-
- if (!output)
- {
- client->errorValue = stuff->output;
- return RRErrorBase + BadRROutput;
- }
-
- mode = LookupIDByType (stuff->mode, RRModeType);
- if (!mode)
- {
- client->errorValue = stuff->mode;
- return RRErrorBase + BadRRMode;
- }
+ VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
+ VERIFY_RR_MODE(stuff->mode, mode, DixUseAccess);
return RROutputAddUserMode (output, mode);
}
@@ -380,20 +364,8 @@ ProcRRDeleteOutputMode (ClientPtr client)
RROutputPtr output;
REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
- output = LookupOutput(client, stuff->output, DixReadAccess);
-
- if (!output)
- {
- client->errorValue = stuff->output;
- return RRErrorBase + BadRROutput;
- }
-
- mode = LookupIDByType (stuff->mode, RRModeType);
- if (!mode)
- {
- client->errorValue = stuff->mode;
- return RRErrorBase + BadRRMode;
- }
+ VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
+ VERIFY_RR_MODE(stuff->mode, mode, DixUseAccess);
return RROutputDeleteUserMode (output, mode);
}
diff --git a/xorg-server/randr/rroutput.c b/xorg-server/randr/rroutput.c
index bb1620cfd..e58eb9f74 100644
--- a/xorg-server/randr/rroutput.c
+++ b/xorg-server/randr/rroutput.c
@@ -453,20 +453,14 @@ ProcRRGetOutputInfo (ClientPtr client)
int i, n;
REQUEST_SIZE_MATCH(xRRGetOutputInfoReq);
- output = LookupOutput(client, stuff->output, DixReadAccess);
-
- if (!output)
- {
- client->errorValue = stuff->output;
- return RRErrorBase + BadRROutput;
- }
+ VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
pScreen = output->pScreen;
pScrPriv = rrGetScrPriv(pScreen);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = OutputInfoExtra >> 2;
+ rep.length = bytes_to_int32(OutputInfoExtra);
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
rep.crtc = output->crtc ? output->crtc->id : None;
rep.mmWidth = output->mmWidth;
@@ -479,14 +473,14 @@ ProcRRGetOutputInfo (ClientPtr client)
rep.nClones = output->numClones;
rep.nameLength = output->nameLength;
- extraLen = ((output->numCrtcs +
+ extraLen = ((output->numCrtcs +
output->numModes + output->numUserModes +
output->numClones +
- ((rep.nameLength + 3) >> 2)) << 2);
+ bytes_to_int32(rep.nameLength)) << 2);
if (extraLen)
{
- rep.length += extraLen >> 2;
+ rep.length += bytes_to_int32(extraLen);
extra = xalloc (extraLen);
if (!extra)
return BadAlloc;
@@ -543,7 +537,7 @@ ProcRRGetOutputInfo (ClientPtr client)
return client->noClientException;
}
-void
+static void
RRSetPrimaryOutput(ScreenPtr pScreen, rrScrPrivPtr pScrPriv,
RROutputPtr output)
{
@@ -574,24 +568,16 @@ ProcRRSetOutputPrimary(ClientPtr client)
RROutputPtr output = NULL;
WindowPtr pWin;
rrScrPrivPtr pScrPriv;
+ int rc;
REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
- pWin = SecurityLookupIDByType(client, stuff->window, RT_WINDOW,
- DixReadAccess);
-
- if (!pWin) {
- client->errorValue = stuff->window;
- return BadWindow;
- }
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
if (stuff->output) {
- output = LookupOutput(client, stuff->output, DixReadAccess);
-
- if (!output) {
- client->errorValue = stuff->output;
- return RRErrorBase + BadRROutput;
- }
+ VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
if (output->pScreen != pWin->drawable.pScreen) {
client->errorValue = stuff->window;
@@ -613,16 +599,13 @@ ProcRRGetOutputPrimary(ClientPtr client)
rrScrPrivPtr pScrPriv;
xRRGetOutputPrimaryReply rep;
RROutputPtr primary = NULL;
+ int rc;
REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
- pWin = SecurityLookupIDByType(client, stuff->window, RT_WINDOW,
- DixReadAccess);
-
- if (!pWin) {
- client->errorValue = stuff->window;
- return BadWindow;
- }
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
if (pScrPriv)
diff --git a/xorg-server/randr/rrproperty.c b/xorg-server/randr/rrproperty.c
index 12923a2c7..6187b855f 100644
--- a/xorg-server/randr/rrproperty.c
+++ b/xorg-server/randr/rrproperty.c
@@ -31,7 +31,8 @@ DeliverPropertyEvent(WindowPtr pWin, void *value)
RREventPtr *pHead, pRREvent;
ClientPtr client;
- pHead = LookupIDByType(pWin->drawable.id, RREventType);
+ dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
+ RREventType, serverClient, DixReadAccess);
if (!pHead)
return WT_WALKCHILDREN;
@@ -419,10 +420,7 @@ ProcRRListOutputProperties (ClientPtr client)
REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq);
- output = LookupOutput (client, stuff->output, DixReadAccess);
-
- if (!output)
- return RRErrorBase + BadRROutput;
+ VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
for (prop = output->properties; prop; prop = prop->next)
numProps++;
@@ -431,7 +429,7 @@ ProcRRListOutputProperties (ClientPtr client)
return(BadAlloc);
rep.type = X_Reply;
- rep.length = (numProps * sizeof(Atom)) >> 2;
+ rep.length = bytes_to_int32(numProps * sizeof(Atom));
rep.sequenceNumber = client->sequence;
rep.nAtoms = numProps;
if (client->swapped)
@@ -466,10 +464,7 @@ ProcRRQueryOutputProperty (ClientPtr client)
REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq);
- output = LookupOutput (client, stuff->output, DixReadAccess);
-
- if (!output)
- return RRErrorBase + BadRROutput;
+ VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
prop = RRQueryOutputProperty (output, stuff->property);
if (!prop)
@@ -513,12 +508,9 @@ ProcRRConfigureOutputProperty (ClientPtr client)
REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq);
- output = LookupOutput (client, stuff->output, DixReadAccess);
-
- if (!output)
- return RRErrorBase + BadRROutput;
+ VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
- num_valid = stuff->length - (sizeof (xRRConfigureOutputPropertyReq) >> 2);
+ num_valid = stuff->length - bytes_to_int32(sizeof (xRRConfigureOutputPropertyReq));
return RRConfigureOutputProperty (output, stuff->property,
stuff->pending, stuff->range,
FALSE, num_valid,
@@ -552,15 +544,13 @@ ProcRRChangeOutputProperty (ClientPtr client)
return BadValue;
}
len = stuff->nUnits;
- if (len > ((0xffffffff - sizeof(xChangePropertyReq)) >> 2))
+ if (len > bytes_to_int32((0xffffffff - sizeof(xChangePropertyReq))))
return BadLength;
sizeInBytes = format>>3;
totalSize = len * sizeInBytes;
REQUEST_FIXED_SIZE(xRRChangeOutputPropertyReq, totalSize);
- output = LookupOutput (client, stuff->output, DixWriteAccess);
- if (!output)
- return RRErrorBase + BadRROutput;
+ VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
if (!ValidAtom(stuff->property))
{
@@ -590,9 +580,7 @@ ProcRRDeleteOutputProperty (ClientPtr client)
REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq);
UpdateCurrentTime();
- output = LookupOutput (client, stuff->output, DixWriteAccess);
- if (!output)
- return RRErrorBase + BadRROutput;
+ VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
if (!ValidAtom(stuff->property))
{
@@ -619,11 +607,8 @@ ProcRRGetOutputProperty (ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
if (stuff->delete)
UpdateCurrentTime();
- output = LookupOutput (client, stuff->output,
- stuff->delete ? DixWriteAccess :
- DixReadAccess);
- if (!output)
- return RRErrorBase + BadRROutput;
+ VERIFY_RR_OUTPUT(stuff->output, output,
+ stuff->delete ? DixWriteAccess : DixReadAccess);
if (!ValidAtom(stuff->property))
{
@@ -723,7 +708,7 @@ ProcRRGetOutputProperty (ClientPtr client)
}
reply.bytesAfter = n - (ind + len);
reply.format = prop_value->format;
- reply.length = (len + 3) >> 2;
+ reply.length = bytes_to_int32(len);
if (prop_value->format)
reply.nItems = len / (prop_value->format / 8);
else
diff --git a/xorg-server/randr/rrscreen.c b/xorg-server/randr/rrscreen.c
index dceb32f2e..e88a42816 100644
--- a/xorg-server/randr/rrscreen.c
+++ b/xorg-server/randr/rrscreen.c
@@ -204,7 +204,7 @@ RRScreenSizeSet (ScreenPtr pScreen,
/*
* Retrieve valid screen size range
*/
-int
+int
ProcRRGetScreenSizeRange (ClientPtr client)
{
REQUEST(xRRGetScreenSizeRangeReq);
@@ -215,7 +215,7 @@ ProcRRGetScreenSizeRange (ClientPtr client)
int rc;
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -266,7 +266,7 @@ ProcRRSetScreenSize (ClientPtr client)
int i, rc;
REQUEST_SIZE_MATCH(xRRSetScreenSizeReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -336,7 +336,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
CARD8 *names;
REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -386,8 +386,8 @@ rrGetScreenResources(ClientPtr client, Bool query)
rep.length = (pScrPriv->numCrtcs +
pScrPriv->numOutputs +
- num_modes * (SIZEOF(xRRModeInfo) >> 2) +
- ((rep.nbytesNames + 3) >> 2));
+ num_modes * bytes_to_int32(SIZEOF(xRRModeInfo)) +
+ bytes_to_int32(rep.nbytesNames));
extraLen = rep.length << 2;
if (extraLen)
@@ -460,7 +460,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
names += mode->mode.nameLength;
}
xfree (modes);
- assert (((((char *) names - (char *) extra) + 3) >> 2) == rep.length);
+ assert (bytes_to_int32((char *) names - (char *) extra) == rep.length);
}
if (client->swapped) {
@@ -611,7 +611,7 @@ ProcRRGetScreenInfo (ClientPtr client)
RROutputPtr output;
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -731,7 +731,7 @@ ProcRRGetScreenInfo (ClientPtr client)
if (data8 - (CARD8 *) extra != extraLen)
FatalError ("RRGetScreenInfo bad extra len %ld != %ld\n",
(unsigned long)(data8 - (CARD8 *) extra), extraLen);
- rep.length = (extraLen + 3) >> 2;
+ rep.length = bytes_to_int32(extraLen);
}
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
diff --git a/xorg-server/randr/rrsdispatch.c b/xorg-server/randr/rrsdispatch.c
index 9fbf8f0f5..e16090a41 100644
--- a/xorg-server/randr/rrsdispatch.c
+++ b/xorg-server/randr/rrsdispatch.c
@@ -375,10 +375,10 @@ SProcRRSetCrtcTransform (ClientPtr client)
REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
swaps(&stuff->length, n);
swapl(&stuff->crtc, n);
- SwapLongs((CARD32 *)&stuff->transform, (sizeof(xRenderTransform)) >> 2);
+ SwapLongs((CARD32 *)&stuff->transform, bytes_to_int32(sizeof(xRenderTransform)));
swaps(&stuff->nbytesFilter, n);
filter = (char *)(stuff + 1);
- params = (CARD32 *) (filter + ((stuff->nbytesFilter + 3) & ~3));
+ params = (CARD32 *) (filter + pad_to_int32(stuff->nbytesFilter));
nparams = ((CARD32 *) stuff + client->req_len) - params;
if (nparams < 0)
return BadLength;
@@ -453,7 +453,7 @@ static int
SProcRRGetOutputPrimary (ClientPtr client)
{
int n;
- REQUEST(xRRSetOutputPrimaryReq);
+ REQUEST(xRRGetOutputPrimaryReq);
REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
swaps(&stuff->length, n);
diff --git a/xorg-server/randr/rrtransform.h b/xorg-server/randr/rrtransform.h
index 92d3ee7be..561762dfe 100644
--- a/xorg-server/randr/rrtransform.h
+++ b/xorg-server/randr/rrtransform.h
@@ -39,16 +39,16 @@ struct _rrTransform {
int height;
};
-void
+extern _X_EXPORT void
RRTransformInit (RRTransformPtr transform);
-void
+extern _X_EXPORT void
RRTransformFini (RRTransformPtr transform);
-Bool
+extern _X_EXPORT Bool
RRTransformEqual (RRTransformPtr a, RRTransformPtr b);
-Bool
+extern _X_EXPORT Bool
RRTransformSetFilter (RRTransformPtr dst,
PictFilterPtr filter,
xFixed *params,
@@ -56,10 +56,10 @@ RRTransformSetFilter (RRTransformPtr dst,
int width,
int height);
-Bool
+extern _X_EXPORT Bool
RRTransformCopy (RRTransformPtr dst, RRTransformPtr src);
-Bool
+extern _X_EXPORT Bool
RRTransformCompute (int x,
int y,
int width,
diff --git a/xorg-server/randr/rrxinerama.c b/xorg-server/randr/rrxinerama.c
index 36135c6c1..97be7c1e6 100644
--- a/xorg-server/randr/rrxinerama.c
+++ b/xorg-server/randr/rrxinerama.c
@@ -245,7 +245,8 @@ ProcRRXineramaIsActive(ClientPtr client)
xXineramaIsActiveReply rep;
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
-
+
+ memset(&rep, 0, sizeof(xXineramaIsActiveReply));
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@@ -312,7 +313,7 @@ ProcRRXineramaQueryScreens(ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.number = RRXineramaScreenCount (pScreen);
- rep.length = rep.number * sz_XineramaScreenInfo >> 2;
+ rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
if(client->swapped) {
register int n;
swaps(&rep.sequenceNumber, n);