? Makefile ? current.diff ? duoview.diff ? savage.4.html ? savage._man Index: savage_accel.c =================================================================== RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v retrieving revision 1.19 diff -u -r1.19 savage_accel.c --- savage_accel.c 26 Mar 2004 17:09:04 -0000 1.19 +++ savage_accel.c 12 Jul 2004 03:05:01 -0000 @@ -212,7 +212,7 @@ void writescan( unsigned long scan, unsigned long color ); static int GetTileAperturePitch(ulong dwWidth, ulong dwBpp); -void SavageSetGBD_M7(ScrnInfoPtr pScrn); +void SavageSetGBD_M7(ScrnInfoPtr pScrn); void SavageSetGBD_Twister(ScrnInfoPtr pScrn); void SavageSetGBD_PM(ScrnInfoPtr pScrn); void SavageSetGBD_2000(ScrnInfoPtr pScrn); @@ -457,14 +457,12 @@ case S3_TWISTER: case S3_PROSAVAGE: case S3_PROSAVAGEDDR: + case S3_SAVAGE2000: SavageSetGBD_Twister(pScrn); break; case S3_SUPERSAVAGE: SavageSetGBD_PM(pScrn); break; - case S3_SAVAGE2000: - SavageSetGBD_2000(pScrn); - break; } } @@ -477,8 +475,8 @@ if (psav->Chipset == S3_SAVAGE4) { bci_enable = BCI_ENABLE; - tile16 = TILE_FORMAT_DESTINATION16; - tile32 = TILE_FORMAT_DESTINATION32; + tile16 = TILE_FORMAT_16BPP; + tile32 = TILE_FORMAT_32BPP; } else { bci_enable = BCI_ENABLE_TWISTER; tile16 = TILE_DESTINATION; @@ -644,8 +642,8 @@ int bci_enable, tile16, tile32; bci_enable = BCI_ENABLE; - tile16 = TILE_FORMAT_DESTINATION16; - tile32 = TILE_FORMAT_DESTINATION32; + tile16 = TILE_FORMAT_16BPP; + tile32 = TILE_FORMAT_32BPP; /* following is the enable case */ @@ -701,9 +699,15 @@ #endif /* MM81C0 and 81C4 are used to control primary stream. */ - OUTREG32(PRI_STREAM_FBUF_ADDR0,0x00000000); - OUTREG32(PRI_STREAM_FBUF_ADDR1,0x00000000); - OUTREG32(PRI_STREAM2_FBUF_ADDR0,0x00000000); +#if 0 + OUTREG32(PRI_STREAM_FBUF_ADDR0,pScrn->fbOffset); + OUTREG32(PRI_STREAM_FBUF_ADDR1,pScrn->fbOffset); + OUTREG32(PRI_STREAM2_FBUF_ADDR0,pScrn->fbOffset); + OUTREG32(PRI_STREAM2_FBUF_ADDR1,pScrn->fbOffset); +#endif + OUTREG32(PRI_STREAM_FBUF_ADDR0,0x00000000); + OUTREG32(PRI_STREAM_FBUF_ADDR1,0x00000000); + OUTREG32(PRI_STREAM2_FBUF_ADDR0,0x00000000); OUTREG32(PRI_STREAM2_FBUF_ADDR1,0x00000000); /* @@ -924,12 +928,20 @@ } /* MM81C0 and 81C4 are used to control primary stream. */ +#if 0 /*OUTREG32(PRI_STREAM_FBUF_ADDR0,0x80000000);*/ - OUTREG32(PRI_STREAM_FBUF_ADDR0,0x00000000); - OUTREG32(PRI_STREAM_FBUF_ADDR1,0x00000000); + OUTREG32(PRI_STREAM_FBUF_ADDR0,pScrn->fbOffset); + OUTREG32(PRI_STREAM_FBUF_ADDR1,pScrn->fbOffset); /*OUTREG32(PRI_STREAM2_FBUF_ADDR0,0x80000000);*/ - OUTREG32(PRI_STREAM2_FBUF_ADDR0,0x00000000); + OUTREG32(PRI_STREAM2_FBUF_ADDR0,pScrn->fbOffset); + OUTREG32(PRI_STREAM2_FBUF_ADDR1,pScrn->fbOffset); +#endif + OUTREG32(PRI_STREAM_FBUF_ADDR0,0x80000000); + OUTREG32(PRI_STREAM_FBUF_ADDR1,0x00000000); + OUTREG32(PRI_STREAM2_FBUF_ADDR0,0x80000000); OUTREG32(PRI_STREAM2_FBUF_ADDR1,0x00000000); + + OUTREG32(0x8128, 0xFFFFFFFFL); OUTREG32(0x812C, 0xFFFFFFFFL); Index: savage_bci.h =================================================================== RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h,v retrieving revision 1.2 diff -u -r1.2 savage_bci.h --- savage_bci.h 22 Feb 2004 16:14:42 -0000 1.2 +++ savage_bci.h 12 Jul 2004 03:05:01 -0000 @@ -20,15 +20,14 @@ #define TILE_FORMAT_LINEAR 0 #define TILE_TEXTURE 2 #define TILE_DESTINATION 1 -#define TILE_FORMAT_DESTINATION16 2 -#define TILE_FORMAT_DESTINATION32 3 +#define TILE_FORMAT_16BPP 2 +#define TILE_FORMAT_32BPP 3 /* BD - BCI enable */ /* savage4, MX, IX, 3D */ #define BCI_ENABLE 8 -/* twister, prosavage */ -/* not sure which one supersavage fits into */ -#define BCI_ENABLE_TWISTER 0 +/* prosavage, supersavage, DDR, 2000? */ +#define BCI_ENABLE_TWISTER 0 #define S3_BIG_ENDIAN 4 #define S3_LITTLE_ENDIAN 0 Index: savage_cursor.c =================================================================== RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v retrieving revision 1.2 diff -u -r1.2 savage_cursor.c --- savage_cursor.c 22 Feb 2004 16:14:42 -0000 1.2 +++ savage_cursor.c 12 Jul 2004 03:05:01 -0000 @@ -96,7 +96,8 @@ SavageShowCursor(ScrnInfoPtr pScrn) { /* Turn cursor on. */ - outCRReg( 0x45, inCRReg(0x45) | 0x01 ); + outCRReg( 0x45, inCRReg(0x45) | 0x01 ); /* cursor1 bit 0*/ + outCRReg( 0x45, inCRReg(0x45) | 0x04 ); /* cursor2 bit 2*/ } @@ -109,7 +110,8 @@ { waitHSync(5); } - outCRReg( 0x45, inCRReg(0x45) & 0xfe ); + outCRReg( 0x45, inCRReg(0x45) & 0xfe ); /* cursor1 */ + outCRReg( 0x45, inCRReg(0x45) & 0xfb ); /* cursor2 */ } static void @@ -119,10 +121,20 @@ { SavagePtr psav = SAVPTR(pScrn); + /* cursor 1 */ /* Set cursor location in frame buffer. */ outCRReg( 0x4d, (0xff & psav->CursorKByte)); outCRReg( 0x4c, (0xff00 & psav->CursorKByte) >> 8); + + /* cursor 2 */ + SelectIGA2(); + /* Set cursor location in frame buffer. */ + outCRReg( 0x4d, (0xff & psav->CursorKByte)); + outCRReg( 0x4c, (0xff00 & psav->CursorKByte) >> 8); + SelectIGA1(); + + /* Upload the cursor image to the frame buffer. */ memcpy(psav->FBBase + psav->CursorKByte * 1024, src, 1024); @@ -142,9 +154,10 @@ int x, int y) { + SavagePtr psav = SAVPTR(pScrn); unsigned char xoff, yoff; - if( S3_SAVAGE4_SERIES( SAVPTR(pScrn)->Chipset ) ) + if( S3_SAVAGE4_SERIES( psav->Chipset ) ) { waitHSync(5); } @@ -177,6 +190,17 @@ yoff = 0; } + /* cursor 1 */ + /* This is the recomended order to move the cursor */ + outCRReg( 0x46, (x & 0xff00)>>8 ); + outCRReg( 0x47, (x & 0xff) ); + outCRReg( 0x49, (y & 0xff) ); + outCRReg( 0x4e, xoff ); + outCRReg( 0x4f, yoff ); + outCRReg( 0x48, (y & 0xff00)>>8 ); + + /* cursor 2 */ + SelectIGA2(); /* This is the recomended order to move the cursor */ outCRReg( 0x46, (x & 0xff00)>>8 ); outCRReg( 0x47, (x & 0xff) ); @@ -184,6 +208,8 @@ outCRReg( 0x4e, xoff ); outCRReg( 0x4f, yoff ); outCRReg( 0x48, (y & 0xff00)>>8 ); + SelectIGA1(); + } @@ -196,6 +222,8 @@ SavagePtr psav = SAVPTR(pScrn); Bool bNeedExtra = FALSE; + UnLockExtRegs(); + /* Clock doubled modes need an extra cursor stack write. */ bNeedExtra = @@ -221,6 +249,23 @@ outCRReg(0x4b, bg); outCRReg(0x4b, bg >> 8); outCRReg(0x4b, bg >> 16); + + /* cursor 2 */ + SelectIGA2(); + /* Reset the cursor color stack pointer */ + inCRReg(0x45); + /* Write low, mid, high bytes - foreground */ + outCRReg(0x4a, fg); + outCRReg(0x4a, fg >> 8); + outCRReg(0x4a, fg >> 16); + /* Reset the cursor color stack pointer */ + inCRReg(0x45); + /* Write low, mid, high bytes - background */ + outCRReg(0x4b, bg); + outCRReg(0x4b, bg >> 8); + outCRReg(0x4b, bg >> 16); + SelectIGA1(); + return; } else if( (pScrn->depth == 15) || (pScrn->depth == 16) ) @@ -244,19 +289,46 @@ inCRReg( 0x45 ); outCRReg( 0x4a, fg ); outCRReg( 0x4a, fg>>8 ); + + /* cursor 2 */ + SelectIGA2(); + inCRReg( 0x45 ); + outCRReg( 0x4a, fg ); + outCRReg( 0x4a, fg>>8 ); + SelectIGA1(); + if( bNeedExtra ) { outCRReg( 0x4a, fg ); outCRReg( 0x4a, fg>>8 ); + + SelectIGA2(); + outCRReg( 0x4a, fg ); + outCRReg( 0x4a, fg>>8 ); + SelectIGA1(); } /* Reset the cursor color stack pointer */ inCRReg( 0x45 ); outCRReg( 0x4b, bg ); outCRReg( 0x4b, bg>>8 ); + + /* cursor 2 */ + SelectIGA2(); + inCRReg( 0x45 ); + outCRReg( 0x4b, bg ); + outCRReg( 0x4b, bg>>8 ); + SelectIGA1(); + if( bNeedExtra ) { outCRReg( 0x4b, bg ); outCRReg( 0x4b, bg>>8 ); + + /* cursor 2 */ + SelectIGA2(); + outCRReg( 0x4b, bg ); + outCRReg( 0x4b, bg>>8 ); + SelectIGA1(); } } else if( pScrn->depth == 8 ) @@ -271,5 +343,19 @@ /* Write background */ outCRReg(0x4b, bg); outCRReg(0x4b, bg); + + /* cursor 2 */ + SelectIGA2(); + /* Reset the cursor color stack pointer */ + inCRReg(0x45); + /* Write foreground */ + outCRReg(0x4a, fg); + outCRReg(0x4a, fg); + /* Reset the cursor color stack pointer */ + inCRReg(0x45); + /* Write background */ + outCRReg(0x4b, bg); + outCRReg(0x4b, bg); + SelectIGA1(); } } Index: savage_dri.c =================================================================== RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dri.c,v retrieving revision 1.3 diff -u -r1.3 savage_dri.c --- savage_dri.c 23 Mar 2004 21:11:37 -0000 1.3 +++ savage_dri.c 12 Jul 2004 03:05:03 -0000 @@ -1303,24 +1303,25 @@ pSAVAGEDRI->frontPitch = pSAVAGEDRIServer->frontPitch; pSAVAGEDRI->IsfrontTiled = psav->bTiled; /* AGD: was 0 */ + if(pSAVAGEDRI->cpp==2) + TileStride = (pSAVAGEDRI->width+63)&(~63); + else + TileStride = (pSAVAGEDRI->width+31)&(~31); + if(pSAVAGEDRI->IsfrontTiled) { - if(pSAVAGEDRI->cpp==2) - TileStride = (pSAVAGEDRI->width+63)&(~63); - else - TileStride = (pSAVAGEDRI->width+31)&(~31); - if ((psav->Chipset == S3_TWISTER) - || (psav->Chipset == S3_PROSAVAGE) + if ((psav->Chipset == S3_PROSAVAGE) || (psav->Chipset == S3_PROSAVAGEDDR) || (psav->Chipset == S3_SUPERSAVAGE)) { - pSAVAGEDRI->frontBitmapDesc = 0x10000000 | /* block write disabled */ + pSAVAGEDRI->frontBitmapDesc = BCI_BD_BW_DISABLE | /* block write disabled */ (1<<24) | /* destination tile format */ (pScrn->bitsPerPixel<<16) | /* bpp */ TileStride; /* stride */ - } else { - pSAVAGEDRI->frontBitmapDesc = 0x10000000 | /* block write disabled */ + pSAVAGEDRI->frontPitch = TileStride; + } else { /* twister seems to use this format too */ + pSAVAGEDRI->frontBitmapDesc = BCI_BD_BW_DISABLE | /* block write disabled */ ((pSAVAGEDRI->cpp==2)? BCI_BD_TILE_16:BCI_BD_TILE_32) | /*16/32 bpp tile format */ (pScrn->bitsPerPixel<<16) | /* bpp */ @@ -1330,70 +1331,51 @@ } else { - pSAVAGEDRI->frontBitmapDesc = 0x10000000 | /* AGD: block write should be disabled: was 0x00000000 */ + pSAVAGEDRI->frontBitmapDesc = BCI_BD_BW_DISABLE | pScrn->bitsPerPixel<<16 | pSAVAGEDRI->width; } - - pSAVAGEDRI->backOffset = pSAVAGEDRIServer->backOffset; - pSAVAGEDRI->backbufferSize = pSAVAGEDRIServer->backbufferSize; - pSAVAGEDRI->backbuffer = psav->FrameBufferBase + - pSAVAGEDRI->backOffset; - pSAVAGEDRI->backPitch = pSAVAGEDRIServer->backPitch; { - if(pSAVAGEDRI->cpp==2) - TileStride = (pSAVAGEDRI->width+63)&(~63); - else - TileStride = (pSAVAGEDRI->width+31)&(~31); - if ((psav->Chipset == S3_TWISTER) - || (psav->Chipset == S3_PROSAVAGE) + if ((psav->Chipset == S3_PROSAVAGE) || (psav->Chipset == S3_PROSAVAGEDDR) || (psav->Chipset == S3_SUPERSAVAGE)) /* AGD: supersavage may work like savage4/MX/IX, I just don't know. */ { /* It's here since the 2D driver sets it up like prosavage */ - pSAVAGEDRI->backBitmapDesc = 0x10000000 | + pSAVAGEDRI->backBitmapDesc = BCI_BD_BW_DISABLE | (1<<24) | (pScrn->bitsPerPixel<<16) | TileStride; - } else { - pSAVAGEDRI->backBitmapDesc = 0x10000000 | + pSAVAGEDRI->depthBitmapDesc = BCI_BD_BW_DISABLE | + (1<<24) | + (pScrn->bitsPerPixel<<16) | + TileStride; + } else { /* twister seems to use this format too */ + pSAVAGEDRI->backBitmapDesc = BCI_BD_BW_DISABLE | ((pSAVAGEDRI->cpp==2)? BCI_BD_TILE_16:BCI_BD_TILE_32) | (pScrn->bitsPerPixel<<16) | TileStride; + pSAVAGEDRI->depthBitmapDesc = BCI_BD_BW_DISABLE | + ((pSAVAGEDRI->zpp==2)? + BCI_BD_TILE_16:BCI_BD_TILE_32) | + (pScrn->bitsPerPixel<<16) | + TileStride; } } + pSAVAGEDRI->backOffset = pSAVAGEDRIServer->backOffset; + pSAVAGEDRI->backbufferSize = pSAVAGEDRIServer->backbufferSize; + pSAVAGEDRI->backbuffer = psav->FrameBufferBase + + pSAVAGEDRI->backOffset; + pSAVAGEDRI->backPitch = pSAVAGEDRIServer->backPitch; + pSAVAGEDRI->depthOffset = pSAVAGEDRIServer->depthOffset; pSAVAGEDRI->depthbufferSize = pSAVAGEDRIServer->depthbufferSize; pSAVAGEDRI->depthbuffer = psav->FrameBufferBase + pSAVAGEDRI->depthOffset; pSAVAGEDRI->depthPitch = pSAVAGEDRIServer->depthPitch; - { - if(pSAVAGEDRI->zpp==2) - TileStride = (pSAVAGEDRI->width+63)&(~63); - else - TileStride = (pSAVAGEDRI->width+31)&(~31); - - if ((psav->Chipset == S3_TWISTER) - || (psav->Chipset == S3_PROSAVAGE) - || (psav->Chipset == S3_PROSAVAGEDDR) - || (psav->Chipset == S3_SUPERSAVAGE)) - { - pSAVAGEDRI->depthBitmapDesc = 0x10000000 | - (1<<24) | - (pScrn->bitsPerPixel<<16) | - TileStride; - } else { - pSAVAGEDRI->depthBitmapDesc = 0x10000000 | - ((pSAVAGEDRI->zpp==2)? - BCI_BD_TILE_16:BCI_BD_TILE_32) | - (pScrn->bitsPerPixel<<16) | - TileStride; - } - } pSAVAGEDRI->textureOffset = pSAVAGEDRIServer->textureOffset; pSAVAGEDRI->textures = psav->FrameBufferBase + Index: savage_driver.c =================================================================== RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v retrieving revision 1.22 diff -u -r1.22 savage_driver.c --- savage_driver.c 26 Mar 2004 22:20:40 -0000 1.22 +++ savage_driver.c 12 Jul 2004 03:05:04 -0000 @@ -1310,16 +1310,14 @@ * The Savage4 and ProSavage have COB coherency bugs which render * the buffer useless. */ - /* - psav->cobIndex = 2; - psav->cobSize = 0x8000 << psav->cobIndex; - */ psav->cobIndex = 0; psav->cobSize = 0; } else { /* We use 128kB for the COB on all other chips. */ psav->cobSize = 0x20000; - if (S3_SAVAGE3D_SERIES(psav->Chipset)) { + if (S3_SAVAGE3D_SERIES(psav->Chipset) + || (psav->Chipset == S3_TWISTER)) /* twister seems to use 7 */ + { psav->cobIndex = 7; /* rev.A savage4 also uses 7 */ } else { psav->cobIndex = 2; @@ -2131,7 +2129,7 @@ VGAOUT8(vgaCRIndex, 0x67); cr67 = VGAIN8(vgaCRReg); /*VGAOUT8(vgaCRReg, restore->CR67 & ~0x0c);*/ /* no STREAMS yet */ - VGAOUT8(vgaCRReg, restore->CR67 & ~0xf1); /* no streams for new and old streams engines */ + VGAOUT8(vgaCRReg, restore->CR67 & ~0x0e); /* no streams for new and old streams engines */ /* restore extended regs */ VGAOUT8(vgaCRIndex, 0x66); @@ -2195,7 +2193,7 @@ /* restore the desired video mode with cr67 */ VGAOUT8(vgaCRIndex, 0x67); /*VGAOUT8(vgaCRReg, restore->CR67 & ~0x0c);*/ /* no STREAMS yet */ - VGAOUT8(vgaCRReg, restore->CR67 & ~0xf1); /* no streams for new and old streams engines */ + VGAOUT8(vgaCRReg, restore->CR67 & ~0x0e); /* no streams for new and old streams engines */ /* other mode timing and extended regs */ VGAOUT8(vgaCRIndex, 0x34); @@ -3247,15 +3245,40 @@ } } + address += pScrn->fbOffset; + /* * because we align the viewport to the width and height of one tile - * we shoud update the locate of frame + * we should update the locate of frame */ pScrn->frameX0 = left; pScrn->frameY0 = top; pScrn->frameX1 = left + currentMode->HDisplay - 1; - pScrn->frameY1 = top+ currentMode->VDisplay - 1; + pScrn->frameY1 = top + currentMode->VDisplay - 1; + if (psav->Chipset == S3_SAVAGE_MX) { +#if 0 + OUTREG32(PRI_STREAM_FBUF_ADDR0, address | 0xFFFFFFFC); + OUTREG32(PRI_STREAM_FBUF_ADDR1, address & 0xFFFFFFFC);/* IGA1 */ + OUTREG32(PRI_STREAM2_FBUF_ADDR0, address & 0xFFFFFFFC);/* IGA2 */ + OUTREG32(PRI_STREAM2_FBUF_ADDR1, address & 0xFFFFFFFC); +#endif + OUTREG32(PRI_STREAM_FBUF_ADDR0, address | 0xFFFFFFFF); + OUTREG32(PRI_STREAM_FBUF_ADDR1, address | 0x80000000);/* IGA1 */ + OUTREG32(PRI_STREAM2_FBUF_ADDR0, address & 0xFFFFFFFF);/* IGA2 */ + OUTREG32(PRI_STREAM2_FBUF_ADDR1, address & 0xFFFFFFFF); + } else if (psav->Chipset == S3_SUPERSAVAGE) { + /* IGA1 */ + OUTREG32(PRI_STREAM_FBUF_ADDR1, address & 0xFFFFFFF8); + OUTREG32(PRI_STREAM_FBUF_ADDR0, 0x80000000); + /* IGA2 */ + OUTREG32(PRI_STREAM2_FBUF_ADDR0, ((address & 0xFFFFFFF8) | 0x80000000)); + } else { + OUTREG32(PRI_STREAM_FBUF_ADDR0,address | 0xFFFFFFFC); + OUTREG32(PRI_STREAM_FBUF_ADDR1,address | 0x80000000); + } + +#if 0 if (S3_SAVAGE_MOBILE_SERIES(psav->Chipset)) { OUTREG32(PRI_STREAM_FBUF_ADDR0,address | 0xFFFFFFFC); /* IGA1 */ OUTREG32(PRI_STREAM_FBUF_ADDR1,address | 0x80000000); @@ -3265,6 +3288,7 @@ OUTREG32(PRI_STREAM_FBUF_ADDR0,address | 0xFFFFFFFC); OUTREG32(PRI_STREAM_FBUF_ADDR1,address | 0x80000000); } +#endif return; } @@ -3620,10 +3644,7 @@ break; } - if ( (!psav->CrtOnly) && psav->UseBIOS && psav->PanelX ) { - SavageSetPanelEnabled(psav, (mode == DPMSModeOn)); - } - else if ((!psav->CrtOnly) && psav->PanelX) { + if ((!psav->CrtOnly) && psav->PanelX) { switch (mode) { case DPMSModeOn: VGAOUT8(0x3c4, 0x31); /* SR31 bit 4 - FP enable */ @@ -3767,7 +3788,7 @@ OUTREG32(PRI_STREAM_FBUF_ADDR1,0); OUTREG8(CRT_ADDRESS_REG, 0x67); cr67 = INREG8(CRT_DATA_REG); - cr67 &= ~0x0c; /* CR67[2] = 1 : enable stream 1 */ + cr67 &= ~0x0c; OUTREG8(CRT_DATA_REG, cr67); OUTREG8(CRT_ADDRESS_REG, 0x69); cr69 = INREG8(CRT_DATA_REG); Index: savage_regs.h =================================================================== RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v retrieving revision 1.10 diff -u -r1.10 savage_regs.h --- savage_regs.h 2 Mar 2004 18:15:45 -0000 1.10 +++ savage_regs.h 12 Jul 2004 03:05:05 -0000 @@ -185,10 +185,21 @@ /* CR69[0] = 1 : Mem-mapped regs */ #define USE_MM_FOR_PRI_STREAM_OLD 0x01 +/* duoview */ #define SELECT_IGA1 0x4026 #define SELECT_IGA2_READS_WRITES 0x4f26 +#define SelectIGA1() \ +do { \ + OUTREG16(SEQ_ADDRESS_REG,SELECT_IGA1); \ +} while (0) + +#define SelectIGA2() \ +do { \ + OUTREG16(SEQ_ADDRESS_REG,SELECT_IGA2_READS_WRITES); \ +} while (0) + #define MEM_PS1 0x10 /*CRCA_4 :Primary stream 1*/ #define MEM_PS2 0x20 /*CRCA_5 :Primary stream 2*/ #define MEM_SS1 0x40 /*CRCA_6 :Secondary stream 1*/ Index: savage_vbe.c =================================================================== RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v retrieving revision 1.3 diff -u -r1.3 savage_vbe.c --- savage_vbe.c 22 Feb 2004 16:14:42 -0000 1.3 +++ savage_vbe.c 12 Jul 2004 03:05:05 -0000 @@ -16,6 +16,8 @@ Bool vbeModeInit( vbeInfoPtr, int ); static int SavageGetDevice( SavagePtr psav ); /*static int SavageGetTVType( SavagePtr psav );*/ +void SavageSetVESAModeCrtc1( SavagePtr psav, int n, int Refresh ); +void SavageSetVESAModeCrtc2( SavagePtr psav, int n, int Refresh ); static void SavageClearVM86Regs( xf86Int10InfoPtr pInt ) @@ -49,7 +51,68 @@ xf86ExecX86int10( psav->pInt10 ); } +void +SavageSetVESAModeCrtc1(SavagePtr psav, int n, int refresh) +{ + unsigned char byte; + + xf86Msg(X_INFO,"SavageSetVESAMode:mode=0x%x,refresh=%dHZ\n",n,refresh); + + SavageClearVM86Regs(psav->pInt10); + + /* set active displays. */ + psav->pInt10->ax = S3_EXTBIOS_INFO; + psav->pInt10->bx = S3_SET_ACTIVE_DISP; + psav->pInt10->cx = 0x83; /* lcd, crt, duoview */ + xf86ExecX86int10(psav->pInt10); + + SavageClearVM86Regs(psav->pInt10); + + /* Establish the refresh rate for this mode. */ + psav->pInt10->ax = S3_EXTBIOS_INFO; + psav->pInt10->bx = S3_SET_REFRESH; + psav->pInt10->cx = n & 0x1ff; + psav->pInt10->di = refresh & 0xffff; + xf86ExecX86int10(psav->pInt10); + + /* SR01:turn off screen */ + OUTREG8 (SEQ_ADDRESS_REG,0x01); + byte = INREG8(SEQ_DATA_REG) | 0x20; + OUTREG8(SEQ_DATA_REG,byte); + + psav->pInt10->ax = BIOS_SET_VBE_MODE; + psav->pInt10->bx = n; + xf86ExecX86int10(psav->pInt10); + +} + +void +SavageSetVESAModeCrtc2( SavagePtr psav, int n, int refresh ) +{ + SavageClearVM86Regs(psav->pInt10); + + UnLockExtRegs(); + + /* set crtc2, clone crtc1 for now */ + psav->pInt10->ax = S3_EXTBIOS_INFO; + psav->pInt10->bx = S3_ALT_SET_ACTIVE_DISP; + psav->pInt10->cx = 0x83; /* lcd, crt, duoview */ + psav->pInt10->dx = n & 0x1ff; + psav->pInt10->di = refresh & 0xffff; + xf86ExecX86int10(psav->pInt10); + +} +void +SavageSetVESAMode(SavagePtr psav, int n, int refresh) +{ + + SavageSetVESAModeCrtc1(psav, n, refresh); + SavageSetVESAModeCrtc2(psav, n, refresh); + +} + +#if 0 void SavageSetVESAMode( SavagePtr psav, int n, int Refresh ) { @@ -121,7 +184,7 @@ } #endif } - +#endif void SavageSetPanelEnabled( SavagePtr psav, Bool active ) Index: savage_vbe.h =================================================================== RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 savage_vbe.h --- savage_vbe.h 22 Oct 2002 13:40:41 -0000 1.1.1.2 +++ savage_vbe.h 12 Jul 2004 03:05:05 -0000 @@ -16,6 +16,58 @@ #ifndef _SAVAGEVBE_H #define _SAVAGEVBE_H +/* + * Common BIOS functions + */ + +#define BIOS_SET_VBE_MODE 0x4F02 +#define BIOS_GET_VBE_MODE 0x4F03 +#define BIOS_SVGA_STATE 0x4F04 +#define BIOS_LOG_SCANLINE 0x4F06 +#define BIOS_VBE_PM_SERVICE 0x4F10 +#define S3_EXTBIOS_INFO 0x4F14 /* S3 Extended BIOS services */ +#define BIOS_VBE_DDC 0x4F15 + +/************************************************************************* + * Defines for BIOS compliant with S3 (Mobile and Desktop) PCI Video + * Bios External Interface Specification, Core Revision 3.02+ + * + * e.g. used by Trio3D, GX-3 + *************************************************************************/ + +#define S3_GET_SVGA_BUF 0x0000 +#define S3_SAVE_SVGA_STATE 0x0001 +#define S3_RESTORE_SVGA_STATE 0x0002 +/* + * For S3_EXTBIOS_INFO (0x4F14) services + */ +#define S3_VBE_INFO 0x0000 /* fn0: Query S3/VBE info */ + +#define S3_SET_REFRESH 0x0001 /* fn1,sub0: Set Refresh Rate for Mode */ +#define S3_GET_REFRESH 0x0101 /* fn1,sub1: Get Refresh Rate for Mode */ +#define S3_QUERY_REFRESH 0x0201 /* fn1,sub2: Query Refresh Rates for Mode */ + +#define S3_QUERY_MODELIST 0x0202 /* fn2,sub2: Query Mode List */ +#define S3_GET_EXT_MODEINFO 0x0302 /* fn2,sub3: Get Extended Mode Info */ + +#define S3_QUERY_ATTACHED 0x0004 /* fn4,sub0: Query detected displays */ + +#define S3_GET_ACTIVE_DISP 0x0103 /* fn3,sub1: Get Active Display */ +#define S3_SET_ACTIVE_DISP 0x0003 /* fn3,sub0: Set Active Display */ +#define S3_ALT_SET_ACTIVE_DISP 0x8003 /* fn8003,sub0: Alternate Set Active Display */ + +#define S3_SET_TV_CONFIG 0x0007 /* fn7,sub0: Set TV Configuration */ +#define S3_GET_TV_CONFIG 0x0107 /* fn7,sub1: Get TV Configuration */ + + +#define BIOS_CRT1_ONLY 0x01 +#define BIOS_LCD_ONLY 0x02 +#define BIOS_TV_NTSC 0x04 +#define BIOS_TV_PAL 0x08 +#define BIOS_TV_ONLY 0x0c +#define BIOS_DVI_ONLY 0x20 +#define BIOS_DEVICE_MASK (BIOS_CRT1_ONLY|BIOS_LCD_ONLY|BIOS_TV_ONLY|BIOS_DVI_ONLY) + /* structures for vbe 2.0 */ #ifndef __GNUC__ Index: savage_video.c =================================================================== RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v retrieving revision 1.8 diff -u -r1.8 savage_video.c --- savage_video.c 26 Mar 2004 17:09:05 -0000 1.8 +++ savage_video.c 12 Jul 2004 03:05:06 -0000 @@ -285,18 +285,18 @@ * and the stride should have already been set properly in SavageSetGBD() */ if (!psav->bTiled) { - OUTREG(PRI_STREAM_STRIDE, + OUTREG(PSTREAM_STRIDE_REG, (((psav->lDelta * 2) << 16) & 0x3FFFE000) | (psav->lDelta & 0x00001fff)); } else if (pScrn->bitsPerPixel == 16) { /* Scanline-length-in-bytes/128-bytes-per-tile * 256 Qwords/tile */ - OUTREG(PRI_STREAM_STRIDE, + OUTREG(PSTREAM_STRIDE_REG, (((psav->lDelta * 2) << 16) & 0x3FFFE000) | 0x80000000 | (psav->lDelta & 0x00001fff)); } else if (pScrn->bitsPerPixel == 32) { - OUTREG(PRI_STREAM_STRIDE, + OUTREG(PSTREAM_STRIDE_REG, (((psav->lDelta * 2) << 16) & 0x3FFFE000) | 0xC0000000 | (psav->lDelta & 0x00001fff)); } @@ -364,23 +364,35 @@ */ /* Primary stream reflects the frame buffer. */ OUTREG32(PRI_STREAM_FBUF_ADDR0, pScrn->fbOffset); + OUTREG32(PRI_STREAM2_FBUF_ADDR0, pScrn->fbOffset); if (!psav->bTiled) { OUTREG(PRI_STREAM_STRIDE, (((psav->lDelta * 2) << 16) & 0x3FFFE000) | (psav->lDelta & 0x00001fff)); + OUTREG(PRI_STREAM2_STRIDE, + (((psav->lDelta * 2) << 16) & 0x3FFFE000) | + (psav->lDelta & 0x00001fff)); } else if (pScrn->bitsPerPixel == 16) { /* Scanline-length-in-bytes/128-bytes-per-tile * 256 Qwords/tile */ OUTREG(PRI_STREAM_STRIDE, (((psav->lDelta * 2) << 16) & 0x3FFFE000) | 0x80000000 | (psav->lDelta & 0x00001fff)); + OUTREG(PRI_STREAM2_STRIDE, + (((psav->lDelta * 2) << 16) & 0x3FFFE000) + | 0x80000000 | (psav->lDelta & 0x00001fff)); } else if (pScrn->bitsPerPixel == 32) { OUTREG(PRI_STREAM_STRIDE, (((psav->lDelta * 2) << 16) & 0x3FFFE000) | 0xC0000000 | (psav->lDelta & 0x00001fff)); + OUTREG(PRI_STREAM2_STRIDE, + (((psav->lDelta * 2) << 16) & 0x3FFFE000) + | 0xC0000000 | (psav->lDelta & 0x00001fff)); } - OUTREG(PSTREAM_FBSIZE_REG, + OUTREG(PRI_STREAM_BUFFERSIZE, + pScrn->virtualX * pScrn->virtualY * (pScrn->bitsPerPixel >> 3)); + OUTREG(PRI_STREAM2_BUFFERSIZE, pScrn->virtualX * pScrn->virtualY * (pScrn->bitsPerPixel >> 3)); /* Primary stream reflects the frame buffer. */ #if 0 @@ -442,7 +454,7 @@ if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) || (psav->Chipset == S3_SAVAGE2000) ) { - jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1; + jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1 | ENABLE_STREAM2; /* Wait for VBLANK. */