Rev 1500 | Rev 1505 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1500 | Rev 1501 | ||
|---|---|---|---|
| Line 357... | Line 357... | ||
| 357 | * @param y Screen height in pixels |
357 | * @param y Screen height in pixels |
| 358 | * @param bpp Bits per pixel (8, 16, 24, 32) |
358 | * @param bpp Bits per pixel (8, 16, 24, 32) |
| 359 | * @param scan Bytes per one scanline |
359 | * @param scan Bytes per one scanline |
| 360 | * |
360 | * |
| 361 | */ |
361 | */ |
| 362 | static void screen_init(__address addr, unsigned int xres, unsigned int yres, unsigned int bpp, unsigned int scan) |
362 | static void screen_init(void *addr, unsigned int xres, unsigned int yres, unsigned int bpp, unsigned int scan) |
| 363 | { |
363 | { |
| 364 | switch (bpp) { |
364 | switch (bpp) { |
| 365 | case 8: |
365 | case 8: |
| 366 | screen.putpixel = putpixel_1byte; |
366 | screen.putpixel = putpixel_1byte; |
| 367 | screen.getpixel = getpixel_1byte; |
367 | screen.getpixel = getpixel_1byte; |
| Line 595... | Line 595... | ||
| 595 | } |
595 | } |
| 596 | 596 | ||
| 597 | /** Initialization of framebuffer */ |
597 | /** Initialization of framebuffer */ |
| 598 | int fb_init(void) |
598 | int fb_init(void) |
| 599 | { |
599 | { |
| 600 | __address fb_ph_addr; |
600 | void *fb_ph_addr; |
| 601 | unsigned int fb_width; |
601 | unsigned int fb_width; |
| 602 | unsigned int fb_height; |
602 | unsigned int fb_height; |
| 603 | unsigned int fb_bpp; |
603 | unsigned int fb_bpp; |
| 604 | unsigned int fb_scanline; |
604 | unsigned int fb_scanline; |
| 605 | __address fb_addr; |
605 | void *fb_addr; |
| - | 606 | size_t asz; |
|
| 606 | 607 | ||
| 607 | async_set_client_connection(fb_client_connection); |
608 | async_set_client_connection(fb_client_connection); |
| 608 | 609 | ||
| 609 | fb_ph_addr=sysinfo_value("fb.address.physical"); |
610 | fb_ph_addr=(void *)sysinfo_value("fb.address.physical"); |
| 610 | fb_width=sysinfo_value("fb.width"); |
611 | fb_width=sysinfo_value("fb.width"); |
| 611 | fb_height=sysinfo_value("fb.height"); |
612 | fb_height=sysinfo_value("fb.height"); |
| 612 | fb_bpp=sysinfo_value("fb.bpp"); |
613 | fb_bpp=sysinfo_value("fb.bpp"); |
| 613 | fb_scanline=sysinfo_value("fb.scanline"); |
614 | fb_scanline=sysinfo_value("fb.scanline"); |
| 614 | 615 | ||
| - | 616 | asz = fb_scanline*fb_height; |
|
| 615 | fb_addr=ALIGN_UP(((__address)set_maxheapsize(USER_ADDRESS_SPACE_SIZE_ARCH>>1)),PAGE_SIZE); |
617 | fb_addr = as_get_mappable_page(asz); |
| 616 | 618 | ||
| 617 | map_physmem((void *)((__address)fb_ph_addr),(void *)fb_addr, |
- | |
| 618 | (fb_scanline*fb_height+PAGE_SIZE-1)>>PAGE_WIDTH, |
619 | map_physmem(fb_ph_addr, fb_addr, ALIGN_UP(asz,PAGE_SIZE) >>PAGE_WIDTH, |
| 619 | AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); |
620 | AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); |
| 620 | 621 | ||
| 621 | screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline); |
622 | screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline); |
| 622 | 623 | ||
| 623 | return 0; |
624 | return 0; |