Changeset 925fdd7 in mainline


Ignore:
Timestamp:
2008-12-10T21:41:22Z (16 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.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • boot/genarch/ofw.c

    r8af9950 r925fdd7  
    299299        unsigned int sc = ofw_get_size_cells(ofw_memory) /
    300300            (sizeof(uintptr_t) / sizeof(uint32_t));
    301         printf("address cells: %d, size cells: %d. ", ac, sc);
    302301
    303302        uintptr_t buf[((ac + sc) * MEMMAP_MAX_RECORDS)];
     
    406405                return false;
    407406
    408         /* setup the palette so that the 3:2:3 scheme is usable */
     407        /* setup the palette so that the (inverted) 3:2:3 scheme is usable */
    409408        unsigned int i;
    410409        for (i = 0; i < 256; i++)
    411410                if (ofw_call("call-method", 6, 1, NULL, "color!", screen,
    412                         i,
     411                        255 - i,
    413412                        i << 5,
    414413                        (i >> 3) << 6,
  • 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);
  • uspace/srv/fb/fb.c

    r8af9950 r925fdd7  
    243243rgb_byte8(void *dst, int rgb)
    244244{
    245         *(uint8_t *)dst = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3);
     245        *(uint8_t *)dst = 255 - (RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 |
     246                BLUE(rgb, 3));
    246247}
    247248
     
    250251byte8_rgb(void *src)
    251252{
    252         int color = *(uint8_t *)src;
     253        int color = 255 - (*(uint8_t *)src);
    253254        return (((color >> 5) & 0x7) << (16 + 5)) |
    254255            (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
     
    566567        }
    567568
    568         screen.fbaddress = (unsigned char *) (((uintptr_t) addr) + offset);
     569        screen.fbaddress = (unsigned char *) (((uintptr_t) addr));
    569570        screen.xres = xres;
    570571        screen.yres = yres;
Note: See TracChangeset for help on using the changeset viewer.