1 /* mga_drm_public.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*-
2 * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com
4 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice (including the next
15 * paragraph) shall be included in all copies or substantial portions of the
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
26 * Authors: Jeff Hartmann <jhartmann@precisioninsight.com>
27 * Keith Whitwell <keithw@precisioninsight.com>
29 * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm_public.h,v 1.1 2000/02/11 17:26:07 dawes Exp $
32 #ifndef _MGA_DRM_PUBLIC_H_
33 #define _MGA_DRM_PUBLIC_H_
35 #define MGA_F 0x1 /* fog */
36 #define MGA_A 0x2 /* alpha */
37 #define MGA_S 0x4 /* specular */
38 #define MGA_T2 0x8 /* multitexture */
40 #define MGA_WARP_TGZ 0
41 #define MGA_WARP_TGZF (MGA_F)
42 #define MGA_WARP_TGZA (MGA_A)
43 #define MGA_WARP_TGZAF (MGA_F|MGA_A)
44 #define MGA_WARP_TGZS (MGA_S)
45 #define MGA_WARP_TGZSF (MGA_S|MGA_F)
46 #define MGA_WARP_TGZSA (MGA_S|MGA_A)
47 #define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A)
48 #define MGA_WARP_T2GZ (MGA_T2)
49 #define MGA_WARP_T2GZF (MGA_T2|MGA_F)
50 #define MGA_WARP_T2GZA (MGA_T2|MGA_A)
51 #define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F)
52 #define MGA_WARP_T2GZS (MGA_T2|MGA_S)
53 #define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F)
54 #define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A)
55 #define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A)
58 #define MGA_MAX_G400_PIPES 16
59 #define MGA_MAX_G200_PIPES 8 /* no multitex */
62 #define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES
64 #define MGA_CARD_TYPE_G200 1
65 #define MGA_CARD_TYPE_G400 2
68 typedef struct _drm_mga_warp_index {
70 unsigned long phys_addr;
74 typedef struct drm_mga_init {
77 MGA_CLEANUP_DMA = 0x02
79 int reserved_map_agpstart;
82 int sarea_priv_offset;
94 mgaWarpIndex WarpIndex[MGA_MAX_WARP_PIPES];
104 typedef struct _xf86drmClipRectRec {
109 } xf86drmClipRectRec;
111 #define MGA_CLEAR_FRONT 0x1
112 #define MGA_CLEAR_BACK 0x2
113 #define MGA_CLEAR_DEPTH 0x4
116 /* Each context has a state:
118 #define MGA_CTXREG_DSTORG 0 /* validated */
119 #define MGA_CTXREG_MACCESS 1
120 #define MGA_CTXREG_PLNWT 2
121 #define MGA_CTXREG_DWGCTL 3
122 #define MGA_CTXREG_ALPHACTRL 4
123 #define MGA_CTXREG_FOGCOLOR 5
124 #define MGA_CTXREG_WFLAG 6
125 #define MGA_CTXREG_TDUAL0 7
126 #define MGA_CTXREG_TDUAL1 8
127 #define MGA_CTX_SETUP_SIZE 9
131 #define MGA_2DREG_PITCH 0
132 #define MGA_2D_SETUP_SIZE 1
134 /* Each texture unit has a state:
136 #define MGA_TEXREG_CTL 0
137 #define MGA_TEXREG_CTL2 1
138 #define MGA_TEXREG_FILTER 2
139 #define MGA_TEXREG_BORDERCOL 3
140 #define MGA_TEXREG_ORG 4 /* validated */
141 #define MGA_TEXREG_ORG1 5
142 #define MGA_TEXREG_ORG2 6
143 #define MGA_TEXREG_ORG3 7
144 #define MGA_TEXREG_ORG4 8
145 #define MGA_TEXREG_WIDTH 9
146 #define MGA_TEXREG_HEIGHT 10
147 #define MGA_TEX_SETUP_SIZE 11
150 /* What needs to be changed for the current vertex dma buffer?
152 #define MGASAREA_NEW_CONTEXT 0x1
153 #define MGASAREA_NEW_TEX0 0x2
154 #define MGASAREA_NEW_TEX1 0x4
155 #define MGASAREA_NEW_PIPE 0x8
156 #define MGASAREA_NEW_2D 0x10
159 /* Keep this small for testing
161 #define MGA_NR_SAREA_CLIPRECTS 2
163 /* Upto 128 regions. Minimum region size of 256k.
165 #define MGA_NR_TEX_REGIONS 128
166 #define MGA_MIN_LOG_TEX_GRANULARITY 18
169 unsigned char next, prev;
170 unsigned char in_use;
176 unsigned int ContextState[MGA_CTX_SETUP_SIZE];
177 unsigned int ServerState[MGA_2D_SETUP_SIZE];
178 unsigned int TexState[2][MGA_TEX_SETUP_SIZE];
179 unsigned int WarpPipe;
183 xf86drmClipRectRec boxes[MGA_NR_SAREA_CLIPRECTS];
185 /* kernel doesn't touch from here down */
187 mgaTexRegion texList[MGA_NR_TEX_REGIONS+1];
192 /* Device specific ioctls:
202 int flags; /* not actually used? */
206 unsigned int destOrg;
207 unsigned int mAccess;
209 xf86drmClipRectRec texture;
214 #define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t)
215 #define DRM_IOCTL_MGA_SWAP DRM_IOW( 0x41, drm_mga_swap_t)
216 #define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x42, drm_mga_clear_t)
217 #define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x43, drm_mga_iload_t)