| 1 | #ifndef LIB__FB_H__ |
| 2 | #define LIB__FB_H__ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | #include <stddef.h> |
| 6 | #include <stdbool.h> |
| 7 | #include <drivers/edid.h> |
| 8 | |
| 9 | struct resolution { |
| 10 | uint64_t width; |
| 11 | uint64_t height; |
| 12 | uint16_t bpp; |
| 13 | }; |
| 14 | |
| 15 | struct fb_info { |
| 16 | uint64_t framebuffer_pitch; |
| 17 | uint64_t framebuffer_width; |
| 18 | uint64_t framebuffer_height; |
| 19 | uint16_t framebuffer_bpp; |
| 20 | uint8_t memory_model; |
| 21 | uint8_t red_mask_size; |
| 22 | uint8_t red_mask_shift; |
| 23 | uint8_t green_mask_size; |
| 24 | uint8_t green_mask_shift; |
| 25 | uint8_t blue_mask_size; |
| 26 | uint8_t blue_mask_shift; |
| 27 | |
| 28 | uint64_t framebuffer_addr; |
| 29 | |
| 30 | struct edid_info_struct *edid; |
| 31 | |
| 32 | uint64_t mode_count; |
| 33 | struct fb_info *mode_list; |
| 34 | }; |
| 35 | |
| 36 | extern struct fb_info *fb_fbs; |
| 37 | extern size_t fb_fbs_count; |
| 38 | |
| 39 | void fb_init(struct fb_info **ret, size_t *_fbs_count, |
| 40 | uint64_t target_width, uint64_t target_height, uint16_t target_bpp, |
| 41 | bool preserve_screen, bool keep_wc); |
| 42 | |
| 43 | void fb_clear(struct fb_info *fb); |
| 44 | |
| 45 | void fb_flush(volatile void *base, size_t length); |
| 46 | |
| 47 | #endif |