xref: /haiku/headers/os/add-ons/graphics/GraphicsCard.h (revision 513955e6c09a38af8ecf374d6b4565ee8fa1b488)
1 /*
2  * Copyright 2009, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _GRAPHICS_CARD_H
6 #define _GRAPHICS_CARD_H
7 
8 
9 #include <GraphicsDefs.h>
10 
11 
12 /* #pragma mark - command constants */
13 enum {
14 	B_OPEN_GRAPHICS_CARD,
15 	B_CLOSE_GRAPHICS_CARD,
16 	B_GET_GRAPHICS_CARD_INFO,
17 	B_GET_GRAPHICS_CARD_HOOKS,
18 	B_SET_INDEXED_COLOR,
19 	B_GET_SCREEN_SPACES,
20 	B_CONFIG_GRAPHICS_CARD,
21 	B_GET_REFRESH_RATES,
22 	B_SET_SCREEN_GAMMA,
23 
24 	B_GET_INFO_FOR_CLONE_SIZE,
25 	B_GET_INFO_FOR_CLONE,
26 	B_SET_CLONED_GRAPHICS_CARD,
27 	B_CLOSE_CLONED_GRAPHICS_CARD,
28 	B_PROPOSE_FRAME_BUFFER,
29 	B_SET_FRAME_BUFFER,
30 	B_SET_DISPLAY_AREA,
31 	B_MOVE_DISPLAY_AREA
32 };
33 
34 /* #pragma mark - optional flags */
35 enum {
36 	B_CRT_CONTROL				= 0x0001,
37 	B_GAMMA_CONTROL				= 0x0002,
38 	B_FRAME_BUFFER_CONTROL		= 0x0004,
39 	B_PARALLEL_BUFFER_ACCESS	= 0x0008,
40 	B_LAME_ASS_CARD				= 0x0010
41 };
42 
43 
44 /* #pragma mark - structures */
45 
46 
47 typedef struct {
48 	int16			version;
49 	int16			id;
50 	void*			frame_buffer;
51 	char			rgba_order[4];
52 	int16			flags;
53 	int16			bits_per_pixel;
54 	int16			bytes_per_row;
55 	int16			width;
56 	int16			height;
57 } graphics_card_info;
58 
59 
60 typedef struct {
61 	int32			index;
62 	rgb_color		color;
63 } indexed_color;
64 
65 
66 typedef struct {
67 	uint32			space;
68 	float			refresh_rate;
69 	uchar			h_position;
70 	uchar			v_position;
71 	uchar			h_size;
72 	uchar			v_size;
73 } graphics_card_config;
74 
75 
76 typedef struct {
77 	float			min;
78 	float			max;
79 	float			current;
80 } refresh_rate_info;
81 
82 
83 typedef struct {
84 	void*			screen_base;
85 	void*			io_base;
86 	uint32			vendor_id;
87 	uint32			device_id;
88 	uint32			_reserved1_;
89 	uint32			_reserved2_;
90 } graphics_card_spec;
91 
92 
93 typedef struct {
94 	int16			x1;
95 	int16			y1;
96 	int16			x2;
97 	int16			y2;
98 	rgb_color		color;
99 } rgb_color_line;
100 
101 
102 typedef struct {
103 	int16			x1;
104 	int16			y1;
105 	int16			x2;
106 	int16			y2;
107 	uchar			color;
108 } indexed_color_line;
109 
110 
111 typedef struct {
112     int16			bits_per_pixel;
113 	int16			bytes_per_row;
114 	int16			width;
115 	int16			height;
116     int16			display_width;
117 	int16			display_height;
118 	int16			display_x;
119 	int16			display_y;
120 } frame_buffer_info;
121 
122 
123 typedef struct {
124 	uchar			red[256];
125 	uchar			green[256];
126 	uchar			blue[256];
127 } screen_gamma;
128 
129 
130 /* #pragma mark - hook function */
131 
132 
133 typedef void (*graphics_card_hook) ();
134 
135 #define B_GRAPHICS_HOOK_COUNT	48
136 
137 
138 #ifdef __cplusplus
139 extern "C" {
140 #endif
141 
142 int32 control_graphics_card(uint32, void*);
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 
149 /* #pragma mark - deprecated */
150 #define B_HOOK_COUNT  B_GRAPHICS_HOOK_COUNT
151 
152 
153 #endif /* _GRAPHICS_CARD_H */
154