From 555da078acfc715053715590eed3c7f1253c0d15 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 11 Oct 2004 00:36:11 +0000 Subject: Fix Xv on savages with the "old" streams engine. --- src/savage_streams.c | 27 ++++--------------- src/savage_video.c | 76 +++++++++++++++++----------------------------------- 2 files changed, 30 insertions(+), 73 deletions(-) diff --git a/src/savage_streams.c b/src/savage_streams.c index b1c5ab2..1b865aa 100644 --- a/src/savage_streams.c +++ b/src/savage_streams.c @@ -130,12 +130,13 @@ void SavageInitStreamsOld(ScrnInfoPtr pScrn) xf86ErrorFVerb(STREAMS_TRACE, "SavageInitStreams\n" ); - if (psav->FBStart2nd) { unsigned long jDelta = pScrn->displayWidth; format = 0 << 24; OUTREG( PSTREAM_STRIDE_REG, jDelta ); OUTREG( PSTREAM_FBSIZE_REG, jDelta * pScrn->virtualY >> 3 ); + OUTREG( PSTREAM_FBADDR0_REG, pScrn->fbOffset ); + OUTREG( PSTREAM_FBADDR1_REG, 0 ); } else { /*jDelta = pScrn->displayWidth * (pScrn->bitsPerPixel + 7) / 8;*/ switch( pScrn->depth ) { @@ -150,8 +151,8 @@ void SavageInitStreamsOld(ScrnInfoPtr pScrn) OUTREG( PSTREAM_WINDOW_START_REG, OS_XY(0,0) ); OUTREG( PSTREAM_WINDOW_SIZE_REG, OS_WH(pScrn->displayWidth, pScrn->virtualY) ); - OUTREG( PSTREAM_FBADDR0_REG, pScrn->fbOffset ); - OUTREG( PSTREAM_FBADDR1_REG, 0 ); +/* OUTREG( PSTREAM_FBADDR0_REG, pScrn->fbOffset ); + OUTREG( PSTREAM_FBADDR1_REG, 0 ); */ /*OUTREG( PSTREAM_STRIDE_REG, jDelta );*/ OUTREG( PSTREAM_CONTROL_REG, format ); /*OUTREG( PSTREAM_FBSIZE_REG, jDelta * pScrn->virtualY >> 3 );*/ @@ -166,36 +167,18 @@ void SavageInitStreamsOld(ScrnInfoPtr pScrn) OUTREG( SSTREAM_FBADDR0_REG, 0 ); OUTREG( SSTREAM_FBADDR1_REG, 0 ); OUTREG( SSTREAM_FBADDR2_REG, 0 ); -/* OUTREG( SSTREAM_FBSIZE_REG, 0 ); */ + OUTREG( SSTREAM_FBSIZE_REG, 0 ); OUTREG( SSTREAM_STRIDE_REG, 0 ); OUTREG( SSTREAM_VSCALE_REG, 0 ); OUTREG( SSTREAM_LINES_REG, 0 ); OUTREG( SSTREAM_VINITIAL_REG, 0 ); OUTREG( SSTREAM_WINDOW_START_REG, OS_XY(0xfffe, 0xfffe) ); OUTREG( SSTREAM_WINDOW_SIZE_REG, OS_WH(10,2) ); - OUTREG(STREAMS_FIFO_REG, 2 | 25 << 5 | 32 << 11); if (S3_MOBILE_TWISTER_SERIES(psav->Chipset) && psav->FPExpansion) { OverlayTwisterInit(pScrn); } - - { - vgaHWPtr hwp; - unsigned short vgaIOBase, vgaCRIndex, vgaCRReg; - unsigned char cr90; - - hwp = VGAHWPTR(pScrn); - - vgaHWGetIOBase(hwp); - vgaIOBase = hwp->IOBase; - vgaCRIndex = vgaIOBase + 4; - vgaCRReg = vgaIOBase + 5; - - VGAOUT8(vgaCRIndex, 0x90); - cr90 = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, (cr90 & 0x7F)); - } } static void diff --git a/src/savage_video.c b/src/savage_video.c index 9c03bb5..b62a4fc 100644 --- a/src/savage_video.c +++ b/src/savage_video.c @@ -1144,7 +1144,6 @@ SavageDisplayVideoOld( SavageResetVideo(pScrn); } - /* Calculate horizontal scale factor. */ if (S3_MOBILE_TWISTER_SERIES(psav->Chipset) && psav->FPExpansion) { drw_w = (((float)(drw_w * psav->XExp1)/(float)psav->XExp2)+1); @@ -1156,37 +1155,6 @@ SavageDisplayVideoOld( dstBox->y1 += psav->displayYoffset; } - /* Set surface format. */ - ssControl = (GetBlendForFourCC(psav->videoFourCC) << 24) | src_w; - - OUTREG(SSTREAM_CONTROL_REG, ssControl); - - /* Calculate horizontal scale factor. */ - - OUTREG(SSTREAM_STRETCH_REG, (src_w << 15) / drw_w ); - - /* Calculate vertical scale factor. */ - - /* - * MM81E8:Secondary Stream Source Line Count - * bit_0~10: # of lines in the source image (before scaling) - * bit_15 = 1: Enable vertical interpolation - * 0: Line duplicaion - */ - OUTREG(SSTREAM_LINES_REG, 0x00008000 | src_h ); - OUTREG(SSTREAM_VINITIAL_REG, 0 ); - /*OUTREG(SSTREAM_VSCALE_REG, (src_h << 15) / drw_h );*/ - OUTREG(SSTREAM_VSCALE_REG, VSCALING(src_h,drw_h)); - - /* Set surface location and stride. */ - - OUTREG(SSTREAM_FBADDR0_REG, (offset + (x1>>15)) & (0x1ffffff & ~BASE_PAD) ); - OUTREG(SSTREAM_STRIDE_REG, pitch & 0xfff ); - - OUTREG(SSTREAM_WINDOW_START_REG, OS_XY(dstBox->x1, dstBox->y1) ); - OUTREG(SSTREAM_WINDOW_SIZE_REG, OS_WH(dstBox->x2-dstBox->x1, - dstBox->y2-dstBox->y1)); - /* * Process horizontal scaling * upscaling and downscaling smaller than 2:1 controled by MM8198 @@ -1194,22 +1162,7 @@ SavageDisplayVideoOld( */ scalratio = 0; ssControl = 0; -#if 0 - if( src_w > (drw_w << 1) ) - { - /* BUGBUG shouldn't this be >=? */ - if( src_w <= (drw_w << 2) ) - ssControl |= HDSCALE_4; - else if( src_w > (drw_w << 3) ) - ssControl |= HDSCALE_8; - else if( src_w > (drw_w << 4) ) - ssControl |= HDSCALE_16; - else if( src_w > (drw_w << 5) ) - ssControl |= HDSCALE_32; - else if( src_w > (drw_w << 6) ) - ssControl |= HDSCALE_64; - } -#endif + if (src_w >= (drw_w * 2)) { if (src_w < (drw_w * 4)) { scalratio = HSCALING(2,1); @@ -1223,17 +1176,39 @@ SavageDisplayVideoOld( ssControl |= HDSCALE_32; } else ssControl |= HDSCALE_64; - } else + } else scalratio = HSCALING(src_w,drw_w); ssControl |= src_w; - ssControl |= (1 << 24); + /*ssControl |= (1 << 24);*/ + ssControl |= (GetBlendForFourCC(psav->videoFourCC) << 24); /* Wait for VBLANK. */ VerticalRetraceWait(); OUTREG(SSTREAM_CONTROL_REG, ssControl); if (scalratio) OUTREG(SSTREAM_STRETCH_REG,scalratio); + /* Calculate vertical scale factor. */ + OUTREG(SSTREAM_VINITIAL_REG, 0 ); + /*OUTREG(SSTREAM_VSCALE_REG, (src_h << 15) / drw_h );*/ + OUTREG(SSTREAM_VSCALE_REG, VSCALING(src_h,drw_h)); + /* Set surface location and stride. */ + OUTREG(SSTREAM_FBADDR0_REG, (offset + (x1>>15)) & (0x1ffffff & ~BASE_PAD) ); + OUTREG(SSTREAM_FBADDR1_REG, 0); + OUTREG(SSTREAM_STRIDE_REG, pitch & 0xfff ); + + OUTREG(SSTREAM_WINDOW_START_REG, OS_XY(dstBox->x1, dstBox->y1) ); + OUTREG(SSTREAM_WINDOW_SIZE_REG, OS_WH(dstBox->x2-dstBox->x1, + dstBox->y2-dstBox->y1)); + + /* + * MM81E8:Secondary Stream Source Line Count + * bit_0~10: # of lines in the source image (before scaling) + * bit_15 = 1: Enable vertical interpolation + * 0: Line duplicaion + */ + OUTREG(SSTREAM_LINES_REG, 0x00008000 | src_h ); + #if 0 /* Set color key on primary. */ @@ -1255,7 +1230,6 @@ SavageDisplayVideoOld( VGAOUT8(vgaCRIndex, 0x93); VGAOUT8(vgaCRReg, pitch); } - OUTREG(STREAMS_FIFO_REG, 0x2 | 25 << 5 | 32 << 11); } static void -- cgit v1.2.3