Changeset 253f35a1 in mainline for kernel/genarch/src/fb/fb.c


Ignore:
Timestamp:
2006-09-07T19:56:44Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ab1ae2d9
Parents:
801579fe
Message:

sparc64 work.

  • Changes to enable userspace keyboard drivers.
  • Fix z8530 initialization (i.e. clear any pending Tx interrupts).
  • Experimental support for framebuffers with inverted colors.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/fb/fb.c

    r801579fe r253f35a1  
    6161static unsigned int bitspp = 0;
    6262static unsigned int pixelbytes = 0;
     63#ifdef FB_INVERT_COLORS
     64static bool invert_colors = true;
     65#else
     66static bool invert_colors = false;
     67#endif
    6368
    6469static unsigned int position = 0;
     
    6671static unsigned int rows = 0;
    6772
    68 
    6973#define COL_WIDTH       8
    7074#define ROW_BYTES       (scanline * FONT_SCANLINES)
     
    8589static void (*rgb2scr)(void *, int);
    8690static int (*scr2rgb)(void *);
     91
     92static inline int COLOR(int color)
     93{
     94        return invert_colors ? ~color : color;
     95}
    8796
    8897/* Conversion routines between different color representations */
     
    160169static void putpixel(unsigned int x, unsigned int y, int color)
    161170{
    162         (*rgb2scr)(&fbaddress[POINTPOS(x,y)],color);
     171        (*rgb2scr)(&fbaddress[POINTPOS(x,y)], COLOR(color));
    163172
    164173        if (dbbuffer) {
    165174                int dline = (y + dboffset) % yres;
    166                 (*rgb2scr)(&dbbuffer[POINTPOS(x,dline)],color);
     175                (*rgb2scr)(&dbbuffer[POINTPOS(x,dline)], COLOR(color));
    167176        }
    168177}
     
    173182        if (dbbuffer) {
    174183                int dline = (y + dboffset) % yres;
    175                 return (*scr2rgb)(&dbbuffer[POINTPOS(x,dline)]);
    176         }
    177         return (*scr2rgb)(&fbaddress[POINTPOS(x,y)]);
     184                return COLOR((*scr2rgb)(&dbbuffer[POINTPOS(x,dline)]));
     185        }
     186        return COLOR((*scr2rgb)(&fbaddress[POINTPOS(x,y)]));
    178187}
    179188
     
    275284                        byte >>= x % 8;
    276285                        if (byte & 1)
    277                                 putpixel(startx + x, starty + y, LOGOCOLOR);
     286                                putpixel(startx + x, starty + y, COLOR(LOGOCOLOR));
    278287                }
    279288}
     
    398407        sysinfo_set_item_val("fb.scanline", NULL, scan);
    399408        sysinfo_set_item_val("fb.address.physical", NULL, addr);
     409        sysinfo_set_item_val("fb.invert-colors", NULL, invert_colors);
    400410
    401411        /* Allocate double buffer */
     
    417427        if (!blankline)
    418428                panic("Failed to allocate blank line for framebuffer.");
    419         for (y=0; y < FONT_SCANLINES; y++)
    420                 for (x=0; x < xres; x++)
    421                         (*rgb2scr)(&blankline[POINTPOS(x,y)],BGCOLOR);
     429        for (y=0; y < FONT_SCANLINES; y++) {
     430                for (x=0; x < xres; x++) {
     431                        (*rgb2scr)(&blankline[POINTPOS(x,y)], COLOR(BGCOLOR));
     432                }
     433        }
    422434
    423435        clear_screen();
Note: See TracChangeset for help on using the changeset viewer.