Changeset fd375a8d in mainline


Ignore:
Timestamp:
2009-02-03T13:50:26Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
753d851
Parents:
eddf924
Message:

more exact RGB323 palette calculation
set the RGB323 palette on ppc32

Location:
boot
Files:
5 edited

Legend:

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

    reddf924 rfd375a8d  
    177177        fix_overlap(&bootinfo, &bootinfo_pa, "boot info", &top);
    178178       
     179        ofw_setup_palette();
     180       
    179181        printf("\nBooting the kernel...\n");
    180182        jump_to_kernel(bootinfo_pa, sizeof(bootinfo), trans_pa, pages << PAGE_WIDTH, real_mode_pa, (void *) bootinfo.screen.addr, bootinfo.screen.scanline);
  • boot/arch/sparc64/loader/main.c

    reddf924 rfd375a8d  
    270270#endif
    271271
    272         setup_palette();
     272        ofw_setup_palette();
    273273
    274274        printf("\nBooting the kernel...\n");
  • boot/genarch/ofw.c

    reddf924 rfd375a8d  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28  
     28
    2929#include <ofw.h>
    3030#include <ofwarch.h>
     
    373373}
    374374
     375#define RED(i)    (((i) >> 5) & ((1 << 3) - 1))
     376#define GREEN(i)  (((i) >> 3) & ((1 << 2) - 1))
     377#define BLUE(i)   ((i) & ((1 << 3) - 1))
     378#define CLIP(i)   ((i) <= 255 ? (i) : 255)
     379
     380
    375381/**
    376382 * Sets up the palette for the 8-bit color depth configuration so that the
    377383 * 3:2:3 color scheme can be used. Checks that setting the palette makes sense
    378384 * (appropriate nodes exist in the OBP tree and the color depth is not greater
    379  * than 8).
    380  *
    381  * @return      true if the palette has been set, false otherwise
     385 * than 8).
     386 *
     387 * @return true if the palette has been set, false otherwise
     388 *
    382389 */
    383 int setup_palette(void)
     390int ofw_setup_palette(void)
    384391{
    385392        char device_name[BUF_SIZE];
     
    387394        /* resolve alias */
    388395        if (ofw_get_property(ofw_aliases, "screen", device_name,
    389                 sizeof(device_name)) <= 0)
    390                 return false;
    391 
     396            sizeof(device_name)) <= 0)
     397                return false;
     398       
    392399        /* for depth greater than 8 it makes no sense to set up the palette */
    393400        uint32_t depth;
     
    404411        if (screen == -1)
    405412                return false;
    406 
     413       
    407414        /* setup the palette so that the (inverted) 3:2:3 scheme is usable */
    408415        unsigned int i;
    409416        for (i = 0; i < 256; i++)
    410                 if (ofw_call("call-method", 6, 1, NULL, "color!", screen,
    411                         255 - i,
    412                         i << 5,
    413                         (i >> 3) << 6,
    414                         (i >> 5) << 5) != 0);
     417                ofw_call("call-method", 6, 1, NULL, "color!", screen,
     418                    255 - i, CLIP(BLUE(i) * 37), GREEN(i) * 85, CLIP(RED(i) * 37));
    415419        return true;
    416420}
  • boot/genarch/ofw.h

    reddf924 rfd375a8d  
    124124extern int ofw_screen(screen_t *screen);
    125125extern int ofw_macio(macio_t *macio);
    126 extern int setup_palette(void);
     126extern int ofw_setup_palette(void);
    127127extern void ofw_quiesce(void);
    128128
  • boot/tools/ia32/gen_vga323.c

    reddf924 rfd375a8d  
     1/*
     2 * Copyright (c) 2008 Martin Decky
     3 * All rights reserved.
     4 *
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 *
     9 * - Redistributions of source code must retain the above copyright
     10 *   notice, this list of conditions and the following disclaimer.
     11 * - Redistributions in binary form must reproduce the above copyright
     12 *   notice, this list of conditions and the following disclaimer in the
     13 *   documentation and/or other materials provided with the distribution.
     14 * - The name of the author may not be used to endorse or promote products
     15 *   derived from this software without specific prior written permission.
     16 *
     17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 */
     28
    129#include <stdio.h>
    230
    3 #define RED(i) ((i >> 5) & ((1 << 3) - 1))
    4 #define GREEN(i) ((i >> 3) & ((1 << 2) - 1))
    5 #define BLUE(i) (i & ((1 << 3) - 1))
     31#define RED(i)    (((i) >> 5) & ((1 << 3) - 1))
     32#define GREEN(i)  (((i) >> 3) & ((1 << 2) - 1))
     33#define BLUE(i)   ((i) & ((1 << 3) - 1))
    634
    735int main(int argc, char *argv[]) {
Note: See TracChangeset for help on using the changeset viewer.