xref: /haiku/headers/os/add-ons/graphics/GraphicsCard.h (revision a381c8a06378de22ff08adf4282b4e3f7e50d250)
1 /******************************************************************************
2 /
3 /	File:			GraphicsCard.h
4 /
5 /	Description:	App Server interface for graphics card add-ons.
6 /
7 /	Copyright 1993-98, Be Incorporated
8 /
9 *******************************************************************************/
10 
11 #ifndef _GRAPHICS_CARD_H
12 #define _GRAPHICS_CARD_H
13 
14 #include <BeBuild.h>
15 #include <GraphicsDefs.h>
16 #include <SupportDefs.h>
17 
18 /*-------------------------------------------------------------*/
19 /*----- Command Constants -------------------------------------*/
20 
21 enum {
22 	B_OPEN_GRAPHICS_CARD,
23 	B_CLOSE_GRAPHICS_CARD,
24 	B_GET_GRAPHICS_CARD_INFO,
25 	B_GET_GRAPHICS_CARD_HOOKS,
26 	B_SET_INDEXED_COLOR,
27 	B_GET_SCREEN_SPACES,
28 	B_CONFIG_GRAPHICS_CARD,
29 	B_GET_REFRESH_RATES,
30 	B_SET_SCREEN_GAMMA,
31 
32 	B_GET_INFO_FOR_CLONE_SIZE,
33 	B_GET_INFO_FOR_CLONE,
34 	B_SET_CLONED_GRAPHICS_CARD,
35 	B_CLOSE_CLONED_GRAPHICS_CARD,
36 	B_PROPOSE_FRAME_BUFFER,
37 	B_SET_FRAME_BUFFER,
38 	B_SET_DISPLAY_AREA,
39 	B_MOVE_DISPLAY_AREA}
40 ;
41 
42 /*----- Optional ---------------*/
43 
44 enum {
45 	B_CRT_CONTROL = 0x0001,
46 	B_GAMMA_CONTROL = 0x0002,
47 	B_FRAME_BUFFER_CONTROL = 0x0004,
48 	B_PARALLEL_BUFFER_ACCESS = 0x0008,
49 	B_LAME_ASS_CARD = 0x0010
50 };
51 
52 /*-------------------------------------------------------------*/
53 /*----- Structures --------------------------------------------*/
54 
55 typedef struct {
56 	int16           version;
57 	int16           id;
58 	void            *frame_buffer;
59 	char            rgba_order[4];
60 	int16           flags;
61 	int16			bits_per_pixel;
62 	int16           bytes_per_row;
63 	int16			width;
64 	int16			height;
65 } graphics_card_info;
66 
67 
68 typedef struct {
69 	int32	        index;
70 	rgb_color       color;
71 } indexed_color;
72 
73 
74 typedef struct {
75 	uint32           space;
76 	float           refresh_rate;
77 	uchar           h_position;
78 	uchar           v_position;
79 	uchar           h_size;
80 	uchar           v_size;
81 } graphics_card_config;
82 
83 
84 typedef struct {
85 	float           min;
86 	float           max;
87 	float           current;
88 } refresh_rate_info;
89 
90 
91 typedef struct {
92 	void            *screen_base;
93 	void            *io_base;
94 	uint32           vendor_id;
95 	uint32           device_id;
96 	uint32           _reserved1_;
97 	uint32           _reserved2_;
98 } graphics_card_spec;
99 
100 
101 typedef struct {
102 	int16           x1;
103 	int16           y1;
104 	int16           x2;
105 	int16           y2;
106 	rgb_color       color;
107 } rgb_color_line;
108 
109 
110 typedef struct {
111 	int16           x1;
112 	int16           y1;
113 	int16           x2;
114 	int16           y2;
115 	uchar           color;
116 } indexed_color_line;
117 
118 
119 typedef struct {
120     int16           bits_per_pixel;
121 	int16           bytes_per_row;
122 	int16           width;
123 	int16           height;
124     int16           display_width;
125 	int16           display_height;
126 	int16           display_x;
127 	int16           display_y;
128 } frame_buffer_info;
129 
130 
131 typedef struct {
132 	uchar           red[256];
133 	uchar           green[256];
134 	uchar           blue[256];
135 } screen_gamma;
136 
137 
138 /*-------------------------------------------------------------*/
139 /*----- Hook Function -----------------------------------------*/
140 
141 typedef void (*graphics_card_hook) ();
142 
143 #define B_GRAPHICS_HOOK_COUNT	48
144 
145 
146 #ifdef __cplusplus
147 extern "C" {
148 #endif
149 
150 int32	control_graphics_card(uint32, void*);
151 
152 #ifdef __cplusplus
153 }
154 #endif
155 
156 
157 /*-------------------------------------------------------------*/
158 /*----- Debugging Functions ------------------------------------*/
159 
160 #ifdef __cplusplus
161 extern "C" {
162 #endif
163 
164 void    dprintf(const char *format, ...);
165 bool    set_dprintf_enabled(bool);	/* returns old enable flag */
166 
167 #ifdef __cplusplus
168 }
169 #endif
170 
171 
172 /*-------------------------------------------------------------*/
173 /*----- Obsolete  ---------------------------------------------*/
174 #define B_HOOK_COUNT  B_GRAPHICS_HOOK_COUNT
175 
176 
177 /*-------------------------------------------------------------*/
178 /*-------------------------------------------------------------*/
179 
180 #endif /* _GRAPHICS_CARD_H */
181 
182 
183 
184 
185 
186 
187 
188 
189