Home | History | Annotate | Line # | Download | only in dev
crmfbreg.h revision 1.5
      1 /* $NetBSD: crmfbreg.h,v 1.5 2008/02/05 21:42:16 macallan Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 2007 Jared D. McNeill <jmcneill (at) invisible.ca>
      5  *               2008 Michael Lorenz <macallan (at) 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  * 3. All advertising materials mentioning features or use of this software
     17  *    must display the following acknowledgement:
     18  *        This product includes software developed by Jared D. McNeill.
     19  * 4. Neither the name of The NetBSD Foundation nor the names of its
     20  *    contributors may be used to endorse or promote products derived
     21  *    from this software without specific prior written permission.
     22  *
     23  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     24  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     25  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     26  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     27  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     33  * POSSIBILITY OF SUCH DAMAGE.
     34  */
     35 
     36 /*
     37  * SGI-CRM (O2) Framebuffer driver, register definitions
     38  */
     39 
     40 #ifndef CRMFBREG_H
     41 #define CRMFBREG_H
     42 
     43 #define CRMFB_DOTCLOCK		0x00000004
     44 #define		CRMFB_DOTCLOCK_CLKRUN_SHIFT	20
     45 #define CRMFB_VT_XY		0x00010000
     46 #define		CRMFB_VT_XY_FREEZE_SHIFT	31
     47 #define	CRMFB_VT_FLAGS		0x00010018
     48 #define		CRMFB_VT_FLAGS_SYNC_LOW_MSB	5
     49 #define		CRMFB_VT_FLAGS_SYNC_LOW_LSB	5
     50 #define CRMFB_VT_INTR01		0x00010020
     51 #define		CRMFB_VT_INTR01_EN		0xffffffff
     52 #define CRMFB_VT_INTR23		0x00010024
     53 #define		CRMFB_VT_INTR23_EN		0xffffffff
     54 #define CRMFB_VT_VPIX_EN	0x00010038
     55 #define		CRMFB_VT_VPIX_EN_OFF_SHIFT	0
     56 #define CRMFB_VT_HCMAP		0x0001003c
     57 #define		CRMFB_VT_HCMAP_ON_SHIFT		12
     58 #define CRMFB_VT_VCMAP		0x00010040
     59 #define		CRMFB_VT_VCMAP_ON_SHIFT		12
     60 #define CRMFB_OVR_WIDTH_TILE	0x00020000
     61 #define CRMFB_OVR_CONTROL	0x00020008
     62 #define		CRMFB_OVR_CONTROL_DMAEN_SHIFT	0
     63 #define CRMFB_FRM_TILESIZE	0x00030000
     64 #define		CRMFB_FRM_TILESIZE_RHS_SHIFT	0
     65 #define		CRMFB_FRM_TILESIZE_WIDTH_SHIFT	5
     66 #define		CRMFB_FRM_TILESIZE_DEPTH_SHIFT	13
     67 #define			CRMFB_FRM_TILESIZE_DEPTH_8	0
     68 #define			CRMFB_FRM_TILESIZE_DEPTH_16	1
     69 #define			CRMFB_FRM_TILESIZE_DEPTH_32	2
     70 #define		CRMFB_FRM_TILESIZE_FIFOR_SHIFT	15
     71 #define CRMFB_FRM_PIXSIZE	0x00030004
     72 #define		CRMFB_FRM_PIXSIZE_HEIGHT_SHIFT	16
     73 #define CRMFB_FRM_CONTROL	0x0003000c
     74 #define		CRMFB_FRM_CONTROL_DMAEN_SHIFT	0
     75 #define		CRMFB_FRM_CONTROL_LINEAR_SHIFT	1
     76 #define		CRMFB_FRM_CONTROL_TILEPTR_SHIFT	9
     77 #define CRMFB_DID_CONTROL	0x00040004
     78 #define		CRMFB_DID_CONTROL_DMAEN_SHIFT	0
     79 #define CRMFB_MODE		0x00048000
     80 #define		CRMFB_MODE_TYP_SHIFT		2
     81 #define			CRMFB_MODE_TYP_I8	0
     82 #define			CRMFB_MODE_TYP_ARGB5	4
     83 #define			CRMFB_MODE_TYP_RGB8	5
     84 #define		CRMFB_MODE_BUF_SHIFT		0
     85 #define			CRMFB_MODE_BUF_BOTH	3
     86 #define CRMFB_CMAP		0x00050000
     87 #define CRMFB_CMAP_FIFO		0x00058000
     88 #define CRMFB_GMAP		0x00060000
     89 #define CRMFB_CURSOR_POS	0x00070000
     90 /*
     91  * upper 16 bit are Y, lower 16 bit are X - both signed so there's no need for
     92  * a hotspot register
     93  */
     94 #define CRMFB_CURSOR_CONTROL	0x00070004
     95 	#define CRMFB_CURSOR_ON		0x00000001
     96 #define CRMFB_CURSOR_CMAP0	0x00070008
     97 #define CRMFB_CURSOR_CMAP1	0x0007000c
     98 #define CRMFB_CURSOR_CMAP2	0x00070010
     99 #define CRMFB_CURSOR_BITMAP	0x00078000
    100 /* two bit deep cursor image, zero is transparent */
    101 
    102 /* rendering engine registers */
    103 #define CRIME_RE_TLB_A		0x1000
    104 #define CRIME_RE_TLB_B		0x1200
    105 #define CRIME_RE_TLB_C		0x1400
    106 #define CRIME_RE_TEX		0x1600
    107 #define CRIME_RE_CLIP_IDS	0x16e0
    108 #define CRIME_RE_LINEAR_A	0x1700
    109 #define CRIME_RE_LINEAR_B	0x1780
    110 
    111 /* memory transfer engine from 0x3000*/
    112 #define CRIME_MTE_MODE		0x3000
    113 #define CRIME_MTE_BYTEMASK	0x3008
    114 #define CRIME_MTE_STIPPLEMASK	0x3010
    115 #define CRIME_MTE_BG		0x3018
    116 #define CRIME_MTE_SRC0		0x3020	/* start */
    117 #define CRIME_MTE_SRC1		0x3028	/* end */
    118 #define CRIME_MTE_DST0		0x3030	/* start */
    119 #define CRIME_MTE_DST1		0x3038	/* end */
    120 #define CRIME_MTE_SRC_STRIDE	0x3040
    121 #define CRIME_MTE_DST_STRIDE	0x3048
    122 #define CRIME_MTE_NULL		0x3070
    123 #define CRIME_MTE_FLUSH		0x3078
    124 
    125 /* CRIME_MTE_MODE */
    126 #define MTE_MODE_DST_ECC	0x00000001	/* enable ECC in DST */
    127 #define MTE_MODE_SRC_ECC	0x00000002	/* enable ESS in SRC */
    128 #define MTE_MODE_DST_BUF_MASK	0x0000001c
    129 	#define MTE_TLB_A	0
    130 	#define MTE_TLB_B	1
    131 	#define MTE_TLB_C	2
    132 	#define MTE_TLB_TEX	3
    133 	#define MTE_TLB_LIN_A	4
    134 	#define MTE_TLB_LIN_B	5
    135 	#define MTE_TLB_CLIP	6
    136 	#define MTE_DST_TLB_SHIFT 2
    137 #define MTE_MODE_SRC_BUF_MASK	0x000000e0
    138 	#define MTE_SRC_TLB_SHIFT 5
    139 #define MTE_MODE_DEPTH_MASK	0x00000300
    140 	#define MTE_DEPTH_8	0
    141 	#define MTE_DEPTH_16	1
    142 	#define MTE_DEPTH_32	2
    143 	#define MTE_DEPTH_SHIFT 8
    144 #define MTE_MODE_STIPPLE	0x00000400
    145 #define MTE_MODE_COPY		0x00000800	/* 1 - copy, 0 - clear dst */
    146 
    147 /* drawing engine from 0x2000 */
    148 #define CRIME_DE_MODE_SRC	0x2000
    149 #define CRIME_DE_MODE_DST	0x2008
    150 #define CRIME_DE_CLIPMODE	0x2010
    151 #define CRIME_DE_DRAWMODE	0x2018
    152 #define CRIME_DE_SCRMASK0	0x2020
    153 #define CRIME_DE_SCRMASK1	0x2028
    154 #define CRIME_DE_SCRMASK2	0x2030
    155 #define CRIME_DE_SCRMASK3	0x2038
    156 #define CRIME_DE_SCRMASK4	0x2040
    157 #define CRIME_DE_SCISSOR	0x2048
    158 #define CRIME_DE_WINOFFSET_SRC	0x2050	/* x in upper, y in lower 16 bit */
    159 #define CRIME_DE_WINOFFSET_DST	0x2058
    160 #define CRIME_DE_PRIMITIVE	0x2060
    161 #define CRIME_DE_X_VERTEX_0	0x2070
    162 #define CRIME_DE_X_VERTEX_1	0x2074
    163 #define CRIME_DE_X_VERTEX_2	0x2078
    164 #define CRIME_DE_GL_VERTEX_0_X	0x2080
    165 #define CRIME_DE_GL_VERTEX_0_Y	0x2084
    166 #define CRIME_DE_GL_VERTEX_1_X	0x2088
    167 #define CRIME_DE_GL_VERTEX_1_Y	0x208c
    168 #define CRIME_DE_GL_VERTEX_2_X	0x2090
    169 #define CRIME_DE_GL_VERTEX_2_Y	0x2094
    170 #define CRIME_DE_XFER_ADDR_SRC	0x20a0
    171 #define CRIME_DE_XFER_STEP_X	0x20a8
    172 #define CRIME_DE_XFER_STEP_Y	0x20ac
    173 #define CRIME_DE_XFER_DST_ADDR	0x20b0
    174 #define CRIME_DE_XFER_DST_STRD	0x20b4
    175 #define CRIME_DE_STIPPLE_MODE	0x20c0
    176 #define CRIME_DE_STIPPLE_PAT	0x20c4
    177 #define CRIME_DE_FG		0x20d0
    178 #define CRIME_DE_BG		0x20d8
    179 
    180 #define CRIME_DE_ROP		0x21b0
    181 #define CRIME_DE_PLANEMASK	0x21b8
    182 
    183 #define CRIME_DE_NULL		0x21f0
    184 #define CRIME_DE_FLUSH		0x21f8
    185 
    186 #define CRIME_DE_START		0x0800	/* OR this to a register address in
    187 					 * order to start a command */
    188 
    189 /* CRIME_DE_MODE_* */
    190 #define DE_MODE_TLB_A		0x00000000
    191 #define DE_MODE_TLB_B		0x00000400
    192 #define DE_MODE_TLB_C		0x00000800
    193 #define DE_MODE_LIN_A		0x00001000
    194 #define DE_MODE_LIN_B		0x00001400
    195 #define DE_MODE_BUFDEPTH_8	0x00000000
    196 #define DE_MODE_BUFDEPTH_16	0x00000100
    197 #define DE_MODE_BUFDEPTH_32	0x00000200
    198 #define DE_MODE_TYPE_CI		0x00000000
    199 #define DE_MODE_TYPE_RGB	0x00000010
    200 #define DE_MODE_TYPE_RGBA	0x00000020
    201 #define DE_MODE_TYPE_ABGR	0x00000030
    202 #define DE_MODE_TYPE_YCRCB	0x000000f0
    203 #define DE_MODE_PIXDEPTH_8	0x00000000
    204 #define DE_MODE_PIXDEPTH_16	0x00000004
    205 #define DE_MODE_PIXDEPTH_32	0x00000008
    206 #define DE_MODE_DOUBLE_PIX	0x00000002
    207 #define DE_MODE_DOUBLE_SELECT	0x00000001
    208 
    209 /* clip mode */
    210 #define DE_CLIPMODE_ENABLE	0x00000800
    211 
    212 /* draw mode */
    213 #define DE_DRAWMODE_NO_CONF	0x00800000	/* disable coherency testing */
    214 #define DE_DRAWMODE_X11		0x00000000
    215 #define DE_DRAWMODE_GL		0x00400000
    216 #define DE_DRAWMODE_XFER_EN	0x00200000
    217 #define DE_DRAWMODE_SCISSOR_EN	0x00100000
    218 #define DE_DRAWMODE_LINE_STIP	0x00080000
    219 #define DE_DRAWMODE_POLY_STIP	0x00040000
    220 #define DE_DRAWMODE_OPAQUE_STIP	0x00020000
    221 #define DE_DRAWMODE_SHADE	0x00010000	/* smooth shading enable */
    222 #define DE_DRAWMODE_TEXTURE	0x00008000
    223 #define DE_DRAWMODE_FOG		0x00004000
    224 #define DE_DRAWMODE_COVERAGE	0x00002000
    225 #define DE_DRAWMODE_LINE_AA	0x00001000
    226 #define DE_DRAWMODE_ALPHA_TEST	0x00000800
    227 #define DE_DRAWMODE_ALPHA_BLEND	0x00000400
    228 #define DE_DRAWMODE_ROP		0x00000200
    229 #define DE_DRAWMODE_DITHER	0x00000100
    230 #define DE_DRAWMODE_PLANEMASK	0x00000080
    231 #define DE_DRAWMODE_BYTEMASK	0x00000078
    232 #define DE_DRAWMODE_DEPTH_TEST	0x00000004
    233 #define DE_DRAWMODE_DEPTH_MASK	0x00000002
    234 #define DE_DRAWMODE_STENCIL	0x00000001
    235 
    236 /* primitive */
    237 #define DE_PRIM_POINT		0x00000000
    238 #define DE_PRIM_LINE		0x01000000
    239 #define DE_PRIM_TRIANGLE	0x02000000
    240 #define DE_PRIM_RECTANGLE	0x03000000
    241 #define DE_PRIM_LINE_SKIP_END	0x00040000
    242 #define DE_PRIM_LR		0x00000000	/* left to right */
    243 #define DE_PRIM_RL		0x00010000	/* right to left */
    244 #define DE_PRIM_BT		0x00000000	/* bottom to top */
    245 #define DE_PRIM_TB		0x00020000	/* top to bottom */
    246 #define DE_PRIM_LINE_WIDTH_MASK	0x0000ffff	/* in half pixels */
    247 
    248 /* status register */
    249 #define CRIME_DE_STATUS		0x4000
    250 #define CRIME_DE_IDLE		0x10000000
    251 
    252 #endif /* CRMFBREG_H */
    253