kernels/linux-2.4.0/drivers/video/riva/riva_hw.c
/*
 * Calculate extended mode parameters (SVGA) and save in a 
 * mode state structure.
 */
Calculate extended mode parameters (SVGA) and save in a
mode state structure.
Calculate extended mode parameters ( SVGA ) and save in a mode state structure .
static void CalcStateExt
(
    RIVA_HW_INST  *chip,
    RIVA_HW_STATE *state,
    int            bpp,
    int            width,
    int            hDisplaySize,
    int            hDisplay,
    int            hStart,
    int            hEnd,
    int            hTotal,
    int            height,
    int            vDisplay,
    int            vStart,
    int            vEnd,
    int            vTotal,
    int            dotClock
)
{
    int pixelDepth, VClk, m, n, p;
    state->bpp    = bpp;
    state->width  = width;
    state->height = height;
    pixelDepth = (bpp + 1)/8;
    CalcVClock(dotClock, &VClk, &m, &n, &p, chip);
    switch (chip->Architecture)
    {
	    case 3:
            nv3UpdateArbitrationSettings(VClk, 
                                         pixelDepth * 8, 
                                        &(state->arbitration0),
                                        &(state->arbitration1),
                                         chip);
            state->cursor0  = 0x00;
            state->cursor1  = 0x78;
            state->cursor2  = 0x00000000;
            state->pllsel   = 0x10010100;
            state->config   = ((width + 31)/32)
                            | (((pixelDepth > 2) ? 3 : pixelDepth) << 8)
                            | 0x1000;
            state->general  = 0x00000100;
            state->repaint1 = hDisplaySize < 1280 ? 0x06 : 0x02;
            break;
	    case 4:
	    case 5:
            nv4UpdateArbitrationSettings(VClk, 
                                         pixelDepth * 8, 
                                        &(state->arbitration0),
                                        &(state->arbitration1),
                                         chip);
            state->cursor0  = 0x00;
            state->cursor1  = 0xFC;
            state->cursor2  = 0x00000000;
            state->pllsel   = 0x10000700;
            state->config   = 0x00001114;
            state->general  = bpp == 16 ? 0x00101100 : 0x00100100;
            state->repaint1 = hDisplaySize < 1280 ? 0x04 : 0x00;
            break;
    }
    state->vpll     = (p << 16) | (n << 8) | m;
    state->screen   = ((hTotal   & 0x040) >> 2)
                    | ((vDisplay & 0x400) >> 7)
                    | ((vStart   & 0x400) >> 8)
                    | ((vDisplay & 0x400) >> 9)
                    | ((vTotal   & 0x400) >> 10);
    state->repaint0 = (((width/8)*pixelDepth) & 0x700) >> 3;
    state->horiz    = hTotal     < 260 ? 0x00 : 0x01;
    state->pixel    = (pixelDepth > 2 ? 3 : pixelDepth) | 0x40;
    state->offset0  =
    state->offset1  =
    state->offset2  =
    state->offset3  = 0;
    state->pitch0   =
    state->pitch1   =
    state->pitch2   =
    state->pitch3   = pixelDepth * width;
}
static void CalcStateExt ( RIVA_HW_INST * chip , RIVA_HW_STATE * state , int bpp , int width , int hDisplaySize , int hDisplay , int hStart , int hEnd , int hTotal , int height , int vDisplay , int vStart , int vEnd , int vTotal , int dotClock ) { int pixelDepth , VClk , m , n , p ; state -> bpp = bpp ; state -> width = width ; state -> height = height ; pixelDepth = ( bpp + 1 ) / 8 ; CalcVClock ( dotClock , & VClk , & m , & n , & p , chip ) ; switch ( chip -> Architecture ) { case 3 : nv3UpdateArbitrationSettings ( VClk , pixelDepth * 8 , & ( state -> arbitration0 ) , & ( state -> arbitration1 ) , chip ) ; state -> cursor0 = 0x00 ; state -> cursor1 = 0x78 ; state -> cursor2 = 0x00000000 ; state -> pllsel = 0x10010100 ; state -> config = ( ( width + 31 ) / 32 ) | ( ( ( pixelDepth > 2 ) ? 3 : pixelDepth ) << 8 ) | 0x1000 ; state -> general = 0x00000100 ; state -> repaint1 = hDisplaySize < 1280 ? 0x06 : 0x02 ; break ; case 4 : case 5 : nv4UpdateArbitrationSettings ( VClk , pixelDepth * 8 , & ( state -> arbitration0 ) , & ( state -> arbitration1 ) , chip ) ; state -> cursor0 = 0x00 ; state -> cursor1 = 0xFC ; state -> cursor2 = 0x00000000 ; state -> pllsel = 0x10000700 ; state -> config = 0x00001114 ; state -> general = bpp == 16 ? 0x00101100 : 0x00100100 ; state -> repaint1 = hDisplaySize < 1280 ? 0x04 : 0x00 ; break ; } state -> vpll = ( p << 16 ) | ( n << 8 ) | m ; state -> screen = ( ( hTotal & 0x040 ) >> 2 ) | ( ( vDisplay & 0x400 ) >> 7 ) | ( ( vStart & 0x400 ) >> 8 ) | ( ( vDisplay & 0x400 ) >> 9 ) | ( ( vTotal & 0x400 ) >> 10 ) ; state -> repaint0 = ( ( ( width / 8 ) * pixelDepth ) & 0x700 ) >> 3 ; state -> horiz = hTotal < 260 ? 0x00 : 0x01 ; state -> pixel = ( pixelDepth > 2 ? 3 : pixelDepth ) | 0x40 ; state -> offset0 = state -> offset1 = state -> offset2 = state -> offset3 = 0 ; state -> pitch0 = state -> pitch1 = state -> pitch2 = state -> pitch3 = pixelDepth * width ; }
Calculate extended mode parameters (SVGA) and save in a
 mode state structure.
Calculate extended mode parameters ( SVGA ) and save in a mode state structure .
/*
     * Save mode parameters.
     */ /*
     * Extended RIVA registers.
     */