Changeset b4fa652 in mainline


Ignore:
Timestamp:
2006-08-04T08:21:30Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b006a2c8
Parents:
d7e3fa66
Message:

Support 24bpp framebuffers with 4 pixelbytes (each pixel aligned on 32-bits).

At least on sparc64, the OpenFirmware linebytes property specifies the number
of pixels between consecutive scan lines of the display. Fix scanilne calculation,
including possible alignment.

Add note to 8bpp pixel functions pointing out drawbacks of that mode.

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/sparc64/loader/main.c

    rd7e3fa66 rb4fa652  
    3232#include "_components.h"
    3333#include <ofw.h>
     34#include "ofwarch.h"
    3435#include <align.h>
    3536
     
    6061        }
    6162        bootinfo.screen.addr = ofw_translate(bootinfo.screen.addr);
     63        /* transform scanline to bytes with respect to potential alignment */
     64        bootinfo.screen.scanline = bootinfo.screen.scanline*bpp2align[bootinfo.screen.bpp >> 3];
    6265       
    6366        if (!ofw_keyboard(&bootinfo.keyboard))
    6467                printf("Error: unable to get keyboard properties\n");
    65        
     68
    6669        printf("\nDevice statistics\n");
    6770        printf(" memory: %dM\n", bootinfo.memmap.total>>20);
  • boot/arch/sparc64/loader/ofwarch.c

    rd7e3fa66 rb4fa652  
    3636#include <printf.h>
    3737
     38int bpp2align[] = {
     39        [0] = 0,                /** Invalid bpp. */
     40        [1] = 1,                /** 8bpp is not aligned. */
     41        [2] = 2,                /** 16bpp is naturally aligned. */
     42        [3] = 4,                /** 24bpp is aligned on 4 byte boundary. */
     43        [4] = 4,                /** 32bpp is naturally aligned. */
     44};
     45
    3846void write(const char *str, const int len)
    3947{
  • boot/arch/sparc64/loader/ofwarch.h

    rd7e3fa66 rb4fa652  
    3333#define OFW_SIZE_CELLS          2
    3434
     35extern int bpp2align[];
     36
    3537#endif
  • kernel/arch/ia32/src/drivers/vesa.c

    rd7e3fa66 rb4fa652  
    6868void vesa_init(void)
    6969{
    70         fb_init(vesa_ph_addr, vesa_width, vesa_height, vesa_bpp, vesa_scanline);
     70        fb_init(vesa_ph_addr, vesa_width, vesa_height, vesa_bpp, vesa_scanline, false);
    7171}
    7272
  • kernel/arch/mips32/src/mips32.c

    rd7e3fa66 rb4fa652  
    128128{
    129129#ifdef CONFIG_FB
    130         fb_init(0x12000000, 640, 480, 24, 1920); // gxemul framebuffer
     130        fb_init(0x12000000, 640, 480, 24, 1920, false); // gxemul framebuffer
    131131#endif
    132132        sysinfo_set_item_val("machine." STRING(MACHINE),NULL,1);
  • kernel/arch/ppc32/src/ppc32.c

    rd7e3fa66 rb4fa652  
    7171{
    7272        if (config.cpu_active == 1) {
    73                 fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline);
     73                fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline, false);
    7474       
    7575                /* Initialize PIC */
  • kernel/arch/ppc64/src/ppc64.c

    rd7e3fa66 rb4fa652  
    2727 */
    2828
    29  /** @addtogroup ppc64
     29/** @addtogroup ppc64
    3030 * @{
    3131 */
     
    6969{
    7070        if (config.cpu_active == 1) {
    71                 fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline);   
     71                fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline, false);
    7272       
    7373                /* Merge all zones to 1 big zone */
     
    111111}
    112112
    113  /** @}
     113/** @}
    114114 */
    115 
  • kernel/arch/sparc64/src/console.c

    rd7e3fa66 rb4fa652  
    5959               
    6060        fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height,
    61                 bootinfo.screen.bpp, bootinfo.screen.scanline);
     61                bootinfo.screen.bpp, bootinfo.screen.scanline, true);
    6262}
    6363
  • kernel/genarch/include/fb/fb.h

    rd7e3fa66 rb4fa652  
    4040
    4141extern spinlock_t fb_lock;
    42 void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan);
     42void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan, bool align);
    4343
    4444#endif
  • kernel/genarch/src/fb/fb.c

    rd7e3fa66 rb4fa652  
    135135}
    136136
    137 /** Put pixel - 8-bit depth (3:2:3) */
     137/** Put pixel - 8-bit depth (color palette/3:2:3)
     138 *
     139 * Even though we try 3:2:3 color scheme here, an 8-bit framebuffer
     140 * will most likely use a color palette. The color appearance
     141 * will be pretty random and depend on the default installed
     142 * palette. This could be fixed by supporting custom palette
     143 * and setting it to simulate the 8-bit truecolor.
     144 */
    138145static void rgb_1byte(void *dst, int rgb)
    139146{
     
    141148}
    142149
    143 /** Return pixel color - 8-bit depth (3:2:3) */
     150/** Return pixel color - 8-bit depth (color palette/3:2:3)
     151 *
     152 * See the comment for rgb_1byte().
     153 */
    144154static int byte1_rgb(void *src)
    145155{
     
    330340/** Initialize framebuffer as a chardev output device
    331341 *
    332  * @param addr Physical address of the framebuffer
    333  * @param x    Screen width in pixels
    334  * @param y    Screen height in pixels
    335  * @param bpp  Bits per pixel (8, 16, 24, 32)
    336  * @param scan Bytes per one scanline
    337  *
    338  */
    339 void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan)
     342 * @param addr  Physical address of the framebuffer
     343 * @param x     Screen width in pixels
     344 * @param y     Screen height in pixels
     345 * @param bpp   Bits per pixel (8, 16, 24, 32)
     346 * @param scan  Bytes per one scanline
     347 * @param align Request alignment for 24bpp mode.
     348 */
     349void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan, bool align)
    340350{
    341351        switch (bpp) {
     
    353363                        rgb2scr = rgb_3byte;
    354364                        scr2rgb = byte3_rgb;
    355                         pixelbytes = 3;
     365                        if (align)
     366                                pixelbytes = 4;
     367                        else
     368                                pixelbytes = 3;
    356369                        break;
    357370                case 32:
Note: See TracChangeset for help on using the changeset viewer.