i810_common.h revision fa225cbc
1/* i810_common.h -- common header definitions for I810 2D/3D/DRM suite 2 * 3 * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the "Software"), 8 * to deal in the Software without restriction, including without limitation 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 * and/or sell copies of the Software, and to permit persons to whom the 11 * Software is furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice (including the next 14 * paragraph) shall be included in all copies or substantial portions of the 15 * Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 * DEALINGS IN THE SOFTWARE. 24 * 25 * Converted to common header format: 26 * Jens Owen <jens@tungstengraphics.com> 27 * 28 * 29 */ 30 31/* WARNING: If you change any of these defines, make sure to change 32 * the kernel include file as well (i810_drm.h) 33 */ 34 35#ifndef _I810_COMMON_H_ 36#define _I810_COMMON_H_ 37 38#ifndef _I810_DEFINES_ 39#define _I810_DEFINES_ 40#define I810_USE_BATCH 1 41 42#define I810_DMA_BUF_ORDER 12 43#define I810_DMA_BUF_SZ (1<<I810_DMA_BUF_ORDER) 44#define I810_DMA_BUF_NR 256 45 46#define I810_NR_SAREA_CLIPRECTS 8 47 48/* Each region is a minimum of 64k, and there are at most 64 of them. 49 */ 50#define I810_NR_TEX_REGIONS 64 51#define I810_LOG_MIN_TEX_REGION_SIZE 16 52 53/* Destbuffer state 54 * - backbuffer linear offset and pitch -- invarient in the current dri 55 * - zbuffer linear offset and pitch -- also invarient 56 * - drawing origin in back and depth buffers. 57 * 58 * Keep the depth/back buffer state here to acommodate private buffers 59 * in the future. 60 */ 61#define I810_DESTREG_DI0 0 /* CMD_OP_DESTBUFFER_INFO (2 dwords) */ 62#define I810_DESTREG_DI1 1 63#define I810_DESTREG_DV0 2 /* GFX_OP_DESTBUFFER_VARS (2 dwords) */ 64#define I810_DESTREG_DV1 3 65#define I810_DESTREG_DR0 4 /* GFX_OP_DRAWRECT_INFO (4 dwords) */ 66#define I810_DESTREG_DR1 5 67#define I810_DESTREG_DR2 6 68#define I810_DESTREG_DR3 7 69#define I810_DESTREG_DR4 8 70#define I810_DEST_SETUP_SIZE 10 71 72/* Context state 73 */ 74#define I810_CTXREG_CF0 0 /* GFX_OP_COLOR_FACTOR */ 75#define I810_CTXREG_CF1 1 76#define I810_CTXREG_ST0 2 /* GFX_OP_STIPPLE */ 77#define I810_CTXREG_ST1 3 78#define I810_CTXREG_VF 4 /* GFX_OP_VERTEX_FMT */ 79#define I810_CTXREG_MT 5 /* GFX_OP_MAP_TEXELS */ 80#define I810_CTXREG_MC0 6 /* GFX_OP_MAP_COLOR_STAGES - stage 0 */ 81#define I810_CTXREG_MC1 7 /* GFX_OP_MAP_COLOR_STAGES - stage 1 */ 82#define I810_CTXREG_MC2 8 /* GFX_OP_MAP_COLOR_STAGES - stage 2 */ 83#define I810_CTXREG_MA0 9 /* GFX_OP_MAP_ALPHA_STAGES - stage 0 */ 84#define I810_CTXREG_MA1 10 /* GFX_OP_MAP_ALPHA_STAGES - stage 1 */ 85#define I810_CTXREG_MA2 11 /* GFX_OP_MAP_ALPHA_STAGES - stage 2 */ 86#define I810_CTXREG_SDM 12 /* GFX_OP_SRC_DEST_MONO */ 87#define I810_CTXREG_FOG 13 /* GFX_OP_FOG_COLOR */ 88#define I810_CTXREG_B1 14 /* GFX_OP_BOOL_1 */ 89#define I810_CTXREG_B2 15 /* GFX_OP_BOOL_2 */ 90#define I810_CTXREG_LCS 16 /* GFX_OP_LINEWIDTH_CULL_SHADE_MODE */ 91#define I810_CTXREG_PV 17 /* GFX_OP_PV_RULE -- Invarient! */ 92#define I810_CTXREG_ZA 18 /* GFX_OP_ZBIAS_ALPHAFUNC */ 93#define I810_CTXREG_AA 19 /* GFX_OP_ANTIALIAS */ 94#define I810_CTX_SETUP_SIZE 20 95 96/* Texture state (per tex unit) 97 */ 98#define I810_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (4 dwords) */ 99#define I810_TEXREG_MI1 1 100#define I810_TEXREG_MI2 2 101#define I810_TEXREG_MI3 3 102#define I810_TEXREG_MF 4 /* GFX_OP_MAP_FILTER */ 103#define I810_TEXREG_MLC 5 /* GFX_OP_MAP_LOD_CTL */ 104#define I810_TEXREG_MLL 6 /* GFX_OP_MAP_LOD_LIMITS */ 105#define I810_TEXREG_MCS 7 /* GFX_OP_MAP_COORD_SETS ??? */ 106#define I810_TEX_SETUP_SIZE 8 107 108/* Driver specific DRM command indices 109 * NOTE: these are not OS specific, but they are driver specific 110 */ 111#define DRM_I810_INIT 0x00 112#define DRM_I810_VERTEX 0x01 113#define DRM_I810_CLEAR 0x02 114#define DRM_I810_FLUSH 0x03 115#define DRM_I810_GETAGE 0x04 116#define DRM_I810_GETBUF 0x05 117#define DRM_I810_SWAP 0x06 118#define DRM_I810_COPY 0x07 119#define DRM_I810_DOCOPY 0x08 120#define DRM_I810_OV0INFO 0x09 121#define DRM_I810_FSTATUS 0x0a 122#define DRM_I810_OV0FLIP 0x0b 123#define DRM_I810_MC 0x0c 124#define DRM_I810_RSTATUS 0x0d 125#define DRM_I810_FLIP 0x0e 126 127#endif 128 129typedef enum _drmI810Initfunc { 130 I810_INIT_DMA = 0x01, 131 I810_CLEANUP_DMA = 0x02, 132 I810_INIT_DMA_1_4 = 0x03 133} drmI810Initfunc; 134 135typedef struct { 136 drmI810Initfunc func; 137 unsigned int mmio_offset; 138 unsigned int buffers_offset; 139 int sarea_priv_offset; 140 unsigned int ring_start; 141 unsigned int ring_end; 142 unsigned int ring_size; 143 unsigned int front_offset; 144 unsigned int back_offset; 145 unsigned int depth_offset; 146 unsigned int overlay_offset; 147 unsigned int overlay_physical; 148 unsigned int w; 149 unsigned int h; 150 unsigned int pitch; 151 unsigned int pitch_bits; 152} drmI810Init; 153 154typedef struct { 155 void *virtual; 156 int request_idx; 157 int request_size; 158 int granted; 159} drmI810DMA; 160 161/* Flags for clear ioctl 162 */ 163#define I810_FRONT 0x1 164#define I810_BACK 0x2 165#define I810_DEPTH 0x4 166 167typedef struct { 168 int clear_color; 169 int clear_depth; 170 int flags; 171} drmI810Clear; 172 173typedef struct { 174 int idx; /* buffer index */ 175 int used; /* nr bytes in use */ 176 int discard; /* client is finished with the buffer? */ 177} drmI810Vertex; 178 179/* Flags for vertex ioctl 180 */ 181#define PR_TRIANGLES (0x0<<18) 182#define PR_TRISTRIP_0 (0x1<<18) 183#define PR_TRISTRIP_1 (0x2<<18) 184#define PR_TRIFAN (0x3<<18) 185#define PR_POLYGON (0x4<<18) 186#define PR_LINES (0x5<<18) 187#define PR_LINESTRIP (0x6<<18) 188#define PR_RECTS (0x7<<18) 189#define PR_MASK (0x7<<18) 190 191#endif 192