xref: /titanic_41/usr/src/uts/common/sys/fbio.h (revision 4445fffbbb1ea25fd0e9ea68b9380dd7a6709025)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1986,1997-1998 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _SYS_FBIO_H
28 #define	_SYS_FBIO_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SunOS4.1.2 5.49 */
31 
32 #include <sys/types.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #ifndef ASM
39 /*
40  * Frame buffer descriptor.
41  * Returned by FBIOGTYPE ioctl on frame buffer devices.
42  */
43 struct	fbtype {
44 	int	fb_type;	/* as defined below */
45 	int	fb_height;	/* in pixels */
46 	int	fb_width;	/* in pixels */
47 	int	fb_depth;	/* bits per pixel */
48 	int	fb_cmsize;	/* size of color map (entries) */
49 	int	fb_size;	/* total size in bytes */
50 };
51 
52 #define	FIOC		('F'<<8)
53 #define	FBIOGTYPE	(FIOC|0)
54 
55 #ifdef	_KERNEL
56 struct	fbpixrect {
57 	struct	pixrect *fbpr_pixrect;	/* Pixrect of dev returned here */
58 };
59 
60 #define	FBIOGPIXRECT	(FIOC|1)
61 #endif /* _KERNEL */
62 
63 /*
64  * General purpose structure for passing info in and out of frame buffers
65  * (used for gp1)
66  */
67 struct	fbinfo {
68 	int		fb_physaddr;	/* physical frame buffer address */
69 	int		fb_hwwidth;	/* fb board width */
70 	int		fb_hwheight;	/* fb board height */
71 	int		fb_addrdelta;	/* phys addr diff between boards */
72 	unsigned char	*fb_ropaddr;	/* fb va thru kernelmap */
73 	int		fb_unit;	/* minor devnum of fb */
74 };
75 
76 #define	FBIOGINFO	(FIOC|2)
77 
78 /*
79  * Color map I/O.  See also fbcmap_i below.
80  */
81 struct	fbcmap {
82 	int		index;		/* first element (0 origin) */
83 	int		count;		/* number of elements */
84 	unsigned char	*red;		/* red color map elements */
85 	unsigned char	*green;		/* green color map elements */
86 	unsigned char	*blue;		/* blue color map elements */
87 };
88 
89 #ifdef _SYSCALL32
90 
91 struct	fbcmap32 {
92 	int32_t		index;		/* first element (0 origin) */
93 	int32_t		count;		/* number of elements */
94 	caddr32_t 	red;		/* red color map elements */
95 	caddr32_t 	green;		/* green color map elements */
96 	caddr32_t 	blue;		/* blue color map elements */
97 };
98 
99 #endif	/* _SYSCALL32 */
100 
101 #define	FBIOPUTCMAP	(FIOC|3)
102 #define	FBIOGETCMAP	(FIOC|4)
103 
104 /*
105  * Set/Get attributes
106  */
107 #define	FB_ATTR_NDEVSPECIFIC	8	/* no. of device specific values */
108 #define	FB_ATTR_NEMUTYPES	4	/* no. of emulation types */
109 
110 struct fbsattr {
111 	int	flags;			/* misc flags */
112 #define	FB_ATTR_AUTOINIT	1	/* emulation auto init flag */
113 #define	FB_ATTR_DEVSPECIFIC	2	/* dev. specific stuff valid flag */
114 	int	emu_type;		/* emulation type (-1 if unused) */
115 	int	dev_specific[FB_ATTR_NDEVSPECIFIC];	/* catchall */
116 };
117 
118 struct fbgattr {
119 	int	real_type;		/* real device type */
120 	int	owner;			/* PID of owner, 0 if myself */
121 	struct fbtype fbtype;		/* fbtype info for real device */
122 	struct fbsattr sattr;		/* see above */
123 	int	emu_types[FB_ATTR_NEMUTYPES];	/* possible emulations */
124 						/* (-1 if unused) */
125 };
126 
127 #define	FBIOSATTR	(FIOC|5)
128 #define	FBIOGATTR	(FIOC|6)
129 
130 
131 /*
132  * Video control
133  * (the unused bits are reserved for future use)
134  */
135 #define	FBVIDEO_OFF	0
136 #define	FBVIDEO_ON	1
137 
138 #define	FBIOSVIDEO	(FIOC|7)
139 #define	FBIOGVIDEO	(FIOC|8)
140 
141 /* Vertical retrace support. */
142 #define	FBIOVERTICAL	(FIOC|9)
143 #define	GRABPAGEALLOC	(FIOC|10)
144 #define	GRABPAGEFREE	(FIOC|11)
145 #define	GRABATTACH	(FIOC|12)
146 
147 #define	FBIOGPLNGRP	(FIOC|13)
148 #define	FBIOGCMSIZE	(FIOC|14)
149 #define	FBIOSCMSIZE	(FIOC|15)
150 #define	FBIOSCMS	(FIOC|16)
151 #define	FBIOAVAILPLNGRP (FIOC|17)
152 
153 
154 /*
155  * Structure to pass double buffering state back and forth the device.
156  */
157 
158 /* used in devstate */
159 #define	FBDBL_AVAIL	0x80000000
160 #define	FBDBL_DONT_BLOCK 0x40000000
161 #define	FBDBL_AVAIL_PG	0x20000000
162 
163 /* used in read/write/display */
164 #define	FBDBL_A	 0x1
165 #define	FBDBL_B	 0x2
166 #define	FBDBL_BOTH	(FBDBL_A | FBDBL_B)
167 #define	FBDBL_NONE	0x4
168 
169 struct fbdblinfo {
170 	unsigned int	dbl_devstate;
171 	unsigned int	dbl_read;
172 	unsigned int	dbl_write;
173 	unsigned int	dbl_display;
174 	int		dbl_depth;
175 	char		dbl_wid;
176 };
177 
178 #define	FBIODBLGINFO	(FIOC|18)
179 #define	FBIODBLSINFO	(FIOC|19)
180 
181 /* 8-bit emulation in 24-bit ioctls */
182 
183 #define	FBIOSWINFD	(FIOC|20)
184 #define	FBIOSAVWINFD	(FIOC|21)
185 #define	FBIORESWINFD	(FIOC|22)
186 #define	FBIOSRWINFD	(FIOC|23)
187 
188 /*
189  * hardware cursor control
190  */
191 
192 struct fbcurpos {
193 	short x, y;
194 };
195 
196 struct fbcursor {
197 	short set;		/* what to set */
198 #define	FB_CUR_SETCUR	0x01
199 #define	FB_CUR_SETPOS	0x02
200 #define	FB_CUR_SETHOT	0x04
201 #define	FB_CUR_SETCMAP	0x08
202 #define	FB_CUR_SETSHAPE 0x10
203 #define	FB_CUR_SETALL	0x1F
204 	short enable;		/* cursor on/off */
205 	struct fbcurpos pos;	/* cursor position */
206 	struct fbcurpos hot;	/* cursor hot spot */
207 	struct fbcmap cmap;	/* color map info */
208 	struct fbcurpos size;	/* cursor bit map size */
209 	char *image;		/* cursor image bits */
210 	char *mask;		/* cursor mask bits */
211 };
212 
213 #ifdef _SYSCALL32
214 struct fbcursor32 {
215 	short set;		/* what to set */
216 	short enable;		/* cursor on/off */
217 	struct fbcurpos pos;	/* cursor position */
218 	struct fbcurpos hot;	/* cursor hot spot */
219 	struct fbcmap32 cmap;	/* color map info */
220 	struct fbcurpos size;	/* cursor bit map size */
221 	caddr32_t image;	/* cursor image bits */
222 	caddr32_t mask;		/* cursor mask bits */
223 };
224 #endif	/* _SYSCALL32 */
225 
226 /* set/get cursor attributes/shape */
227 #define	FBIOSCURSOR	(FIOC|24)
228 #define	FBIOGCURSOR	(FIOC|25)
229 
230 /* set/get cursor position */
231 #define	FBIOSCURPOS	(FIOC|26)
232 #define	FBIOGCURPOS	(FIOC|27)
233 
234 /* get max cursor size */
235 #define	FBIOGCURMAX	(FIOC|28)
236 
237 /* Window Grabber info ioctl */
238 #define	GRABLOCKINFO	(FIOC|29)
239 
240 /*
241  * Window Identification (wid) defines, structures, and ioctls.
242  *
243  * Some wids need to be unique when used for things such as double
244  * buffering or rendering clipping.  Some wids can be shared when
245  * used for display attributes only.  What can be shared and how
246  * may be device dependent.  The fb_wid_alloc.wa_type and fb_wid_item
247  * structure members will be left to device specific interpretation.
248  */
249 
250 #define	FB_WID_SHARED_8		0
251 #define	FB_WID_SHARED_24	1
252 #define	FB_WID_DBL_8		2
253 #define	FB_WID_DBL_24		3
254 
255 struct fb_wid_alloc {
256 	unsigned int	wa_type;	/* special attributes		*/
257 	int		wa_index;	/* base wid returned		*/
258 	unsigned int	wa_count;	/* how many contiguous wids	*/
259 };
260 
261 struct fb_wid_item {
262 	unsigned int	wi_type;	/* special attributes		*/
263 	int		wi_index;	/* which lut			*/
264 	unsigned int	wi_attrs;	/* which attributes		*/
265 	unsigned int	wi_values[NBBY*sizeof (int)]; /* the attr values */
266 };
267 
268 struct fb_wid_list {
269 	unsigned int	wl_flags;
270 	unsigned int	wl_count;
271 	struct fb_wid_item	*wl_list;
272 };
273 
274 #ifdef _SYSCALL32
275 
276 struct fb_wid_list32 {
277 	uint32_t	wl_flags;
278 	uint32_t	wl_count;
279 	caddr32_t	wl_list;
280 };
281 
282 #endif /* _SYSCALL32 */
283 
284 struct fb_wid_dbl_info {
285 	struct fb_wid_alloc dbl_wid;
286 	char		dbl_fore;
287 	char		dbl_back;
288 	char		dbl_read_state;
289 	char		dbl_write_state;
290 };
291 
292 #define	FBIO_WID_ALLOC	(FIOC|30)
293 #define	FBIO_WID_FREE	(FIOC|31)
294 #define	FBIO_WID_PUT	(FIOC|32)
295 #define	FBIO_WID_GET	(FIOC|33)
296 
297 #define	FBIO_DEVID	(FIOC|34)
298 #define	FBIO_U_RST	(FIOC|35)
299 #define	FBIO_FULLSCREEN_ELIMINATION_GROUPS	(FIOC|36)
300 #define	FBIO_WID_DBL_SET	(FIOC|37)
301 #define	FBIOVRTOFFSET	(FIOC|38)
302 
303 struct cg6_info {
304 	ushort_t  accessible_width;	/* accessible bytes in scanline */
305 	ushort_t  accessible_height;	/* number of accessible scanlines */
306 	ushort_t  line_bytes;		/* number of bytes/scanline */
307 	ushort_t  hdb_capable;		/* can this thing hardware db? */
308 	ushort_t  vmsize;		/* this is Mb of video memory */
309 	uchar_t	  boardrev;		/* board revision # */
310 	uchar_t	  slot;			/* sbus slot # */
311 	uint_t	  pad1;			/* expansion */
312 };
313 
314 struct s3_info {
315 	ushort_t  accessible_width;	/* accessible bytes in scanline */
316 	ushort_t  accessible_height;	/* number of accessible scanlines */
317 	ushort_t  line_bytes;		/* number of bytes/scanline */
318 	ushort_t  hdb_capable;		/* can this thing hardware db? */
319 	ushort_t  vmsize;		/* this is Mb of video memory */
320 	uchar_t	  boardrev;		/* board revision # */
321 	uchar_t	  slot;			/* sbus slot # */
322 	uint_t	  pad1;			/* expansion */
323 };
324 
325 struct p9000_info {
326 	ushort_t  accessible_width;	/* accessible bytes in scanline */
327 	ushort_t  accessible_height;	/* number of accessible scanlines */
328 	ushort_t  line_bytes;		/* number of bytes/scanline */
329 	ushort_t  hdb_capable;		/* can this thing hardware db? */
330 	ushort_t  vmsize;		/* this is Mb of video memory */
331 	uchar_t	  boardrev;		/* board revision # */
332 	uchar_t	  slot;			/* sbus slot # */
333 	uint_t	  pad1;			/* expansion */
334 };
335 
336 struct p9100_info {
337 	ushort_t  accessible_width;	/* accessible bytes in scanline */
338 	ushort_t  accessible_height;	/* number of accessible scanlines */
339 	ushort_t  line_bytes;		/* number of bytes/scanline */
340 	ushort_t  hdb_capable;		/* can this thing hardware db? */
341 	ushort_t  vmsize;		/* this is Mb of video memory */
342 	uchar_t	  boardrev;		/* board revision # */
343 	uchar_t	  slot;			/* sbus slot # */
344 	uint_t	  pad1;			/* expansion */
345 };
346 
347 struct wd90c24a2_info {
348 	ushort_t  accessible_width;	/* accessible bytes in scanline */
349 	ushort_t  accessible_height;	/* number of accessible scanlines */
350 	ushort_t  line_bytes;		/* number of bytes/scanline */
351 	ushort_t  hdb_capable;		/* can this thing hardware db? */
352 	ushort_t  vmsize;		/* this is Mb of video memory */
353 	uchar_t	  boardrev;		/* board revision # */
354 	uchar_t	  slot;			/* sbus slot # */
355 	uint_t	  pad1;			/* expansion */
356 };
357 
358 #define	MON_TYPE_STEREO		0x8	/* stereo display */
359 #define	MON_TYPE_0_OFFSET	0x4	/* black level 0 ire instead of 7.5 */
360 #define	MON_TYPE_OVERSCAN	0x2	/* overscan */
361 #define	MON_TYPE_GRAY		0x1	/* greyscale monitor */
362 
363 struct mon_info {
364 	uint_t	  mon_type;		/* bit array: defined above */
365 	uint_t	  pixfreq;		/* pixel frequency in Hz */
366 	uint_t	  hfreq;		/* horizontal freq in Hz */
367 	uint_t	  vfreq;		/* vertical freq in Hz */
368 	uint_t	  vsync;		/* vertical sync in scanlines */
369 	uint_t	  hsync;		/* horizontal sync in pixels */
370 					/* these are in pixel units */
371 	ushort_t  hfporch;		/* horizontal front porch */
372 	ushort_t  hbporch;		/* horizontal back porch */
373 	ushort_t  vfporch;		/* vertical front porch */
374 	ushort_t  vbporch;		/* vertical back porch */
375 };
376 
377 
378 #define	FBIOGXINFO	(FIOC|39)
379 #define	FBIOMONINFO	(FIOC|40)
380 
381 /*
382  * Color map I/O.
383  */
384 struct	fbcmap_i {
385 	unsigned int	flags;		/* see below */
386 	int		id;		/* colormap id for multiple cmaps */
387 	int		index;		/* first element (0 origin) */
388 	int		count;		/* number of elements */
389 	unsigned char	*red;		/* red color map elements */
390 	unsigned char	*green;		/* green color map elements */
391 	unsigned char	*blue;		/* blue color map elements */
392 };
393 
394 #ifdef _SYSCALL32
395 
396 struct	fbcmap_i32 {
397 	uint32_t	flags;		/* see below */
398 	int32_t		id;		/* colormap id for multiple cmaps */
399 	int32_t		index;		/* first element (0 origin) */
400 	int32_t		count;		/* number of elements */
401 	caddr32_t	red;		/* red color map elements */
402 	caddr32_t	green;		/* green color map elements */
403 	caddr32_t	blue;		/* blue color map elements */
404 };
405 
406 #endif	/* _SYSCALL32 */
407 
408 #define	FB_CMAP_BLOCK	0x1	/* wait for vrt before returning */
409 #define	FB_CMAP_KERNEL	0x2	/* called within kernel */
410 
411 #define	FBIOPUTCMAPI	(FIOC|41)
412 #define	FBIOGETCMAPI	(FIOC|42)
413 
414 /* assigning a given window id to a pixrect - special for PHIGS */
415 #define	FBIO_ASSIGNWID	(FIOC|43)
416 
417 /* assigning a given window to be stereo */
418 #define	FBIO_STEREO	(FIOC|44)
419 #define	FB_WIN_STEREO	    0x2
420 
421 #endif	/* !ASM */
422 
423 /* frame buffer type codes */
424 #define	FBTYPE_NOTYPE		(-1)	/* for backwards compatibility */
425 #define	FBTYPE_SUN1BW		0	/* Multibus mono */
426 #define	FBTYPE_SUN1COLOR	1	/* Multibus color */
427 #define	FBTYPE_SUN2BW		2	/* memory mono */
428 #define	FBTYPE_SUN2COLOR	3	/* color w/rasterop chips */
429 #define	FBTYPE_SUN2GP		4	/* GP1/GP2 */
430 #define	FBTYPE_SUN5COLOR	5	/* RoadRunner accelerator */
431 #define	FBTYPE_SUN3COLOR	6	/* memory color */
432 #define	FBTYPE_MEMCOLOR		7	/* memory 24-bit */
433 #define	FBTYPE_SUN4COLOR	8	/* memory color w/overlay */
434 
435 #define	FBTYPE_NOTSUN1		9	/* reserved for customer */
436 #define	FBTYPE_NOTSUN2		10	/* reserved for customer */
437 #define	FBTYPE_NOTSUN3		11	/* reserved for customer */
438 
439 #define	FBTYPE_SUNFAST_COLOR	12	/* accelerated 8bit */
440 #define	FBTYPE_SUNROP_COLOR	13	/* MEMCOLOR with rop h/w */
441 #define	FBTYPE_SUNFB_VIDEO	14	/* Simple video mixing */
442 #define	FBTYPE_SUNGIFB		15	/* medical image */
443 #define	FBTYPE_SUNGPLAS		16	/* plasma panel */
444 #define	FBTYPE_SUNGP3		17	/* cg12 running gpsi microcode */
445 #define	FBTYPE_SUNGT		18	/* gt graphics accelerator */
446 #define	FBTYPE_SUNLEO		19	/* zx graphics accelerator */
447 #define	FBTYPE_MDICOLOR		20	/* cgfourteen framebuffer */
448 
449 #define	FBTYPE_LASTPLUSONE	21	/* max number of fbs (change as add) */
450 
451 #ifdef	__cplusplus
452 }
453 #endif
454 
455 #endif	/* _SYS_FBIO_H */
456