#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _RANDRSTR_H_
#define _RANDRSTR_H_
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "resource.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "extnsionst.h"
#include "servermd.h"
#include <X11/extensions/randr.h>
#include <X11/extensions/randrproto.h>
#ifdef RENDER
#include <X11/extensions/render.h>
#include "picturestr.h"
#endif
#include <X11/Xfuncproto.h>
#define RANDR_10_INTERFACE 1
#define RANDR_12_INTERFACE 1
typedef XID RRMode;
typedef XID RROutput;
typedef XID RRCrtc;
extern int RREventBase, RRErrorBase;
extern int (*ProcRandrVector[RRNumberRequests])(ClientPtr);
extern int (*SProcRandrVector[RRNumberRequests])(ClientPtr);
#define RRModeName(pMode) ((char *) (pMode + 1))
typedef struct _rrMode RRModeRec, *RRModePtr;
typedef struct _rrPropertyValue RRPropertyValueRec, *RRPropertyValuePtr;
typedef struct _rrProperty RRPropertyRec, *RRPropertyPtr;
typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
typedef struct _rrOutput RROutputRec, *RROutputPtr;
struct _rrMode {
int refcnt;
xRRModeInfo mode;
char *name;
ScreenPtr userScreen;
};
struct _rrPropertyValue {
Atom type;
short format;
long size;
pointer data;
};
struct _rrProperty {
RRPropertyPtr next;
ATOM propertyName;
Bool is_pending;
Bool range;
Bool immutable;
int num_valid;
INT32 *valid_values;
RRPropertyValueRec current, pending;
};
struct _rrCrtc {
RRCrtc id;
ScreenPtr pScreen;
RRModePtr mode;
int x, y;
Rotation rotation;
Rotation rotations;
Bool changed;
int numOutputs;
RROutputPtr *outputs;
int gammaSize;
CARD16 *gammaRed;
CARD16 *gammaBlue;
CARD16 *gammaGreen;
void *devPrivate;
};
struct _rrOutput {
RROutput id;
ScreenPtr pScreen;
char *name;
int nameLength;
CARD8 connection;
CARD8 subpixelOrder;
int mmWidth;
int mmHeight;
RRCrtcPtr crtc;
int numCrtcs;
RRCrtcPtr *crtcs;
int numClones;
RROutputPtr *clones;
int numModes;
int numPreferred;
RRModePtr *modes;
int numUserModes;
RRModePtr *userModes;
Bool changed;
RRPropertyPtr properties;
Bool pendingProperties;
void *devPrivate;
};
#if RANDR_12_INTERFACE
typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
CARD16 width,
CARD16 height,
CARD32 mmWidth,
CARD32 mmHeight);
typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
RRCrtcPtr crtc,
RRModePtr mode,
int x,
int y,
Rotation rotation,
int numOutputs,
RROutputPtr *outputs);
typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen,
RRCrtcPtr crtc);
typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen,
RROutputPtr output,
Atom property,
RRPropertyValuePtr value);
typedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen,
RROutputPtr output,
RRModePtr mode);
typedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen,
RRModePtr mode);
#endif
typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations);
typedef Bool (*RRCloseScreenProcPtr) ( int i, ScreenPtr pscreen);
typedef struct _rrRefresh {
CARD16 rate;
RRModePtr mode;
} RRScreenRate, *RRScreenRatePtr;
typedef struct _rrScreenSize {
int id;
short width, height;
short mmWidth, mmHeight;
int nRates;
RRScreenRatePtr pRates;
} RRScreenSize, *RRScreenSizePtr;
#ifdef RANDR_10_INTERFACE
typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr pSize);
#endif
typedef struct _rrScrPriv {
#if RANDR_10_INTERFACE
RRSetConfigProcPtr rrSetConfig;
#endif
RRGetInfoProcPtr rrGetInfo;
#if RANDR_12_INTERFACE
RRScreenSetSizeProcPtr rrScreenSetSize;
RRCrtcSetProcPtr rrCrtcSet;
RRCrtcSetGammaProcPtr rrCrtcSetGamma;
RROutputSetPropertyProcPtr rrOutputSetProperty;
RROutputValidateModeProcPtr rrOutputValidateMode;
RRModeDestroyProcPtr rrModeDestroy;
#endif
TimeStamp lastSetTime;
TimeStamp lastConfigTime;
RRCloseScreenProcPtr CloseScreen;
Bool changed;
Bool configChanged;
Bool layoutChanged;
CARD16 minWidth, minHeight;
CARD16 maxWidth, maxHeight;
CARD16 width, height;
CARD16 mmWidth, mmHeight;
int numOutputs;
RROutputPtr *outputs;
int numCrtcs;
RRCrtcPtr *crtcs;
RRCrtcPtr pointerCrtc;
#ifdef RANDR_10_INTERFACE
Rotation rotations;
CARD16 reqWidth, reqHeight;
int nSizes;
RRScreenSizePtr pSizes;
Rotation rotation;
int rate;
int size;
#endif
} rrScrPrivRec, *rrScrPrivPtr;
extern int rrPrivIndex;
#define rrGetScrPriv(pScr) ((rrScrPrivPtr) (pScr)->devPrivates[rrPrivIndex].ptr)
#define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr)
#define SetRRScreen(s,p) ((s)->devPrivates[rrPrivIndex].ptr = (pointer) (p))
typedef struct _RREvent *RREventPtr;
typedef struct _RREvent {
RREventPtr next;
ClientPtr client;
WindowPtr window;
XID clientResource;
int mask;
} RREventRec;
typedef struct _RRTimes {
TimeStamp setTime;
TimeStamp configTime;
} RRTimesRec, *RRTimesPtr;
typedef struct _RRClient {
int major_version;
int minor_version;
} RRClientRec, *RRClientPtr;
extern RESTYPE RRClientType, RREventType;
extern int RRClientPrivateIndex;
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)))
#define GetRRClient(pClient) ((RRClientPtr) (pClient)->devPrivates[RRClientPrivateIndex].ptr)
#define rrClientPriv(pClient) RRClientPtr pRRClient = GetRRClient(pClient)
void
RRExtensionInit (void);
#ifdef RANDR_12_INTERFACE
void
RRScreenSetSizeRange (ScreenPtr pScreen,
CARD16 minWidth,
CARD16 minHeight,
CARD16 maxWidth,
CARD16 maxHeight);
#endif
void
RRScreenSizeNotify (ScreenPtr pScreen);
Bool
RRScreenSizeSet (ScreenPtr pScreen,
CARD16 width,
CARD16 height,
CARD32 mmWidth,
CARD32 mmHeight);
void
RRSendConfigNotify (ScreenPtr pScreen);
int
ProcRRGetScreenSizeRange (ClientPtr client);
int
ProcRRSetScreenSize (ClientPtr client);
int
ProcRRGetScreenResources (ClientPtr client);
int
ProcRRSetScreenConfig (ClientPtr client);
int
ProcRRGetScreenInfo (ClientPtr client);
void
RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);
Bool
miRandRInit (ScreenPtr pScreen);
Bool
miRRGetInfo (ScreenPtr pScreen, Rotation *rotations);
Bool
miRRGetScreenInfo (ScreenPtr pScreen);
Bool
miRRCrtcSet (ScreenPtr pScreen,
RRCrtcPtr crtc,
RRModePtr mode,
int x,
int y,
Rotation rotation,
int numOutput,
RROutputPtr *outputs);
Bool
miRROutputSetProperty (ScreenPtr pScreen,
RROutputPtr output,
Atom property,
RRPropertyValuePtr value);
Bool
miRROutputValidateMode (ScreenPtr pScreen,
RROutputPtr output,
RRModePtr mode);
void
miRRModeDestroy (ScreenPtr pScreen,
RRModePtr mode);
void
RRTellChanged (ScreenPtr pScreen);
Bool
RRGetInfo (ScreenPtr pScreen);
Bool RRInit (void);
Bool RRScreenInit(ScreenPtr pScreen);
RROutputPtr
RRFirstOutput (ScreenPtr pScreen);
Rotation
RRGetRotation (ScreenPtr pScreen);
CARD16
RRVerticalRefresh (xRRModeInfo *mode);
#ifdef RANDR_10_INTERFACE
RRScreenSizePtr
RRRegisterSize (ScreenPtr pScreen,
short width,
short height,
short mmWidth,
short mmHeight);
Bool RRRegisterRate (ScreenPtr pScreen,
RRScreenSizePtr pSize,
int rate);
void
RRSetCurrentConfig (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr pSize);
Bool RRScreenInit (ScreenPtr pScreen);
Rotation
RRGetRotation (ScreenPtr pScreen);
int
RRSetScreenConfig (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr pSize);
#endif
void
RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged);
RRCrtcPtr
RRCrtcCreate (ScreenPtr pScreen, void *devPrivate);
void
RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations);
Bool
RRCrtcNotify (RRCrtcPtr crtc,
RRModePtr mode,
int x,
int y,
Rotation rotation,
int numOutputs,
RROutputPtr *outputs);
void
RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc);
Bool
RRCrtcSet (RRCrtcPtr crtc,
RRModePtr mode,
int x,
int y,
Rotation rotation,
int numOutput,
RROutputPtr *outputs);
Bool
RRCrtcGammaSet (RRCrtcPtr crtc,
CARD16 *red,
CARD16 *green,
CARD16 *blue);
Bool
RRCrtcGammaNotify (RRCrtcPtr crtc);
Bool
RRCrtcGammaSetSize (RRCrtcPtr crtc,
int size);
void
RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
void
RRCrtcDestroy (RRCrtcPtr crtc);
Bool
RRCrtcInit (void);
int
ProcRRGetCrtcInfo (ClientPtr client);
int
ProcRRSetCrtcConfig (ClientPtr client);
int
ProcRRGetCrtcGammaSize (ClientPtr client);
int
ProcRRGetCrtcGamma (ClientPtr client);
int
ProcRRSetCrtcGamma (ClientPtr client);
Bool
RRClientKnowsRates (ClientPtr pClient);
RRModePtr
RRModeGet (xRRModeInfo *modeInfo,
const char *name);
void
RRModePruneUnused (ScreenPtr pScreen);
void
RRModeDestroy (RRModePtr mode);
RRModePtr *
RRModesForScreen (ScreenPtr pScreen, int *num_ret);
Bool
RRModeInit (void);
int
ProcRRCreateMode (ClientPtr client);
int
ProcRRDestroyMode (ClientPtr client);
int
ProcRRAddOutputMode (ClientPtr client);
int
ProcRRDeleteOutputMode (ClientPtr client);
void
RROutputChanged (RROutputPtr output, Bool configChanged);
RROutputPtr
RROutputCreate (ScreenPtr pScreen,
const char *name,
int nameLength,
void *devPrivate);
Bool
RROutputSetClones (RROutputPtr output,
RROutputPtr *clones,
int numClones);
Bool
RROutputSetModes (RROutputPtr output,
RRModePtr *modes,
int numModes,
int numPreferred);
int
RROutputAddUserMode (RROutputPtr output,
RRModePtr mode);
int
RROutputDeleteUserMode (RROutputPtr output,
RRModePtr mode);
Bool
RROutputSetCrtcs (RROutputPtr output,
RRCrtcPtr *crtcs,
int numCrtcs);
Bool
RROutputSetConnection (RROutputPtr output,
CARD8 connection);
Bool
RROutputSetSubpixelOrder (RROutputPtr output,
int subpixelOrder);
Bool
RROutputSetPhysicalSize (RROutputPtr output,
int mmWidth,
int mmHeight);
void
RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
void
RROutputDestroy (RROutputPtr output);
int
ProcRRGetOutputInfo (ClientPtr client);
Bool
RROutputInit (void);
void
RRPointerMoved (ScreenPtr pScreen, int x, int y);
void
RRPointerScreenConfigured (ScreenPtr pScreen);
void
RRDeleteAllOutputProperties (RROutputPtr output);
RRPropertyValuePtr
RRGetOutputProperty (RROutputPtr output, Atom property, Bool pending);
RRPropertyPtr
RRQueryOutputProperty (RROutputPtr output, Atom property);
void
RRDeleteOutputProperty (RROutputPtr output, Atom property);
Bool
RRPostPendingProperties (RROutputPtr output);
int
RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
int format, int mode, unsigned long len,
pointer value, Bool sendevent, Bool pending);
int
RRConfigureOutputProperty (RROutputPtr output, Atom property,
Bool pending, Bool range, Bool immutable,
int num_values, INT32 *values);
int
ProcRRChangeOutputProperty (ClientPtr client);
int
ProcRRGetOutputProperty (ClientPtr client);
int
ProcRRListOutputProperties (ClientPtr client);
int
ProcRRQueryOutputProperty (ClientPtr client);
int
ProcRRConfigureOutputProperty (ClientPtr client);
int
ProcRRDeleteOutputProperty (ClientPtr client);
void
RRXineramaExtensionInit(void);
#endif