Rev 1334 | Rev 1376 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1334 | Rev 1371 | ||
|---|---|---|---|
| Line 30... | Line 30... | ||
| 30 | #include <genarch/fb/fb.h> |
30 | #include <genarch/fb/fb.h> |
| 31 | #include <console/chardev.h> |
31 | #include <console/chardev.h> |
| 32 | #include <console/console.h> |
32 | #include <console/console.h> |
| 33 | #include <sysinfo/sysinfo.h> |
33 | #include <sysinfo/sysinfo.h> |
| 34 | #include <mm/slab.h> |
34 | #include <mm/slab.h> |
| - | 35 | #include <mm/as.h> |
|
| - | 36 | #include <bitops.h> |
|
| - | 37 | #include <align.h> |
|
| 35 | #include <panic.h> |
38 | #include <panic.h> |
| 36 | #include <memstr.h> |
39 | #include <memstr.h> |
| 37 | #include <config.h> |
40 | #include <config.h> |
| 38 | 41 | ||
| 39 | #include "helenos.xbm" |
42 | #include "helenos.xbm" |
| Line 310... | Line 313... | ||
| 310 | }; |
313 | }; |
| 311 | 314 | ||
| 312 | 315 | ||
| 313 | /** Initialize framebuffer as a chardev output device |
316 | /** Initialize framebuffer as a chardev output device |
| 314 | * |
317 | * |
| 315 | * @param addr Address of theframebuffer |
318 | * @param addr Physical address of the framebuffer |
| 316 | * @param x Screen width in pixels |
319 | * @param x Screen width in pixels |
| 317 | * @param y Screen height in pixels |
320 | * @param y Screen height in pixels |
| 318 | * @param bpp Bits per pixel (8, 16, 24, 32) |
321 | * @param bpp Bits per pixel (8, 16, 24, 32) |
| 319 | * @param scan Bytes per one scanline |
322 | * @param scan Bytes per one scanline |
| 320 | * |
323 | * |
| Line 343... | Line 346... | ||
| 343 | pixelbytes = 4; |
346 | pixelbytes = 4; |
| 344 | break; |
347 | break; |
| 345 | default: |
348 | default: |
| 346 | panic("Unsupported bpp"); |
349 | panic("Unsupported bpp"); |
| 347 | } |
350 | } |
| 348 | 351 | ||
| - | 352 | unsigned int fbsize = scan * y; |
|
| 349 | fbaddress = (unsigned char *) addr; |
353 | unsigned int fborder; |
| - | 354 | ||
| - | 355 | if (fbsize <= FRAME_SIZE) |
|
| - | 356 | fborder = 0; |
|
| - | 357 | else |
|
| - | 358 | fborder = (fnzb32(fbsize - 1) + 1) - FRAME_WIDTH; |
|
| - | 359 | ||
| - | 360 | /* Map the framebuffer */ |
|
| - | 361 | fbaddress = (__u8 *) PA2KA(PFN2ADDR(frame_alloc(fborder, FRAME_KA))); |
|
| - | 362 | ||
| - | 363 | pfn_t i; |
|
| - | 364 | for (i = 0; i < ADDR2PFN(ALIGN_UP(fbsize, PAGE_SIZE)); i++) |
|
| - | 365 | page_mapping_insert(AS_KERNEL, (__address) fbaddress + PFN2ADDR(i), addr + PFN2ADDR(i), PAGE_NOT_CACHEABLE); |
|
| - | 366 | ||
| 350 | xres = x; |
367 | xres = x; |
| 351 | yres = y; |
368 | yres = y; |
| 352 | bitspp = bpp; |
369 | bitspp = bpp; |
| 353 | scanline = scan; |
370 | scanline = scan; |
| 354 | 371 | ||
| Line 359... | Line 376... | ||
| 359 | draw_logo(xres - helenos_width, 0); |
376 | draw_logo(xres - helenos_width, 0); |
| 360 | invert_cursor(); |
377 | invert_cursor(); |
| 361 | 378 | ||
| 362 | chardev_initialize("fb", &framebuffer, &fb_ops); |
379 | chardev_initialize("fb", &framebuffer, &fb_ops); |
| 363 | stdout = &framebuffer; |
380 | stdout = &framebuffer; |
| 364 | } |
381 | |
| 365 | - | ||
| 366 | - | ||
| 367 | /** Register framebuffer in sysinfo |
- | |
| 368 | * |
- | |
| 369 | */ |
- | |
| 370 | void fb_register(void) |
- | |
| 371 | { |
- | |
| 372 | sysinfo_set_item_val("fb", NULL, true); |
382 | sysinfo_set_item_val("fb", NULL, true); |
| 373 | sysinfo_set_item_val("fb.width", NULL, xres); |
383 | sysinfo_set_item_val("fb.width", NULL, x); |
| 374 | sysinfo_set_item_val("fb.height", NULL, yres); |
384 | sysinfo_set_item_val("fb.height", NULL, y); |
| 375 | sysinfo_set_item_val("fb.scanline", NULL, scanline); |
385 | sysinfo_set_item_val("fb.bpp", NULL, bpp); |
| 376 | sysinfo_set_item_val("fb.bpp", NULL, bitspp); |
386 | sysinfo_set_item_val("fb.scanline", NULL, scan); |
| 377 | sysinfo_set_item_val("fb.address.virtual", NULL, (__address) fbaddress); |
387 | sysinfo_set_item_val("fb.address.physical", NULL, addr); |
| 378 | } |
388 | } |