Rev 1981 | Rev 1991 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1981 | Rev 1990 | ||
---|---|---|---|
Line 95... | Line 95... | ||
95 | } |
95 | } |
96 | 96 | ||
97 | /* Conversion routines between different color representations */ |
97 | /* Conversion routines between different color representations */ |
98 | static void rgb_4byte(void *dst, int rgb) |
98 | static void rgb_4byte(void *dst, int rgb) |
99 | { |
99 | { |
100 | *(int *)dst = rgb; |
100 | *((int *) dst) = rgb; |
101 | } |
101 | } |
102 | 102 | ||
103 | static int byte4_rgb(void *src) |
103 | static int byte4_rgb(void *src) |
104 | { |
104 | { |
105 | return (*(int *)src) & 0xffffff; |
105 | return (*((int *) src)) & 0xffffff; |
106 | } |
106 | } |
107 | 107 | ||
108 | static void rgb_3byte(void *dst, int rgb) |
108 | static void rgb_3byte(void *dst, int rgb) |
109 | { |
109 | { |
110 | uint8_t *scr = dst; |
110 | uint8_t *scr = dst; |
Line 131... | Line 131... | ||
131 | 131 | ||
132 | /** 16-bit depth (5:6:5) */ |
132 | /** 16-bit depth (5:6:5) */ |
133 | static void rgb_2byte(void *dst, int rgb) |
133 | static void rgb_2byte(void *dst, int rgb) |
134 | { |
134 | { |
135 | /* 5-bit, 6-bits, 5-bits */ |
135 | /* 5-bit, 6-bits, 5-bits */ |
136 | *((uint16_t *)(dst)) = RED(rgb, 5) << 11 | GREEN(rgb, 6) << 5 | BLUE(rgb, 5); |
136 | *((uint16_t *) dst) = RED(rgb, 5) << 11 | GREEN(rgb, 6) << 5 | BLUE(rgb, 5); |
137 | } |
137 | } |
138 | 138 | ||
139 | /** 16-bit depth (5:6:5) */ |
139 | /** 16-bit depth (5:6:5) */ |
140 | static int byte2_rgb(void *src) |
140 | static int byte2_rgb(void *src) |
141 | { |
141 | { |
Line 151... | Line 151... | ||
151 | * palette. This could be fixed by supporting custom palette |
151 | * palette. This could be fixed by supporting custom palette |
152 | * and setting it to simulate the 8-bit truecolor. |
152 | * and setting it to simulate the 8-bit truecolor. |
153 | */ |
153 | */ |
154 | static void rgb_1byte(void *dst, int rgb) |
154 | static void rgb_1byte(void *dst, int rgb) |
155 | { |
155 | { |
156 | *(uint8_t *)dst = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3); |
156 | *((uint8_t *) dst) = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3); |
157 | } |
157 | } |
158 | 158 | ||
159 | /** Return pixel color - 8-bit depth (color palette/3:2:3) |
159 | /** Return pixel color - 8-bit depth (color palette/3:2:3) |
160 | * |
160 | * |
161 | * See the comment for rgb_1byte(). |
161 | * See the comment for rgb_1byte(). |
Line 407... | Line 407... | ||
407 | sysinfo_set_item_val("fb.scanline", NULL, scan); |
407 | sysinfo_set_item_val("fb.scanline", NULL, scan); |
408 | sysinfo_set_item_val("fb.address.physical", NULL, addr); |
408 | sysinfo_set_item_val("fb.address.physical", NULL, addr); |
409 | sysinfo_set_item_val("fb.invert-colors", NULL, invert_colors); |
409 | sysinfo_set_item_val("fb.invert-colors", NULL, invert_colors); |
410 | 410 | ||
411 | /* Allocate double buffer */ |
411 | /* Allocate double buffer */ |
412 | int totsize = scanline * yres; |
- | |
413 | int pages = SIZE2FRAMES(totsize); |
412 | unsigned int order = fnzb(SIZE2FRAMES(ALIGN_UP(fbsize, FRAME_SIZE))) + 1; |
414 | int order; |
- | |
415 | if (pages == 1) |
- | |
416 | order = 0; |
- | |
417 | else |
- | |
418 | order = fnzb(pages - 1) + 1; |
- | |
419 | - | ||
420 | dbbuffer = frame_alloc(order, FRAME_ATOMIC | FRAME_KA); |
413 | dbbuffer = (uint8_t * ) frame_alloc(order, FRAME_ATOMIC | FRAME_KA); |
421 | if (!dbbuffer) |
414 | if (!dbbuffer) |
422 | printf("Failed to allocate scroll buffer.\n"); |
415 | printf("Failed to allocate scroll buffer.\n"); |
423 | dboffset = 0; |
416 | dboffset = 0; |
424 | 417 | ||
425 | /* Initialized blank line */ |
418 | /* Initialized blank line */ |
426 | blankline = (uint8_t *) malloc(ROW_BYTES, FRAME_ATOMIC); |
419 | blankline = (uint8_t *) malloc(ROW_BYTES, FRAME_ATOMIC); |
427 | if (!blankline) |
420 | if (!blankline) |
428 | panic("Failed to allocate blank line for framebuffer."); |
421 | panic("Failed to allocate blank line for framebuffer."); |
429 | for (y=0; y < FONT_SCANLINES; y++) { |
422 | for (y = 0; y < FONT_SCANLINES; y++) |
430 | for (x=0; x < xres; x++) { |
423 | for (x = 0; x < xres; x++) |
431 | (*rgb2scr)(&blankline[POINTPOS(x,y)], COLOR(BGCOLOR)); |
424 | (*rgb2scr)(&blankline[POINTPOS(x, y)], COLOR(BGCOLOR)); |
432 | } |
- | |
433 | } |
- | |
434 | 425 | ||
435 | clear_screen(); |
426 | clear_screen(); |
436 | 427 | ||
437 | /* Update size of screen to match text area */ |
428 | /* Update size of screen to match text area */ |
438 | yres = rows * FONT_SCANLINES; |
429 | yres = rows * FONT_SCANLINES; |
Line 440... | Line 431... | ||
440 | draw_logo(xres - helenos_width, 0); |
431 | draw_logo(xres - helenos_width, 0); |
441 | invert_cursor(); |
432 | invert_cursor(); |
442 | 433 | ||
443 | chardev_initialize("fb", &framebuffer, &fb_ops); |
434 | chardev_initialize("fb", &framebuffer, &fb_ops); |
444 | stdout = &framebuffer; |
435 | stdout = &framebuffer; |
445 | - | ||
446 | } |
436 | } |
447 | 437 | ||
448 | /** @} |
438 | /** @} |
449 | */ |
439 | */ |