Commit 2e237c83 authored by Dave Airlie's avatar Dave Airlie Committed by Dave Airlie

xf86: reimplement XF86SCRNINFO macro using new functions.

This macro did lookups via privates but we can just use the ScreenToScrn
conversion instead.

This patch drops all in-server uses, we should drop the macro later,
once drivers have been converted to not use it.
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 8da35202
......@@ -76,8 +76,8 @@ extern _X_EXPORT Bool xf86DRI2Enabled(void);
extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */
#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \
xf86ScreenKey))
#define XF86SCRNINFO(p) xf86ScreenToScrn(p)
#define XF86FLIP_PIXELS() \
do { \
if (xf86GetFlipPixels()) { \
......
......@@ -133,7 +133,7 @@ xf86InitViewport(ScrnInfoPtr pScr)
void
xf86SetViewport(ScreenPtr pScreen, int x, int y)
{
ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen);
(*pScr->PointerMoved) (pScreen->myNum, x, y);
}
......@@ -184,7 +184,8 @@ xf86PointerMoved(int scrnIndex, int x, int y)
void
xf86LockZoom(ScreenPtr pScreen, Bool lock)
{
XF86SCRNINFO(pScreen)->zoomLocked = lock;
ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen);
pScr->zoomLocked = lock;
}
/*
......@@ -196,7 +197,7 @@ xf86LockZoom(ScreenPtr pScreen, Bool lock)
Bool
xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
{
ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen);
ScreenPtr pCursorScreen;
Bool Switched;
int px, py, was_blocked;
......@@ -316,7 +317,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
void
xf86ZoomViewport(ScreenPtr pScreen, int zoom)
{
ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen);
DisplayModePtr mode;
if (pScr->zoomLocked || !(mode = pScr->currentMode))
......
......@@ -66,7 +66,7 @@ static Bool
xf86RandRGetInfo(ScreenPtr pScreen, Rotation * rotations)
{
RRScreenSizePtr pSize;
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode;
int refresh0 = 60;
......@@ -147,7 +147,7 @@ xf86RandRSetMode(ScreenPtr pScreen,
DisplayModePtr mode,
Bool useVirtual, int mmWidth, int mmHeight)
{
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
int oldWidth = pScreen->width;
int oldHeight = pScreen->height;
......@@ -228,7 +228,7 @@ static Bool
xf86RandRSetConfig(ScreenPtr pScreen,
Rotation rotation, int rate, RRScreenSizePtr pSize)
{
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode;
int pos[MAXDEVICES][2];
......@@ -344,7 +344,7 @@ xf86RandRCreateScreenResources(ScreenPtr pScreen)
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
#if 0
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
DisplayModePtr mode;
#endif
......@@ -367,7 +367,7 @@ xf86RandRCreateScreenResources(ScreenPtr pScreen)
static Bool
xf86RandRCloseScreen(int index, ScreenPtr pScreen)
{
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
scrp->virtualX = pScreen->width = randrp->virtualX;
......@@ -417,8 +417,9 @@ xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
/* This is only for during server start */
if (resetMode) {
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
return (xf86RandRSetMode(pScreen,
XF86SCRNINFO(pScreen)->currentMode,
pScrn->currentMode,
TRUE, pScreen->mmWidth, pScreen->mmHeight));
}
......@@ -430,7 +431,7 @@ xf86RandRInit(ScreenPtr pScreen)
{
rrScrPrivPtr rp;
XF86RandRInfoPtr randrp;
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
#ifdef PANORAMIX
/* XXX disable RandR when using Xinerama */
......
......@@ -72,7 +72,7 @@ static const OptionInfoRec EXAOptions[] = {
static Bool
exaXorgCloseScreen(int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr)
dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
......@@ -111,7 +111,6 @@ void
exaDDXDriverInit(ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
/* Do NOT use XF86SCRNINFO macro here!! */
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
ExaXorgScreenPrivPtr pScreenPriv;
......
......@@ -447,7 +447,7 @@ static Bool
xf86RandR12GetInfo(ScreenPtr pScreen, Rotation * rotations)
{
RRScreenSizePtr pSize;
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode;
int refresh0 = 60;
......@@ -504,7 +504,7 @@ xf86RandR12SetMode(ScreenPtr pScreen,
DisplayModePtr mode,
Bool useVirtual, int mmWidth, int mmHeight)
{
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
int oldWidth = pScreen->width;
int oldHeight = pScreen->height;
......@@ -576,7 +576,7 @@ Bool
xf86RandR12SetConfig(ScreenPtr pScreen,
Rotation rotation, int rate, RRScreenSizePtr pSize)
{
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode;
int pos[MAXDEVICES][2];
......@@ -671,7 +671,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
CARD16 height, CARD32 mmWidth, CARD32 mmHeight)
{
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
WindowPtr pRoot = pScreen->root;
PixmapPtr pScrnPix;
......
......@@ -81,9 +81,6 @@ xColorItem *pdefs;
xColorItem directDefs[256];
Bool new_overscan = FALSE;
Bool writeColormap;
/* This can get called before the ScrnInfoRec is installed so we
can't rely on getting it with XF86SCRNINFO() */
int scrnIndex = pmap->pScreen->myNum;
ScrnInfoPtr scrninfp = xf86ScreenToScrn(pmap->pScreen);
vgaHWPtr hwp = VGAHWPTR(scrninfp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment