Unleashed v1.4
[unleashed.git] / usr / src / boot / sys / boot / common / gfx_fb.h
blob5161383759c25c79bc8e2078c42bb069ed5cfe22
1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright 2017 Toomas Soome <tsoome@me.com>
16 #ifndef _GFX_FB_H
17 #define _GFX_FB_H
19 #include <stdbool.h>
20 #include <sys/visual_io.h>
21 #include <sys/multiboot2.h>
22 #include <pnglite.h>
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 #define EDID_MAGIC { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }
30 struct edid_header {
31 uint8_t header[8]; /* fixed header pattern */
32 uint16_t manufacturer_id;
33 uint16_t product_code;
34 uint32_t serial_number;
35 uint8_t week_of_manufacture;
36 uint8_t year_of_manufacture;
37 uint8_t version;
38 uint8_t revision;
41 struct edid_basic_display_parameters {
42 uint8_t video_input_parameters;
43 uint8_t max_horizontal_image_size;
44 uint8_t max_vertical_image_size;
45 uint8_t display_gamma;
46 uint8_t supported_features;
49 struct edid_chromaticity_coordinates {
50 uint8_t red_green_lo;
51 uint8_t blue_white_lo;
52 uint8_t red_x_hi;
53 uint8_t red_y_hi;
54 uint8_t green_x_hi;
55 uint8_t green_y_hi;
56 uint8_t blue_x_hi;
57 uint8_t blue_y_hi;
58 uint8_t white_x_hi;
59 uint8_t white_y_hi;
62 struct edid_detailed_timings {
63 uint16_t pixel_clock;
64 uint8_t horizontal_active_lo;
65 uint8_t horizontal_blanking_lo;
66 uint8_t horizontal_hi;
67 uint8_t vertical_active_lo;
68 uint8_t vertical_blanking_lo;
69 uint8_t vertical_hi;
70 uint8_t horizontal_sync_offset_lo;
71 uint8_t horizontal_sync_pulse_width_lo;
72 uint8_t vertical_sync_lo;
73 uint8_t sync_hi;
74 uint8_t horizontal_image_size_lo;
75 uint8_t vertical_image_size_lo;
76 uint8_t image_size_hi;
77 uint8_t horizontal_border;
78 uint8_t vertical_border;
79 uint8_t features;
82 struct vesa_edid_info {
83 struct edid_header header;
84 struct edid_basic_display_parameters display;
85 #define EDID_FEATURE_PREFERRED_TIMING_MODE (1 << 1)
86 struct edid_chromaticity_coordinates chromaticity;
87 uint8_t established_timings_1;
88 uint8_t established_timings_2;
89 uint8_t manufacturer_reserved_timings;
90 uint16_t standard_timings[8];
91 struct edid_detailed_timings detailed_timings[4];
92 uint8_t number_of_extensions;
93 uint8_t checksum;
94 } __packed;
96 extern multiboot_tag_framebuffer_t gfx_fb;
98 void gfx_framework_init(struct visual_ops *);
99 uint32_t gfx_fb_color_map(uint8_t);
100 void gfx_fb_display_cursor(struct vis_conscursor *);
101 void gfx_fb_setpixel(uint32_t, uint32_t);
102 void gfx_fb_drawrect(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
103 void gfx_term_drawrect(uint32_t, uint32_t, uint32_t, uint32_t);
104 void gfx_fb_line(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
105 void gfx_fb_bezier(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t,
106 uint32_t);
107 void plat_cons_update_mode(int);
108 int gfx_fb_putimage(png_t *);
110 bool gfx_parse_mode_str(char *, int *, int *, int *);
111 #ifdef __cplusplus
113 #endif
115 #endif /* _GFX_FB_H */