kernels/linux-2.4.0/drivers/video/sa1100fb.c
/*
 * sa1100fb_encode_var():
 * 	Modify var structure using values in par
 */
Modify var structure using values in par
Modify var structure using values in par
static int 
sa1100fb_encode_var(struct fb_var_screeninfo *var,
                    struct sa1100fb_par *par)
{
	var->xres = par->xres;
	var->yres = par->yres;
	var->xres_virtual = par->xres_virtual;
	var->yres_virtual = par->yres_virtual;
	var->bits_per_pixel = par->bits_per_pixel;
        DPRINTK("var->bits_per_pixel=%d\n", var->bits_per_pixel);
	switch(var->bits_per_pixel) {
	case 2:
	case 4:
	case 8:
		var->red.length	   = 4;
		var->green         = var->red;
		var->blue          = var->red;
		var->transp.length = 0;
		break;
	case 12:          
	case 16:
                if (machine_is_bitsy()) {
                        var->red.length    = 4;
                        var->blue.length   = 4;
                        var->green.length  = 4;
                        var->transp.length = 0;
                        var->red.offset    = 12;
                        var->green.offset  = 7;
                        var->blue.offset   = 1;
                        var->transp.offset = 0;
                } else {
                        var->red.length    = 5;
                        var->blue.length   = 5;
                        var->green.length  = 6;
                        var->transp.length = 0;
                        var->red.offset    = 11;
                        var->green.offset  = 5;
                        var->blue.offset   = 0;
                        var->transp.offset = 0;
                }
                break;
	}
	return 0;
}
static int sa1100fb_encode_var ( struct fb_var_screeninfo * var , struct sa1100fb_par * par ) { var -> xres = par -> xres ; var -> yres = par -> yres ; var -> xres_virtual = par -> xres_virtual ; var -> yres_virtual = par -> yres_virtual ; var -> bits_per_pixel = par -> bits_per_pixel ; DPRINTK ( " \n " , var -> bits_per_pixel ) ; switch ( var -> bits_per_pixel ) { case 2 : case 4 : case 8 : var -> red . length = 4 ; var -> green = var -> red ; var -> blue = var -> red ; var -> transp . length = 0 ; break ; case 12 : case 16 : if ( machine_is_bitsy ( ) ) { var -> red . length = 4 ; var -> blue . length = 4 ; var -> green . length = 4 ; var -> transp . length = 0 ; var -> red . offset = 12 ; var -> green . offset = 7 ; var -> blue . offset = 1 ; var -> transp . offset = 0 ; } else { var -> red . length = 5 ; var -> blue . length = 5 ; var -> green . length = 6 ; var -> transp . length = 0 ; var -> red . offset = 11 ; var -> green . offset = 5 ; var -> blue . offset = 0 ; var -> transp . offset = 0 ; } break ; } return 0 ; }
sa1100fb_encode_var():
      Modify var structure using values in par
sa1100fb_encode_var () : Modify var structure using values in par
// Don't know if really want to zero var on entry. // Look at set_var to see.  If so, may need to add extra params to par      //	memset(var, 0, sizeof(struct fb_var_screeninfo)); // This case should differ for Active/Passive mode  