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 <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2012-04-11 10:02:25 +01:00 committed by Dave Airlie
parent 8da35202f3
commit 2e237c838f
6 changed files with 20 additions and 22 deletions

View File

@ -76,8 +76,8 @@ extern _X_EXPORT Bool xf86DRI2Enabled(void);
extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */ extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */
#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \ #define XF86SCRNINFO(p) xf86ScreenToScrn(p)
xf86ScreenKey))
#define XF86FLIP_PIXELS() \ #define XF86FLIP_PIXELS() \
do { \ do { \
if (xf86GetFlipPixels()) { \ if (xf86GetFlipPixels()) { \

View File

@ -133,7 +133,7 @@ xf86InitViewport(ScrnInfoPtr pScr)
void void
xf86SetViewport(ScreenPtr pScreen, int x, int y) xf86SetViewport(ScreenPtr pScreen, int x, int y)
{ {
ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen);
(*pScr->PointerMoved) (pScreen->myNum, x, y); (*pScr->PointerMoved) (pScreen->myNum, x, y);
} }
@ -184,7 +184,8 @@ xf86PointerMoved(int scrnIndex, int x, int y)
void void
xf86LockZoom(ScreenPtr pScreen, Bool lock) 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 Bool
xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
{ {
ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen);
ScreenPtr pCursorScreen; ScreenPtr pCursorScreen;
Bool Switched; Bool Switched;
int px, py, was_blocked; int px, py, was_blocked;
@ -316,7 +317,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
void void
xf86ZoomViewport(ScreenPtr pScreen, int zoom) xf86ZoomViewport(ScreenPtr pScreen, int zoom)
{ {
ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen);
DisplayModePtr mode; DisplayModePtr mode;
if (pScr->zoomLocked || !(mode = pScr->currentMode)) if (pScr->zoomLocked || !(mode = pScr->currentMode))

View File

@ -66,7 +66,7 @@ static Bool
xf86RandRGetInfo(ScreenPtr pScreen, Rotation * rotations) xf86RandRGetInfo(ScreenPtr pScreen, Rotation * rotations)
{ {
RRScreenSizePtr pSize; RRScreenSizePtr pSize;
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode; DisplayModePtr mode;
int refresh0 = 60; int refresh0 = 60;
@ -147,7 +147,7 @@ xf86RandRSetMode(ScreenPtr pScreen,
DisplayModePtr mode, DisplayModePtr mode,
Bool useVirtual, int mmWidth, int mmHeight) Bool useVirtual, int mmWidth, int mmHeight)
{ {
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
int oldWidth = pScreen->width; int oldWidth = pScreen->width;
int oldHeight = pScreen->height; int oldHeight = pScreen->height;
@ -228,7 +228,7 @@ static Bool
xf86RandRSetConfig(ScreenPtr pScreen, xf86RandRSetConfig(ScreenPtr pScreen,
Rotation rotation, int rate, RRScreenSizePtr pSize) Rotation rotation, int rate, RRScreenSizePtr pSize)
{ {
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode; DisplayModePtr mode;
int pos[MAXDEVICES][2]; int pos[MAXDEVICES][2];
@ -344,7 +344,7 @@ xf86RandRCreateScreenResources(ScreenPtr pScreen)
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
#if 0 #if 0
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
DisplayModePtr mode; DisplayModePtr mode;
#endif #endif
@ -367,7 +367,7 @@ xf86RandRCreateScreenResources(ScreenPtr pScreen)
static Bool static Bool
xf86RandRCloseScreen(int index, ScreenPtr pScreen) xf86RandRCloseScreen(int index, ScreenPtr pScreen)
{ {
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
scrp->virtualX = pScreen->width = randrp->virtualX; scrp->virtualX = pScreen->width = randrp->virtualX;
@ -417,8 +417,9 @@ xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
/* This is only for during server start */ /* This is only for during server start */
if (resetMode) { if (resetMode) {
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
return (xf86RandRSetMode(pScreen, return (xf86RandRSetMode(pScreen,
XF86SCRNINFO(pScreen)->currentMode, pScrn->currentMode,
TRUE, pScreen->mmWidth, pScreen->mmHeight)); TRUE, pScreen->mmWidth, pScreen->mmHeight));
} }
@ -430,7 +431,7 @@ xf86RandRInit(ScreenPtr pScreen)
{ {
rrScrPrivPtr rp; rrScrPrivPtr rp;
XF86RandRInfoPtr randrp; XF86RandRInfoPtr randrp;
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
#ifdef PANORAMIX #ifdef PANORAMIX
/* XXX disable RandR when using Xinerama */ /* XXX disable RandR when using Xinerama */

View File

@ -72,7 +72,7 @@ static const OptionInfoRec EXAOptions[] = {
static Bool static Bool
exaXorgCloseScreen(int i, ScreenPtr pScreen) exaXorgCloseScreen(int i, ScreenPtr pScreen)
{ {
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr)
dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey); dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
@ -111,7 +111,6 @@ void
exaDDXDriverInit(ScreenPtr pScreen) exaDDXDriverInit(ScreenPtr pScreen)
{ {
ExaScreenPriv(pScreen); ExaScreenPriv(pScreen);
/* Do NOT use XF86SCRNINFO macro here!! */
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
ExaXorgScreenPrivPtr pScreenPriv; ExaXorgScreenPrivPtr pScreenPriv;

View File

@ -447,7 +447,7 @@ static Bool
xf86RandR12GetInfo(ScreenPtr pScreen, Rotation * rotations) xf86RandR12GetInfo(ScreenPtr pScreen, Rotation * rotations)
{ {
RRScreenSizePtr pSize; RRScreenSizePtr pSize;
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode; DisplayModePtr mode;
int refresh0 = 60; int refresh0 = 60;
@ -504,7 +504,7 @@ xf86RandR12SetMode(ScreenPtr pScreen,
DisplayModePtr mode, DisplayModePtr mode,
Bool useVirtual, int mmWidth, int mmHeight) Bool useVirtual, int mmWidth, int mmHeight)
{ {
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
int oldWidth = pScreen->width; int oldWidth = pScreen->width;
int oldHeight = pScreen->height; int oldHeight = pScreen->height;
@ -576,7 +576,7 @@ Bool
xf86RandR12SetConfig(ScreenPtr pScreen, xf86RandR12SetConfig(ScreenPtr pScreen,
Rotation rotation, int rate, RRScreenSizePtr pSize) Rotation rotation, int rate, RRScreenSizePtr pSize)
{ {
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode; DisplayModePtr mode;
int pos[MAXDEVICES][2]; int pos[MAXDEVICES][2];
@ -671,7 +671,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
CARD16 height, CARD32 mmWidth, CARD32 mmHeight) CARD16 height, CARD32 mmWidth, CARD32 mmHeight)
{ {
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
WindowPtr pRoot = pScreen->root; WindowPtr pRoot = pScreen->root;
PixmapPtr pScrnPix; PixmapPtr pScrnPix;

View File

@ -81,9 +81,6 @@ xColorItem *pdefs;
xColorItem directDefs[256]; xColorItem directDefs[256];
Bool new_overscan = FALSE; Bool new_overscan = FALSE;
Bool writeColormap; 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; int scrnIndex = pmap->pScreen->myNum;
ScrnInfoPtr scrninfp = xf86ScreenToScrn(pmap->pScreen); ScrnInfoPtr scrninfp = xf86ScreenToScrn(pmap->pScreen);
vgaHWPtr hwp = VGAHWPTR(scrninfp); vgaHWPtr hwp = VGAHWPTR(scrninfp);