Start moving to new randr 1.2 definition

This commit is contained in:
Keith Packard 2006-09-16 21:44:42 -07:00
parent fbaeb0b2a1
commit d7f1f286b7
3 changed files with 1078 additions and 632 deletions

View File

@ -34,6 +34,29 @@
#include "randrstr.h" #include "randrstr.h"
#include <stdio.h> #include <stdio.h>
Bool
miRRGetInfo (ScreenPtr pScreen, Rotation *rotations)
{
return TRUE;
}
/*
* Any hardware that can actually change anything will need something
* different here
*/
Bool
miRRCrtcSet (ScreenPtr pScreen,
RRCrtcPtr crtc,
RRModePtr mode,
int x,
int y,
Rotation rotation,
int numOutput,
RROutputPtr *outputs)
{
return TRUE;
}
/* /*
* This function assumes that only a single depth can be * This function assumes that only a single depth can be
* displayed at a time, but that all visuals of that depth * displayed at a time, but that all visuals of that depth
@ -43,70 +66,52 @@
* XXX what to do here.... * XXX what to do here....
*/ */
Bool
miRRGetInfo (ScreenPtr pScreen, Rotation *rotations)
{
int i;
Bool setConfig = FALSE;
RRMonitorPtr pMonitor;
pMonitor = RRRegisterMonitor (pScreen, NULL, RR_Rotate_0);
for (i = 0; i < pScreen->numDepths; i++)
{
if (pScreen->allowedDepths[i].numVids)
{
xRRMonitorMode rrMode;
RRModePtr pMode;
char name[64];
sprintf (name, "%dx%d", pScreen->width, pScreen->height);
memset (&rrMode, '\0', sizeof (rrMode));
rrMode.width = pScreen->width;
rrMode.height = pScreen->height;
rrMode.widthInMillimeters = pScreen->mmWidth;
rrMode.heightInMillimeters = pScreen->mmHeight;
rrMode.nameLength = strlen (name);
pMonitor = RRRegisterMonitor (pScreen, NULL, RR_Rotate_0);
pMode = RRRegisterMode (pMonitor,
&rrMode,
name);
if (!pMode)
return FALSE;
if (!setConfig)
{
RRSetCurrentMode (pMonitor, pMode, 0, 0, RR_Rotate_0);
setConfig = TRUE;
}
}
}
return TRUE;
}
/*
* Any hardware that can actually change anything will need something
* different here
*/
Bool
miRRSetMode (ScreenPtr pScreen,
int monitor,
RRModePtr pMode,
int x,
int y,
Rotation rotation)
{
return TRUE;
}
Bool Bool
miRandRInit (ScreenPtr pScreen) miRandRInit (ScreenPtr pScreen)
{ {
rrScrPrivPtr rp; rrScrPrivPtr pScrPriv;
RRModePtr mode;
RRCrtcPtr crtc;
RROutputPtr output;
xRRModeInfo modeInfo;
char name[64];
if (!RRScreenInit (pScreen)) if (!RRScreenInit (pScreen))
return FALSE; return FALSE;
rp = rrGetScrPriv(pScreen); pScrPriv = rrGetScrPriv(pScreen);
rp->rrGetInfo = miRRGetInfo; pScrPriv->rrGetInfo = miRRGetInfo;
rp->rrSetMode = miRRSetMode; pScrPriv->rrCrtcSet = miRRCrtcSet;
RRScreenSetSizeRange (pScreen,
pScreen->width, pScreen->height,
pScreen->width, pScreen->height);
sprintf (name, "%dx%d", pScreen->width, pScreen->height);
memset (&modeInfo, '\0', sizeof (modeInfo));
modeInfo.width = pScreen->width;
modeInfo.height = pScreen->height;
modeInfo.mmWidth = pScreen->mmWidth;
modeInfo.mmHeight = pScreen->mmHeight;
modeInfo.nameLength = strlen (name);
mode = RRModeGet (pScreen, &modeInfo, name);
if (!mode)
return FALSE;
crtc = RRCrtcCreate (pScreen, NULL);
if (!crtc)
return FALSE;
output = RROutputCreate (pScreen, "screen", 6, NULL);
if (!output)
return FALSE;
if (!RROutputSet (output,
NULL, 0, /* clones */
&mode, 1, /* modes */
&crtc, 1, /* crtcs */
RR_Connected))
return FALSE;
if (!RRCrtcSet (crtc, mode, 0, 0, RR_Rotate_0, 1, &output))
return FALSE;
return TRUE; return TRUE;
} }

File diff suppressed because it is too large Load Diff

View File

@ -34,71 +34,94 @@
#include <X11/extensions/randrproto.h> #include <X11/extensions/randrproto.h>
/* required for ABI compatibility for now */
#define RANDR_SCREEN_INTERFACE 1 #define RANDR_SCREEN_INTERFACE 1
typedef XID RRMode;
typedef XID RROutput;
typedef XID RRCrtc;
/* /*
* Modeline for a monitor. Name follows directly after this struct * Modeline for a monitor. Name follows directly after this struct
*/ */
#define RRModeName(pMode) ((char *) (pMode + 1)) #define RRModeName(pMode) ((char *) (pMode + 1))
typedef struct _rrMode RRModeRec, *RRModePtr;
typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
typedef struct _rrOutput RROutputRec, *RROutputPtr;
typedef struct _rrMode { struct _rrMode {
struct _rrMode *next; RRMode id;
Bool referenced; int refcnt;
Bool oldReferenced; xRRModeInfo mode;
int id; char *name;
xRRMonitorMode mode; };
} RRMode, *RRModePtr;
typedef struct _rrMonitor { struct _rrCrtc {
struct _rrMonitor *next; RRCrtc id;
ScreenPtr pScreen; ScreenPtr pScreen;
RRModePtr pModes; RRModePtr mode;
void *identifier; /* made unique by DDX */
int id; /* index in list of monitors */
Bool referenced;
Bool oldReferenced;
Rotation rotations;
/*
* Current state
*/
RRModePtr pMode;
int x, y; int x, y;
Rotation rotation; Rotation rotation;
} RRMonitor, *RRMonitorPtr; Rotation rotations;
int numPossibleOutputs;
RROutputPtr *possibleOutputs;
Bool changed;
void *devPrivate;
};
typedef Bool (*RRSetScreenSizeProcPtr) (ScreenPtr pScreen, struct _rrOutput {
RROutput id;
ScreenPtr pScreen;
char *name;
int nameLength;
CARD8 connection;
CARD8 subpixelOrder;
RRCrtcPtr crtc;
int numCrtcs;
RRCrtcPtr *crtcs;
int numClones;
RROutputPtr *outputs;
int numModes;
RRModePtr *modes;
Bool changed;
void *devPrivate;
};
typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
CARD16 width, CARD16 width,
CARD16 height, CARD16 height,
CARD32 widthInMM, CARD32 widthInMM,
CARD32 heightInMM); CARD32 heightInMM);
typedef Bool (*RRSetModeProcPtr) (ScreenPtr pScreen, typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
int monitor, RRCrtcPtr crtc,
RRModePtr pMode, RRModePtr mode,
int x, int x,
int y, int y,
Rotation rotation); Rotation rotation,
int numOutput,
RROutputPtr *outputs);
typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations); typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations);
typedef Bool (*RRCloseScreenProcPtr) ( int i, ScreenPtr pscreen); typedef Bool (*RRCloseScreenProcPtr) ( int i, ScreenPtr pscreen);
/* These are for 1.0 compatibility */
#ifdef RANDR_SCREEN_INTERFACE
typedef struct _rrRefresh { typedef struct _rrRefresh {
CARD16 refresh; CARD16 rate;
RRModePtr pMode; RRModePtr mode;
} RRRefreshRec, *RRRefreshPtr; } RRScreenRate, *RRScreenRatePtr;
typedef struct _rrScreenSize { typedef struct _rrScreenSize {
int id; int id;
short width, height; short width, height;
short mmWidth, mmHeight; short mmWidth, mmHeight;
int nrefresh; int nRates;
RRRefreshPtr refresh; RRScreenRatePtr pRates;
} RRScreenSizeRec, *RRScreenSizePtr; } RRScreenSize, *RRScreenSizePtr;
#ifdef RANDR_SCREEN_INTERFACE
typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen, typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
Rotation rotation, Rotation rotation,
@ -117,8 +140,8 @@ typedef struct _rrScrPriv {
RRSetConfigProcPtr rrSetConfig; RRSetConfigProcPtr rrSetConfig;
#endif #endif
RRGetInfoProcPtr rrGetInfo; RRGetInfoProcPtr rrGetInfo;
RRSetScreenSizeProcPtr rrSetScreenSize; RRScreenSetSizeProcPtr rrScreenSetSize;
RRSetModeProcPtr rrSetMode; RRCrtcSetProcPtr rrCrtcSet;
/* /*
* Private part of the structure; not considered part of the ABI * Private part of the structure; not considered part of the ABI
@ -126,20 +149,34 @@ typedef struct _rrScrPriv {
TimeStamp lastSetTime; /* last changed by client */ TimeStamp lastSetTime; /* last changed by client */
TimeStamp lastConfigTime; /* possible configs changed */ TimeStamp lastConfigTime; /* possible configs changed */
RRCloseScreenProcPtr CloseScreen; RRCloseScreenProcPtr CloseScreen;
Bool changed;
CARD16 minWidth, minHeight;
CARD16 maxWidth, maxHeight;
/* /* modes, outputs and crtcs */
* monitor data int numModes;
*/ RRModePtr *modes;
RRMonitorPtr pMonitors;
int numOutputs;
RROutputPtr *outputs;
int numCrtcs;
RRCrtcPtr *crtcs;
#ifdef RANDR_SCREEN_INTERFACE #ifdef RANDR_SCREEN_INTERFACE
/* /*
* Configuration information * Configuration information
*/ */
Rotation rotations; Rotation rotations;
CARD16 reqWidth, reqHeight;
int nSizes;
RRScreenSizePtr pSizes;
RRScreenSizePtr pSize;
Rotation rotation; Rotation rotation;
int rate;
int size;
#endif #endif
} rrScrPrivRec, *rrScrPrivPtr; } rrScrPrivRec, *rrScrPrivPtr;
@ -154,33 +191,91 @@ void
RRExtensionInit (void); RRExtensionInit (void);
/* /*
* Then, register a monitor with the screen * Set the range of sizes for the screen
*/ */
void
RRMonitorPtr RRScreenSetSizeRange (ScreenPtr pScreen,
RRRegisterMonitor (ScreenPtr pScreen, CARD16 minWidth,
void *identifier, CARD16 minHeight,
Rotation rotations); CARD16 maxWidth,
CARD16 maxHeight);
/* /*
* Next, register the list of modes with the monitor * Create a CRTC
*/
RRCrtcPtr
RRCrtcCreate (ScreenPtr pScreen,
void *devPrivate);
/*
* Use this value for any num parameter to indicate that
* the related data are unchanged
*/
#define RR_NUM_UNCHANGED -1
/*
* Notify the extension that the Crtc has been reconfigured
*/
Bool
RRCrtcSet (RRCrtcPtr crtc,
RRModePtr mode,
int x,
int y,
Rotation rotation,
int numOutput,
RROutputPtr *outputs);
/*
* Destroy a Crtc at shutdown
*/
void
RRCrtcDestroy (RRCrtcPtr crtc);
/*
* Find, and if necessary, create a mode
*/ */
RRModePtr RRModePtr
RRRegisterMode (RRMonitorPtr pMonitor, RRModeGet (ScreenPtr pScreen,
xRRMonitorMode *pMode, xRRModeInfo *modeInfo,
char *name); char *name);
/* /*
* Finally, set the current configuration of each monitor * Destroy a mode.
*/ */
void void
RRSetCurrentMode (RRMonitorPtr pMonitor, RRModeDestroy (RRModePtr mode);
RRModePtr pMode,
int x, /*
int y, * Create an output
Rotation rotation); */
RROutputPtr
RROutputCreate (ScreenPtr pScreen,
char *name,
int nameLength,
void *devPrivate);
/*
* Notify extension that output parameters have been changed
*/
Bool
RROutputSet (RROutputPtr output,
RROutputPtr *clones,
int numClones,
RRModePtr *modes,
int numModes,
RRCrtcPtr *crtcs,
int numCrtcs,
CARD8 connection);
void
RROutputDestroy (RROutputPtr output);
void
RRTellChanged (ScreenPtr pScreen);
Bool RRScreenInit(ScreenPtr pScreen); Bool RRScreenInit(ScreenPtr pScreen);
@ -197,12 +292,14 @@ Bool
miRRGetScreenInfo (ScreenPtr pScreen); miRRGetScreenInfo (ScreenPtr pScreen);
Bool Bool
miRRSetMode (ScreenPtr pScreen, miRRCrtcSet (ScreenPtr pScreen,
int monitor, RRCrtcPtr crtc,
RRModePtr pMode, RRModePtr mode,
int x, int x,
int y, int y,
Rotation rotation); Rotation rotation,
int numOutput,
RROutputPtr *outputs);
#ifdef RANDR_SCREEN_INTERFACE #ifdef RANDR_SCREEN_INTERFACE
/* /*
@ -225,9 +322,6 @@ Bool RRRegisterRate (ScreenPtr pScreen,
RRScreenSizePtr pSize, RRScreenSizePtr pSize,
int rate); int rate);
Bool RRRegisterRotation (ScreenPtr pScreen,
Rotation rotation);
/* /*
* Finally, set the current configuration of the screen * Finally, set the current configuration of the screen
*/ */
@ -238,17 +332,16 @@ RRSetCurrentConfig (ScreenPtr pScreen,
int rate, int rate,
RRScreenSizePtr pSize); RRScreenSizePtr pSize);
Bool RRScreenInit (ScreenPtr pScreen);
Rotation
RRGetRotation (ScreenPtr pScreen);
int int
RRSetScreenConfig (ScreenPtr pScreen, RRSetScreenConfig (ScreenPtr pScreen,
Rotation rotation, Rotation rotation,
int rate, int rate,
RRScreenSizePtr pSize); RRScreenSizePtr pSize);
Bool
miRRSetConfig (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr size);
#endif #endif
#endif /* _RANDRSTR_H_ */ #endif /* _RANDRSTR_H_ */