Changeset b4fa652 in mainline for kernel/genarch/src/fb/fb.c


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.