: Differentiate bits_per_pixel from color depth
Subsystems (3)
PATCH 1/5 : Differentiate bits_per_pixel from color depth
Geert,
1. If you remember this thread (HP300 support checked in), one concern was how to support framebuffers with bpp == 8 but color depth < 8 (chunky layout). I suggested to use the fields in var->{red|green|blue} to differentiate between bits_per_pixel and depth. Included is a patch that does that.
(The above assumes background/foreground of 0/1. If hardware needs a different value, such as 0 - black, 0xff - white, just indicate TRUECOLOR or DIRECTCOLOR and set info->pseudopalette correctly in xxxfb_setcolreg().)
The patch will break the following drivers when in monochrome since they do not set the proper color bitfields. I've included a fix in patch #2.
68328fb
bw2fb
cirrusfb
dnfb
macfb
stifb
tx3912fb
2. Besides the change above, support for the inverse and underline attribute is added in monochrome mode. One should get text which are underlined/reversed if the corresponding attribute is set.
3. Because vt.c uses a 16-color palette, use fbcon_default_cmap if framebuffer can do less than 16 colors. In 4 colors, display will be grayscaled. In 8 colors, display should have the same colors as a 16-color console but will lack brightness/ intensity.
4. Fix monochrome logo drawing.
5. Reduce code of fbcon_putc so it just calls fbcon_putcs.
Tony
drivers/char/vt.c | 34 +++-- drivers/video/cfbimgblt.c | 2 drivers/video/console/fbcon.c | 243 +++++++++++++++++++++++++----------------- drivers/video/fbmem.c | 46 +++++-- include/linux/fb.h | 3 5 files changed, 208 insertions(+), 120 deletions(-)
drivers/char/vt.c +23 -11
@@ -599,6 +599,17 @@ static inline void save_screen(int currc* Redrawing of screen */ +static void clear_buffer_attributes (int currcons) +{ +unsigned short *p = (unsigned short *) origin; +int count = screenbuf_size/2 ; +int mask = hi_font_mask |0xff ; + +for (; count >0 ; count--, p++) { +scr_writew ((scr_readw (p)&mask) | (video_erase_char&~mask), p); + } +} +void redraw_screen (int new_console,int is_switch) {int redraw =1 ;
@@ -636,9 +647,21 @@ void redraw_screen(int new_console, intif (redraw) {int update; +int old_was_color = vc_cons[currcons].d->vc_can_do_color; +set_origin (currcons); update = sw->con_switch (vc_cons[currcons].d);set_palette (currcons); +/* +* If console changed from mono<->color, the best we can do +* is to clear the buffer attributes. As it currently stands, +* rebuilding new attributes from the old buffer is not doable +* without overly complex code. +*/ +if (old_was_color != vc_cons[currcons].d->vc_can_do_color) { +update_attr (currcons); +clear_buffer_attributes (currcons); + }if (update && vcmode !=KD_GRAPHICS )do_update_region (currcons, origin, screenbuf_size/2 ); }
@@ -2652,17 +2675,6 @@ int __init vty_init(void)#ifndef VT_SINGLE_DRIVER -static void clear_buffer_attributes (int currcons) -{ -unsigned short *p = (unsigned short *) origin; -int count = screenbuf_size/2 ; -int mask = hi_font_mask |0xff ; - -for (; count >0 ; count--, p++) { -scr_writew ((scr_readw (p)&mask) | (video_erase_char&~mask), p); - } -} -/* * If we support more console drivers, this function is used * when a driver wants to take over some existing consoles
drivers/video/cfbimgblt.c +1 -1
@@ -325,7 +325,7 @@ void cfb_imageblit(struct fb_info *p, coelse slow_imageblit (image, p, dst1, fgcolor, bgcolor, start_index, pitch_index); - }else if (image->depth <= bpp) + }else color_imageblit (image, p, dst1, start_index, pitch_index); }
drivers/video/console/fbcon.c +149 -94
382 lines not on this page · raw message
drivers/video/fbmem.c +32 -14
85 lines not on this page · raw message
include/linux/fb.h +3 -0
@@ -376,6 +376,8 @@ struct fb_cursor {__u16 set;/* what to set */ __u16 enable;/* cursor on/off */ __u16 rop;/* bitop operation */ +__u16 ul;/* underlined? */ +__u16 rev;/* reversed? */ const char *mask;/* cursor mask bits */ struct fbcurpos hot;/* cursor hot spot */ struct fb_image image;/* Cursor image */
@@ -653,6 +655,7 @@ extern void fb_sysmove_buf_aligned(struc u32 height);extern void fb_load_cursor_image (struct fb_info *);extern void fb_set_suspend (struct fb_info *info,int state); +extern int fb_get_color_depth (struct fb_info *info);extern struct fb_info *registered_fb[FB_MAX ];extern int num_registered_fb;
-------------------------------------------------------
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