blob: 3736fb2dc868b855026674a1e3aea91aeff8e721 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2016 Toomas Soome <tsoome@me.com>
*/
#ifndef _SYS_FRAMEBUFFER_H
#define _SYS_FRAMEBUFFER_H
/*
* Framebuffer info from boot loader. Collect linear framebuffer data
* provided by boot loader and early boot setup.
* Note the UEFI and multiboot2 present data with slight differences.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <sys/font.h>
#include <sys/rgb.h>
typedef struct fb_info_pixel_coord {
uint16_t x;
uint16_t y;
} fb_info_pixel_coord_t;
typedef struct fb_info_char_coord {
uint16_t x;
uint16_t y;
} fb_info_char_coord_t;
typedef struct fb_cursor {
fb_info_pixel_coord_t origin; /* cursor upper left */
fb_info_char_coord_t pos; /* cursor coord in chars */
boolean_t visible;
} fb_cursor_t;
typedef struct boot_framebuffer {
uint64_t framebuffer; /* native_ptr_t */
fb_cursor_t cursor;
} __packed boot_framebuffer_t;
typedef enum fb_type {
FB_TYPE_UNINITIALIZED = 0, /* FB not set up, use vga text mode */
FB_TYPE_EGA_TEXT, /* vga text mode */
FB_TYPE_INDEXED, /* FB mode */
FB_TYPE_RGB, /* FB mode */
FB_TYPE_UNKNOWN
} fb_type_t;
typedef struct fb_info {
fb_type_t fb_type; /* Marker from xbi_fb_init */
uint64_t paddr; /* FB address from bootloader */
uint8_t *fb; /* kernel mapped frame buffer */
uint8_t *shadow_fb;
uint64_t fb_size; /* mapped FB size in bytes */
uint32_t pitch; /* scan line in bytes */
uint8_t bpp; /* bytes per pixel */
uint8_t depth; /* bits per pixel */
uint8_t fg_color; /* ansi foreground */
uint8_t bg_color; /* ansi background */
rgb_t rgb;
fb_info_pixel_coord_t screen; /* screen size */
fb_info_pixel_coord_t terminal_origin; /* terminal upper left corner */
fb_info_char_coord_t terminal; /* terminal size in chars */
fb_cursor_t cursor;
uint16_t font_width;
uint16_t font_height;
boolean_t inverse;
boolean_t inverse_screen;
} fb_info_t;
extern fb_info_t fb_info;
void boot_fb_cursor(boolean_t);
extern uint32_t boot_color_map(uint8_t);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FRAMEBUFFER_H */
|