kernels/linux-2.4.0/drivers/video/cyber2000fb.c
/*
 * Decode the info required for the hardware.
 * This involves the PLL parameters for the dot clock,
 * CRTC registers, and accelerator settings.
 */
Decode the info required for the hardware.
This involves the PLL parameters for the dot clock,
CRTC registers, and accelerator settings.
Decode the info required for the hardware . This involves the PLL parameters for the dot clock CRTC registers and accelerator settings .
static int
cyber2000fb_decode_var(struct fb_var_screeninfo *var, struct cfb_info *cfb,
		       struct par_info *hw)
{
	int err;
	hw->width = var->xres_virtual;
	hw->palette_ctrl = 0x06;
	switch (var->bits_per_pixel) {
#ifdef FBCON_HAS_CFB8
	case 8:	
		hw->pixformat		= PIXFORMAT_8BPP;
		hw->visualid		= VISUALID_256;
		hw->pitch		= hw->width >> 3;
		break;
#endif
#ifdef FBCON_HAS_CFB16
	case 16:
#ifndef CFB16_IS_CFB15
		hw->pixformat		= PIXFORMAT_16BPP;
		hw->visualid		= VISUALID_64K;
		hw->pitch		= hw->width >> 2;
		hw->palette_ctrl	|= 0x10;
		break;
#endif
	case 15:
		hw->pixformat		= PIXFORMAT_16BPP;
		hw->visualid		= VISUALID_32K;
		hw->pitch		= hw->width >> 2;
		hw->palette_ctrl	|= 0x10;
		break;
#endif
#ifdef FBCON_HAS_CFB24
	case 24:
		hw->pixformat		= PIXFORMAT_24BPP;
		hw->visualid		= VISUALID_16M;
		hw->width		*= 3;
		hw->pitch		= hw->width >> 3;
		hw->palette_ctrl	|= 0x10;
		break;
#endif
	default:
		return -EINVAL;
	}
	err = cyber2000fb_decode_clock(hw, cfb, var);
	if (err)
		return err;
	err = cyber2000fb_decode_crtc(hw, cfb, var);
	if (err)
		return err;
	hw->width -= 1;
	hw->fetch = hw->pitch;
	if (!(cfb->mem_ctl2 & MEM_CTL2_64BIT))
		hw->fetch <<= 1;
	hw->fetch += 1;
	return 0;
}
static int cyber2000fb_decode_var ( struct fb_var_screeninfo * var , struct cfb_info * cfb , struct par_info * hw ) { int err ; hw -> width = var -> xres_virtual ; hw -> palette_ctrl = 0x06 ; switch ( var -> bits_per_pixel ) { #ifdef FBCON_HAS_CFB8 case 8 : hw -> pixformat = PIXFORMAT_8BPP ; hw -> visualid = VISUALID_256 ; hw -> pitch = hw -> width >> 3 ; break ; #endif #ifdef FBCON_HAS_CFB16 case 16 : #ifndef CFB16_IS_CFB15 hw -> pixformat = PIXFORMAT_16BPP ; hw -> visualid = VISUALID_64K ; hw -> pitch = hw -> width >> 2 ; hw -> palette_ctrl |= 0x10 ; break ; #endif case 15 : hw -> pixformat = PIXFORMAT_16BPP ; hw -> visualid = VISUALID_32K ; hw -> pitch = hw -> width >> 2 ; hw -> palette_ctrl |= 0x10 ; break ; #endif #ifdef FBCON_HAS_CFB24 case 24 : hw -> pixformat = PIXFORMAT_24BPP ; hw -> visualid = VISUALID_16M ; hw -> width *= 3 ; hw -> pitch = hw -> width >> 3 ; hw -> palette_ctrl |= 0x10 ; break ; #endif default : return - EINVAL ; } err = cyber2000fb_decode_clock ( hw , cfb , var ) ; if ( err ) return err ; err = cyber2000fb_decode_crtc ( hw , cfb , var ) ; if ( err ) return err ; hw -> width -= 1 ; hw -> fetch = hw -> pitch ; if ( ! ( cfb -> mem_ctl2 & MEM_CTL2_64BIT ) ) hw -> fetch <<= 1 ; hw -> fetch += 1 ; return 0 ; }
Decode the info required for the hardware.
Decode the info required for the hardware .
/* PSEUDOCOLOUR, 256 */ /* DIRECTCOLOUR, 64k */ /* DIRECTCOLOUR, 32k */ /* TRUECOLOUR, 16m */