summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun/sys/cg6var.h
blob: 7bc3bd7c5691a2fae558a88f8851702ea3c80c38 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright (c) 1988-1989,1997-1998 by Sun Microsystems, Inc.
 * All rights reserved.
 */

#ifndef	_SYS_CG6VAR_H
#define	_SYS_CG6VAR_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SunOS-4.1 1.8 */

#ifdef	__cplusplus
extern "C" {
#endif

#ifndef	FBC_REV0
#define	FBC_REV0	1	/* include FBC0 support if set */
#endif

#include <sys/cg6fbc.h>
#include <sys/cg6tec.h>
#include <sys/cg6thc.h>

#define	CG6_DEPTH	8

#include <sys/memvar.h>
#include <sys/pr_impl_util.h>

/* FBIOSATTR device specific array indices */
#define	FB_ATTR_CG6_SETOWNER_CMD	0
#define	FB_ATTR_CG6_SETOWNER_PID	1

#ifndef	_KERNEL

/* pixrect private data */
struct cg6pr {
	struct mprp_data mprp;		/* memory pixrect simulator */
	int		fd;		/* device file descriptor */
	struct pr_size	cg6_size;	/* screen size */
	struct fbc	*cg6_fbc;	/* FBC base */
	struct tec 	*cg6_tec;	/* TEC base */
};

/* pixrect ops vector */
extern struct pixrectops cg6_ops;

Pixrect *cg6_make();

/* int cg6_rop(); */
int cg6_stencil();
int cg6_batchrop();
int cg6_destroy();
int cg6_get();
int cg6_put();
int cg6_vector();
Pixrect *cg6_region();
/* int cg6_putcolormap(); */
int cg6_getcolormap();
int cg6_putattributes();
int cg6_getattributes();

/* macros */

#define	cg6_d(pr) 	((struct cg6pr *)(pr)->pr_data)



#define	cg6_waitidle(fbc) \
	do {; } while ((fbc)->l_fbc_status & L_FBC_BUSY)

#define	cg6_setfontxy(fbc, x0, x1, y) \
	((fbc)->l_fbc_x0 = (x0), \
	(fbc)->l_fbc_x1 = (x1), \
	(fbc)->l_fbc_y0 = (y))

#define	cg6_setinx(fbc, x, y) \
	((fbc)->l_fbc_autoincx = (x), \
	(fbc)->l_fbc_autoincy = (y))

/*
 * return draw status, if full loop until registers available before returning.
 */
#define	cg6_draw_done(fbc, r) \
	do \
		(r) = (int)(fbc)->l_fbc_drawstatus; \
	while ((int)(r) < 0 && (r & L_FBC_FULL))

/*
 * set clip area.
 */
#define	cg6_clip(fbc, x_min, y_min, x_max, y_max) \
	((fbc)->l_fbc_clipminx = (x_min), \
	(fbc)->l_fbc_clipminy = (y_min), \
	(fbc)->l_fbc_clipmaxx = (x_max), \
	(fbc)->l_fbc_clipmaxy = (y_max))

#define	cg6_color_mode(fbc, mode) \
	(* ((uint32_t *)&(fbc)->l_fbc_misc) = \
		(uint32_t)L_FBC_MISC_BLIT_NOSRC << 20 | \
		((uint32_t)(mode) & 3) << 17 |	/* data */ \
		(uint32_t)L_FBC_MISC_DRAW_RENDER << 15)

extern uint_t cg6_rop_table[];

#define	cg6_setregs(fbc, x, y, rop, planemask, fcolor, patt, polyg) _STMT(\
	(fbc)->l_fbc_rasteroffx = (x); \
	(fbc)->l_fbc_rasteroffy = (y); \
	(fbc)->l_fbc_fcolor = (fcolor); \
	cg6_waitidle(fbc); \
	(fbc)->l_fbc_status = 0; \
	* ((uint32_t *)&(fbc)->l_fbc_rasterop) = \
		((uint32_t)(patt) & 3) << 26 | \
		((uint32_t)(polyg) & 3) << 24 | \
		(uint32_t)L_FBC_RASTEROP_ATTR_SUPP << 22 | \
		(uint32_t)L_FBC_RASTEROP_RAST_BOOL << 17 | \
		(uint32_t)cg6_rop_table[(rop)]; \
	(fbc)->l_fbc_planemask = (planemask); \
	/* can set this before idle in FBC1 */ \
	(fbc)->l_fbc_clipcheck = 0; \
)

/*
 * FBC0 workarounds
 */
#if FBC_REV0
int cg6_vector0();

#define	fbc_rev0(fbc)	((((char *)(fbc))[1] & 0xf0) == 0)

#define	cg6_draw_done0(fbc, x0, x1, r) \
	if (((fbc)->l_fbc_status & L_FBC_DRAW_INTERSECT) && \
		((x0) < 0 || (x1) < 0)) \
		(r) = L_FBC_DRAW_EXCEPTION; \
	else cg6_draw_done((fbc), (r))
#else	/* FBC_REV0 */
#define	fbc_rev0(fbc)	(0)
#define	cg6_draw_done0(fbc, x0, x1, r) \
	cg6_draw_done((fbc), (r))
#endif	/* FBC_REV0 */

#endif	/* _KERNEL */

#ifdef	__cplusplus
}
#endif

#endif	/* _SYS_CG6VAR_H */