vidmode: use ScreenPtr instead of screen index
New code passes ScreenPtr instead of the screen index. Change the VidMode functions to take a ScreenPtr. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
This commit is contained in:
		
							parent
							
								
									6e898ef080
								
							
						
					
					
						commit
						f6f7e21133
					
				| 
						 | 
					@ -41,32 +41,32 @@ typedef union {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern Bool VidModeExtensionInit(ScreenPtr pScreen);
 | 
					extern Bool VidModeExtensionInit(ScreenPtr pScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern Bool VidModeGetCurrentModeline(int scrnIndex, void **mode,
 | 
					extern Bool VidModeGetCurrentModeline(ScreenPtr pScreen, void **mode,
 | 
				
			||||||
                                      int *dotClock);
 | 
					                                      int *dotClock);
 | 
				
			||||||
extern Bool VidModeGetFirstModeline(int scrnIndex, void **mode,
 | 
					extern Bool VidModeGetFirstModeline(ScreenPtr pScreen, void **mode,
 | 
				
			||||||
                                    int *dotClock);
 | 
					                                    int *dotClock);
 | 
				
			||||||
extern Bool VidModeGetNextModeline(int scrnIndex, void **mode,
 | 
					extern Bool VidModeGetNextModeline(ScreenPtr pScreen, void **mode,
 | 
				
			||||||
                                   int *dotClock);
 | 
					                                   int *dotClock);
 | 
				
			||||||
extern Bool VidModeDeleteModeline(int scrnIndex, void *mode);
 | 
					extern Bool VidModeDeleteModeline(ScreenPtr pScreen, void *mode);
 | 
				
			||||||
extern Bool VidModeZoomViewport(int scrnIndex, int zoom);
 | 
					extern Bool VidModeZoomViewport(ScreenPtr pScreen, int zoom);
 | 
				
			||||||
extern Bool VidModeGetViewPort(int scrnIndex, int *x, int *y);
 | 
					extern Bool VidModeGetViewPort(ScreenPtr pScreen, int *x, int *y);
 | 
				
			||||||
extern Bool VidModeSetViewPort(int scrnIndex, int x, int y);
 | 
					extern Bool VidModeSetViewPort(ScreenPtr pScreen, int x, int y);
 | 
				
			||||||
extern Bool VidModeSwitchMode(int scrnIndex, void *mode);
 | 
					extern Bool VidModeSwitchMode(ScreenPtr pScreen, void *mode);
 | 
				
			||||||
extern Bool VidModeLockZoom(int scrnIndex, Bool lock);
 | 
					extern Bool VidModeLockZoom(ScreenPtr pScreen, Bool lock);
 | 
				
			||||||
extern Bool VidModeGetMonitor(int scrnIndex, void **monitor);
 | 
					extern Bool VidModeGetMonitor(ScreenPtr pScreen, void **monitor);
 | 
				
			||||||
extern int VidModeGetNumOfClocks(int scrnIndex, Bool *progClock);
 | 
					extern int VidModeGetNumOfClocks(ScreenPtr pScreen, Bool *progClock);
 | 
				
			||||||
extern Bool VidModeGetClocks(int scrnIndex, int *Clocks);
 | 
					extern Bool VidModeGetClocks(ScreenPtr pScreen, int *Clocks);
 | 
				
			||||||
extern ModeStatus VidModeCheckModeForMonitor(int scrnIndex,
 | 
					extern ModeStatus VidModeCheckModeForMonitor(ScreenPtr pScreen,
 | 
				
			||||||
                                             void *mode);
 | 
					                                             void *mode);
 | 
				
			||||||
extern ModeStatus VidModeCheckModeForDriver(int scrnIndex,
 | 
					extern ModeStatus VidModeCheckModeForDriver(ScreenPtr pScreen,
 | 
				
			||||||
                                            void *mode);
 | 
					                                            void *mode);
 | 
				
			||||||
extern void VidModeSetCrtcForMode(int scrnIndex, void *mode);
 | 
					extern void VidModeSetCrtcForMode(ScreenPtr pScreen, void *mode);
 | 
				
			||||||
extern Bool VidModeAddModeline(int scrnIndex, void *mode);
 | 
					extern Bool VidModeAddModeline(ScreenPtr pScreen, void *mode);
 | 
				
			||||||
extern int VidModeGetDotClock(int scrnIndex, int Clock);
 | 
					extern int VidModeGetDotClock(ScreenPtr pScreen, int Clock);
 | 
				
			||||||
extern int VidModeGetNumOfModes(int scrnIndex);
 | 
					extern int VidModeGetNumOfModes(ScreenPtr pScreen);
 | 
				
			||||||
extern Bool VidModeSetGamma(int scrnIndex, float red, float green,
 | 
					extern Bool VidModeSetGamma(ScreenPtr pScreen, float red, float green,
 | 
				
			||||||
                            float blue);
 | 
					                            float blue);
 | 
				
			||||||
extern Bool VidModeGetGamma(int scrnIndex, float *red, float *green,
 | 
					extern Bool VidModeGetGamma(ScreenPtr pScreen, float *red, float *green,
 | 
				
			||||||
                            float *blue);
 | 
					                            float *blue);
 | 
				
			||||||
extern void *VidModeCreateMode(void);
 | 
					extern void *VidModeCreateMode(void);
 | 
				
			||||||
extern void VidModeCopyMode(void *modefrom, void *modeto);
 | 
					extern void VidModeCopyMode(void *modefrom, void *modeto);
 | 
				
			||||||
| 
						 | 
					@ -74,10 +74,10 @@ extern int VidModeGetModeValue(void *mode, int valtyp);
 | 
				
			||||||
extern void VidModeSetModeValue(void *mode, int valtyp, int val);
 | 
					extern void VidModeSetModeValue(void *mode, int valtyp, int val);
 | 
				
			||||||
extern vidMonitorValue VidModeGetMonitorValue(void *monitor,
 | 
					extern vidMonitorValue VidModeGetMonitorValue(void *monitor,
 | 
				
			||||||
                                              int valtyp, int indx);
 | 
					                                              int valtyp, int indx);
 | 
				
			||||||
extern Bool VidModeSetGammaRamp(int, int, CARD16 *, CARD16 *,
 | 
					extern Bool VidModeSetGammaRamp(ScreenPtr, int, CARD16 *, CARD16 *,
 | 
				
			||||||
                                CARD16 *);
 | 
					                                CARD16 *);
 | 
				
			||||||
extern Bool VidModeGetGammaRamp(int, int, CARD16 *, CARD16 *,
 | 
					extern Bool VidModeGetGammaRamp(ScreenPtr, int, CARD16 *, CARD16 *,
 | 
				
			||||||
                                CARD16 *);
 | 
					                                CARD16 *);
 | 
				
			||||||
extern int VidModeGetGammaRampSize(int scrnIndex);
 | 
					extern int VidModeGetGammaRampSize(ScreenPtr pScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -83,19 +83,14 @@ VidModeExtensionInit(ScreenPtr pScreen)
 | 
				
			||||||
#ifdef XF86VIDMODE
 | 
					#ifdef XF86VIDMODE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool
 | 
					static Bool
 | 
				
			||||||
VidModeAvailable(int scrnIndex)
 | 
					VidModeAvailable(ScreenPtr pScreen)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    if (pScreen == NULL) {
 | 
				
			||||||
    VidModePtr pVidMode;
 | 
					        DebugF("pScreen == NULL\n");
 | 
				
			||||||
 | 
					 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					 | 
				
			||||||
    if (pScrn == NULL) {
 | 
					 | 
				
			||||||
        DebugF("pScrn == NULL\n");
 | 
					 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pVidMode = VMPTR(pScrn->pScreen);
 | 
					    if (VMPTR(pScreen))
 | 
				
			||||||
    if (pVidMode)
 | 
					 | 
				
			||||||
        return TRUE;
 | 
					        return TRUE;
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
        DebugF("pVidMode == NULL\n");
 | 
					        DebugF("pVidMode == NULL\n");
 | 
				
			||||||
| 
						 | 
					@ -104,14 +99,14 @@ VidModeAvailable(int scrnIndex)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeGetCurrentModeline(int scrnIndex, void **mode, int *dotClock)
 | 
					VidModeGetCurrentModeline(ScreenPtr pScreen, void **mode, int *dotClock)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (pScrn->currentMode) {
 | 
					    if (pScrn->currentMode) {
 | 
				
			||||||
        *mode = (void *) (pScrn->currentMode);
 | 
					        *mode = (void *) (pScrn->currentMode);
 | 
				
			||||||
| 
						 | 
					@ -123,14 +118,14 @@ VidModeGetCurrentModeline(int scrnIndex, void **mode, int *dotClock)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
VidModeGetDotClock(int scrnIndex, int Clock)
 | 
					VidModeGetDotClock(ScreenPtr pScreen, int Clock)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
        return 0;
 | 
					        return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
    if ((pScrn->progClock) || (Clock >= MAXCLOCKS))
 | 
					    if ((pScrn->progClock) || (Clock >= MAXCLOCKS))
 | 
				
			||||||
        return Clock;
 | 
					        return Clock;
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
| 
						 | 
					@ -138,14 +133,14 @@ VidModeGetDotClock(int scrnIndex, int Clock)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
VidModeGetNumOfClocks(int scrnIndex, Bool *progClock)
 | 
					VidModeGetNumOfClocks(ScreenPtr pScreen, Bool *progClock)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
        return 0;
 | 
					        return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
    if (pScrn->progClock) {
 | 
					    if (pScrn->progClock) {
 | 
				
			||||||
        *progClock = TRUE;
 | 
					        *progClock = TRUE;
 | 
				
			||||||
        return 0;
 | 
					        return 0;
 | 
				
			||||||
| 
						 | 
					@ -157,15 +152,15 @@ VidModeGetNumOfClocks(int scrnIndex, Bool *progClock)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeGetClocks(int scrnIndex, int *Clocks)
 | 
					VidModeGetClocks(ScreenPtr pScreen, int *Clocks)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (pScrn->progClock)
 | 
					    if (pScrn->progClock)
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
| 
						 | 
					@ -177,49 +172,47 @@ VidModeGetClocks(int scrnIndex, int *Clocks)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeGetFirstModeline(int scrnIndex, void **mode, int *dotClock)
 | 
					VidModeGetFirstModeline(ScreenPtr pScreen, void **mode, int *dotClock)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
    VidModePtr pVidMode;
 | 
					    VidModePtr pVidMode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
    if (pScrn->modes == NULL)
 | 
					    if (pScrn->modes == NULL)
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pVidMode = VMPTR(pScrn->pScreen);
 | 
					    pVidMode = VMPTR(pScreen);
 | 
				
			||||||
    pVidMode->First = pScrn->modes;
 | 
					    pVidMode->First = pScrn->modes;
 | 
				
			||||||
    pVidMode->Next = pVidMode->First->next;
 | 
					    pVidMode->Next = pVidMode->First->next;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (pVidMode->First->status == MODE_OK) {
 | 
					    if (pVidMode->First->status == MODE_OK) {
 | 
				
			||||||
        *mode = (void *) (pVidMode->First);
 | 
					        *mode = (void *) (pVidMode->First);
 | 
				
			||||||
        *dotClock = VidModeGetDotClock(scrnIndex, pVidMode->First->Clock);
 | 
					        *dotClock = VidModeGetDotClock(pScreen, pVidMode->First->Clock);
 | 
				
			||||||
        return TRUE;
 | 
					        return TRUE;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return VidModeGetNextModeline(scrnIndex, mode, dotClock);
 | 
					    return VidModeGetNextModeline(pScreen, mode, dotClock);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeGetNextModeline(int scrnIndex, void **mode, int *dotClock)
 | 
					VidModeGetNextModeline(ScreenPtr pScreen, void **mode, int *dotClock)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					 | 
				
			||||||
    VidModePtr pVidMode;
 | 
					    VidModePtr pVidMode;
 | 
				
			||||||
    DisplayModePtr p;
 | 
					    DisplayModePtr p;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pVidMode = VMPTR(pScreen);
 | 
				
			||||||
    pVidMode = VMPTR(pScrn->pScreen);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (p = pVidMode->Next; p != NULL && p != pVidMode->First; p = p->next) {
 | 
					    for (p = pVidMode->Next; p != NULL && p != pVidMode->First; p = p->next) {
 | 
				
			||||||
        if (p->status == MODE_OK) {
 | 
					        if (p->status == MODE_OK) {
 | 
				
			||||||
            pVidMode->Next = p->next;
 | 
					            pVidMode->Next = p->next;
 | 
				
			||||||
            *mode = (void *) p;
 | 
					            *mode = (void *) p;
 | 
				
			||||||
            *dotClock = VidModeGetDotClock(scrnIndex, p->Clock);
 | 
					            *dotClock = VidModeGetDotClock(pScreen, p->Clock);
 | 
				
			||||||
            return TRUE;
 | 
					            return TRUE;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -228,40 +221,37 @@ VidModeGetNextModeline(int scrnIndex, void **mode, int *dotClock)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeDeleteModeline(int scrnIndex, void *mode)
 | 
					VidModeDeleteModeline(ScreenPtr pScreen, void *mode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
 | 
					    if ((mode == NULL) || (!VidModeAvailable(pScreen)))
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
    xf86DeleteMode(&(pScrn->modes), (DisplayModePtr) mode);
 | 
					    xf86DeleteMode(&(pScrn->modes), (DisplayModePtr) mode);
 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeZoomViewport(int scrnIndex, int zoom)
 | 
					VidModeZoomViewport(ScreenPtr pScreen, int zoom)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    xf86ZoomViewport(pScreen, zoom);
 | 
				
			||||||
    xf86ZoomViewport(pScrn->pScreen, zoom);
 | 
					 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeSetViewPort(int scrnIndex, int x, int y)
 | 
					VidModeSetViewPort(ScreenPtr pScreen, int x, int y)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
    pScrn->frameX0 = min(max(x, 0),
 | 
					    pScrn->frameX0 = min(max(x, 0),
 | 
				
			||||||
                         pScrn->virtualX - pScrn->currentMode->HDisplay);
 | 
					                         pScrn->virtualX - pScrn->currentMode->HDisplay);
 | 
				
			||||||
    pScrn->frameX1 = pScrn->frameX0 + pScrn->currentMode->HDisplay - 1;
 | 
					    pScrn->frameX1 = pScrn->frameX0 + pScrn->currentMode->HDisplay - 1;
 | 
				
			||||||
| 
						 | 
					@ -275,30 +265,30 @@ VidModeSetViewPort(int scrnIndex, int x, int y)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeGetViewPort(int scrnIndex, int *x, int *y)
 | 
					VidModeGetViewPort(ScreenPtr pScreen, int *x, int *y)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
    *x = pScrn->frameX0;
 | 
					    *x = pScrn->frameX0;
 | 
				
			||||||
    *y = pScrn->frameY0;
 | 
					    *y = pScrn->frameY0;
 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeSwitchMode(int scrnIndex, void *mode)
 | 
					VidModeSwitchMode(ScreenPtr pScreen, void *mode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
    DisplayModePtr pTmpMode;
 | 
					    DisplayModePtr pTmpMode;
 | 
				
			||||||
    Bool retval;
 | 
					    Bool retval;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
    /* save in case we fail */
 | 
					    /* save in case we fail */
 | 
				
			||||||
    pTmpMode = pScrn->currentMode;
 | 
					    pTmpMode = pScrn->currentMode;
 | 
				
			||||||
    /* Force a mode switch */
 | 
					    /* Force a mode switch */
 | 
				
			||||||
| 
						 | 
					@ -311,73 +301,69 @@ VidModeSwitchMode(int scrnIndex, void *mode)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeLockZoom(int scrnIndex, Bool lock)
 | 
					VidModeLockZoom(ScreenPtr pScreen, Bool lock)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (xf86Info.dontZoom)
 | 
					    if (xf86Info.dontZoom)
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xf86LockZoom(pScrn->pScreen, lock);
 | 
					    xf86LockZoom(pScreen, lock);
 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeGetMonitor(int scrnIndex, void **monitor)
 | 
					VidModeGetMonitor(ScreenPtr pScreen, void **monitor)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
    *monitor = (void *) (pScrn->monitor);
 | 
					    *monitor = (void *) (pScrn->monitor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ModeStatus
 | 
					ModeStatus
 | 
				
			||||||
VidModeCheckModeForMonitor(int scrnIndex, void *mode)
 | 
					VidModeCheckModeForMonitor(ScreenPtr pScreen, void *mode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
 | 
					    if ((mode == NULL) || (!VidModeAvailable(pScreen)))
 | 
				
			||||||
        return MODE_ERROR;
 | 
					        return MODE_ERROR;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return xf86CheckModeForMonitor((DisplayModePtr) mode, pScrn->monitor);
 | 
					    return xf86CheckModeForMonitor((DisplayModePtr) mode, pScrn->monitor);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ModeStatus
 | 
					ModeStatus
 | 
				
			||||||
VidModeCheckModeForDriver(int scrnIndex, void *mode)
 | 
					VidModeCheckModeForDriver(ScreenPtr pScreen, void *mode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
 | 
					    if ((mode == NULL) || (!VidModeAvailable(pScreen)))
 | 
				
			||||||
        return MODE_ERROR;
 | 
					        return MODE_ERROR;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return xf86CheckModeForDriver(pScrn, (DisplayModePtr) mode, 0);
 | 
					    return xf86CheckModeForDriver(pScrn, (DisplayModePtr) mode, 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
VidModeSetCrtcForMode(int scrnIndex, void *mode)
 | 
					VidModeSetCrtcForMode(ScreenPtr pScreen, void *mode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
    DisplayModePtr ScreenModes;
 | 
					    DisplayModePtr ScreenModes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
 | 
					    if ((mode == NULL) || (!VidModeAvailable(pScreen)))
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Ugly hack so that the xf86Mode.c function can be used without change */
 | 
					    /* Ugly hack so that the xf86Mode.c function can be used without change */
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
    ScreenModes = pScrn->modes;
 | 
					    ScreenModes = pScrn->modes;
 | 
				
			||||||
    pScrn->modes = (DisplayModePtr) mode;
 | 
					    pScrn->modes = (DisplayModePtr) mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -387,14 +373,14 @@ VidModeSetCrtcForMode(int scrnIndex, void *mode)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeAddModeline(int scrnIndex, void *mode)
 | 
					VidModeAddModeline(ScreenPtr pScreen, void *mode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
 | 
					    if ((mode == NULL) || (!VidModeAvailable(pScreen)))
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ((DisplayModePtr) mode)->name = strdup(""); /* freed by deletemode */
 | 
					    ((DisplayModePtr) mode)->name = strdup(""); /* freed by deletemode */
 | 
				
			||||||
    ((DisplayModePtr) mode)->status = MODE_OK;
 | 
					    ((DisplayModePtr) mode)->status = MODE_OK;
 | 
				
			||||||
| 
						 | 
					@ -408,49 +394,47 @@ VidModeAddModeline(int scrnIndex, void *mode)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
VidModeGetNumOfModes(int scrnIndex)
 | 
					VidModeGetNumOfModes(ScreenPtr pScreen)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    void *mode = NULL;
 | 
					    void *mode = NULL;
 | 
				
			||||||
    int dotClock = 0, nummodes = 0;
 | 
					    int dotClock = 0, nummodes = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeGetFirstModeline(scrnIndex, &mode, &dotClock))
 | 
					    if (!VidModeGetFirstModeline(pScreen, &mode, &dotClock))
 | 
				
			||||||
        return nummodes;
 | 
					        return nummodes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    do {
 | 
					    do {
 | 
				
			||||||
        nummodes++;
 | 
					        nummodes++;
 | 
				
			||||||
        if (!VidModeGetNextModeline(scrnIndex, &mode, &dotClock))
 | 
					        if (!VidModeGetNextModeline(pScreen, &mode, &dotClock))
 | 
				
			||||||
            return nummodes;
 | 
					            return nummodes;
 | 
				
			||||||
    } while (TRUE);
 | 
					    } while (TRUE);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeSetGamma(int scrnIndex, float red, float green, float blue)
 | 
					VidModeSetGamma(ScreenPtr pScreen, float red, float green, float blue)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					 | 
				
			||||||
    Gamma gamma;
 | 
					    Gamma gamma;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					 | 
				
			||||||
    gamma.red = red;
 | 
					    gamma.red = red;
 | 
				
			||||||
    gamma.green = green;
 | 
					    gamma.green = green;
 | 
				
			||||||
    gamma.blue = blue;
 | 
					    gamma.blue = blue;
 | 
				
			||||||
    if (xf86ChangeGamma(pScrn->pScreen, gamma) != Success)
 | 
					    if (xf86ChangeGamma(pScreen, gamma) != Success)
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        return TRUE;
 | 
					        return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue)
 | 
					VidModeGetGamma(ScreenPtr pScreen, float *red, float *green, float *blue)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    pScrn = xf86ScreenToScrn(pScreen);
 | 
				
			||||||
    *red = pScrn->gamma.red;
 | 
					    *red = pScrn->gamma.red;
 | 
				
			||||||
    *green = pScrn->gamma.green;
 | 
					    *green = pScrn->gamma.green;
 | 
				
			||||||
    *blue = pScrn->gamma.blue;
 | 
					    *blue = pScrn->gamma.blue;
 | 
				
			||||||
| 
						 | 
					@ -458,38 +442,32 @@ VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeSetGammaRamp(int scrnIndex, int size, CARD16 *r, CARD16 *g, CARD16 *b)
 | 
					VidModeSetGammaRamp(ScreenPtr pScreen, int size, CARD16 *r, CARD16 *g, CARD16 *b)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    xf86ChangeGammaRamp(pScreen, size, r, g, b);
 | 
				
			||||||
    xf86ChangeGammaRamp(pScrn->pScreen, size, r, g, b);
 | 
					 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
VidModeGetGammaRamp(int scrnIndex, int size, CARD16 *r, CARD16 *g, CARD16 *b)
 | 
					VidModeGetGammaRamp(ScreenPtr pScreen, int size, CARD16 *r, CARD16 *g, CARD16 *b)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScrn = xf86Screens[scrnIndex];
 | 
					    xf86GetGammaRamp(pScreen, size, r, g, b);
 | 
				
			||||||
    xf86GetGammaRamp(pScrn->pScreen, size, r, g, b);
 | 
					 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
VidModeGetGammaRampSize(int scrnIndex)
 | 
					VidModeGetGammaRampSize(ScreenPtr pScreen)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!VidModeAvailable(scrnIndex))
 | 
					    if (!VidModeAvailable(pScreen))
 | 
				
			||||||
        return 0;
 | 
					        return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return xf86GetGammaRampSize(xf86Screens[scrnIndex]->pScreen);
 | 
					    return xf86GetGammaRampSize(pScreen);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void *
 | 
					void *
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -121,6 +121,7 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
 | 
				
			||||||
        .type = X_Reply,
 | 
					        .type = X_Reply,
 | 
				
			||||||
        .sequenceNumber = client->sequence
 | 
					        .sequenceNumber = client->sequence
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
    void *mode;
 | 
					    void *mode;
 | 
				
			||||||
    int dotClock;
 | 
					    int dotClock;
 | 
				
			||||||
    int ver;
 | 
					    int ver;
 | 
				
			||||||
| 
						 | 
					@ -141,8 +142,9 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
 | 
					    if (!VidModeGetCurrentModeline(pScreen, &mode, &dotClock))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep.dotclock = dotClock;
 | 
					    rep.dotclock = dotClock;
 | 
				
			||||||
| 
						 | 
					@ -220,6 +222,7 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    REQUEST(xXF86VidModeGetAllModeLinesReq);
 | 
					    REQUEST(xXF86VidModeGetAllModeLinesReq);
 | 
				
			||||||
    xXF86VidModeGetAllModeLinesReply rep;
 | 
					    xXF86VidModeGetAllModeLinesReply rep;
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
    void *mode;
 | 
					    void *mode;
 | 
				
			||||||
    int modecount, dotClock;
 | 
					    int modecount, dotClock;
 | 
				
			||||||
    int ver;
 | 
					    int ver;
 | 
				
			||||||
| 
						 | 
					@ -230,14 +233,14 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
    ver = ClientMajorVersion(client);
 | 
					    ver = ClientMajorVersion(client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    modecount = VidModeGetNumOfModes(stuff->screen);
 | 
					    modecount = VidModeGetNumOfModes(pScreen);
 | 
				
			||||||
    if (modecount < 1)
 | 
					    if (modecount < 1)
 | 
				
			||||||
        return VidModeErrorBase + XF86VidModeExtensionDisabled;
 | 
					        return VidModeErrorBase + XF86VidModeExtensionDisabled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
 | 
					    if (!VidModeGetFirstModeline(pScreen, &mode, &dotClock))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep = (xXF86VidModeGetAllModeLinesReply) {
 | 
					    rep = (xXF86VidModeGetAllModeLinesReply) {
 | 
				
			||||||
| 
						 | 
					@ -308,7 +311,7 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
 | 
				
			||||||
            WriteToClient(client, sizeof(xXF86VidModeModeInfo), &mdinf);
 | 
					            WriteToClient(client, sizeof(xXF86VidModeModeInfo), &mdinf);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
 | 
					    } while (VidModeGetNextModeline(pScreen, &mode, &dotClock));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return Success;
 | 
					    return Success;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -331,6 +334,7 @@ ProcXF86VidModeAddModeLine(ClientPtr client)
 | 
				
			||||||
    xXF86OldVidModeAddModeLineReq *oldstuff =
 | 
					    xXF86OldVidModeAddModeLineReq *oldstuff =
 | 
				
			||||||
        (xXF86OldVidModeAddModeLineReq *) client->requestBuffer;
 | 
					        (xXF86OldVidModeAddModeLineReq *) client->requestBuffer;
 | 
				
			||||||
    xXF86VidModeAddModeLineReq newstuff;
 | 
					    xXF86VidModeAddModeLineReq newstuff;
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
    void *mode;
 | 
					    void *mode;
 | 
				
			||||||
    int len;
 | 
					    int len;
 | 
				
			||||||
    int dotClock;
 | 
					    int dotClock;
 | 
				
			||||||
| 
						 | 
					@ -405,6 +409,7 @@ ProcXF86VidModeAddModeLine(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->hsyncstart < stuff->hdisplay ||
 | 
					    if (stuff->hsyncstart < stuff->hdisplay ||
 | 
				
			||||||
        stuff->hsyncend < stuff->hsyncstart ||
 | 
					        stuff->hsyncend < stuff->hsyncstart ||
 | 
				
			||||||
| 
						 | 
					@ -424,14 +429,14 @@ ProcXF86VidModeAddModeLine(ClientPtr client)
 | 
				
			||||||
    if (stuff->after_htotal != 0 || stuff->after_vtotal != 0) {
 | 
					    if (stuff->after_htotal != 0 || stuff->after_vtotal != 0) {
 | 
				
			||||||
        Bool found = FALSE;
 | 
					        Bool found = FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (VidModeGetFirstModeline(stuff->screen, &mode, &dotClock)) {
 | 
					        if (VidModeGetFirstModeline(pScreen, &mode, &dotClock)) {
 | 
				
			||||||
            do {
 | 
					            do {
 | 
				
			||||||
                if ((VidModeGetDotClock(stuff->screen, stuff->dotclock)
 | 
					                if ((VidModeGetDotClock(pScreen, stuff->dotclock)
 | 
				
			||||||
                     == dotClock) && MODEMATCH(mode, stuff)) {
 | 
					                     == dotClock) && MODEMATCH(mode, stuff)) {
 | 
				
			||||||
                    found = TRUE;
 | 
					                    found = TRUE;
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
 | 
					            } while (VidModeGetNextModeline(pScreen, &mode, &dotClock));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (!found)
 | 
					        if (!found)
 | 
				
			||||||
            return BadValue;
 | 
					            return BadValue;
 | 
				
			||||||
| 
						 | 
					@ -457,7 +462,7 @@ ProcXF86VidModeAddModeLine(ClientPtr client)
 | 
				
			||||||
        ErrorF("AddModeLine - Privates in request have been ignored\n");
 | 
					        ErrorF("AddModeLine - Privates in request have been ignored\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Check that the mode is consistent with the monitor specs */
 | 
					    /* Check that the mode is consistent with the monitor specs */
 | 
				
			||||||
    switch (VidModeCheckModeForMonitor(stuff->screen, mode)) {
 | 
					    switch (VidModeCheckModeForMonitor(pScreen, mode)) {
 | 
				
			||||||
    case MODE_OK:
 | 
					    case MODE_OK:
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case MODE_HSYNC:
 | 
					    case MODE_HSYNC:
 | 
				
			||||||
| 
						 | 
					@ -474,14 +479,14 @@ ProcXF86VidModeAddModeLine(ClientPtr client)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Check that the driver is happy with the mode */
 | 
					    /* Check that the driver is happy with the mode */
 | 
				
			||||||
    if (VidModeCheckModeForDriver(stuff->screen, mode) != MODE_OK) {
 | 
					    if (VidModeCheckModeForDriver(pScreen, mode) != MODE_OK) {
 | 
				
			||||||
        free(mode);
 | 
					        free(mode);
 | 
				
			||||||
        return VidModeErrorBase + XF86VidModeModeUnsuitable;
 | 
					        return VidModeErrorBase + XF86VidModeModeUnsuitable;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    VidModeSetCrtcForMode(stuff->screen, mode);
 | 
					    VidModeSetCrtcForMode(pScreen, mode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    VidModeAddModeline(stuff->screen, mode);
 | 
					    VidModeAddModeline(pScreen, mode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
 | 
					    if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
 | 
				
			||||||
        ErrorF("AddModeLine - Succeeded\n");
 | 
					        ErrorF("AddModeLine - Succeeded\n");
 | 
				
			||||||
| 
						 | 
					@ -495,6 +500,7 @@ ProcXF86VidModeDeleteModeLine(ClientPtr client)
 | 
				
			||||||
    xXF86OldVidModeDeleteModeLineReq *oldstuff =
 | 
					    xXF86OldVidModeDeleteModeLineReq *oldstuff =
 | 
				
			||||||
        (xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer;
 | 
					        (xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer;
 | 
				
			||||||
    xXF86VidModeDeleteModeLineReq newstuff;
 | 
					    xXF86VidModeDeleteModeLineReq newstuff;
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
    void *mode;
 | 
					    void *mode;
 | 
				
			||||||
    int len, dotClock;
 | 
					    int len, dotClock;
 | 
				
			||||||
    int ver;
 | 
					    int ver;
 | 
				
			||||||
| 
						 | 
					@ -557,8 +563,9 @@ ProcXF86VidModeDeleteModeLine(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
 | 
					    if (!VidModeGetCurrentModeline(pScreen, &mode, &dotClock))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
 | 
					    if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
 | 
				
			||||||
| 
						 | 
					@ -577,11 +584,11 @@ ProcXF86VidModeDeleteModeLine(ClientPtr client)
 | 
				
			||||||
             VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
 | 
					             VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
 | 
				
			||||||
             VidModeGetModeValue(mode, VIDMODE_FLAGS));
 | 
					             VidModeGetModeValue(mode, VIDMODE_FLAGS));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
 | 
					    if ((VidModeGetDotClock(pScreen, stuff->dotclock) == dotClock) &&
 | 
				
			||||||
        MODEMATCH(mode, stuff))
 | 
					        MODEMATCH(mode, stuff))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
 | 
					    if (!VidModeGetFirstModeline(pScreen, &mode, &dotClock))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    do {
 | 
					    do {
 | 
				
			||||||
| 
						 | 
					@ -601,14 +608,14 @@ ProcXF86VidModeDeleteModeLine(ClientPtr client)
 | 
				
			||||||
                 VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
 | 
					                 VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
 | 
				
			||||||
                 VidModeGetModeValue(mode, VIDMODE_FLAGS));
 | 
					                 VidModeGetModeValue(mode, VIDMODE_FLAGS));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
 | 
					        if ((VidModeGetDotClock(pScreen, stuff->dotclock) == dotClock) &&
 | 
				
			||||||
            MODEMATCH(mode, stuff)) {
 | 
					            MODEMATCH(mode, stuff)) {
 | 
				
			||||||
            VidModeDeleteModeline(stuff->screen, mode);
 | 
					            VidModeDeleteModeline(pScreen, mode);
 | 
				
			||||||
            if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
 | 
					            if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
 | 
				
			||||||
                ErrorF("DeleteModeLine - Succeeded\n");
 | 
					                ErrorF("DeleteModeLine - Succeeded\n");
 | 
				
			||||||
            return Success;
 | 
					            return Success;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
 | 
					    } while (VidModeGetNextModeline(pScreen, &mode, &dotClock));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return BadValue;
 | 
					    return BadValue;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -620,6 +627,7 @@ ProcXF86VidModeModModeLine(ClientPtr client)
 | 
				
			||||||
    xXF86OldVidModeModModeLineReq *oldstuff =
 | 
					    xXF86OldVidModeModModeLineReq *oldstuff =
 | 
				
			||||||
        (xXF86OldVidModeModModeLineReq *) client->requestBuffer;
 | 
					        (xXF86OldVidModeModModeLineReq *) client->requestBuffer;
 | 
				
			||||||
    xXF86VidModeModModeLineReq newstuff;
 | 
					    xXF86VidModeModModeLineReq newstuff;
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
    void *mode, *modetmp;
 | 
					    void *mode, *modetmp;
 | 
				
			||||||
    int len, dotClock;
 | 
					    int len, dotClock;
 | 
				
			||||||
    int ver;
 | 
					    int ver;
 | 
				
			||||||
| 
						 | 
					@ -677,8 +685,9 @@ ProcXF86VidModeModModeLine(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
 | 
					    if (!VidModeGetCurrentModeline(pScreen, &mode, &dotClock))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    modetmp = VidModeCreateMode();
 | 
					    modetmp = VidModeCreateMode();
 | 
				
			||||||
| 
						 | 
					@ -699,7 +708,7 @@ ProcXF86VidModeModModeLine(ClientPtr client)
 | 
				
			||||||
        ErrorF("ModModeLine - Privates in request have been ignored\n");
 | 
					        ErrorF("ModModeLine - Privates in request have been ignored\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Check that the mode is consistent with the monitor specs */
 | 
					    /* Check that the mode is consistent with the monitor specs */
 | 
				
			||||||
    switch (VidModeCheckModeForMonitor(stuff->screen, modetmp)) {
 | 
					    switch (VidModeCheckModeForMonitor(pScreen, modetmp)) {
 | 
				
			||||||
    case MODE_OK:
 | 
					    case MODE_OK:
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case MODE_HSYNC:
 | 
					    case MODE_HSYNC:
 | 
				
			||||||
| 
						 | 
					@ -716,7 +725,7 @@ ProcXF86VidModeModModeLine(ClientPtr client)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Check that the driver is happy with the mode */
 | 
					    /* Check that the driver is happy with the mode */
 | 
				
			||||||
    if (VidModeCheckModeForDriver(stuff->screen, modetmp) != MODE_OK) {
 | 
					    if (VidModeCheckModeForDriver(pScreen, modetmp) != MODE_OK) {
 | 
				
			||||||
        free(modetmp);
 | 
					        free(modetmp);
 | 
				
			||||||
        return VidModeErrorBase + XF86VidModeModeUnsuitable;
 | 
					        return VidModeErrorBase + XF86VidModeModeUnsuitable;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -733,8 +742,8 @@ ProcXF86VidModeModModeLine(ClientPtr client)
 | 
				
			||||||
    VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
 | 
					    VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
 | 
				
			||||||
    VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
 | 
					    VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    VidModeSetCrtcForMode(stuff->screen, mode);
 | 
					    VidModeSetCrtcForMode(pScreen, mode);
 | 
				
			||||||
    VidModeSwitchMode(stuff->screen, mode);
 | 
					    VidModeSwitchMode(pScreen, mode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
 | 
					    if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
 | 
				
			||||||
        ErrorF("ModModeLine - Succeeded\n");
 | 
					        ErrorF("ModModeLine - Succeeded\n");
 | 
				
			||||||
| 
						 | 
					@ -749,6 +758,7 @@ ProcXF86VidModeValidateModeLine(ClientPtr client)
 | 
				
			||||||
        (xXF86OldVidModeValidateModeLineReq *) client->requestBuffer;
 | 
					        (xXF86OldVidModeValidateModeLineReq *) client->requestBuffer;
 | 
				
			||||||
    xXF86VidModeValidateModeLineReq newstuff;
 | 
					    xXF86VidModeValidateModeLineReq newstuff;
 | 
				
			||||||
    xXF86VidModeValidateModeLineReply rep;
 | 
					    xXF86VidModeValidateModeLineReply rep;
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
    void *mode, *modetmp = NULL;
 | 
					    void *mode, *modetmp = NULL;
 | 
				
			||||||
    int len, status, dotClock;
 | 
					    int len, status, dotClock;
 | 
				
			||||||
    int ver;
 | 
					    int ver;
 | 
				
			||||||
| 
						 | 
					@ -802,6 +812,7 @@ ProcXF86VidModeValidateModeLine(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    status = MODE_OK;
 | 
					    status = MODE_OK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -815,7 +826,7 @@ ProcXF86VidModeValidateModeLine(ClientPtr client)
 | 
				
			||||||
        goto status_reply;
 | 
					        goto status_reply;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
 | 
					    if (!VidModeGetCurrentModeline(pScreen, &mode, &dotClock))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    modetmp = VidModeCreateMode();
 | 
					    modetmp = VidModeCreateMode();
 | 
				
			||||||
| 
						 | 
					@ -836,11 +847,11 @@ ProcXF86VidModeValidateModeLine(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Check that the mode is consistent with the monitor specs */
 | 
					    /* Check that the mode is consistent with the monitor specs */
 | 
				
			||||||
    if ((status =
 | 
					    if ((status =
 | 
				
			||||||
         VidModeCheckModeForMonitor(stuff->screen, modetmp)) != MODE_OK)
 | 
					         VidModeCheckModeForMonitor(pScreen, modetmp)) != MODE_OK)
 | 
				
			||||||
        goto status_reply;
 | 
					        goto status_reply;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Check that the driver is happy with the mode */
 | 
					    /* Check that the driver is happy with the mode */
 | 
				
			||||||
    status = VidModeCheckModeForDriver(stuff->screen, modetmp);
 | 
					    status = VidModeCheckModeForDriver(pScreen, modetmp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 status_reply:
 | 
					 status_reply:
 | 
				
			||||||
    free(modetmp);
 | 
					    free(modetmp);
 | 
				
			||||||
| 
						 | 
					@ -867,6 +878,7 @@ static int
 | 
				
			||||||
ProcXF86VidModeSwitchMode(ClientPtr client)
 | 
					ProcXF86VidModeSwitchMode(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    REQUEST(xXF86VidModeSwitchModeReq);
 | 
					    REQUEST(xXF86VidModeSwitchModeReq);
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DEBUG_P("XF86VidModeSwitchMode");
 | 
					    DEBUG_P("XF86VidModeSwitchMode");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -874,8 +886,9 @@ ProcXF86VidModeSwitchMode(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    VidModeZoomViewport(stuff->screen, (short) stuff->zoom);
 | 
					    VidModeZoomViewport(pScreen, (short) stuff->zoom);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return Success;
 | 
					    return Success;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -887,6 +900,7 @@ ProcXF86VidModeSwitchToMode(ClientPtr client)
 | 
				
			||||||
    xXF86OldVidModeSwitchToModeReq *oldstuff =
 | 
					    xXF86OldVidModeSwitchToModeReq *oldstuff =
 | 
				
			||||||
        (xXF86OldVidModeSwitchToModeReq *) client->requestBuffer;
 | 
					        (xXF86OldVidModeSwitchToModeReq *) client->requestBuffer;
 | 
				
			||||||
    xXF86VidModeSwitchToModeReq newstuff;
 | 
					    xXF86VidModeSwitchToModeReq newstuff;
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
    void *mode;
 | 
					    void *mode;
 | 
				
			||||||
    int len, dotClock;
 | 
					    int len, dotClock;
 | 
				
			||||||
    int ver;
 | 
					    int ver;
 | 
				
			||||||
| 
						 | 
					@ -941,15 +955,16 @@ ProcXF86VidModeSwitchToMode(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
 | 
					    if (!VidModeGetCurrentModeline(pScreen, &mode, &dotClock))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock)
 | 
					    if ((VidModeGetDotClock(pScreen, stuff->dotclock) == dotClock)
 | 
				
			||||||
        && MODEMATCH(mode, stuff))
 | 
					        && MODEMATCH(mode, stuff))
 | 
				
			||||||
        return Success;
 | 
					        return Success;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
 | 
					    if (!VidModeGetFirstModeline(pScreen, &mode, &dotClock))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    do {
 | 
					    do {
 | 
				
			||||||
| 
						 | 
					@ -969,17 +984,17 @@ ProcXF86VidModeSwitchToMode(ClientPtr client)
 | 
				
			||||||
                 VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
 | 
					                 VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
 | 
				
			||||||
                 VidModeGetModeValue(mode, VIDMODE_FLAGS));
 | 
					                 VidModeGetModeValue(mode, VIDMODE_FLAGS));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
 | 
					        if ((VidModeGetDotClock(pScreen, stuff->dotclock) == dotClock) &&
 | 
				
			||||||
            MODEMATCH(mode, stuff)) {
 | 
					            MODEMATCH(mode, stuff)) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!VidModeSwitchMode(stuff->screen, mode))
 | 
					            if (!VidModeSwitchMode(pScreen, mode))
 | 
				
			||||||
                return BadValue;
 | 
					                return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
 | 
					            if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
 | 
				
			||||||
                ErrorF("SwitchToMode - Succeeded\n");
 | 
					                ErrorF("SwitchToMode - Succeeded\n");
 | 
				
			||||||
            return Success;
 | 
					            return Success;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
 | 
					    } while (VidModeGetNextModeline(pScreen, &mode, &dotClock));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return BadValue;
 | 
					    return BadValue;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -988,6 +1003,7 @@ static int
 | 
				
			||||||
ProcXF86VidModeLockModeSwitch(ClientPtr client)
 | 
					ProcXF86VidModeLockModeSwitch(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    REQUEST(xXF86VidModeLockModeSwitchReq);
 | 
					    REQUEST(xXF86VidModeLockModeSwitchReq);
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
 | 
					    REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -995,8 +1011,9 @@ ProcXF86VidModeLockModeSwitch(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeLockZoom(stuff->screen, (short) stuff->lock))
 | 
					    if (!VidModeLockZoom(pScreen, (short) stuff->lock))
 | 
				
			||||||
        return VidModeErrorBase + XF86VidModeZoomLocked;
 | 
					        return VidModeErrorBase + XF86VidModeZoomLocked;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return Success;
 | 
					    return Success;
 | 
				
			||||||
| 
						 | 
					@ -1013,6 +1030,7 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
 | 
				
			||||||
    CARD32 *hsyncdata, *vsyncdata;
 | 
					    CARD32 *hsyncdata, *vsyncdata;
 | 
				
			||||||
    int i, nHsync, nVrefresh;
 | 
					    int i, nHsync, nVrefresh;
 | 
				
			||||||
    void *monitor;
 | 
					    void *monitor;
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DEBUG_P("XF86VidModeGetMonitor");
 | 
					    DEBUG_P("XF86VidModeGetMonitor");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1020,8 +1038,9 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeGetMonitor(stuff->screen, &monitor))
 | 
					    if (!VidModeGetMonitor(pScreen, &monitor))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
 | 
					    nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
 | 
				
			||||||
| 
						 | 
					@ -1101,6 +1120,7 @@ ProcXF86VidModeGetViewPort(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    REQUEST(xXF86VidModeGetViewPortReq);
 | 
					    REQUEST(xXF86VidModeGetViewPortReq);
 | 
				
			||||||
    xXF86VidModeGetViewPortReply rep;
 | 
					    xXF86VidModeGetViewPortReply rep;
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
    int x, y;
 | 
					    int x, y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DEBUG_P("XF86VidModeGetViewPort");
 | 
					    DEBUG_P("XF86VidModeGetViewPort");
 | 
				
			||||||
| 
						 | 
					@ -1109,8 +1129,9 @@ ProcXF86VidModeGetViewPort(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    VidModeGetViewPort(stuff->screen, &x, &y);
 | 
					    VidModeGetViewPort(pScreen, &x, &y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep = (xXF86VidModeGetViewPortReply) {
 | 
					    rep = (xXF86VidModeGetViewPortReply) {
 | 
				
			||||||
        .type = X_Reply,
 | 
					        .type = X_Reply,
 | 
				
			||||||
| 
						 | 
					@ -1134,6 +1155,7 @@ static int
 | 
				
			||||||
ProcXF86VidModeSetViewPort(ClientPtr client)
 | 
					ProcXF86VidModeSetViewPort(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    REQUEST(xXF86VidModeSetViewPortReq);
 | 
					    REQUEST(xXF86VidModeSetViewPortReq);
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DEBUG_P("XF86VidModeSetViewPort");
 | 
					    DEBUG_P("XF86VidModeSetViewPort");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1141,8 +1163,9 @@ ProcXF86VidModeSetViewPort(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeSetViewPort(stuff->screen, stuff->x, stuff->y))
 | 
					    if (!VidModeSetViewPort(pScreen, stuff->x, stuff->y))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return Success;
 | 
					    return Success;
 | 
				
			||||||
| 
						 | 
					@ -1153,6 +1176,7 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    REQUEST(xXF86VidModeGetDotClocksReq);
 | 
					    REQUEST(xXF86VidModeGetDotClocksReq);
 | 
				
			||||||
    xXF86VidModeGetDotClocksReply rep;
 | 
					    xXF86VidModeGetDotClocksReply rep;
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
    int n;
 | 
					    int n;
 | 
				
			||||||
    int numClocks;
 | 
					    int numClocks;
 | 
				
			||||||
    CARD32 dotclock;
 | 
					    CARD32 dotclock;
 | 
				
			||||||
| 
						 | 
					@ -1165,8 +1189,9 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
 | 
					    numClocks = VidModeGetNumOfClocks(pScreen, &ClockProg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep = (xXF86VidModeGetDotClocksReply) {
 | 
					    rep = (xXF86VidModeGetDotClocksReply) {
 | 
				
			||||||
        .type = X_Reply,
 | 
					        .type = X_Reply,
 | 
				
			||||||
| 
						 | 
					@ -1182,7 +1207,7 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
 | 
				
			||||||
        Clocks = calloc(numClocks, sizeof(int));
 | 
					        Clocks = calloc(numClocks, sizeof(int));
 | 
				
			||||||
        if (!Clocks)
 | 
					        if (!Clocks)
 | 
				
			||||||
            return BadValue;
 | 
					            return BadValue;
 | 
				
			||||||
        if (!VidModeGetClocks(stuff->screen, Clocks)) {
 | 
					        if (!VidModeGetClocks(pScreen, Clocks)) {
 | 
				
			||||||
            free(Clocks);
 | 
					            free(Clocks);
 | 
				
			||||||
            return BadValue;
 | 
					            return BadValue;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -1218,6 +1243,7 @@ static int
 | 
				
			||||||
ProcXF86VidModeSetGamma(ClientPtr client)
 | 
					ProcXF86VidModeSetGamma(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    REQUEST(xXF86VidModeSetGammaReq);
 | 
					    REQUEST(xXF86VidModeSetGammaReq);
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DEBUG_P("XF86VidModeSetGamma");
 | 
					    DEBUG_P("XF86VidModeSetGamma");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1225,8 +1251,9 @@ ProcXF86VidModeSetGamma(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeSetGamma(stuff->screen, ((float) stuff->red) / 10000.,
 | 
					    if (!VidModeSetGamma(pScreen, ((float) stuff->red) / 10000.,
 | 
				
			||||||
                         ((float) stuff->green) / 10000.,
 | 
					                         ((float) stuff->green) / 10000.,
 | 
				
			||||||
                         ((float) stuff->blue) / 10000.))
 | 
					                         ((float) stuff->blue) / 10000.))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
| 
						 | 
					@ -1239,6 +1266,7 @@ ProcXF86VidModeGetGamma(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    REQUEST(xXF86VidModeGetGammaReq);
 | 
					    REQUEST(xXF86VidModeGetGammaReq);
 | 
				
			||||||
    xXF86VidModeGetGammaReply rep;
 | 
					    xXF86VidModeGetGammaReply rep;
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
    float red, green, blue;
 | 
					    float red, green, blue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DEBUG_P("XF86VidModeGetGamma");
 | 
					    DEBUG_P("XF86VidModeGetGamma");
 | 
				
			||||||
| 
						 | 
					@ -1247,8 +1275,9 @@ ProcXF86VidModeGetGamma(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeGetGamma(stuff->screen, &red, &green, &blue))
 | 
					    if (!VidModeGetGamma(pScreen, &red, &green, &blue))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
    rep = (xXF86VidModeGetGammaReply) {
 | 
					    rep = (xXF86VidModeGetGammaReply) {
 | 
				
			||||||
        .type = X_Reply,
 | 
					        .type = X_Reply,
 | 
				
			||||||
| 
						 | 
					@ -1273,6 +1302,7 @@ ProcXF86VidModeGetGamma(ClientPtr client)
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
ProcXF86VidModeSetGammaRamp(ClientPtr client)
 | 
					ProcXF86VidModeSetGammaRamp(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
    CARD16 *r, *g, *b;
 | 
					    CARD16 *r, *g, *b;
 | 
				
			||||||
    int length;
 | 
					    int length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1280,8 +1310,9 @@ ProcXF86VidModeSetGammaRamp(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->size != VidModeGetGammaRampSize(stuff->screen))
 | 
					    if (stuff->size != VidModeGetGammaRampSize(pScreen))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    length = (stuff->size + 1) & ~1;
 | 
					    length = (stuff->size + 1) & ~1;
 | 
				
			||||||
| 
						 | 
					@ -1292,7 +1323,7 @@ ProcXF86VidModeSetGammaRamp(ClientPtr client)
 | 
				
			||||||
    g = r + length;
 | 
					    g = r + length;
 | 
				
			||||||
    b = g + length;
 | 
					    b = g + length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!VidModeSetGammaRamp(stuff->screen, stuff->size, r, g, b))
 | 
					    if (!VidModeSetGammaRamp(pScreen, stuff->size, r, g, b))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return Success;
 | 
					    return Success;
 | 
				
			||||||
| 
						 | 
					@ -1305,6 +1336,7 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
 | 
				
			||||||
    int length;
 | 
					    int length;
 | 
				
			||||||
    size_t ramplen = 0;
 | 
					    size_t ramplen = 0;
 | 
				
			||||||
    xXF86VidModeGetGammaRampReply rep;
 | 
					    xXF86VidModeGetGammaRampReply rep;
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    REQUEST(xXF86VidModeGetGammaRampReq);
 | 
					    REQUEST(xXF86VidModeGetGammaRampReq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1312,8 +1344,9 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->size != VidModeGetGammaRampSize(stuff->screen))
 | 
					    if (stuff->size != VidModeGetGammaRampSize(pScreen))
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    length = (stuff->size + 1) & ~1;
 | 
					    length = (stuff->size + 1) & ~1;
 | 
				
			||||||
| 
						 | 
					@ -1323,7 +1356,7 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
 | 
				
			||||||
            return BadAlloc;
 | 
					            return BadAlloc;
 | 
				
			||||||
        ramplen = length * 3 * sizeof(CARD16);
 | 
					        ramplen = length * 3 * sizeof(CARD16);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!VidModeGetGammaRamp(stuff->screen, stuff->size,
 | 
					        if (!VidModeGetGammaRamp(pScreen, stuff->size,
 | 
				
			||||||
                                 ramp, ramp + length, ramp + (length * 2))) {
 | 
					                                 ramp, ramp + length, ramp + (length * 2))) {
 | 
				
			||||||
            free(ramp);
 | 
					            free(ramp);
 | 
				
			||||||
            return BadValue;
 | 
					            return BadValue;
 | 
				
			||||||
| 
						 | 
					@ -1355,6 +1388,7 @@ static int
 | 
				
			||||||
ProcXF86VidModeGetGammaRampSize(ClientPtr client)
 | 
					ProcXF86VidModeGetGammaRampSize(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    xXF86VidModeGetGammaRampSizeReply rep;
 | 
					    xXF86VidModeGetGammaRampSizeReply rep;
 | 
				
			||||||
 | 
					    ScreenPtr pScreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    REQUEST(xXF86VidModeGetGammaRampSizeReq);
 | 
					    REQUEST(xXF86VidModeGetGammaRampSizeReq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1362,12 +1396,13 @@ ProcXF86VidModeGetGammaRampSize(ClientPtr client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (stuff->screen >= screenInfo.numScreens)
 | 
					    if (stuff->screen >= screenInfo.numScreens)
 | 
				
			||||||
        return BadValue;
 | 
					        return BadValue;
 | 
				
			||||||
 | 
					    pScreen = screenInfo.screens[stuff->screen];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep = (xXF86VidModeGetGammaRampSizeReply) {
 | 
					    rep = (xXF86VidModeGetGammaRampSizeReply) {
 | 
				
			||||||
        .type = X_Reply,
 | 
					        .type = X_Reply,
 | 
				
			||||||
        .sequenceNumber = client->sequence,
 | 
					        .sequenceNumber = client->sequence,
 | 
				
			||||||
        .length = 0,
 | 
					        .length = 0,
 | 
				
			||||||
        .size = VidModeGetGammaRampSize(stuff->screen)
 | 
					        .size = VidModeGetGammaRampSize(pScreen)
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    if (client->swapped) {
 | 
					    if (client->swapped) {
 | 
				
			||||||
        swaps(&rep.sequenceNumber);
 | 
					        swaps(&rep.sequenceNumber);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue