xref: /netbsd-src/sys/arch/sgimips/dev/crmfbreg.h (revision ba65fde2d7fefa7d39838fa5fa855e62bd606b5e)
1 /* $NetBSD: crmfbreg.h,v 1.15 2011/05/17 22:26:33 macallan Exp $ */
2 
3 /*-
4  * Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
5  *               2008 Michael Lorenz <macallan@netbsd.org>
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 /*
31  * SGI-CRM (O2) Framebuffer driver, register definitions
32  */
33 
34 #ifndef CRMFBREG_H
35 #define CRMFBREG_H
36 
37 #define	CRMFB_CTRLSTAT		0x00000000
38 #define		CRMFB_CTRLSTAT_CHIPID_MASK	0x0000000f
39 #define		CRMFB_CTRLSTAT_SENSE		0x00000010 /* monitor sense pin */
40 #define		CRMFB_CTRLSTAT_GPIO0_SENSE	0x00000040
41 #define		CRMFB_CTRLSTAT_GPIO0_INPUT	0x00000080
42 #define		CRMFB_CTRLSTAT_GPIO1_SENSE	0x00000100
43 #define		CRMFB_CTRLSTAT_GPIO1_INPUT	0x00000200
44 #define		CRMFB_CTRLSTAT_GPIO2_SENSE	0x00000400
45 #define		CRMFB_CTRLSTAT_GPIO2_INPUT	0x00000800
46 #define		CRMFB_CTRLSTAT_GPIO3_SENSE	0x00001000
47 #define		CRMFB_CTRLSTAT_GPIO3_INPUT	0x00002000
48 #define		CRMFB_CTRLSTAT_GPIO4_SENSE	0x00004000
49 #define		CRMFB_CTRLSTAT_GPIO4_INPUT	0x00008000
50 #define		CRMFB_CTRLSTAT_GPIO5_SENSE	0x00010000
51 #define		CRMFB_CTRLSTAT_GPIO5_INPUT	0x00020000
52 #define		CRMFB_CTRLSTAT_GPIO6_SENSE	0x00040000
53 #define		CRMFB_CTRLSTAT_GPIO6_INPUT	0x00080000
54 #define		CRMFB_CTRLSTAT_GPIO7_SENSE	0x00100000
55 #define		CRMFB_CTRLSTAT_GPIO7_INPUT	0x00200000
56 #define		CRMFB_CTRLSTAT_GPIO8_SENSE	0x00400000
57 #define		CRMFB_CTRLSTAT_GPIO8_INPUT	0x00800000
58 #define		CRMFB_CTRLSTAT_GPIO9_SENSE	0x01000000
59 #define		CRMFB_CTRLSTAT_GPIO9_INPUT	0x02000000
60 #define		CRMFB_CTRLSTAT_HALF_PHASE	0x04000000 /* for flat panel */
61 #define		CRMFB_CTRLSTAT_CSYNC_ALOW	0x08000000 /* csync active low */
62 #define		CRMFB_CTRLSTAT_EXTERNAL_PCLK	0x00000000
63 #define		CRMFB_CTRLSTAT_DIFF_PCLK	0x10000000 /* differential pclock */
64 #define		CRMFB_CTRLSTAT_INTERNAL_PCLK	0x30000000
65 
66 #define CRMFB_DOTCLOCK		0x00000004
67 #define		CRMFB_DOTCLOCK_M_MASK		0x000000ff
68 #define		CRMFB_DOTCLOCK_N_MASK		0x00003f00
69 #define		CRMFB_DOTCLOCK_P_MASK		0x0000c000
70 #define		CRMFB_DOTCLOCK_CLKRUN_SHIFT	20
71 #define		CRMFB_DOTCLOCK_OUT_OF_RANGE	0x00400000
72 #define		CRMFB_DOTCLOCK_OUT_OF_LOCK	0x00800000
73 #define		CRMFB_DOTCLOCK_TDWNI		0x01000000 /* ? */
74 #define		CRMFB_DOTCLOCK_TUPI		0x02000000 /* ? */
75 
76 #define CRMFB_I2C_VGA		0x00000008
77 #define 	CRMFB_I2C_SDA			0x00000001 /* these bits are */
78 #define 	CRMFB_I2C_SCL			0x00000002 /* low active */
79 
80 #define CRMFB_SYSCLK		0x0000000c
81 
82 #define CRMFB_I2C_FP		0x00000010 /* same bits as CRMFB_I2C_VGA */
83 
84 #define CRMFB_DEVICE_ID		0x00000014
85 #define		CRMFB_DEVICE_ID_DEF		0x00000666 /* this chip is EVIL */
86 
87 
88 #define CRMFB_VT_XY		0x00010000 /* pixel / line counters */
89 #define		CRMFB_VT_XY_X_MASK		0x00000fff
90 #define		CRMFB_VT_XY_Y_MASK		0x00fff000
91 #define		CRMFB_VT_XY_FREEZE_SHIFT	31
92 #define CRMFB_VT_XYMAX		0x00010004 /* same masks as CRMFB_VT_XY, counters in
93 					    * CRMFB_VT_XY reset when reaching max */
94 #define CRMFB_VT_VSYNC		0x00010008
95 #define		CRMFB_VT_VSYNC_OFF_MASK		0x00000fff
96 #define		CRMFB_VT_VSYNC_ON_MASK		0x00fff000
97 #define CRMFB_VT_HSYNC		0x0001000c
98 #define		CRMFB_VT_HSYNC_OFF_MASK		0x00000fff
99 #define		CRMFB_VT_HSYNC_ON_MASK		0x00fff000
100 #define CRMFB_VT_VBLANK		0x00010010
101 #define		CRMFB_VT_VBLANK_OFF_MASK	0x00000fff
102 #define		CRMFB_VT_VBLANK_ON_MASK		0x00fff000
103 #define CRMFB_VT_HBLANK		0x00010014
104 #define		CRMFB_VT_HBLANK_OFF_MASK	0x00000fff
105 #define		CRMFB_VT_HBLANK_ON_MASK		0x00fff000
106 
107 #define	CRMFB_VT_FLAGS		0x00010018
108 #define 	CRMFB_VT_FLAGS_VDRV_INVERT	0x00000001
109 #define 	CRMFB_VT_FLAGS_VDRV_LOW		0x00000002
110 #define 	CRMFB_VT_FLAGS_HDRV_INVERT	0x00000004
111 #define 	CRMFB_VT_FLAGS_HDRV_LOW		0x00000008 /* put monitor to sleep */
112 #define 	CRMFB_VT_FLAGS_SYNC_HIGH	0x00000010
113 #define 	CRMFB_VT_FLAGS_SYNC_LOW		0x00000020
114 #define		CRMFB_VT_FLAGS_SYNC_LOW_MSB	5
115 #define		CRMFB_VT_FLAGS_SYNC_LOW_LSB	5
116 #define 	CRMFB_VT_FLAGS_F2RF_HIGH	0x00000040 /* sync left/right ? */
117 
118 #define CRMFB_VT_FRAMELOCK	0x0001001c
119 #define		CRMFB_VT_FRAMELOCK_F2RF_MASK	0x00000fff /* f2rf toggles when y
120 							    * reaches this */
121 #define		CRMFB_VT_FRAMELOCK_LOCK_MASK	0x00fff000
122 
123 /* scanline interrupts! */
124 #define CRMFB_VT_INTR01		0x00010020
125 #define		CRMFB_INTR_1_MASK		0x00000fff /* intr1 when y == this */
126 #define		CRMFB_INTR_0_MASK		0x00fff000 /* intr0 when y == this */
127 #define CRMFB_VT_INTR23		0x00010024
128 #define		CRMFB_INTR_3_MASK		0x00000fff /* intr3 when y == this */
129 #define		CRMFB_INTR_2_MASK		0x00fff000 /* intr2 when y == this */
130 
131 #define CRMFB_VT_HPIX_EN		0x00010034
132 #define		CRMFB_HPIXEN_OFF_MASK		0x00000fff
133 #define		CRMFB_HPIXEN_ON_MASK		0x00fff000
134 #define CRMFB_VT_VPIX_EN	0x00010038
135 #define		CRMFB_VT_VPIX_EN_OFF_SHIFT	0
136 #define		CRMFB_VPIXEN_OFF_MASK		0x00000fff
137 #define		CRMFB_VPIXEN_ON_MASK		0x00fff000
138 #define CRMFB_VT_HCMAP		0x0001003c
139 #define		CRMFB_HCMAP_OFF_MASK		0x00000fff
140 #define		CRMFB_HCMAP_ON_MASK		0x00fff000
141 #define		CRMFB_VT_HCMAP_ON_SHIFT		12
142 #define CRMFB_VT_VCMAP		0x00010040
143 #define		CRMFB_VCMAP_OFF_MASK		0x00000fff
144 #define		CRMFB_VCMAP_ON_MASK		0x00fff000
145 #define		CRMFB_VT_VCMAP_ON_SHIFT		12
146 
147 #define CRMFB_VT_DID_STARTXY	0x00010044
148 #define		CRMFB_VT_DID_START_X_MASK	0x00000fff
149 #define		CRMFB_VT_DID_START_Y_MASK	0x00fff000
150 #define CRMFB_VT_CRS_STARTXY	0x00010048
151 #define		CRMFB_VT_CRS_START_X_MASK	0x00000fff
152 #define		CRMFB_VT_CRS_START_Y_MASK	0x00fff000
153 #define CRMFB_VT_VC_STARTXY	0x0001004c
154 #define		CRMFB_VT_VC_START_X_MASK	0x00000fff
155 #define		CRMFB_VT_VC_START_Y_MASK	0x00fff000
156 
157 #define CRMFB_OVR_WIDTH_TILE	0x00020000
158 #define		CRMFB_OVR_WIDTH_TILE_RHS_MASK	0x0000001f /* width of rightmost tile
159 							    * in 32 byte units */
160 #define		CRMFB_OVR_WIDTH_TILES_MASK	0x00001fe0 /* width in whole tiles */
161 #define CRMFB_OVR_TILE_PTR	0x00020004
162 #define		CRMFB_OVR_TILE_LIST_MASK	0xfffff000
163 #define 	CRMFB_OVR_DMA_ENABLE		0x00000001
164 #define CRMFB_OVR_CONTROL	0x00020008 /* same bits as CRMFB_OVR_TILE_PTR, copied
165 					    * from here when blanking */
166 #define		CRMFB_OVR_CONTROL_DMAEN_SHIFT	0
167 
168 #define CRMFB_FRM_TILESIZE	0x00030000
169 #define		CRMFB_FRM_TILESIZE_RHS_SHIFT	0 /* width of a partial tile
170 						   * on the right in 32 BYTES */
171 #define		CRMFB_FRM_TILESIZE_WIDTH_SHIFT	5 /* width in tiles */
172 #define		CRMFB_FRM_TILESIZE_DEPTH_SHIFT	13
173 #define			CRMFB_FRM_TILESIZE_DEPTH_8	0
174 #define			CRMFB_FRM_TILESIZE_DEPTH_16	1
175 #define			CRMFB_FRM_TILESIZE_DEPTH_32	2
176 #define		CRMFB_FRM_TILESIZE_FIFOR_SHIFT	15
177 #define CRMFB_FRM_PIXSIZE	0x00030004
178 #define		CRMFB_FRM_PIXSIZE_HEIGHT_SHIFT	16
179 #define CRMFB_TILE_PTR		0x00020008
180 #define		CRMFB_TILE_LIST_MASK		0xfffff000
181 #define 	CRMFB_DMA_ENABLE		0x00000001
182 #define CRMFB_FRM_CONTROL	0x0003000c
183 #define		CRMFB_FRM_CONTROL_DMAEN_SHIFT	0
184 #define		CRMFB_FRM_CONTROL_LINEAR_SHIFT	1
185 #define		CRMFB_FRM_CONTROL_TILEPTR_SHIFT	9
186 
187 #define CRMFB_DID_PTR		0x00040000
188 #define		CRMFB_DID_BASE_MASK		0x0000ffff
189 #define 	CRMFB_DID_DMA_ENABLE		0x00010000
190 #define CRMFB_DID_CONTROL	0x00040004
191 #define		CRMFB_DID_CONTROL_DMAEN_SHIFT	0
192 
193 #define CRMFB_WID		0x00048000	/* 32 WIDs */
194 #define CRMFB_MODE		0x00048000
195 #define		CRMFB_MODE_TYP_SHIFT		2
196 #define			CRMFB_MODE_TYP_I8	0
197 #define			CRMFB_MODE_TYP_I12	1
198 #define			CRMFB_MODE_TYP_RG3B2	2
199 #define			CRMFB_MODE_TYP_RGB4	3
200 #define			CRMFB_MODE_TYP_ARGB5	4
201 #define			CRMFB_MODE_TYP_RGB8	5
202 #define		CRMFB_MODE_BUF_SHIFT		0
203 #define			CRMFB_MODE_BUF_BOTH	3
204 #define		CRMFB_MODE_CMAP_SELECT_SHIFT	5 /* upper 5 bit */
205 #define		CRMFB_MODE_GAMMA_ENABLE_SHIFT	10
206 #define		CRMFB_MODE_FP_ENABLE_SHIFT	11 /* two bits */
207 
208 #define CRMFB_CMAP		0x00050000	/* 32*256 entries */
209 #define CRMFB_CMAP_OVL		0x00051400
210 #define CRMFB_CMAP_FIFO		0x00058000
211 #define CRMFB_GMAP		0x00060000	/* gamma map */
212 #define CRMFB_CURSOR_POS	0x00070000
213 /*
214  * upper 16 bit are Y, lower 16 bit are X - both signed so there's no need for
215  * a hotspot register
216  */
217 #define CRMFB_CURSOR_CONTROL	0x00070004
218 	#define CRMFB_CURSOR_ON		0x00000001
219 	#define CRMFB_CURSOR_CROSSHAIR	0x00000002
220 #define CRMFB_CURSOR_CMAP0	0x00070008
221 #define CRMFB_CURSOR_CMAP1	0x0007000c
222 #define CRMFB_CURSOR_CMAP2	0x00070010
223 #define CRMFB_CURSOR_BITMAP	0x00078000
224 /* two bit deep cursor image, zero is transparent */
225 
226 /* rendering engine registers */
227 /* these TLBs define 16x16 tiles, 64kB each, upper 16 bit only */
228 #define CRIME_RE_TLB_A		0x1000
229 #define CRIME_RE_TLB_B		0x1200
230 #define CRIME_RE_TLB_C		0x1400
231 #define CRIME_RE_TEX		0x1600
232 #define CRIME_RE_CLIP_IDS	0x16e0
233 /* 32bit entries, 4kB page address >> 12 | 0x80000000 */
234 #define CRIME_RE_LINEAR_A	0x1700
235 #define CRIME_RE_LINEAR_B	0x1780
236 
237 /* memory transfer engine from 0x3000*/
238 #define CRIME_MTE_MODE		0x3000
239 #define CRIME_MTE_BYTEMASK	0x3008
240 #define CRIME_MTE_STIPPLEMASK	0x3010
241 #define CRIME_MTE_BG		0x3018
242 #define CRIME_MTE_SRC0		0x3020	/* start */
243 #define CRIME_MTE_SRC1		0x3028	/* end */
244 #define CRIME_MTE_DST0		0x3030	/* start */
245 #define CRIME_MTE_DST1		0x3038	/* end */
246 #define CRIME_MTE_SRC_Y_STEP	0x3040
247 #define CRIME_MTE_DST_Y_STEP	0x3048
248 #define CRIME_MTE_NULL		0x3070
249 #define CRIME_MTE_FLUSH		0x3078
250 
251 /* CRIME_MTE_MODE */
252 #define MTE_MODE_DST_ECC	0x00000001	/* enable ECC in DST */
253 #define MTE_MODE_SRC_ECC	0x00000002	/* enable ECC in SRC */
254 #define MTE_MODE_DST_BUF_MASK	0x0000001c
255 	#define MTE_TLB_A	0
256 	#define MTE_TLB_B	1
257 	#define MTE_TLB_C	2
258 	#define MTE_TLB_TEX	3
259 	#define MTE_TLB_LIN_A	4
260 	#define MTE_TLB_LIN_B	5
261 	#define MTE_TLB_CLIP	6
262 	#define MTE_DST_TLB_SHIFT 2
263 #define MTE_MODE_SRC_BUF_MASK	0x000000e0
264 	#define MTE_SRC_TLB_SHIFT 5
265 #define MTE_MODE_DEPTH_MASK	0x00000300
266 	#define MTE_DEPTH_8	0
267 	#define MTE_DEPTH_16	1
268 	#define MTE_DEPTH_32	2
269 	#define MTE_DEPTH_SHIFT 8
270 #define MTE_MODE_STIPPLE	0x00000400
271 #define MTE_MODE_COPY		0x00000800	/* 1 - copy, 0 - clear dst */
272 
273 /* drawing engine from 0x2000 */
274 #define CRIME_DE_MODE_SRC	0x2000
275 #define CRIME_DE_MODE_DST	0x2008
276 #define CRIME_DE_CLIPMODE	0x2010
277 #define CRIME_DE_DRAWMODE	0x2018
278 #define CRIME_DE_SCRMASK0	0x2020
279 #define CRIME_DE_SCRMASK1	0x2028
280 #define CRIME_DE_SCRMASK2	0x2030
281 #define CRIME_DE_SCRMASK3	0x2038
282 #define CRIME_DE_SCRMASK4	0x2040
283 #define CRIME_DE_SCISSOR	0x2048
284 #define CRIME_DE_WINOFFSET_SRC	0x2050	/* x in upper, y in lower 16 bit */
285 #define CRIME_DE_WINOFFSET_DST	0x2058
286 #define CRIME_DE_PRIMITIVE	0x2060
287 #define CRIME_DE_X_VERTEX_0	0x2070
288 #define CRIME_DE_X_VERTEX_1	0x2074
289 #define CRIME_DE_X_VERTEX_2	0x2078
290 #define CRIME_DE_GL_VERTEX_0_X	0x2080
291 #define CRIME_DE_GL_VERTEX_0_Y	0x2084
292 #define CRIME_DE_GL_VERTEX_1_X	0x2088
293 #define CRIME_DE_GL_VERTEX_1_Y	0x208c
294 #define CRIME_DE_GL_VERTEX_2_X	0x2090
295 #define CRIME_DE_GL_VERTEX_2_Y	0x2094
296 #define CRIME_DE_XFER_ADDR_SRC	0x20a0
297 #define CRIME_DE_XFER_STRD_SRC	0x20a4
298 #define CRIME_DE_XFER_STEP_X	0x20a8
299 #define CRIME_DE_XFER_STEP_Y	0x20ac
300 #define CRIME_DE_XFER_ADDR_DST	0x20b0
301 #define CRIME_DE_XFER_STRD_DST	0x20b4
302 #define CRIME_DE_STIPPLE_MODE	0x20c0
303 #define CRIME_DE_STIPPLE_PAT	0x20c4
304 #define CRIME_DE_FG		0x20d0
305 #define CRIME_DE_BG		0x20d8
306 #define CRIME_DE_ALPHA_COLOR	0x21a0	/* constant colour for alpha */
307 #define CRIME_DE_ALPHA_FUNC	0x21a8	/* blend function */
308 #define CRIME_DE_ROP		0x21b0
309 #define CRIME_DE_PLANEMASK	0x21b8
310 
311 #define CRIME_DE_NULL		0x21f0
312 #define CRIME_DE_FLUSH		0x21f8
313 
314 #define CRIME_DE_START		0x0800	/* OR this to a register address in
315 					 * order to start a command */
316 
317 /* CRIME_DE_MODE_* */
318 #define DE_MODE_TLB_A		0x00000000
319 #define DE_MODE_TLB_B		0x00000400
320 #define DE_MODE_TLB_C		0x00000800
321 #define DE_MODE_LIN_A		0x00001000
322 #define DE_MODE_LIN_B		0x00001400
323 #define DE_MODE_BUFDEPTH_8	0x00000000
324 #define DE_MODE_BUFDEPTH_16	0x00000100
325 #define DE_MODE_BUFDEPTH_32	0x00000200
326 #define DE_MODE_TYPE_CI		0x00000000
327 #define DE_MODE_TYPE_RGB	0x00000010
328 #define DE_MODE_TYPE_RGBA	0x00000020
329 #define DE_MODE_TYPE_ABGR	0x00000030
330 #define DE_MODE_TYPE_YCRCB	0x000000f0
331 #define DE_MODE_PIXDEPTH_8	0x00000000
332 #define DE_MODE_PIXDEPTH_16	0x00000004
333 #define DE_MODE_PIXDEPTH_32	0x00000008
334 #define DE_MODE_DOUBLE_PIX	0x00000002
335 #define DE_MODE_DOUBLE_SELECT	0x00000001
336 
337 /* clip mode */
338 #define DE_CLIPMODE_ENABLE	0x00000800
339 /* enable testing against mask register n */
340 #define DE_CLIPMODE_MASK0_EN	0x00000200
341 #define DE_CLIPMODE_MASK1_EN	0x00000100
342 #define DE_CLIPMODE_MASK2_EN	0x00000080
343 #define DE_CLIPMODE_MASK3_EN	0x00000040
344 #define DE_CLIPMODE_MASK4_EN	0x00000020
345 /* let pixels pass if inside mask n, otherwise outside */
346 #define DE_CLIPMODE_MASK0_IN	0x00000010
347 #define DE_CLIPMODE_MASK1_IN	0x00000008
348 #define DE_CLIPMODE_MASK2_IN	0x00000004
349 #define DE_CLIPMODE_MASK3_IN	0x00000002
350 #define DE_CLIPMODE_MASK4_IN	0x00000001
351 
352 /* draw mode */
353 #define DE_DRAWMODE_NO_CONF	0x00800000	/* disable coherency testing */
354 #define DE_DRAWMODE_X11		0x00000000
355 #define DE_DRAWMODE_GL		0x00400000
356 #define DE_DRAWMODE_XFER_EN	0x00200000
357 #define DE_DRAWMODE_SCISSOR_EN	0x00100000
358 #define DE_DRAWMODE_LINE_STIP	0x00080000
359 #define DE_DRAWMODE_POLY_STIP	0x00040000
360 #define DE_DRAWMODE_OPAQUE_STIP	0x00020000
361 #define DE_DRAWMODE_SHADE	0x00010000	/* smooth shading enable */
362 #define DE_DRAWMODE_TEXTURE	0x00008000
363 #define DE_DRAWMODE_FOG		0x00004000
364 #define DE_DRAWMODE_COVERAGE	0x00002000
365 #define DE_DRAWMODE_LINE_AA	0x00001000
366 #define DE_DRAWMODE_ALPHA_TEST	0x00000800
367 #define DE_DRAWMODE_ALPHA_BLEND	0x00000400
368 #define DE_DRAWMODE_ROP		0x00000200
369 #define DE_DRAWMODE_DITHER	0x00000100
370 #define DE_DRAWMODE_PLANEMASK	0x00000080
371 #define DE_DRAWMODE_BYTEMASK	0x00000078
372 #define DE_DRAWMODE_DEPTH_TEST	0x00000004
373 #define DE_DRAWMODE_DEPTH_MASK	0x00000002
374 #define DE_DRAWMODE_STENCIL	0x00000001
375 
376 /* primitive */
377 #define DE_PRIM_POINT		0x00000000
378 #define DE_PRIM_LINE		0x01000000
379 #define DE_PRIM_TRIANGLE	0x02000000
380 #define DE_PRIM_RECTANGLE	0x03000000
381 #define DE_PRIM_LINE_SKIP_END	0x00040000
382 #define DE_PRIM_LR		0x00000000	/* left to right */
383 #define DE_PRIM_RL		0x00010000	/* right to left */
384 #define DE_PRIM_BT		0x00000000	/* bottom to top */
385 #define DE_PRIM_TB		0x00020000	/* top to bottom */
386 #define DE_PRIM_LINE_WIDTH_MASK	0x0000ffff	/* in half pixels */
387 
388 /* CRIME_DE_STIPPLE_MODE */
389 #define DE_STIP_MAXREP_SHIFT	0	/* max. repeats 8 bit */
390 #define DE_STIP_REPCNT_SHIFT	8	/* repeat count, 8 bit */
391 #define DE_STIP_MAXIDX_SHIFT	16	/* max. index, 5 bit */
392 #define DE_STIP_STRTIDX_SHIFT	24	/* start index, 5 bit */
393 
394 /* alpha function register */
395 #define DE_ALPHA_ADD		0x00000000
396 #define DE_ALPHA_MIN		0x00000100
397 #define DE_ALPHA_MAX		0x00000200
398 #define DE_ALPHA_SUB		0x00000300
399 #define DE_ALPHA_REV_SUB	0x00000400
400 
401 #define DE_ALPHA_OP_ZERO		0
402 #define DE_ALPHA_OP_ONE			1
403 #define DE_ALPHA_OP_DST_COLOR		2
404 #define DE_ALPHA_OP_1_MINUS_DST_COLOR	3
405 #define DE_ALPHA_OP_SRC_ALPHA		4
406 #define DE_ALPHA_OP_1_MINUS_SRC_ALPHA	5
407 #define DE_ALPHA_OP_DST_ALPHA		6
408 #define DE_ALPHA_OP_1_MINUS_DST_APLHA	7
409 #define DE_ALPHA_OP_CONSTANT_COLOR	8
410 #define DE_ALPHA_OP_1_MINUS_CONST_COLOR	9
411 #define DE_ALPHA_OP_CONSTANT_ALPHA	10
412 #define DE_ALPHA_OP_1_MINUS_CONST_ALPHA	11
413 #define DE_ALPHA_OP_SRC_ALPHA_SATURATE	12
414 
415 #define DE_ALPHA_OP_SRC_SHIFT 4
416 #define DE_ALPHA_OP_DST_SHIFT 0
417 
418 /* status register */
419 #define CRIME_DE_STATUS		0x4000
420 #define CRIME_DE_IDLE		0x10000000
421 #define CRIME_DE_SETUP_IDLE	0x08000000
422 #define CRIME_DE_PIXPIPE_IDLE	0x04000000
423 #define CRIME_DE_MTE_IDLE	0x02000000
424 #define CRIME_DE_LEVEL_MASK	0x01fc0000
425 #define CRIME_DE_RD_PTR_MASK	0x0003f000
426 #define CRIME_DE_WR_PTR_MASK	0x00000fc0
427 #define CRIME_DE_BUF_START	0x0000003f
428 
429 #define CRIME_DE_LEVEL_SHIFT	18
430 #define CRIME_DE_LEVEL_MAX	0x7f
431 #define CRIME_PIPE_LEVEL(x)	((x & CRIME_DE_LEVEL_MASK) >>  \
432 				  CRIME_DE_LEVEL_SHIFT)
433 
434 #endif /* CRMFBREG_H */
435