kernels/linux-2.4.0/drivers/video/sa1100fb.c
/*
 * sa1100fb_set_var():
 *	Set the user defined part of the display for the specified console
 */
Set the user defined part of the display for the specified console
Set the user defined part of the display for the specified console
static int
sa1100fb_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
{
	struct display *display;
	int err, chgvar = 0;
	struct sa1100fb_par par;
	if (con >= 0)
		display = &fb_display[con]; 
	else
		display = &global_disp;     
	if ((err = sa1100fb_decode_var(var, &par)))
		return err;
	sa1100fb_encode_var(var, &par);
	if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_TEST)
		return 0;
	else if (((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW) && 
		 ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NXTOPEN))
		return -EINVAL;
	if (con >= 0) {
		if ((display->var.xres != var->xres) ||
		    (display->var.yres != var->yres) ||
		    (display->var.xres_virtual != var->xres_virtual) ||
		    (display->var.yres_virtual != var->yres_virtual) ||
		    (display->var.sync != var->sync)                 ||
                    (display->var.bits_per_pixel != var->bits_per_pixel) ||
		    (memcmp(&display->var.red, &var->red, sizeof(var->red))) ||
		    (memcmp(&display->var.green, &var->green, sizeof(var->green))) ||
		    (memcmp(&display->var.blue, &var->blue, sizeof(var->blue)))) 
			chgvar = 1;
	}
	display->var = *var;
	display->screen_base	= par.v_screen_base;
	display->visual		= par.visual;
	display->type		= FB_TYPE_PACKED_PIXELS;
	display->type_aux	= 0;
	display->ypanstep	= 0;
	display->ywrapstep	= 0;
	display->line_length	= 
	display->next_line      = (var->xres * var->bits_per_pixel) / 8;
	display->can_soft_blank	= 1;
	display->inverse	= 0;
	switch (display->var.bits_per_pixel) {
#ifdef FBCON_HAS_CFB4
        case 4:
		display->dispsw = &fbcon_cfb4;
		break;
#endif
#ifdef FBCON_HAS_CFB8
	case 8: 
		display->dispsw = &fbcon_cfb8;
		break;
#endif
#ifdef FBCON_HAS_CFB16
	case 16:
		display->dispsw = &fbcon_cfb16;
		break;
#endif
	default:
		display->dispsw = &fbcon_dummy;
		break;
	}
	if (chgvar && info && info->changevar)
		info->changevar(con);
	if ((con == current_par.currcon) &&
	    (current_par.visual != FB_VISUAL_TRUECOLOR)) {
		struct fb_cmap *cmap;
		current_par = par;
		if (display->cmap.len)
			cmap = &display->cmap;
		else
			cmap = fb_default_cmap(current_par.palette_size);
		fb_set_cmap(cmap, 1, sa1100fb_setcolreg, info);
	}
	if (con == current_par.currcon)
		sa1100fb_activate_var(var);
	return 0;
}
static int sa1100fb_set_var ( struct fb_var_screeninfo * var , int con , struct fb_info * info ) { struct display * display ; int err , chgvar = 0 ; struct sa1100fb_par par ; if ( con >= 0 ) display = & fb_display [ con ] ; else display = & global_disp ; if ( ( err = sa1100fb_decode_var ( var , & par ) ) ) return err ; sa1100fb_encode_var ( var , & par ) ; if ( ( var -> activate & FB_ACTIVATE_MASK ) == FB_ACTIVATE_TEST ) return 0 ; else if ( ( ( var -> activate & FB_ACTIVATE_MASK ) != FB_ACTIVATE_NOW ) && ( ( var -> activate & FB_ACTIVATE_MASK ) != FB_ACTIVATE_NXTOPEN ) ) return - EINVAL ; if ( con >= 0 ) { if ( ( display -> var . xres != var -> xres ) || ( display -> var . yres != var -> yres ) || ( display -> var . xres_virtual != var -> xres_virtual ) || ( display -> var . yres_virtual != var -> yres_virtual ) || ( display -> var . sync != var -> sync ) || ( display -> var . bits_per_pixel != var -> bits_per_pixel ) || ( memcmp ( & display -> var . red , & var -> red , sizeof ( var -> red ) ) ) || ( memcmp ( & display -> var . green , & var -> green , sizeof ( var -> green ) ) ) || ( memcmp ( & display -> var . blue , & var -> blue , sizeof ( var -> blue ) ) ) ) chgvar = 1 ; } display -> var = * var ; display -> screen_base = par . v_screen_base ; display -> visual = par . visual ; display -> type = FB_TYPE_PACKED_PIXELS ; display -> type_aux = 0 ; display -> ypanstep = 0 ; display -> ywrapstep = 0 ; display -> line_length = display -> next_line = ( var -> xres * var -> bits_per_pixel ) / 8 ; display -> can_soft_blank = 1 ; display -> inverse = 0 ; switch ( display -> var . bits_per_pixel ) { #ifdef FBCON_HAS_CFB4 case 4 : display -> dispsw = & fbcon_cfb4 ; break ; #endif #ifdef FBCON_HAS_CFB8 case 8 : display -> dispsw = & fbcon_cfb8 ; break ; #endif #ifdef FBCON_HAS_CFB16 case 16 : display -> dispsw = & fbcon_cfb16 ; break ; #endif default : display -> dispsw = & fbcon_dummy ; break ; } if ( chgvar && info && info -> changevar ) info -> changevar ( con ) ; if ( ( con == current_par . currcon ) && ( current_par . visual != FB_VISUAL_TRUECOLOR ) ) { struct fb_cmap * cmap ; current_par = par ; if ( display -> cmap . len ) cmap = & display -> cmap ; else cmap = fb_default_cmap ( current_par . palette_size ) ; fb_set_cmap ( cmap , 1 , sa1100fb_setcolreg , info ) ; } if ( con == current_par . currcon ) sa1100fb_activate_var ( var ) ; return 0 ; }
sa1100fb_set_var():
      Set the user defined part of the display for the specified console
sa1100fb_set_var () : Set the user defined part of the display for the specified console
/* Display settings for console */ /* Default display settings */ /* Decode var contents into a par structure, adjusting any */ /* out of range values. */ // Store adjusted par values into var structure /* If the console has changed and the console has defined */ /* a changevar function, call that function. */ /* If the current console is selected and it's not truecolor, 
	 *  update the palette 
	 */ /* If the current console is selected, activate the new var. */