Changeset 925fdd7 in mainline for kernel/genarch/src


Ignore:
Timestamp:
2008-12-10T21:41:22Z (17 years ago)
Author:
Pavel Rimsky <rimskyp@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bb74e8ab
Parents:
8af9950
Message:

Fixed the bug when on SunBlade1500 we wrote to an address outside the framebuffer memory. A nasty hack to the 8-bit palette so that on sb1500 we do not have to turn black into white and white into black.

File:
1 edited

Legend:

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

    r8af9950 r925fdd7  
    178178}
    179179
    180 /** Put pixel - 8-bit depth (color palette/3:2:3)
     180/** Put pixel - 8-bit depth (color palette/3:2:3, inverted)
    181181 *
    182182 * Even though we try 3:2:3 color scheme here, an 8-bit framebuffer
     
    185185 * palette. This could be fixed by supporting custom palette
    186186 * and setting it to simulate the 8-bit truecolor.
     187 *
     188 * Currently we set the palette on the sparc64 port.
     189 *
     190 * Note that the byte is being inverted by this function. The reason is
     191 * that we would like to use a color palette where the white color code
     192 * is 0 and the black color code is 255, as some machines (SunBlade 1500)
     193 * use these codes for black and white and prevent to set codes
     194 * 0 and 255 to other colors.
    187195 */
    188196static void rgb_byte8(void *dst, int rgb)
    189197{
    190         *((uint8_t *) dst) = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 |
    191             BLUE(rgb, 3);
     198        *((uint8_t *) dst) = 255 - (RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 |
     199            BLUE(rgb, 3));
    192200}
    193201
     
    198206static int byte8_rgb(void *src)
    199207{
    200         int color = *(uint8_t *)src;
     208        int color = 255 - (*(uint8_t *)src);
    201209        return (((color >> 5) & 0x7) << (16 + 5)) |
    202210            (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
     
    484492       
    485493        /* Map the framebuffer */
    486         fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr + props->offset,
    487                 fbsize);
     494        fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr,
     495                fbsize + props->offset);
    488496        fbaddress += props->offset;
    489497       
     
    495503        columns = props->x / COL_WIDTH;
    496504
    497         fb_parea.pbase = (uintptr_t) props->addr;
     505        fb_parea.pbase = (uintptr_t) props->addr + props->offset;
    498506        fb_parea.vbase = (uintptr_t) fbaddress;
    499507        fb_parea.frames = SIZE2FRAMES(fbsize);
Note: See TracChangeset for help on using the changeset viewer.