/trunk/kernel/genarch/include/fb/fb.h |
---|
39,7 → 39,7 |
#include <arch/types.h> |
extern spinlock_t fb_lock; |
void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan); |
void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan, bool align); |
#endif |
/trunk/kernel/genarch/src/fb/fb.c |
---|
134,13 → 134,23 |
return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3); |
} |
/** Put pixel - 8-bit depth (3:2:3) */ |
/** Put pixel - 8-bit depth (color palette/3:2:3) |
* |
* Even though we try 3:2:3 color scheme here, an 8-bit framebuffer |
* will most likely use a color palette. The color appearance |
* will be pretty random and depend on the default installed |
* palette. This could be fixed by supporting custom palette |
* and setting it to simulate the 8-bit truecolor. |
*/ |
static void rgb_1byte(void *dst, int rgb) |
{ |
*(uint8_t *)dst = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3); |
} |
/** Return pixel color - 8-bit depth (3:2:3) */ |
/** Return pixel color - 8-bit depth (color palette/3:2:3) |
* |
* See the comment for rgb_1byte(). |
*/ |
static int byte1_rgb(void *src) |
{ |
int color = *(uint8_t *)src; |
329,14 → 339,14 |
/** Initialize framebuffer as a chardev output device |
* |
* @param addr Physical address of the framebuffer |
* @param x Screen width in pixels |
* @param y Screen height in pixels |
* @param bpp Bits per pixel (8, 16, 24, 32) |
* @param scan Bytes per one scanline |
* |
* @param addr Physical address of the framebuffer |
* @param x Screen width in pixels |
* @param y Screen height in pixels |
* @param bpp Bits per pixel (8, 16, 24, 32) |
* @param scan Bytes per one scanline |
* @param align Request alignment for 24bpp mode. |
*/ |
void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan) |
void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan, bool align) |
{ |
switch (bpp) { |
case 8: |
352,7 → 362,10 |
case 24: |
rgb2scr = rgb_3byte; |
scr2rgb = byte3_rgb; |
pixelbytes = 3; |
if (align) |
pixelbytes = 4; |
else |
pixelbytes = 3; |
break; |
case 32: |
rgb2scr = rgb_4byte; |
/trunk/kernel/arch/sparc64/src/console.c |
---|
58,7 → 58,7 |
kbd_init(); |
fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, |
bootinfo.screen.bpp, bootinfo.screen.scanline); |
bootinfo.screen.bpp, bootinfo.screen.scanline, true); |
} |
/** Kernel thread for polling keyboard. |
/trunk/kernel/arch/ppc32/src/ppc32.c |
---|
70,7 → 70,7 |
void arch_post_mm_init(void) |
{ |
if (config.cpu_active == 1) { |
fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline); |
fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline, false); |
/* Initialize PIC */ |
pic_init(bootinfo.keyboard.addr, PAGE_SIZE); |
/trunk/kernel/arch/ppc64/src/ppc64.c |
---|
26,7 → 26,7 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup ppc64 |
/** @addtogroup ppc64 |
* @{ |
*/ |
/** @file |
68,7 → 68,7 |
void arch_post_mm_init(void) |
{ |
if (config.cpu_active == 1) { |
fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline); |
fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline, false); |
/* Merge all zones to 1 big zone */ |
zone_merge_all(); |
110,6 → 110,5 |
{ |
} |
/** @} |
/** @} |
*/ |
/trunk/kernel/arch/mips32/src/mips32.c |
---|
127,7 → 127,7 |
void arch_post_mm_init(void) |
{ |
#ifdef CONFIG_FB |
fb_init(0x12000000, 640, 480, 24, 1920); // gxemul framebuffer |
fb_init(0x12000000, 640, 480, 24, 1920, false); // gxemul framebuffer |
#endif |
sysinfo_set_item_val("machine." STRING(MACHINE),NULL,1); |
} |
/trunk/kernel/arch/ia32/src/drivers/vesa.c |
---|
67,7 → 67,7 |
void vesa_init(void) |
{ |
fb_init(vesa_ph_addr, vesa_width, vesa_height, vesa_bpp, vesa_scanline); |
fb_init(vesa_ph_addr, vesa_width, vesa_height, vesa_bpp, vesa_scanline, false); |
} |
#endif |
/trunk/boot/arch/sparc64/loader/ofwarch.h |
---|
32,4 → 32,6 |
#define OFW_ADDRESS_CELLS 2 |
#define OFW_SIZE_CELLS 2 |
extern int bpp2align[]; |
#endif |
/trunk/boot/arch/sparc64/loader/main.c |
---|
31,6 → 31,7 |
#include "asm.h" |
#include "_components.h" |
#include <ofw.h> |
#include "ofwarch.h" |
#include <align.h> |
#define KERNEL_VIRTUAL_ADDRESS 0x400000 |
59,10 → 60,12 |
halt(); |
} |
bootinfo.screen.addr = ofw_translate(bootinfo.screen.addr); |
/* transform scanline to bytes with respect to potential alignment */ |
bootinfo.screen.scanline = bootinfo.screen.scanline*bpp2align[bootinfo.screen.bpp >> 3]; |
if (!ofw_keyboard(&bootinfo.keyboard)) |
printf("Error: unable to get keyboard properties\n"); |
printf("\nDevice statistics\n"); |
printf(" memory: %dM\n", bootinfo.memmap.total>>20); |
printf(" screen at %P, resolution %dx%d, %d bpp (scanline %d bytes)\n", (uintptr_t) bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline); |
/trunk/boot/arch/sparc64/loader/ofwarch.c |
---|
35,6 → 35,14 |
#include <ofw.h> |
#include <printf.h> |
int bpp2align[] = { |
[0] = 0, /** Invalid bpp. */ |
[1] = 1, /** 8bpp is not aligned. */ |
[2] = 2, /** 16bpp is naturally aligned. */ |
[3] = 4, /** 24bpp is aligned on 4 byte boundary. */ |
[4] = 4, /** 32bpp is naturally aligned. */ |
}; |
void write(const char *str, const int len) |
{ |
int i; |