Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3678 → Rev 3679

/trunk/kernel/genarch/include/fb/visuals.h
44,7 → 44,6
#define VISUAL_RGB_0_8_8_8 5
 
#define VISUAL_BGR_0_8_8_8 6
#define VISUAL_SB1500_PALETTE 7
 
#endif
 
/trunk/kernel/genarch/src/fb/fb.c
191,26 → 191,6
BLUE(rgb, 3);
}
 
static void sb1500rgb_byte8(void *dst, int rgb)
{
if (RED(rgb, 1) && GREEN(rgb, 1) && BLUE(rgb, 1))
*((uint8_t *) dst) = 255;
else if (RED(rgb, 1) && GREEN(rgb, 1))
*((uint8_t *) dst) = 150;
else if (GREEN(rgb, 1) && BLUE(rgb, 1))
*((uint8_t *) dst) = 47;
else if (RED(rgb, 1) && BLUE(rgb, 1))
*((uint8_t *) dst) = 48;
else if (RED(rgb, 1))
*((uint8_t *) dst) = 32;
else if (GREEN(rgb, 1))
*((uint8_t *) dst) = 47;
else if (BLUE(rgb, 1))
*((uint8_t *) dst) = 2;
else
*((uint8_t *) dst) = 1;
}
 
/** Return pixel color - 8-bit depth (color palette/3:2:3)
*
* See the comment for rgb_byte().
466,11 → 446,6
scr2rgb = byte8_rgb;
pixelbytes = 1;
break;
case VISUAL_SB1500_PALETTE:
rgb2scr = sb1500rgb_byte8;
scr2rgb = byte8_rgb;
pixelbytes = 1;
break;
case VISUAL_RGB_5_5_5:
rgb2scr = rgb_byte555;
scr2rgb = byte555_rgb;
505,10 → 480,11
panic("Unsupported visual.\n");
}
unsigned int fbsize = props->scan * props->y + props->offset;
unsigned int fbsize = props->scan * props->y;
/* Map the framebuffer */
fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr, fbsize);
fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr + props->offset,
fbsize);
fbaddress += props->offset;
xres = props->x;
531,6 → 507,7
sysinfo_set_item_val("fb.scanline", NULL, props->scan);
sysinfo_set_item_val("fb.visual", NULL, props->visual);
sysinfo_set_item_val("fb.address.physical", NULL, props->addr);
sysinfo_set_item_val("fb.offset", NULL, props->offset);
sysinfo_set_item_val("fb.invert-colors", NULL, invert_colors);
 
/* Allocate double buffer */
/trunk/kernel/arch/sparc64/src/drivers/scr.c
78,6 → 78,7
}
uintptr_t fb_addr;
unsigned int fb_offset = 0;
uint32_t fb_width = 0;
uint32_t fb_height = 0;
uint32_t fb_depth = 0;
167,10 → 168,12
return;
}
 
fb_offset = 4 * 0x2000;
 
switch (fb_depth) {
case 8:
fb_scanline = fb_linebytes * (fb_depth >> 3);
visual = VISUAL_SB1500_PALETTE;
visual = VISUAL_INDIRECT_8;
break;
case 16:
fb_scanline = fb_linebytes * (fb_depth >> 3);
225,7 → 228,7
 
fb_properties_t props = {
.addr = fb_addr,
.offset = 0,
.offset = fb_offset,
.x = fb_width,
.y = fb_height,
.scan = fb_scanline,
/trunk/uspace/srv/fb/fb.c
521,8 → 521,9
*
*/
static bool
screen_init(void *addr, unsigned int xres, unsigned int yres,
unsigned int scan, unsigned int visual, bool invert_colors)
screen_init(void *addr, unsigned int offset, unsigned int xres,
unsigned int yres, unsigned int scan, unsigned int visual,
bool invert_colors)
{
switch (visual) {
case VISUAL_INDIRECT_8:
564,7 → 565,7
return false;
}
 
screen.fbaddress = (unsigned char *) addr;
screen.fbaddress = (unsigned char *) (((uintptr_t) addr) + offset);
screen.xres = xres;
screen.yres = yres;
screen.scanline = scan;
1353,6 → 1354,7
unsigned int fb_height;
unsigned int fb_scanline;
unsigned int fb_visual;
unsigned int fb_offset;
bool fb_invert_colors;
void *fb_addr;
size_t asz;
1360,6 → 1362,7
async_set_client_connection(fb_client_connection);
 
fb_ph_addr = (void *) sysinfo_value("fb.address.physical");
fb_offset = sysinfo_value("fb.offset");
fb_width = sysinfo_value("fb.width");
fb_height = sysinfo_value("fb.height");
fb_scanline = sysinfo_value("fb.scanline");
1369,10 → 1372,10
asz = fb_scanline * fb_height;
fb_addr = as_get_mappable_page(asz);
physmem_map(fb_ph_addr, fb_addr, ALIGN_UP(asz, PAGE_SIZE) >>
physmem_map(fb_ph_addr + fb_offset, fb_addr, ALIGN_UP(asz, PAGE_SIZE) >>
PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE);
 
if (screen_init(fb_addr, fb_width, fb_height, fb_scanline, fb_visual,
if (screen_init(fb_addr, fb_offset, fb_width, fb_height, fb_scanline, fb_visual,
fb_invert_colors))
return 0;