: Set color fields correctly
PATCH 2/5 : Set color fields correctly
Hello all,
Although the depth can be correctly inferred from bits_per_pixel (if bits_per_pixel == 1), for the sake of consistency, drivers should still set the color fields correctly. True even if the first patch is not applied.
(I've combined everything in a single diff since there is only 1 logical change)
Tony
Signed-off-by Antonino Daplas <[email protected]>
68328fb.c | 13 +++++++++++++ bw2.c | 6 +++++- cirrusfb.c | 6 ++++++ dnfb.c | 3 +++ macfb.c | 3 +++ stifb.c | 1 + tx3912fb.c | 3 +++ 7 files changed, 34 insertions(+), 1 deletion(-)
drivers/video/68328fb.c +13 -0
@@ -199,6 +199,15 @@ static int mc68x328fb_check_var(struct f*/ switch (var->bits_per_pixel) {case 1 : + var->red.offset =0 ; + var->red.length =1 ; + var->green.offset =0 ; + var->green.length =1 ; + var->blue.offset =0 ; + var->blue.length =1 ; + var->transp.offset =0 ; + var->transp.length =0 ; +break ;case 8 : var->red.offset =0 ; var->red.length =8 ;
@@ -452,6 +461,10 @@ int __init mc68x328fb_init(void)get_line_length (mc68x328fb_default.xres_virtual, mc68x328fb_default.bits_per_pixel); fb_info.fix.visual = (mc68x328fb_default.bits_per_pixel) ==1 ?MC68X328FB_MONO_VISUAL :FB_VISUAL_PSEUDOCOLOR ; +if (fb_info.var.bits_per_pixel ==1 ) { + fb_info.var.red.length = fb_info.var.green.length = fb_info.var.blue.length =1 ; + fb_info.var.red.offset = fb_info.var.green.offset = fb_info.var.blue.offset =0 ; + } fb_info.pseudo_palette = &mc68x328fb_pseudo_palette; fb_info.flags =FBINFO_FLAG_DEFAULT ;
drivers/video/bw2.c +5 -1
@@ -323,7 +323,7 @@ static void bw2_init_one(struct sbus_dev resp = &res; all->info.var.xres = all->info.var.xres_virtual =1152 ; all->info.var.yres = all->info.var.yres_virtual =900 ; - all->info.bits_per_pixel =1 ; + all->info.var.bits_per_pixel =1 ; linebytes =1152 /8 ; } else#else
@@ -337,6 +337,10 @@ static void bw2_init_one(struct sbus_dev all->info.var.xres); }#endif + all->info.var.red.length = all->info.var.green.length = + all->info.var.blue.length = all_info.var.bits_per_pixel; + all->info.var.red.offset = all->info.var.green.offset = + all->info.var.blue.offset =0 ; all->par.regs = (struct bw2_regs *) sbus_ioremap(resp, BWTWO_REGISTER_OFFSET,
drivers/video/cirrusfb.c +6 -0
@@ -752,6 +752,12 @@ int cirrusfb_check_var(struct fb_var_scrswitch (var->bits_per_pixel) {case 1 : + var->red.offset =0 ; + var->red.length =1 ; + var->green.offset =0 ; + var->green.length =1 ; + var->blue.offset =0 ; + var->blue.length =1 ;break ;case 8 :
drivers/video/dnfb.c +3 -0
@@ -239,6 +239,9 @@ static int __devinit dnfb_probe(struct d info->fbops = &dn_fb_ops; info->fix = dnfb_fix; info->var = dnfb_var; + info->var.red.length =1 ; + info->var.red.offset =0 ; + info->var.green = info->var.blue = info->var.red; info->screen_base = (u_char *) info->fix.smem_start; err =fb_alloc_cmap (&info->cmap,2 ,0 );
drivers/video/macfb.c +3 -0
@@ -660,6 +660,9 @@ void __init macfb_init(void)case 1 :/* XXX: I think this will catch any program that tries to do FBIO_PUTCMAP when the visual is monochrome */ + macfb_defined.red.length = macfb_defined.bits_per_pixel; + macfb_defined.green.length = macfb_defined.bits_per_pixel; + macfb_defined.blue.length = macfb_defined.bits_per_pixel; video_cmap_len =0 ; macfb_fix.visual =FB_VISUAL_MONO01 ;break ;
drivers/video/stifb.c +1 -0
@@ -1298,6 +1298,7 @@ stifb_init_fb(struct sti_struct *sti, incase 1 : fix->type =FB_TYPE_PLANES ;/* well, sort of */ fix->visual =FB_VISUAL_MONO10 ; + var->red.length = var->green.length = var->blue.length =1 ;break ;case 8 : fix->type =FB_TYPE_PACKED_PIXELS ;
drivers/video/tx3912fb.c +3 -0
@@ -60,6 +60,9 @@ static struct fb_var_screeninfo tx3912fb .blue = { 0, 2, 0 }, #else .bits_per_pixel =4, + .red = { 0, 4, 0 }, /* ??? */ + .green = { 0, 4, 0 }, + .blue = { 0, 4, 0 }, #endif .activate = FB_ACTIVATE_NOW, .width = -1,
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click