Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3683 → Rev 3692

/trunk/kernel/genarch/src/fb/fb.c
177,7 → 177,7
(((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3);
}
 
/** Put pixel - 8-bit depth (color palette/3:2:3)
/** Put pixel - 8-bit depth (color palette/3:2:3, inverted)
*
* Even though we try 3:2:3 color scheme here, an 8-bit framebuffer
* will most likely use a color palette. The color appearance
184,11 → 184,19
* 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.
*
* Currently we set the palette on the sparc64 port.
*
* Note that the byte is being inverted by this function. The reason is
* that we would like to use a color palette where the white color code
* is 0 and the black color code is 255, as some machines (SunBlade 1500)
* use these codes for black and white and prevent to set codes
* 0 and 255 to other colors.
*/
static void rgb_byte8(void *dst, int rgb)
{
*((uint8_t *) dst) = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 |
BLUE(rgb, 3);
*((uint8_t *) dst) = 255 - (RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 |
BLUE(rgb, 3));
}
 
/** Return pixel color - 8-bit depth (color palette/3:2:3)
197,7 → 205,7
*/
static int byte8_rgb(void *src)
{
int color = *(uint8_t *)src;
int color = 255 - (*(uint8_t *)src);
return (((color >> 5) & 0x7) << (16 + 5)) |
(((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
}
483,8 → 491,8
unsigned int fbsize = props->scan * props->y;
/* Map the framebuffer */
fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr + props->offset,
fbsize);
fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr,
fbsize + props->offset);
fbaddress += props->offset;
xres = props->x;
494,7 → 502,7
rows = props->y / FONT_SCANLINES;
columns = props->x / COL_WIDTH;
 
fb_parea.pbase = (uintptr_t) props->addr;
fb_parea.pbase = (uintptr_t) props->addr + props->offset;
fb_parea.vbase = (uintptr_t) fbaddress;
fb_parea.frames = SIZE2FRAMES(fbsize);
fb_parea.cacheable = false;
/trunk/uspace/srv/fb/fb.c
242,7 → 242,8
static void
rgb_byte8(void *dst, int rgb)
{
*(uint8_t *)dst = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3);
*(uint8_t *)dst = 255 - (RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 |
BLUE(rgb, 3));
}
 
/** Return pixel color - 8-bit depth (3:2:3) */
249,7 → 250,7
static int
byte8_rgb(void *src)
{
int color = *(uint8_t *)src;
int color = 255 - (*(uint8_t *)src);
return (((color >> 5) & 0x7) << (16 + 5)) |
(((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
}
565,7 → 566,7
return false;
}
 
screen.fbaddress = (unsigned char *) (((uintptr_t) addr) + offset);
screen.fbaddress = (unsigned char *) (((uintptr_t) addr));
screen.xres = xres;
screen.yres = yres;
screen.scanline = scan;
/trunk/boot/genarch/ofw.c
298,7 → 298,6
(sizeof(uintptr_t) / sizeof(uint32_t));
unsigned int sc = ofw_get_size_cells(ofw_memory) /
(sizeof(uintptr_t) / sizeof(uint32_t));
printf("address cells: %d, size cells: %d. ", ac, sc);
 
uintptr_t buf[((ac + sc) * MEMMAP_MAX_RECORDS)];
int ret = ofw_get_property(ofw_memory, "reg", buf, sizeof(buf));
405,11 → 404,11
if (screen == -1)
return false;
 
/* setup the palette so that the 3:2:3 scheme is usable */
/* setup the palette so that the (inverted) 3:2:3 scheme is usable */
unsigned int i;
for (i = 0; i < 256; i++)
if (ofw_call("call-method", 6, 1, NULL, "color!", screen,
i,
255 - i,
i << 5,
(i >> 3) << 6,
(i >> 5) << 5) != 0);