xfree86: track screens' installed colormaps as screen privates
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
This commit is contained in:
parent
a94f5455c7
commit
b61870595b
|
@ -731,7 +731,7 @@ DGAInstallCmap(ColormapPtr cmap)
|
||||||
/* We rely on the extension to check that DGA is active */
|
/* We rely on the extension to check that DGA is active */
|
||||||
|
|
||||||
if(!pScreenPriv->dgaColormap)
|
if(!pScreenPriv->dgaColormap)
|
||||||
pScreenPriv->savedColormap = miInstalledMaps[pScreen->myNum];
|
pScreenPriv->savedColormap = GetInstalledmiColormap(pScreen);
|
||||||
|
|
||||||
pScreenPriv->dgaColormap = cmap;
|
pScreenPriv->dgaColormap = cmap;
|
||||||
|
|
||||||
|
|
|
@ -63,10 +63,10 @@
|
||||||
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
|
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
|
||||||
((pScreen)->field = wrapper)
|
((pScreen)->field = wrapper)
|
||||||
|
|
||||||
#define LOAD_PALETTE(pmap, index) \
|
#define LOAD_PALETTE(pmap) \
|
||||||
((pmap == miInstalledMaps[index]) && \
|
((pmap == GetInstalledmiColormap(pmap->pScreen)) && \
|
||||||
((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \
|
((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \
|
||||||
xf86Screens[index]->vtSema || pScreenPriv->isDGAmode))
|
xf86Screens[pmap->pScreen->myNum]->vtSema || pScreenPriv->isDGAmode))
|
||||||
|
|
||||||
|
|
||||||
typedef struct _CMapLink {
|
typedef struct _CMapLink {
|
||||||
|
@ -221,7 +221,7 @@ Bool xf86HandleColormaps(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Force the initial map to be loaded */
|
/* Force the initial map to be loaded */
|
||||||
miInstalledMaps[pScreen->myNum] = NULL;
|
SetInstalledmiColormap(pScreen, NULL);
|
||||||
CMapInstallColormap(pDefMap);
|
CMapInstallColormap(pDefMap);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -425,11 +425,10 @@ static void
|
||||||
CMapInstallColormap(ColormapPtr pmap)
|
CMapInstallColormap(ColormapPtr pmap)
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pmap->pScreen;
|
ScreenPtr pScreen = pmap->pScreen;
|
||||||
int index = pScreen->myNum;
|
|
||||||
CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
|
CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
|
||||||
&pScreen->devPrivates, CMapScreenKey);
|
&pScreen->devPrivates, CMapScreenKey);
|
||||||
|
|
||||||
if (pmap == miInstalledMaps[index])
|
if (pmap == GetInstalledmiColormap(pmap->pScreen))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pScreen->InstallColormap = pScreenPriv->InstallColormap;
|
pScreen->InstallColormap = pScreenPriv->InstallColormap;
|
||||||
|
@ -438,15 +437,15 @@ CMapInstallColormap(ColormapPtr pmap)
|
||||||
|
|
||||||
/* Important. We let the lower layers, namely DGA,
|
/* Important. We let the lower layers, namely DGA,
|
||||||
overwrite the choice of Colormap to install */
|
overwrite the choice of Colormap to install */
|
||||||
if (miInstalledMaps[index])
|
if (GetInstalledmiColormap(pmap->pScreen))
|
||||||
pmap = miInstalledMaps[index];
|
pmap = GetInstalledmiColormap(pmap->pScreen);
|
||||||
|
|
||||||
if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
|
if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
|
||||||
(pmap->pVisual->class == TrueColor) &&
|
(pmap->pVisual->class == TrueColor) &&
|
||||||
CMapColormapUseMax(pmap->pVisual, pScreenPriv))
|
CMapColormapUseMax(pmap->pVisual, pScreenPriv))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(LOAD_PALETTE(pmap, index))
|
if(LOAD_PALETTE(pmap))
|
||||||
CMapReinstallMap(pmap);
|
CMapReinstallMap(pmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,8 +460,8 @@ CMapEnterVT(int index, int flags)
|
||||||
&pScreen->devPrivates, CMapScreenKey);
|
&pScreen->devPrivates, CMapScreenKey);
|
||||||
|
|
||||||
if((*pScreenPriv->EnterVT)(index, flags)) {
|
if((*pScreenPriv->EnterVT)(index, flags)) {
|
||||||
if(miInstalledMaps[index])
|
if(GetInstalledmiColormap(pScreen))
|
||||||
CMapReinstallMap(miInstalledMaps[index]);
|
CMapReinstallMap(GetInstalledmiColormap(pScreen));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -477,8 +476,8 @@ CMapSwitchMode(int index, DisplayModePtr mode, int flags)
|
||||||
&pScreen->devPrivates, CMapScreenKey);
|
&pScreen->devPrivates, CMapScreenKey);
|
||||||
|
|
||||||
if((*pScreenPriv->SwitchMode)(index, mode, flags)) {
|
if((*pScreenPriv->SwitchMode)(index, mode, flags)) {
|
||||||
if(miInstalledMaps[index])
|
if(GetInstalledmiColormap(pScreen))
|
||||||
CMapReinstallMap(miInstalledMaps[index]);
|
CMapReinstallMap(GetInstalledmiColormap(pScreen));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -497,9 +496,9 @@ CMapSetDGAMode(int index, int num, DGADevicePtr dev)
|
||||||
|
|
||||||
pScreenPriv->isDGAmode = DGAActive(index);
|
pScreenPriv->isDGAmode = DGAActive(index);
|
||||||
|
|
||||||
if(!pScreenPriv->isDGAmode && miInstalledMaps[index]
|
if(!pScreenPriv->isDGAmode && GetInstalledmiColormap(pScreen)
|
||||||
&& xf86Screens[pScreen->myNum]->vtSema)
|
&& xf86Screens[pScreen->myNum]->vtSema)
|
||||||
CMapReinstallMap(miInstalledMaps[index]);
|
CMapReinstallMap(GetInstalledmiColormap(pScreen));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -649,7 +648,7 @@ CMapRefreshColors(ColormapPtr pmap, int defs, int* indices)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(LOAD_PALETTE(pmap, pmap->pScreen->myNum))
|
if(LOAD_PALETTE(pmap))
|
||||||
(*pScrn->LoadPalette)(pScreenPriv->pScrn, defs, indices,
|
(*pScrn->LoadPalette)(pScreenPriv->pScrn, defs, indices,
|
||||||
colors, pmap->pVisual);
|
colors, pmap->pVisual);
|
||||||
|
|
||||||
|
@ -802,7 +801,7 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
|
||||||
}
|
}
|
||||||
if (newOverscan) {
|
if (newOverscan) {
|
||||||
pColPriv->overscan = overscan;
|
pColPriv->overscan = overscan;
|
||||||
if (LOAD_PALETTE(pmap, pmap->pScreen->myNum)) {
|
if (LOAD_PALETTE(pmap)) {
|
||||||
#ifdef DEBUGOVERSCAN
|
#ifdef DEBUGOVERSCAN
|
||||||
ErrorF("SetOverscan() called from CmapSetOverscan\n");
|
ErrorF("SetOverscan() called from CmapSetOverscan\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -929,10 +928,10 @@ CMapChangeGamma(
|
||||||
pLink = pLink->next;
|
pLink = pLink->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(miInstalledMaps[pScreen->myNum] &&
|
if(GetInstalledmiColormap(pScreen) &&
|
||||||
((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
|
((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
|
||||||
pScrn->vtSema || pScreenPriv->isDGAmode)) {
|
pScrn->vtSema || pScreenPriv->isDGAmode)) {
|
||||||
ColormapPtr pMap = miInstalledMaps[pScreen->myNum];
|
ColormapPtr pMap = GetInstalledmiColormap(pScreen);
|
||||||
|
|
||||||
if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
|
if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
|
||||||
(pMap->pVisual->class == TrueColor) &&
|
(pMap->pVisual->class == TrueColor) &&
|
||||||
|
@ -951,9 +950,9 @@ CMapChangeGamma(
|
||||||
if(pLink) {
|
if(pLink) {
|
||||||
/* need to trick CMapRefreshColors() into thinking
|
/* need to trick CMapRefreshColors() into thinking
|
||||||
this is the currently installed map */
|
this is the currently installed map */
|
||||||
miInstalledMaps[pScreen->myNum] = pLink->cmap;
|
SetInstalledmiColormap(pScreen, pLink->cmap);
|
||||||
CMapReinstallMap(pLink->cmap);
|
CMapReinstallMap(pLink->cmap);
|
||||||
miInstalledMaps[pScreen->myNum] = pMap;
|
SetInstalledmiColormap(pScreen, pMap);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
CMapReinstallMap(pMap);
|
CMapReinstallMap(pMap);
|
||||||
|
@ -1035,10 +1034,10 @@ xf86ChangeGammaRamp(
|
||||||
pLink = pLink->next;
|
pLink = pLink->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(miInstalledMaps[pScreen->myNum] &&
|
if(GetInstalledmiColormap(pScreen) &&
|
||||||
((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
|
((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
|
||||||
pScrn->vtSema || pScreenPriv->isDGAmode)) {
|
pScrn->vtSema || pScreenPriv->isDGAmode)) {
|
||||||
ColormapPtr pMap = miInstalledMaps[pScreen->myNum];
|
ColormapPtr pMap = GetInstalledmiColormap(pScreen);
|
||||||
|
|
||||||
if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
|
if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
|
||||||
(pMap->pVisual->class == TrueColor) &&
|
(pMap->pVisual->class == TrueColor) &&
|
||||||
|
@ -1057,9 +1056,9 @@ xf86ChangeGammaRamp(
|
||||||
if(pLink) {
|
if(pLink) {
|
||||||
/* need to trick CMapRefreshColors() into thinking
|
/* need to trick CMapRefreshColors() into thinking
|
||||||
this is the currently installed map */
|
this is the currently installed map */
|
||||||
miInstalledMaps[pScreen->myNum] = pLink->cmap;
|
SetInstalledmiColormap(pScreen, pLink->cmap);
|
||||||
CMapReinstallMap(pLink->cmap);
|
CMapReinstallMap(pLink->cmap);
|
||||||
miInstalledMaps[pScreen->myNum] = pMap;
|
SetInstalledmiColormap(pScreen, pMap);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
CMapReinstallMap(pMap);
|
CMapReinstallMap(pMap);
|
||||||
|
|
|
@ -50,7 +50,7 @@ vgaListInstalledColormaps(pScreen, pmaps)
|
||||||
/* By the time we are processing requests, we can guarantee that there
|
/* By the time we are processing requests, we can guarantee that there
|
||||||
* is always a colormap installed */
|
* is always a colormap installed */
|
||||||
|
|
||||||
*pmaps = miInstalledMaps[pScreen->myNum]->mid;
|
*pmaps = GetInstalledmiColormap(pScreen)->mid;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,13 +62,13 @@ vgaGetInstalledColormaps(pScreen, pmaps)
|
||||||
/* By the time we are processing requests, we can guarantee that there
|
/* By the time we are processing requests, we can guarantee that there
|
||||||
* is always a colormap installed */
|
* is always a colormap installed */
|
||||||
|
|
||||||
*pmaps = miInstalledMaps[pScreen->myNum];
|
*pmaps = GetInstalledmiColormap(pScreen);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int vgaCheckColorMap(ColormapPtr pmap)
|
int vgaCheckColorMap(ColormapPtr pmap)
|
||||||
{
|
{
|
||||||
return (pmap != miInstalledMaps[pmap->pScreen->myNum]);
|
return (pmap != GetInstalledmiColormap(pmap->pScreen));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ void
|
||||||
vgaInstallColormap(pmap)
|
vgaInstallColormap(pmap)
|
||||||
ColormapPtr pmap;
|
ColormapPtr pmap;
|
||||||
{
|
{
|
||||||
ColormapPtr oldmap = miInstalledMaps[pmap->pScreen->myNum];
|
ColormapPtr oldmap = GetInstalledmiColormap(pmap->pScreen);
|
||||||
int entries;
|
int entries;
|
||||||
Pixel * ppix;
|
Pixel * ppix;
|
||||||
xrgb * prgb;
|
xrgb * prgb;
|
||||||
|
@ -242,7 +242,7 @@ vgaInstallColormap(pmap)
|
||||||
if ( oldmap != NOMAPYET)
|
if ( oldmap != NOMAPYET)
|
||||||
WalkTree( pmap->pScreen, TellLostMap, &oldmap->mid);
|
WalkTree( pmap->pScreen, TellLostMap, &oldmap->mid);
|
||||||
|
|
||||||
miInstalledMaps[pmap->pScreen->myNum] = pmap;
|
SetInstalledmiColormap(pmap->pScreen, pmap);
|
||||||
|
|
||||||
for ( i=0; i<entries; i++) ppix[i] = i;
|
for ( i=0; i<entries; i++) ppix[i] = i;
|
||||||
|
|
||||||
|
@ -273,13 +273,13 @@ vgaUninstallColormap(pmap)
|
||||||
|
|
||||||
ColormapPtr defColormap;
|
ColormapPtr defColormap;
|
||||||
|
|
||||||
if ( pmap != miInstalledMaps[pmap->pScreen->myNum] )
|
if ( pmap != GetInstalledmiColormap(pmap->pScreen))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dixLookupResourceByType((pointer *)&defColormap, pmap->pScreen->defColormap,
|
dixLookupResourceByType((pointer *)&defColormap, pmap->pScreen->defColormap,
|
||||||
RT_COLORMAP, serverClient, DixInstallAccess);
|
RT_COLORMAP, serverClient, DixInstallAccess);
|
||||||
|
|
||||||
if (defColormap == miInstalledMaps[pmap->pScreen->myNum])
|
if (defColormap == GetInstalledmiColormap(pmap->pScreen))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
(*pmap->pScreen->InstallColormap) (defColormap);
|
(*pmap->pScreen->InstallColormap) (defColormap);
|
||||||
|
|
Loading…
Reference in New Issue