xref: /illumos-gate/usr/src/common/ficl/emu/gfx_fb.h (revision e75b2cb0)
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.
6  *
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.
10  */
11 
12 /*
13  * Copyright 2016 Toomas Some <tsoome@me.com>
14  */
15 
16 #ifndef _GFX_FB_H
17 #define	_GFX_FB_H
18 
19 /*
20  * Graphics support for loader emulation.
21  */
22 #include <sys/visual_io.h>
23 #include <pnglite.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 struct framebuffer {
30 	struct vis_identifier ident;
31 	int fd;			/* frame buffer device descriptor */
32 	uint8_t *fb_addr;	/* mapped framebuffer */
33 
34 	int fb_height;		/* in pixels */
35 	int fb_width;		/* in pixels */
36 	int fb_depth;		/* bits per pixel */
37 	int fb_bpp;		/* bytes per pixel */
38 	int fb_size;		/* total size in bytes */
39 	int fb_pitch;		/* bytes per scanline */
40 	uint16_t terminal_origin_x;
41 	uint16_t terminal_origin_y;
42 	uint16_t font_width;
43 	uint16_t font_height;
44 	uint8_t red_mask_size;
45 	uint8_t red_field_position;
46 	uint8_t green_mask_size;
47 	uint8_t green_field_position;
48 	uint8_t blue_mask_size;
49 	uint8_t blue_field_position;
50 };
51 
52 extern struct framebuffer fb;
53 
54 void gfx_framework_init(void);
55 void gfx_framework_fini(void);
56 void gfx_fb_setpixel(uint32_t, uint32_t);
57 void gfx_fb_drawrect(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
58 void gfx_term_drawrect(uint32_t, uint32_t, uint32_t, uint32_t);
59 void gfx_fb_line(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
60 void gfx_fb_bezier(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t,
61 	uint32_t);
62 int gfx_fb_putimage(png_t *, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 
68 #endif /* _GFX_FB_H */
69