Changeset 253f35a1 in mainline for uspace


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
  • uspace/fb/fb.c

    r801579fe r253f35a1  
    7171
    7272struct {
    73         uint8_t *fbaddress ;
    74 
    75         unsigned int xres ;
    76         unsigned int yres ;
    77         unsigned int scanline ;
    78         unsigned int pixelbytes ;
     73        uint8_t *fbaddress;
     74
     75        unsigned int xres;
     76        unsigned int yres;
     77        unsigned int scanline;
     78        unsigned int pixelbytes;
     79        unsigned int invert_colors;
    7980
    8081        conv2scr_fn_t rgb2scr;
     
    141142#define POINTPOS(x, y)  ((y) * screen.scanline + (x) * screen.pixelbytes)
    142143
     144static inline int COLOR(int color)
     145{
     146        return screen.invert_colors ? ~color : color;
     147}
     148
    143149/* Conversion routines between different color representations */
    144150static void rgb_4byte(void *dst, int rgb)
     
    164170        scr[0] = BLUE(rgb, 8);
    165171#endif
    166 
    167 
    168172}
    169173
     
    218222
    219223        if (! (vport->paused && vport->dbdata))
    220                 (*screen.rgb2scr)(&screen.fbaddress[POINTPOS(dx,dy)],color);
     224                (*screen.rgb2scr)(&screen.fbaddress[POINTPOS(dx,dy)], COLOR(color));
    221225
    222226        if (vport->dbdata) {
    223227                int dline = (y + vport->dboffset) % vport->height;
    224228                int doffset = screen.pixelbytes * (dline * vport->width + x);
    225                 (*screen.rgb2scr)(&vport->dbdata[doffset],color);
     229                (*screen.rgb2scr)(&vport->dbdata[doffset], COLOR(color));
    226230        }
    227231}
     
    233237        int dy = vport->y + y;
    234238
    235         return (*screen.scr2rgb)(&screen.fbaddress[POINTPOS(dx,dy)]);
     239        return COLOR((*screen.scr2rgb)(&screen.fbaddress[POINTPOS(dx,dy)]));
    236240}
    237241
     
    239243                                int color)
    240244{
    241         (*screen.rgb2scr)(&mem[POINTPOS(x,y)],color);
     245        (*screen.rgb2scr)(&mem[POINTPOS(x,y)], COLOR(color));
    242246}
    243247
     
    455459 * @param scan Bytes per one scanline
    456460 * @param align Alignment for 24bpp mode.
     461 * @param invert_colors Inverted colors.
    457462 *
    458463 */
    459464static void
    460 screen_init(void *addr, unsigned int xres, unsigned int yres, unsigned int bpp, unsigned int scan, int align)
     465screen_init(void *addr, unsigned int xres, unsigned int yres, unsigned int bpp, unsigned int scan,
     466        int align, int invert_colors)
    461467{
    462468        switch (bpp) {
     
    491497        screen.yres = yres;
    492498        screen.scanline = scan;
     499        screen.invert_colors = invert_colors;
    493500       
    494501        /* Create first viewport */
     
    594601        int pos = (y * pmap->width + x) * screen.pixelbytes;
    595602
    596         (*screen.rgb2scr)(&pmap->data[pos],color);
     603        (*screen.rgb2scr)(&pmap->data[pos],COLOR(color));
    597604}
    598605
     
    12241231        unsigned int fb_bpp_align;
    12251232        unsigned int fb_scanline;
     1233        unsigned int fb_invert_colors;
    12261234        void *fb_addr;
    12271235        size_t asz;
     
    12351243        fb_bpp_align=sysinfo_value("fb.bpp-align");
    12361244        fb_scanline=sysinfo_value("fb.scanline");
     1245        fb_invert_colors=sysinfo_value("fb.invert-colors");
    12371246
    12381247        asz = fb_scanline*fb_height;
     
    12421251                    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
    12431252       
    1244         screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline, fb_bpp_align);
     1253        screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline, fb_bpp_align, fb_invert_colors);
    12451254
    12461255        return 0;
Note: See TracChangeset for help on using the changeset viewer.