summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@gmail.com>2008-10-27 22:39:52 +0100
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-10-28 15:09:19 -0200
commitc0447d33c82829248e642b3156fd9a3c0d0eb709 (patch)
tree6e5680c1c9c9880c22e88c43005b3a96e4de5756
parentf2c83671cccc42345bfc9b506365936bbb6b9ef0 (diff)
Some corrections in the CRTC code.
* Make screen resizing behave better with XAA. * Move some local variable declarations to the top of the function definition to conform ANSI C. * Make the Lynx panel modesetting code to actually program the panel sync pulse width in dualhead mode. * Also, fix a crash when using libpciaccess (the memory wasn't being unmapped).
-rw-r--r--src/smi_crtc.c34
-rw-r--r--src/smi_driver.c53
-rw-r--r--src/smilynx_crtc.c185
-rw-r--r--src/smilynx_hw.c30
-rw-r--r--src/smilynx_output.c20
5 files changed, 180 insertions, 142 deletions
diff --git a/src/smi_crtc.c b/src/smi_crtc.c
index 626dc46..429df28 100644
--- a/src/smi_crtc.c
+++ b/src/smi_crtc.c
@@ -120,12 +120,14 @@ SMI_CrtcShadowAllocate (xf86CrtcPtr crtc, int width, int height)
ENTER();
- int aligned_pitch = (width * pSmi->Bpp + 15) & ~15;
+ if(!pSmi->NoAccel && pSmi->useEXA){
+ int aligned_pitch = (width * pSmi->Bpp + 15) & ~15;
- crtcPriv->shadowArea = exaOffscreenAlloc(pScrn->pScreen, aligned_pitch * height, 16, TRUE, NULL, NULL);
+ crtcPriv->shadowArea = exaOffscreenAlloc(pScrn->pScreen, aligned_pitch * height, 16, TRUE, NULL, NULL);
- if(crtcPriv->shadowArea)
- RETURN(pSmi->FBBase + crtcPriv->shadowArea->offset);
+ if(crtcPriv->shadowArea)
+ RETURN(pSmi->FBBase + crtcPriv->shadowArea->offset);
+ }
RETURN(NULL);
}
@@ -135,10 +137,11 @@ SMI_CrtcShadowCreate (xf86CrtcPtr crtc, void *data, int width, int height)
{
ScrnInfoPtr pScrn = crtc->scrn;
SMIPtr pSmi = SMIPTR(pScrn);
+ int aligned_pitch;
ENTER();
- int aligned_pitch = (width * pSmi->Bpp + 15) & ~15;
+ aligned_pitch = (width * pSmi->Bpp + 15) & ~15;
RETURN(GetScratchPixmapHeader(pScrn->pScreen,width,height,pScrn->depth,
pScrn->bitsPerPixel,aligned_pitch,data));
@@ -224,11 +227,11 @@ SMI_CrtcConfigResize(ScrnInfoPtr pScrn,
ENTER();
- int aligned_pitch = (width*pSmi->Bpp + 15) & ~15;
-
/* Allocate another offscreen area and use it as screen, if it really has to be resized */
if(!pSmi->NoAccel && pSmi->useEXA &&
( !pSmi->fbArea || width != pScrn->virtualX || height != pScrn->virtualY )){
+ int aligned_pitch = (width*pSmi->Bpp + 15) & ~15;
+
ExaOffscreenArea* fbArea = exaOffscreenAlloc(pScrn->pScreen, aligned_pitch*height, 16, TRUE, NULL, NULL);
if(!fbArea){
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -243,19 +246,24 @@ SMI_CrtcConfigResize(ScrnInfoPtr pScrn,
pSmi->FBOffset = fbArea->offset;
pScrn->fbOffset = pSmi->FBOffset + pSmi->fbMapOffset;
- if(pScrn->pScreen->GetScreenPixmap(pScrn->pScreen)->devPrivate.ptr)
- pScrn->pScreen->ModifyPixmapHeader(pScrn->pScreen->GetScreenPixmap(pScrn->pScreen),
- -1,-1,-1,-1,-1, pSmi->FBBase + pSmi->FBOffset);
- else
+ if(pScrn->pixmapPrivate.ptr)
/* Framebuffer access is disabled */
pScrn->pixmapPrivate.ptr = pSmi->FBBase + pSmi->FBOffset;
+ else
+ pScrn->pScreen->ModifyPixmapHeader(pScrn->pScreen->GetScreenPixmap(pScrn->pScreen),
+ -1,-1,-1,-1,-1, pSmi->FBBase + pSmi->FBOffset);
+
+ /* Modify the screen pitch */
+ pScrn->displayWidth = aligned_pitch / pSmi->Bpp;
+ pScrn->pScreen->ModifyPixmapHeader(pScrn->pScreen->GetScreenPixmap(pScrn->pScreen),
+ -1, -1, -1, -1, aligned_pitch, NULL);
}
+ /* Modify the screen dimensions */
pScrn->virtualX = width;
pScrn->virtualY = height;
- pScrn->displayWidth = aligned_pitch / pSmi->Bpp;
pScrn->pScreen->ModifyPixmapHeader(pScrn->pScreen->GetScreenPixmap(pScrn->pScreen),
- width, height, -1, -1, aligned_pitch, NULL);
+ width, height, -1, -1, 0, NULL);
/* Setup each crtc video processor */
for(i=0;i<crtcConf->num_crtc;i++){
diff --git a/src/smi_driver.c b/src/smi_driver.c
index 9b4d07a..3906555 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -877,6 +877,25 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, from, "Dual head %sabled\n",
pSmi->Dualhead ? "en" : "dis");
+ if (!pSmi->NoAccel) {
+ char *strptr;
+
+ from = X_DEFAULT;
+ if ((strptr = (char *)xf86GetOptValString(pSmi->Options,
+ OPTION_ACCELMETHOD))) {
+ if (!xf86NameCmp(strptr,"XAA")) {
+ from = X_CONFIG;
+ pSmi->useEXA = FALSE;
+ } else if(!xf86NameCmp(strptr,"EXA")) {
+ from = X_CONFIG;
+ pSmi->useEXA = TRUE;
+ }
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s acceleration architecture\n",
+ pSmi->useEXA ? "EXA" : "XAA");
+ }
+
SMI_MapMmio(pScrn);
SMI_DetectMem(pScrn);
SMI_MapMem(pScrn);
@@ -938,7 +957,8 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
if(!SMI_OutputPreInit(pScrn))
RETURN(FALSE);
- if (!xf86InitialConfiguration (pScrn, TRUE)){
+ /* Only allow growing the screen dimensions if EXA is being used */
+ if (!xf86InitialConfiguration (pScrn, !pSmi->NoAccel && pSmi->useEXA)){
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
RETURN(FALSE);
}
@@ -962,25 +982,6 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
RETURN(FALSE);
}
- if (!pSmi->NoAccel) {
- char *strptr;
-
- from = X_DEFAULT;
- if ((strptr = (char *)xf86GetOptValString(pSmi->Options,
- OPTION_ACCELMETHOD))) {
- if (!xf86NameCmp(strptr,"XAA")) {
- from = X_CONFIG;
- pSmi->useEXA = FALSE;
- } else if(!xf86NameCmp(strptr,"EXA")) {
- from = X_CONFIG;
- pSmi->useEXA = TRUE;
- }
- }
-
- xf86DrvMsg(pScrn->scrnIndex, from, "Using %s acceleration architecture\n",
- pSmi->useEXA ? "EXA" : "XAA");
- }
-
xf86LoaderReqSymLists(fbSymbols, NULL);
/* Load XAA or EXA if needed */
@@ -1499,7 +1500,7 @@ SMI_MapMem(ScrnInfoPtr pScrn)
void **result = (void**)&pSmi->FBBase;
int err = pci_device_map_range(pSmi->PciInfo,
pScrn->memPhysBase +
- pSmi->fbMapOffset,
+ pSmi->fbMapOffset,
pSmi->videoRAMBytes,
PCI_DEV_MAP_FLAG_WRITABLE |
PCI_DEV_MAP_FLAG_WRITE_COMBINE,
@@ -1590,14 +1591,24 @@ SMI_UnmapMem(ScrnInfoPtr pScrn)
SMI_DisableMmio(pScrn);
if (pSmi->MapBase) {
+#ifndef XSERVER_LIBPCIACCESS
xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSmi->MapBase,
pSmi->MapSize);
+#else
+ pci_device_unmap_range(pSmi->PciInfo, (pointer)pSmi->MapBase,
+ pSmi->MapSize);
+#endif
pSmi->MapBase = NULL;
}
if (pSmi->FBBase) {
+#ifndef XSERVER_LIBPCIACCESS
xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pSmi->FBBase,
pSmi->videoRAMBytes);
+#else
+ pci_device_unmap_range(pSmi->PciInfo, (pointer)pSmi->FBBase,
+ pSmi->videoRAMBytes);
+#endif
pSmi->FBBase = NULL;
}
diff --git a/src/smilynx_crtc.c b/src/smilynx_crtc.c
index 5166ea1..faeb0e3 100644
--- a/src/smilynx_crtc.c
+++ b/src/smilynx_crtc.c
@@ -39,6 +39,7 @@ SMILynx_CrtcVideoInit_crt(xf86CrtcPtr crtc)
{
ScrnInfoPtr pScrn=crtc->scrn;
SMIPtr pSmi = SMIPTR(pScrn);
+ int pitch;
ENTER();
@@ -57,7 +58,7 @@ SMILynx_CrtcVideoInit_crt(xf86CrtcPtr crtc)
break;
}
- int pitch = (crtc->rotatedData? crtc->mode.HDisplay : pScrn->displayWidth) * pSmi->Bpp;
+ pitch = (crtc->rotatedData? crtc->mode.HDisplay : pScrn->displayWidth) * pSmi->Bpp;
pitch = (pitch + 15) & ~15;
WRITE_VPR(pSmi, 0x10, (crtc->mode.HDisplay * pSmi->Bpp) >> 3 << 16 | pitch >> 3);
@@ -70,18 +71,21 @@ SMILynx_CrtcVideoInit_lcd(xf86CrtcPtr crtc)
{
ScrnInfoPtr pScrn=crtc->scrn;
SMIPtr pSmi = SMIPTR(pScrn);
+ CARD8 SR31;
+ CARD16 fifo_readoffset,fifo_writeoffset;
ENTER();
/* Set display depth */
- CARD8 SR31=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x31);
+ SR31=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x31);
if (pScrn->bitsPerPixel > 8)
SR31 |= 0x40; /* 16 bpp */
else
SR31 &= ~0x40; /* 8 bpp */
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x31,SR31);
- CARD16 fifo_readoffset = (crtc->rotatedData? crtc->mode.HDisplay : pScrn->displayWidth) * pSmi->Bpp;
+ /* FIFO1/2 Read Offset*/
+ fifo_readoffset = (crtc->rotatedData? crtc->mode.HDisplay : pScrn->displayWidth) * pSmi->Bpp;
fifo_readoffset = ((fifo_readoffset + 15) & ~15) >> 3;
/* FIFO1 Read Offset */
@@ -93,7 +97,7 @@ SMILynx_CrtcVideoInit_lcd(xf86CrtcPtr crtc)
(((fifo_readoffset & 0x00000300) >> 8) << 6));
/* FIFO Write Offset */
- CARD16 fifo_writeoffset = crtc->mode.HDisplay * pSmi->Bpp >> 3;
+ fifo_writeoffset = crtc->mode.HDisplay * pSmi->Bpp >> 3;
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x48, fifo_writeoffset & 0x000000FF);
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x49, (fifo_writeoffset & 0x00000300) >> 8);
@@ -108,6 +112,7 @@ SMI730_CrtcVideoInit(xf86CrtcPtr crtc)
{
ScrnInfoPtr pScrn=crtc->scrn;
SMIPtr pSmi = SMIPTR(pScrn);
+ int pitch;
ENTER();
@@ -130,7 +135,7 @@ SMI730_CrtcVideoInit(xf86CrtcPtr crtc)
break;
}
- int pitch = (crtc->rotatedData? crtc->mode.HDisplay : pScrn->displayWidth) * pSmi->Bpp;
+ pitch = (crtc->rotatedData? crtc->mode.HDisplay : pScrn->displayWidth) * pSmi->Bpp;
pitch = (pitch + 15) & ~15;
WRITE_VPR(pSmi, 0x10, (crtc->mode.HDisplay * pSmi->Bpp) >> 3 << 16 | pitch >> 3);
@@ -317,51 +322,54 @@ SMILynx_CrtcModeSet_crt(xf86CrtcPtr crtc,
VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9E,
VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9E) & ~0x20);
- unsigned long HTotal=(mode->CrtcHTotal>>3)-5;
- unsigned long HDisplay=(mode->CrtcHDisplay>>3)-1;
- unsigned long HBlankStart=(mode->CrtcHBlankStart>>3)-1;
- unsigned long HBlankEnd=(mode->CrtcHBlankEnd>>3)-1;
- unsigned long HSyncStart=mode->CrtcHSyncStart>>3;
- unsigned long HSyncEnd=mode->CrtcHSyncEnd>>3;
- unsigned long VTotal=mode->CrtcVTotal-2;
- unsigned long VDisplay=mode->CrtcVDisplay-1;
- unsigned long VBlankStart=mode->CrtcVBlankStart-1;
- unsigned long VBlankEnd=mode->CrtcVBlankEnd-1;
- unsigned long VSyncStart=mode->CrtcVSyncStart;
- unsigned long VSyncEnd=mode->CrtcVSyncEnd;
-
- if((mode->CrtcHBlankEnd >> 3) == (mode->CrtcHTotal >> 3)) HBlankEnd=0;
- if(mode->CrtcVBlankEnd == mode->CrtcVTotal) VBlankEnd=0;
-
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x40, HTotal & 0xFF );
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x41, HBlankStart & 0xFF);
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x42, HBlankEnd & 0x1F);
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x43, HSyncStart & 0xFF);
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x44,
- (HBlankEnd & 0x20) >> 5 << 7 |
- (HSyncEnd & 0x1F) );
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x45, VTotal & 0xFF );
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x46, VBlankStart & 0xFF );
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x47, VBlankEnd & 0xFF );
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x48, VSyncStart & 0xFF );
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x49, VSyncEnd & 0x0F );
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x4A,
- (VSyncStart & 0x200) >> 9 << 7 |
- (VDisplay & 0x200) >> 9 << 6 |
- (VTotal & 0x200) >> 9 << 5 |
- (VBlankStart & 0x100) >> 8 << 3 |
- (VSyncStart & 0x100) >> 8 << 2 |
- (VDisplay & 0x100) >> 8 << 1 |
- (VTotal & 0x100) >> 8 << 0 );
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x4B,
- ((mode->Flags & V_NVSYNC)?1:0) << 7 |
- ((mode->Flags & V_NHSYNC)?1:0) << 6 |
- (VBlankStart & 0x200) >> 9 << 5 );
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x4C, HDisplay & 0xFF );
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x4D, VDisplay & 0xFF );
- VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33,
- (HBlankEnd & 0xC0) >> 6 << 5 |
- (VBlankEnd & 0x300) >> 8 << 3);
+ {
+ unsigned long HTotal=(mode->CrtcHTotal>>3)-5;
+ unsigned long HDisplay=(mode->CrtcHDisplay>>3)-1;
+ unsigned long HBlankStart=(mode->CrtcHBlankStart>>3)-1;
+ unsigned long HBlankEnd=(mode->CrtcHBlankEnd>>3)-1;
+ unsigned long HSyncStart=mode->CrtcHSyncStart>>3;
+ unsigned long HSyncEnd=mode->CrtcHSyncEnd>>3;
+ unsigned long VTotal=mode->CrtcVTotal-2;
+ unsigned long VDisplay=mode->CrtcVDisplay-1;
+ unsigned long VBlankStart=mode->CrtcVBlankStart-1;
+ unsigned long VBlankEnd=mode->CrtcVBlankEnd-1;
+ unsigned long VSyncStart=mode->CrtcVSyncStart;
+ unsigned long VSyncEnd=mode->CrtcVSyncEnd;
+
+ if((mode->CrtcHBlankEnd >> 3) == (mode->CrtcHTotal >> 3)) HBlankEnd=0;
+ if(mode->CrtcVBlankEnd == mode->CrtcVTotal) VBlankEnd=0;
+
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x40, HTotal & 0xFF );
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x41, HBlankStart & 0xFF);
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x42, HBlankEnd & 0x1F);
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x43, HSyncStart & 0xFF);
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x44,
+ (HBlankEnd & 0x20) >> 5 << 7 |
+ (HSyncEnd & 0x1F) );
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x45, VTotal & 0xFF );
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x46, VBlankStart & 0xFF );
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x47, VBlankEnd & 0xFF );
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x48, VSyncStart & 0xFF );
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x49, VSyncEnd & 0x0F );
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x4A,
+ (VSyncStart & 0x200) >> 9 << 7 |
+ (VDisplay & 0x200) >> 9 << 6 |
+ (VTotal & 0x200) >> 9 << 5 |
+ (VBlankStart & 0x100) >> 8 << 3 |
+ (VSyncStart & 0x100) >> 8 << 2 |
+ (VDisplay & 0x100) >> 8 << 1 |
+ (VTotal & 0x100) >> 8 << 0 );
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x4B,
+ ((mode->Flags & V_NVSYNC)?1:0) << 7 |
+ ((mode->Flags & V_NHSYNC)?1:0) << 6 |
+ (VBlankStart & 0x200) >> 9 << 5 );
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x4C, HDisplay & 0xFF );
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x4D, VDisplay & 0xFF );
+ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33,
+ (HBlankEnd & 0xC0) >> 6 << 5 |
+ (VBlankEnd & 0x300) >> 8 << 3);
+
+ }
LEAVE();
}
@@ -374,7 +382,7 @@ SMILynx_CrtcModeSet_lcd(xf86CrtcPtr crtc,
{
ScrnInfoPtr pScrn=crtc->scrn;
SMIPtr pSmi = SMIPTR(pScrn);
- CARD8 SR6E, SR6F;
+ CARD8 SR32, SR6E, SR6F;
ENTER();
@@ -405,41 +413,45 @@ SMILynx_CrtcModeSet_lcd(xf86CrtcPtr crtc,
/* Adjust mode timings */
-
- unsigned long HTotal=(mode->CrtcHTotal>>3)-1;
- unsigned long HDisplay=(mode->CrtcHDisplay>>3)-1;
- unsigned long HSyncStart=(mode->CrtcHSyncStart>>3);
- unsigned long VTotal=mode->CrtcVTotal-1;
- unsigned long VDisplay=mode->CrtcVDisplay-1;
- unsigned long VSyncStart=mode->CrtcVSyncStart-1;
-
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x50,
- (VTotal & 0x700) >> 8 << 1 |
- (HSyncStart & 0x100) >> 8 << 0);
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x51,
- (VSyncStart & 0x700) >> 8 << 5 |
- (VDisplay & 0x700) >> 8 << 2 |
- (HDisplay & 0x100) >> 8 << 1 |
- (HTotal & 0x100) >> 8 << 0);
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x52, HTotal & 0xFF);
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x53, HDisplay & 0xFF);
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x54, HSyncStart & 0xFF);
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x55, VTotal & 0xFF);
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x56, VDisplay & 0xFF);
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x57, VSyncStart & 0xFF);
-
- /* XXX - Why is the polarity hardcoded here? */
- CARD8 SR32=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x32);
- SR32 &= ~0x18;
- if (mode->HDisplay == 800) {
- SR32 |= 0x18;
- }
- if ((mode->HDisplay == 1024) && SMI_LYNXM_SERIES(pSmi->Chipset)) {
- SR32 |= 0x18;
+ {
+ unsigned long HTotal=(mode->CrtcHTotal>>3)-1;
+ unsigned long HDisplay=(mode->CrtcHDisplay>>3)-1;
+ unsigned long HSyncStart=(mode->CrtcHSyncStart>>3);
+ unsigned long HSyncWidth=((mode->CrtcHSyncEnd - mode->CrtcHSyncStart) >> 3) - 1;
+ unsigned long VTotal=mode->CrtcVTotal-1;
+ unsigned long VDisplay=mode->CrtcVDisplay-1;
+ unsigned long VSyncStart=mode->CrtcVSyncStart-1;
+ unsigned long VSyncWidth=mode->CrtcVSyncEnd - mode->CrtcVSyncStart - 1;
+
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x50,
+ (VTotal & 0x700) >> 8 << 1 |
+ (HSyncStart & 0x100) >> 8 << 0);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x51,
+ (VSyncStart & 0x700) >> 8 << 5 |
+ (VDisplay & 0x700) >> 8 << 2 |
+ (HDisplay & 0x100) >> 8 << 1 |
+ (HTotal & 0x100) >> 8 << 0);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x52, HTotal & 0xFF);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x53, HDisplay & 0xFF);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x54, HSyncStart & 0xFF);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x55, VTotal & 0xFF);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x56, VDisplay & 0xFF);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x57, VSyncStart & 0xFF);
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x5A,
+ (HSyncWidth & 0x1F) << 3 |
+ (VSyncWidth & 0x07) << 0);
+
+ /* XXX - Why is the polarity hardcoded here? */
+ SR32=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x32);
+ SR32 &= ~0x18;
+ if (mode->HDisplay == 800) {
+ SR32 |= 0x18;
+ }
+ if ((mode->HDisplay == 1024) && SMI_LYNXM_SERIES(pSmi->Chipset)) {
+ SR32 |= 0x18;
+ }
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x32,SR32);
}
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x32,SR32);
-
- /* XXX - sync pulse width? FPR5A */
LEAVE();
}
@@ -450,11 +462,12 @@ SMILynx_CrtcLoadLUT_crt(xf86CrtcPtr crtc)
ScrnInfoPtr pScrn = crtc->scrn;
SMIPtr pSmi = SMIPTR(pScrn);
SMICrtcPrivatePtr crtcPriv = SMICRTC(crtc);
+ CARD8 SR66;
int i;
ENTER();
- CARD8 SR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x66);
+ SR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x66);
/* Write CRT RAM only */
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x66,(SR66 & ~0x30) | 0x20);
diff --git a/src/smilynx_hw.c b/src/smilynx_hw.c
index 8c7aef0..41223e1 100644
--- a/src/smilynx_hw.c
+++ b/src/smilynx_hw.c
@@ -44,23 +44,25 @@ SMILynx_HWInit(ScrnInfoPtr pScrn)
int vgaIOBase = hwp->IOBase;
int vgaCRIndex = vgaIOBase + VGA_CRTC_INDEX_OFFSET;
int vgaCRData = vgaIOBase + VGA_CRTC_DATA_OFFSET;
+ CARD8 SR17, SR20, SR21, SR22, SR24, SR30, SR31, SR32, SR34,
+ SR66, SR68, SR69, SR6A, SR6B;
ENTER();
- CARD8 SR17 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x17);
- CARD8 SR20 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x20);
- CARD8 SR21 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x21);
- CARD8 SR22 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x22);
- CARD8 SR24 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x24);
- CARD8 SR30 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x30);
- CARD8 SR31 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x31);
- CARD8 SR32 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x32);
- CARD8 SR34 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x34);
- CARD8 SR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x66);
- CARD8 SR68 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x68);
- CARD8 SR69 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x69);
- CARD8 SR6A = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x6A);
- CARD8 SR6B = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x6B);
+ SR17 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x17);
+ SR20 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x20);
+ SR21 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x21);
+ SR22 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x22);
+ SR24 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x24);
+ SR30 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x30);
+ SR31 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x31);
+ SR32 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x32);
+ SR34 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x34);
+ SR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x66);
+ SR68 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x68);
+ SR69 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x69);
+ SR6A = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x6A);
+ SR6B = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x6B);
if (pSmi->PCIBurst) {
SR17 |= 0x20;
diff --git a/src/smilynx_output.c b/src/smilynx_output.c
index 54905f2..d55d808 100644
--- a/src/smilynx_output.c
+++ b/src/smilynx_output.c
@@ -40,12 +40,13 @@ SMILynx_OutputDPMS_crt(xf86OutputPtr output, int mode)
ScrnInfoPtr pScrn = output->scrn;
SMIPtr pSmi = SMIPTR(pScrn);
vgaHWPtr hwp = VGAHWPTR(pScrn);
+ CARD8 SR21, SR22, SR31;
ENTER();
- CARD8 SR21=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x21);
- CARD8 SR22=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x22);
- CARD8 SR31=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x31);
+ SR21=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x21);
+ SR22=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x22);
+ SR31=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x31);
switch (mode) {
case DPMSModeOn:
@@ -90,11 +91,12 @@ SMILynx_OutputDPMS_lcd(xf86OutputPtr output, int mode)
{
ScrnInfoPtr pScrn = output->scrn;
SMIPtr pSmi = SMIPTR(pScrn);
+ CARD8 SR21, SR31;
ENTER();
- CARD8 SR21=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x21);
- CARD8 SR31=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x31);
+ SR21=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x21);
+ SR31=VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX,VGA_SEQ_DATA,0x31);
switch (mode) {
case DPMSModeOn:
@@ -177,11 +179,13 @@ SMILynx_OutputDetect_crt(xf86OutputPtr output)
{
SMIPtr pSmi = SMIPTR(output->scrn);
vgaHWPtr hwp = VGAHWPTR(output->scrn);
+ CARD8 SR21, SR7D;
+ Bool status;
ENTER();
- CARD8 SR21 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21);
- CARD8 SR7D = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x7D);
+ SR21 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21);
+ SR7D = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x7D);
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, SR21 & ~0x80); /* Enable DAC */
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x7B, 0x40); /* "TV and RAMDAC Testing Power", Green component */
@@ -191,7 +195,7 @@ SMILynx_OutputDetect_crt(xf86OutputPtr output)
while (hwp->readST01(hwp) & 0x8) ;
while (!(hwp->readST01(hwp) & 0x8)) ;
- Bool status = MMIO_IN8(pSmi->IOBase, 0x3C2) & 0x10;
+ status = MMIO_IN8(pSmi->IOBase, 0x3C2) & 0x10;
/* Restore previous state */
VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, SR21);