aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/common')
-rw-r--r--xorg-server/hw/xfree86/common/xf86.h15
-rw-r--r--xorg-server/hw/xfree86/common/xf86AutoConfig.c4
-rw-r--r--xorg-server/hw/xfree86/common/xf86Bus.c20
-rw-r--r--xorg-server/hw/xfree86/common/xf86Cursor.c9
-rw-r--r--xorg-server/hw/xfree86/common/xf86DGA.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86DPMS.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Helper.c18
-rw-r--r--xorg-server/hw/xfree86/common/xf86Init.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Priv.h1
-rw-r--r--xorg-server/hw/xfree86/common/xf86RandR.c15
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiter.c8
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h2
-rw-r--r--xorg-server/hw/xfree86/common/xf86cmap.c22
-rw-r--r--xorg-server/hw/xfree86/common/xf86fbman.c4
-rw-r--r--xorg-server/hw/xfree86/common/xf86pciBus.c10
-rw-r--r--xorg-server/hw/xfree86/common/xf86sbusBus.c8
-rw-r--r--xorg-server/hw/xfree86/common/xf86xv.c10
-rw-r--r--xorg-server/hw/xfree86/common/xf86xvmc.c12
18 files changed, 109 insertions, 55 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86.h b/xorg-server/hw/xfree86/common/xf86.h
index fc4c34e92..0eb000d41 100644
--- a/xorg-server/hw/xfree86/common/xf86.h
+++ b/xorg-server/hw/xfree86/common/xf86.h
@@ -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()) { \
@@ -97,12 +97,12 @@ extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */
/* PCI related */
#ifdef XSERVER_LIBPCIACCESS
#include <pciaccess.h>
-extern _X_EXPORT Bool pciSlotClaimed;
+extern _X_EXPORT int pciSlotClaimed;
extern _X_EXPORT Bool xf86CheckPciSlot(const struct pci_device *);
extern _X_EXPORT int xf86ClaimPciSlot(struct pci_device *, DriverPtr drvp,
int chipset, GDevPtr dev, Bool active);
-extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *);
+extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *, GDevPtr dev);
extern _X_EXPORT Bool xf86ParsePciBusString(const char *busID, int *bus,
int *device, int *func);
extern _X_EXPORT Bool xf86ComparePciBusString(const char *busID, int bus,
@@ -449,6 +449,13 @@ xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
extern _X_EXPORT Bool
VidModeExtensionInit(ScreenPtr pScreen);
+/* convert ScreenPtr to ScrnInfoPtr */
+extern _X_EXPORT ScrnInfoPtr xf86ScreenToScrn(ScreenPtr pScreen);
+/* convert ScrnInfoPtr to ScreenPtr */
+extern _X_EXPORT ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn);
+
#endif /* _NO_XF86_PROTOTYPES */
+#define XF86_HAS_SCRN_CONV 1 /* define for drivers to use in api compat */
+
#endif /* _XF86_H */
diff --git a/xorg-server/hw/xfree86/common/xf86AutoConfig.c b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
index 43c746b7f..d0eb0affb 100644
--- a/xorg-server/hw/xfree86/common/xf86AutoConfig.c
+++ b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
@@ -270,6 +270,10 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
#endif
}
+#if defined(__linux__)
+ matches[i++] = xnfstrdup("modesetting");
+#endif
+
#if !defined(sun)
/* Fallback to platform default frame buffer driver */
if (i < (nmatches - 1)) {
diff --git a/xorg-server/hw/xfree86/common/xf86Bus.c b/xorg-server/hw/xfree86/common/xf86Bus.c
index b176e8cc4..b8764344b 100644
--- a/xorg-server/hw/xfree86/common/xf86Bus.c
+++ b/xorg-server/hw/xfree86/common/xf86Bus.c
@@ -420,6 +420,26 @@ xf86AddDevToEntity(int entityIndex, GDevPtr dev)
dev->claimed = TRUE;
}
+
+void
+xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev)
+{
+ EntityPtr pEnt;
+ int i, j;
+ if (entityIndex >= xf86NumEntities)
+ return;
+
+ pEnt = xf86Entities[entityIndex];
+ for (i = 0; i < pEnt->numInstances; i++) {
+ if (pEnt->devices[i] == dev) {
+ for (j = i; j < pEnt->numInstances - 1; j++)
+ pEnt->devices[j] = pEnt->devices[j + 1];
+ break;
+ }
+ }
+ pEnt->numInstances--;
+ dev->claimed = FALSE;
+}
/*
* xf86GetEntityInfo() -- This function hands information from the
* EntityRec struct to the drivers. The EntityRec structure itself
diff --git a/xorg-server/hw/xfree86/common/xf86Cursor.c b/xorg-server/hw/xfree86/common/xf86Cursor.c
index 3716434f0..61cae6aa7 100644
--- a/xorg-server/hw/xfree86/common/xf86Cursor.c
+++ b/xorg-server/hw/xfree86/common/xf86Cursor.c
@@ -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))
diff --git a/xorg-server/hw/xfree86/common/xf86DGA.c b/xorg-server/hw/xfree86/common/xf86DGA.c
index 316978cfa..e0314d86e 100644
--- a/xorg-server/hw/xfree86/common/xf86DGA.c
+++ b/xorg-server/hw/xfree86/common/xf86DGA.c
@@ -100,7 +100,7 @@ typedef struct {
Bool
DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, int num)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
DGAScreenPtr pScreenPriv;
int i;
diff --git a/xorg-server/hw/xfree86/common/xf86DPMS.c b/xorg-server/hw/xfree86/common/xf86DPMS.c
index 75f034239..54ad84243 100644
--- a/xorg-server/hw/xfree86/common/xf86DPMS.c
+++ b/xorg-server/hw/xfree86/common/xf86DPMS.c
@@ -57,7 +57,7 @@ Bool
xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
{
#ifdef DPMSExtension
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
DPMSPtr pDPMS;
pointer DPMSOpt;
MessageType enabled_from;
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
index 8c948cf6f..fb56a0b17 100644
--- a/xorg-server/hw/xfree86/common/xf86Helper.c
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -1577,7 +1577,7 @@ xf86SetBackingStore(ScreenPtr pScreen)
{
Bool useBS = FALSE;
MessageType from = X_DEFAULT;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
OptionInfoPtr options;
options = xnfalloc(sizeof(BSOptions));
@@ -1618,7 +1618,7 @@ xf86SetSilkenMouse(ScreenPtr pScreen)
{
Bool useSM = TRUE;
MessageType from = X_DEFAULT;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
OptionInfoPtr options;
options = xnfalloc(sizeof(SMOptions));
@@ -1834,3 +1834,17 @@ xf86MotionHistoryAllocate(InputInfoPtr pInfo)
{
AllocateMotionHistory(pInfo->dev);
}
+
+ScrnInfoPtr
+xf86ScreenToScrn(ScreenPtr pScreen)
+{
+ assert(pScreen->myNum < xf86NumScreens);
+ return xf86Screens[pScreen->myNum];
+}
+
+ScreenPtr
+xf86ScrnToScreen(ScrnInfoPtr pScrn)
+{
+ assert(pScrn->scrnIndex < screenInfo.numScreens);
+ return screenInfo.screens[pScrn->scrnIndex];
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c
index f42dd1083..ead47ccba 100644
--- a/xorg-server/hw/xfree86/common/xf86Init.c
+++ b/xorg-server/hw/xfree86/common/xf86Init.c
@@ -405,6 +405,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
xf86Initialising = TRUE;
+ config_pre_init();
+
if (serverGeneration == 1) {
if ((xf86ServerName = strrchr(argv[0], '/')) != 0)
xf86ServerName++;
diff --git a/xorg-server/hw/xfree86/common/xf86Priv.h b/xorg-server/hw/xfree86/common/xf86Priv.h
index 8d9cb5539..6c5efeacc 100644
--- a/xorg-server/hw/xfree86/common/xf86Priv.h
+++ b/xorg-server/hw/xfree86/common/xf86Priv.h
@@ -116,6 +116,7 @@ extern _X_EXPORT void xf86AccessLeave(void);
extern _X_EXPORT void xf86PostProbe(void);
extern _X_EXPORT void xf86ClearEntityListForScreen(int scrnIndex);
extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev);
+extern _X_EXPORT void xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev);
/* xf86Config.c */
diff --git a/xorg-server/hw/xfree86/common/xf86RandR.c b/xorg-server/hw/xfree86/common/xf86RandR.c
index abd894dff..b17f601d1 100644
--- a/xorg-server/hw/xfree86/common/xf86RandR.c
+++ b/xorg-server/hw/xfree86/common/xf86RandR.c
@@ -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 */
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
index 7c9e6ba02..b9b46f6cd 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
@@ -106,7 +106,7 @@ xf86VGAarbiterAllowDRI(ScreenPtr pScreen)
{
int vga_count;
int rsrc_decodes;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
if (vga_no_arb)
return TRUE;
@@ -173,7 +173,7 @@ xf86VGAarbiterWrapFunctions(void)
for (i = 0; i < xf86NumScreens; i++) {
pScreen = xf86Screens[i]->pScreen;
ps = GetPictureScreenIfSet(pScreen);
- pScrn = xf86Screens[pScreen->myNum];
+ pScrn = xf86ScreenToScrn(pScreen);
PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
if (!dixRegisterPrivateKey
@@ -224,7 +224,7 @@ static Bool
VGAarbiterCloseScreen(int i, ScreenPtr pScreen)
{
Bool val;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
VGAarbiterScreenPtr pScreenPriv =
(VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
VGAarbiterScreenKey);
@@ -298,9 +298,7 @@ VGAarbiterGetImage(DrawablePtr pDrawable,
ScreenPtr pScreen = pDrawable->pScreen;
SCREEN_PROLOG(GetImage);
-// if (xf86Screens[pScreen->myNum]->vtSema) {
VGAGet(pScreen);
-// }
(*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine);
VGAPut();
SCREEN_EPILOG(GetImage, VGAarbiterGetImage);
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
index 2513ce65d..ebc8854d3 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -95,7 +95,7 @@
static inline void
VGAGet(ScreenPtr pScreen)
{
- pci_device_vgaarb_set_target(xf86Screens[pScreen->myNum]->vgaDev);
+ pci_device_vgaarb_set_target(xf86ScreenToScrn(pScreen)->vgaDev);
pci_device_vgaarb_lock();
}
diff --git a/xorg-server/hw/xfree86/common/xf86cmap.c b/xorg-server/hw/xfree86/common/xf86cmap.c
index cdc8459af..460fafde3 100644
--- a/xorg-server/hw/xfree86/common/xf86cmap.c
+++ b/xorg-server/hw/xfree86/common/xf86cmap.c
@@ -66,7 +66,7 @@
#define LOAD_PALETTE(pmap) \
((pmap == GetInstalledmiColormap(pmap->pScreen)) && \
((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \
- xf86Screens[pmap->pScreen->myNum]->vtSema || pScreenPriv->isDGAmode))
+ xf86ScreenToScrn(pmap->pScreen)->vtSema || pScreenPriv->isDGAmode))
typedef struct _CMapLink {
ColormapPtr cmap;
@@ -151,7 +151,7 @@ xf86HandleColormaps(ScreenPtr pScreen,
xf86LoadPaletteProc * loadPalette,
xf86SetOverscanProc * setOverscan, unsigned int flags)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
ColormapPtr pDefMap = NULL;
CMapScreenPtr pScreenPriv;
LOCO *gamma;
@@ -511,7 +511,7 @@ CMapSetDGAMode(int index, int num, DGADevicePtr dev)
pScreenPriv->isDGAmode = DGAActive(index);
if (!pScreenPriv->isDGAmode && GetInstalledmiColormap(pScreen)
- && xf86Screens[pScreen->myNum]->vtSema)
+ && xf86ScreenToScrn(pScreen)->vtSema)
CMapReinstallMap(GetInstalledmiColormap(pScreen));
return ret;
@@ -528,7 +528,7 @@ CMapReinstallMap(ColormapPtr pmap)
CMapScreenKey);
CMapColormapPtr cmapPriv =
(CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey);
- ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen);
int i = cmapPriv->numColors;
int *indices = pScreenPriv->PreAllocIndices;
@@ -560,7 +560,7 @@ CMapRefreshColors(ColormapPtr pmap, int defs, int *indices)
CMapColormapPtr pColPriv =
(CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey);
VisualPtr pVisual = pmap->pVisual;
- ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen);
int numColors, i;
LOCO *gamma, *colors;
EntryPtr entry;
@@ -692,7 +692,7 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
CMapScreenKey);
CMapColormapPtr pColPriv =
(CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey);
- ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen);
VisualPtr pVisual = pmap->pVisual;
int i;
LOCO *colors;
@@ -833,7 +833,7 @@ CMapUnwrapScreen(ScreenPtr pScreen)
{
CMapScreenPtr pScreenPriv =
(CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
pScreen->CreateColormap = pScreenPriv->CreateColormap;
@@ -1008,7 +1008,7 @@ xf86ChangeGammaRamp(ScreenPtr pScreen,
unsigned short *red,
unsigned short *green, unsigned short *blue)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
CMapColormapPtr pColPriv;
CMapScreenPtr pScreenPriv;
CMapLinkPtr pLink;
@@ -1085,7 +1085,7 @@ xf86ChangeGammaRamp(ScreenPtr pScreen,
int
xf86GetGammaRampSize(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
CMapScreenPtr pScreenPriv;
if (xf86_crtc_supports_gamma(pScrn)) {
@@ -1112,7 +1112,7 @@ xf86GetGammaRamp(ScreenPtr pScreen,
unsigned short *red,
unsigned short *green, unsigned short *blue)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
CMapScreenPtr pScreenPriv;
LOCO *entry;
int shift, sigbits;
@@ -1172,7 +1172,7 @@ xf86GetGammaRamp(ScreenPtr pScreen,
int
xf86ChangeGamma(ScreenPtr pScreen, Gamma gamma)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
if (pScrn->ChangeGamma)
return (*pScrn->ChangeGamma) (pScreen->myNum, gamma);
diff --git a/xorg-server/hw/xfree86/common/xf86fbman.c b/xorg-server/hw/xfree86/common/xf86fbman.c
index 3c29bf531..e2db1c354 100644
--- a/xorg-server/hw/xfree86/common/xf86fbman.c
+++ b/xorg-server/hw/xfree86/common/xf86fbman.c
@@ -1186,7 +1186,7 @@ xf86FBCloseScreen(int i, ScreenPtr pScreen)
Bool
xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
RegionRec ScreenRegion;
RegionRec FullRegion;
BoxRec ScreenBox;
@@ -1223,7 +1223,7 @@ xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox)
Bool
xf86InitFBManagerArea(ScreenPtr pScreen, int PixelArea, int Verbosity)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
xRectangle Rect[3];
RegionPtr pRegion, pScreenRegion;
int nRect;
diff --git a/xorg-server/hw/xfree86/common/xf86pciBus.c b/xorg-server/hw/xfree86/common/xf86pciBus.c
index e52f1da84..d758260b6 100644
--- a/xorg-server/hw/xfree86/common/xf86pciBus.c
+++ b/xorg-server/hw/xfree86/common/xf86pciBus.c
@@ -52,7 +52,7 @@
#define PCI_VENDOR_GENERIC 0x00FF
/* Bus-specific globals */
-Bool pciSlotClaimed = FALSE;
+int pciSlotClaimed = 0;
#define PCIINFOCLASSES(c) \
( (((c) & 0x00ff0000) == (PCI_CLASS_PREHISTORIC << 16)) \
@@ -223,7 +223,7 @@ xf86ClaimPciSlot(struct pci_device *d, DriverPtr drvp,
p->inUse = FALSE;
if (dev)
xf86AddDevToEntity(num, dev);
- pciSlotClaimed = TRUE;
+ pciSlotClaimed++;
return num;
}
@@ -235,7 +235,7 @@ xf86ClaimPciSlot(struct pci_device *d, DriverPtr drvp,
* Unclaim PCI slot, e.g. if probing failed, so that a different driver can claim.
*/
void
-xf86UnclaimPciSlot(struct pci_device *d)
+xf86UnclaimPciSlot(struct pci_device *d, GDevPtr dev)
{
int i;
@@ -244,6 +244,8 @@ xf86UnclaimPciSlot(struct pci_device *d)
if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) {
/* Probably the slot should be deallocated? */
+ xf86RemoveDevFromEntity(i, dev);
+ pciSlotClaimed--;
p->bus.type = BUS_NONE;
return;
}
@@ -537,7 +539,7 @@ xf86PciProbeDev(DriverPtr drvp)
foundScreen = TRUE;
}
else
- xf86UnclaimPciSlot(pPci);
+ xf86UnclaimPciSlot(pPci, devList[i]);
}
break;
diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.c b/xorg-server/hw/xfree86/common/xf86sbusBus.c
index c993b603c..27d24f8e1 100644
--- a/xorg-server/hw/xfree86/common/xf86sbusBus.c
+++ b/xorg-server/hw/xfree86/common/xf86sbusBus.c
@@ -619,8 +619,9 @@ xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp)
pScrn->virtualY = psdp->height;
}
-static sbusPaletteKeyIndex;
-static DevPrivateKey sbusPaletteKey = &sbusPaletteKeyIndex;
+static DevPrivateKeyRec sbusPaletteKeyRec;
+#define sbusPaletteKey (&sbusPaletteKeyRec)
+
typedef struct _sbusCmap {
sbusDevicePtr psdp;
CloseScreenProcPtr CloseScreen;
@@ -692,6 +693,9 @@ xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp)
struct fbcmap fbcmap;
unsigned char data[2];
+ if (!dixRegisterPrivateKey(sbusPaletteKey, PRIVATE_SCREEN, 0))
+ FatalError("Cannot register sbus private key");
+
cmap = xnfcalloc(1, sizeof(sbusCmapRec));
dixSetPrivate(&pScreen->devPrivates, sbusPaletteKey, cmap);
cmap->psdp = psdp;
diff --git a/xorg-server/hw/xfree86/common/xf86xv.c b/xorg-server/hw/xfree86/common/xf86xv.c
index 0e5b0cf0f..b10034852 100644
--- a/xorg-server/hw/xfree86/common/xf86xv.c
+++ b/xorg-server/hw/xfree86/common/xf86xv.c
@@ -271,7 +271,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
if (!ScreenPriv)
return FALSE;
- pScrn = xf86Screens[pScreen->myNum];
+ pScrn = xf86ScreenToScrn(pScreen);
ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
ScreenPriv->WindowExposures = pScreen->WindowExposures;
@@ -356,7 +356,7 @@ static Bool
xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number)
{
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XF86VideoAdaptorPtr adaptorPtr;
XvAdaptorPtr pAdaptor, pa;
XvAdaptorRecPrivatePtr adaptorPriv;
@@ -1150,7 +1150,7 @@ xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind)
pScreen = pLayerWin->drawable.pScreen;
ScreenPriv = GET_XF86XV_SCREEN(pScreen);
- pScrn = xf86Screens[pScreen->myNum];
+ pScrn = xf86ScreenToScrn(pScreen);
xf86XVReputOrStopAllPorts(pScrn, TRUE);
@@ -1257,7 +1257,7 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
static Bool
xf86XVCloseScreen(int i, ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
XvAdaptorPtr pa;
@@ -1899,7 +1899,7 @@ xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes)
xRectangle *rects;
GCPtr gc;
- if (!xf86Screens[pScreen->myNum]->vtSema)
+ if (!xf86ScreenToScrn(pScreen)->vtSema)
return;
gc = GetScratchGC(pDraw->depth, pScreen);
diff --git a/xorg-server/hw/xfree86/common/xf86xvmc.c b/xorg-server/hw/xfree86/common/xf86xvmc.c
index 7321efa43..b7da7589a 100644
--- a/xorg-server/hw/xfree86/common/xf86xvmc.c
+++ b/xorg-server/hw/xfree86/common/xf86xvmc.c
@@ -64,7 +64,7 @@ xf86XvMCCreateContext(XvPortPtr pPort,
XvMCContextPtr pContext, int *num_priv, CARD32 **priv)
{
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
pContext->port_priv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
@@ -78,7 +78,7 @@ static void
xf86XvMCDestroyContext(XvMCContextPtr pContext)
{
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num]->DestroyContext) (pScrn,
pContext);
@@ -89,7 +89,7 @@ xf86XvMCCreateSurface(XvMCSurfacePtr pSurface, int *num_priv, CARD32 **priv)
{
XvMCContextPtr pContext = pSurface->context;
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSurface) (pScrn,
pSurface,
@@ -102,7 +102,7 @@ xf86XvMCDestroySurface(XvMCSurfacePtr pSurface)
{
XvMCContextPtr pContext = pSurface->context;
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num]->DestroySurface) (pScrn,
pSurface);
@@ -114,7 +114,7 @@ xf86XvMCCreateSubpicture(XvMCSubpicturePtr pSubpicture,
{
XvMCContextPtr pContext = pSubpicture->context;
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
return (*pScreenPriv->adaptors[pContext->adapt_num]->
CreateSubpicture) (pScrn, pSubpicture, num_priv, priv);
@@ -125,7 +125,7 @@ xf86XvMCDestroySubpicture(XvMCSubpicturePtr pSubpicture)
{
XvMCContextPtr pContext = pSubpicture->context;
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num]->DestroySubpicture) (pScrn,
pSubpicture);