Changeset 2bc137c2 in mainline for kernel/arch


Ignore:
Timestamp:
2006-11-22T12:36:59Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ccb0cbc
Parents:
33dc0ad
Message:

make framebuffer code more generic

Location:
kernel/arch
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/drivers/vesa.c

    r33dc0ad r2bc137c2  
    3838
    3939#include <genarch/fb/fb.h>
     40#include <genarch/fb/visuals.h>
    4041#include <arch/drivers/vesa.h>
    4142#include <putchar.h>
     
    6869void vesa_init(void)
    6970{
    70         fb_init(vesa_ph_addr, vesa_width, vesa_height, vesa_bpp, vesa_scanline, false);
     71        unsigned int visual;
     72       
     73        switch (vesa_bpp) {
     74        case 8:
     75                visual = VISUAL_INDIRECT_8;
     76                break;
     77        case 16:
     78                visual = VISUAL_RGB_5_6_5;
     79                break;
     80        case 24:
     81                visual = VISUAL_RGB_8_8_8;
     82                break;
     83        case 32:
     84                visual = VISUAL_RGB_0_8_8_8;
     85                break;
     86        default:
     87                panic("Unsupported bits per pixel");
     88        }
     89       
     90        fb_init(vesa_ph_addr, vesa_width, vesa_height, vesa_scanline, visual);
    7191}
    7292
  • kernel/arch/mips32/src/mips32.c

    r33dc0ad r2bc137c2  
    5454#include <arch/debugger.h>
    5555#include <genarch/fb/fb.h>
     56#include <genarch/fb/visuals.h>
    5657#include <macros.h>
    5758#include <ddi/device.h>
     
    123124        console_init(device_assign_devno());
    124125#ifdef CONFIG_FB
    125         fb_init(0x12000000, 640, 480, 24, 1920, false); // gxemul framebuffer
     126        fb_init(0x12000000, 640, 480, 1920, VISUAL_RGB_8_8_8); // gxemul framebuffer
    126127#endif
    127128        sysinfo_set_item_val("machine." STRING(MACHINE), NULL, 1);
  • kernel/arch/ppc32/src/ppc32.c

    r33dc0ad r2bc137c2  
    3939#include <arch/interrupt.h>
    4040#include <genarch/fb/fb.h>
     41#include <genarch/fb/visuals.h>
    4142#include <userspace.h>
    4243#include <proc/uarg.h>
     
    7677        if (config.cpu_active == 1) {
    7778                /* Initialize framebuffer */
    78                 fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline, false);
     79                unsigned int visual;
     80               
     81                switch (bootinfo.screen.bpp) {
     82                case 8:
     83                        visual = VISUAL_INDIRECT_8;
     84                        break;
     85                case 16:
     86                        visual = VISUAL_RGB_5_5_5;
     87                        break;
     88                case 24:
     89                        visual = VISUAL_RGB_8_8_8;
     90                        break;
     91                case 32:
     92                        visual = VISUAL_RGB_0_8_8_8;
     93                        break;
     94                default:
     95                        panic("Unsupported bits per pixel");
     96                }
     97                fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.scanline, visual);
    7998               
    8099                /* Initialize IRQ routing */
  • kernel/arch/ppc64/src/ppc64.c

    r33dc0ad r2bc137c2  
    3838#include <arch/interrupt.h>
    3939#include <genarch/fb/fb.h>
     40#include <genarch/fb/visuals.h>
    4041#include <userspace.h>
    4142#include <proc/uarg.h>
     
    6970{
    7071        if (config.cpu_active == 1) {
    71                 fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline, false);
     72                /* Initialize framebuffer */
     73                unsigned int visual;
     74               
     75                switch (bootinfo.screen.bpp) {
     76                case 8:
     77                        visual = VISUAL_INDIRECT_8;
     78                        break;
     79                case 16:
     80                        visual = VISUAL_RGB_5_5_5;
     81                        break;
     82                case 24:
     83                        visual = VISUAL_RGB_8_8_8;
     84                        break;
     85                case 32:
     86                        visual = VISUAL_RGB_0_8_8_8;
     87                        break;
     88                default:
     89                        panic("Unsupported bits per pixel");
     90                }
     91                fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.scanline, visual);
     92               
    7293       
    7394                /* Merge all zones to 1 big zone */
  • kernel/arch/sparc64/src/drivers/scr.c

    r33dc0ad r2bc137c2  
    3636#include <genarch/ofw/ofw_tree.h>
    3737#include <genarch/fb/fb.h>
     38#include <genarch/fb/visuals.h>
    3839#include <arch/types.h>
    3940#include <typedefs.h>
     
    7677        uint32_t fb_linebytes = 0;
    7778        uint32_t fb_scanline = 0;
     79        unsigned int visual;
    7880
    7981        prop = ofw_tree_getprop(node, "width");
     
    116118                        return;
    117119                }
    118 
    119                 if (fb_depth == 24)
     120               
     121                switch (fb_depth) {
     122                case 8:
     123                        fb_scanline = fb_linebytes * (fb_depth >> 3);
     124                        visual = VISUAL_INDIRECT_8;
     125                        break;
     126                case 16:
     127                        fb_scanline = fb_linebytes * (fb_depth >> 3);
     128                        visual = VISUAL_RGB_5_6_5;
     129                        break;
     130                case 24:
    120131                        fb_scanline = fb_linebytes * 4;
    121                 else
     132                        visual = VISUAL_RGB_8_8_8_0;
     133                        break;
     134                case 32:
    122135                        fb_scanline = fb_linebytes * (fb_depth >> 3);
     136                        visual = VISUAL_RGB_0_8_8_8;
     137                        break;
     138                default:
     139                        printf("Unsupported bits per pixel.\n");
     140                        return;
     141                }
    123142               
    124143                break;
    125144        case SCR_FFB:   
    126                 fb_depth = 32;
    127145                fb_scanline = 8192;
     146                visual = VISUAL_RGB_0_8_8_8;
    128147
    129148                ofw_upa_reg_t *reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP];
     
    138157        }
    139158
    140         fb_init(fb_addr, fb_width, fb_height, fb_depth, fb_scanline, true);
     159        fb_init(fb_addr, fb_width, fb_height, fb_scanline, visual);
    141160}
    142161
Note: See TracChangeset for help on using the changeset viewer.