1*4882a593Smuzhiyun /* mga_drm.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*- 2*4882a593Smuzhiyun * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 5*4882a593Smuzhiyun * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 6*4882a593Smuzhiyun * All rights reserved. 7*4882a593Smuzhiyun * 8*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person obtaining a 9*4882a593Smuzhiyun * copy of this software and associated documentation files (the "Software"), 10*4882a593Smuzhiyun * to deal in the Software without restriction, including without limitation 11*4882a593Smuzhiyun * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12*4882a593Smuzhiyun * and/or sell copies of the Software, and to permit persons to whom the 13*4882a593Smuzhiyun * Software is furnished to do so, subject to the following conditions: 14*4882a593Smuzhiyun * 15*4882a593Smuzhiyun * The above copyright notice and this permission notice (including the next 16*4882a593Smuzhiyun * paragraph) shall be included in all copies or substantial portions of the 17*4882a593Smuzhiyun * Software. 18*4882a593Smuzhiyun * 19*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20*4882a593Smuzhiyun * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22*4882a593Smuzhiyun * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23*4882a593Smuzhiyun * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24*4882a593Smuzhiyun * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25*4882a593Smuzhiyun * OTHER DEALINGS IN THE SOFTWARE. 26*4882a593Smuzhiyun * 27*4882a593Smuzhiyun * Authors: 28*4882a593Smuzhiyun * Jeff Hartmann <jhartmann@valinux.com> 29*4882a593Smuzhiyun * Keith Whitwell <keith@tungstengraphics.com> 30*4882a593Smuzhiyun * 31*4882a593Smuzhiyun * Rewritten by: 32*4882a593Smuzhiyun * Gareth Hughes <gareth@valinux.com> 33*4882a593Smuzhiyun */ 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun #ifndef __MGA_DRM_H__ 36*4882a593Smuzhiyun #define __MGA_DRM_H__ 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun #include "drm.h" 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun #if defined(__cplusplus) 41*4882a593Smuzhiyun extern "C" { 42*4882a593Smuzhiyun #endif 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun /* WARNING: If you change any of these defines, make sure to change the 45*4882a593Smuzhiyun * defines in the Xserver file (mga_sarea.h) 46*4882a593Smuzhiyun */ 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun #ifndef __MGA_SAREA_DEFINES__ 49*4882a593Smuzhiyun #define __MGA_SAREA_DEFINES__ 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun /* WARP pipe flags 52*4882a593Smuzhiyun */ 53*4882a593Smuzhiyun #define MGA_F 0x1 /* fog */ 54*4882a593Smuzhiyun #define MGA_A 0x2 /* alpha */ 55*4882a593Smuzhiyun #define MGA_S 0x4 /* specular */ 56*4882a593Smuzhiyun #define MGA_T2 0x8 /* multitexture */ 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun #define MGA_WARP_TGZ 0 59*4882a593Smuzhiyun #define MGA_WARP_TGZF (MGA_F) 60*4882a593Smuzhiyun #define MGA_WARP_TGZA (MGA_A) 61*4882a593Smuzhiyun #define MGA_WARP_TGZAF (MGA_F|MGA_A) 62*4882a593Smuzhiyun #define MGA_WARP_TGZS (MGA_S) 63*4882a593Smuzhiyun #define MGA_WARP_TGZSF (MGA_S|MGA_F) 64*4882a593Smuzhiyun #define MGA_WARP_TGZSA (MGA_S|MGA_A) 65*4882a593Smuzhiyun #define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) 66*4882a593Smuzhiyun #define MGA_WARP_T2GZ (MGA_T2) 67*4882a593Smuzhiyun #define MGA_WARP_T2GZF (MGA_T2|MGA_F) 68*4882a593Smuzhiyun #define MGA_WARP_T2GZA (MGA_T2|MGA_A) 69*4882a593Smuzhiyun #define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) 70*4882a593Smuzhiyun #define MGA_WARP_T2GZS (MGA_T2|MGA_S) 71*4882a593Smuzhiyun #define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) 72*4882a593Smuzhiyun #define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) 73*4882a593Smuzhiyun #define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) 74*4882a593Smuzhiyun 75*4882a593Smuzhiyun #define MGA_MAX_G200_PIPES 8 /* no multitex */ 76*4882a593Smuzhiyun #define MGA_MAX_G400_PIPES 16 77*4882a593Smuzhiyun #define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES 78*4882a593Smuzhiyun #define MGA_WARP_UCODE_SIZE 32768 /* in bytes */ 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun #define MGA_CARD_TYPE_G200 1 81*4882a593Smuzhiyun #define MGA_CARD_TYPE_G400 2 82*4882a593Smuzhiyun #define MGA_CARD_TYPE_G450 3 /* not currently used */ 83*4882a593Smuzhiyun #define MGA_CARD_TYPE_G550 4 84*4882a593Smuzhiyun 85*4882a593Smuzhiyun #define MGA_FRONT 0x1 86*4882a593Smuzhiyun #define MGA_BACK 0x2 87*4882a593Smuzhiyun #define MGA_DEPTH 0x4 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun /* What needs to be changed for the current vertex dma buffer? 90*4882a593Smuzhiyun */ 91*4882a593Smuzhiyun #define MGA_UPLOAD_CONTEXT 0x1 92*4882a593Smuzhiyun #define MGA_UPLOAD_TEX0 0x2 93*4882a593Smuzhiyun #define MGA_UPLOAD_TEX1 0x4 94*4882a593Smuzhiyun #define MGA_UPLOAD_PIPE 0x8 95*4882a593Smuzhiyun #define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */ 96*4882a593Smuzhiyun #define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */ 97*4882a593Smuzhiyun #define MGA_UPLOAD_2D 0x40 98*4882a593Smuzhiyun #define MGA_WAIT_AGE 0x80 /* handled client-side */ 99*4882a593Smuzhiyun #define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ 100*4882a593Smuzhiyun #if 0 101*4882a593Smuzhiyun #define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock 102*4882a593Smuzhiyun quiescent */ 103*4882a593Smuzhiyun #endif 104*4882a593Smuzhiyun 105*4882a593Smuzhiyun /* 32 buffers of 64k each, total 2 meg. 106*4882a593Smuzhiyun */ 107*4882a593Smuzhiyun #define MGA_BUFFER_SIZE (1 << 16) 108*4882a593Smuzhiyun #define MGA_NUM_BUFFERS 128 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun /* Keep these small for testing. 111*4882a593Smuzhiyun */ 112*4882a593Smuzhiyun #define MGA_NR_SAREA_CLIPRECTS 8 113*4882a593Smuzhiyun 114*4882a593Smuzhiyun /* 2 heaps (1 for card, 1 for agp), each divided into up to 128 115*4882a593Smuzhiyun * regions, subject to a minimum region size of (1<<16) == 64k. 116*4882a593Smuzhiyun * 117*4882a593Smuzhiyun * Clients may subdivide regions internally, but when sharing between 118*4882a593Smuzhiyun * clients, the region size is the minimum granularity. 119*4882a593Smuzhiyun */ 120*4882a593Smuzhiyun 121*4882a593Smuzhiyun #define MGA_CARD_HEAP 0 122*4882a593Smuzhiyun #define MGA_AGP_HEAP 1 123*4882a593Smuzhiyun #define MGA_NR_TEX_HEAPS 2 124*4882a593Smuzhiyun #define MGA_NR_TEX_REGIONS 16 125*4882a593Smuzhiyun #define MGA_LOG_MIN_TEX_REGION_SIZE 16 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun #define DRM_MGA_IDLE_RETRY 2048 128*4882a593Smuzhiyun 129*4882a593Smuzhiyun #endif /* __MGA_SAREA_DEFINES__ */ 130*4882a593Smuzhiyun 131*4882a593Smuzhiyun /* Setup registers for 3D context 132*4882a593Smuzhiyun */ 133*4882a593Smuzhiyun typedef struct { 134*4882a593Smuzhiyun unsigned int dstorg; 135*4882a593Smuzhiyun unsigned int maccess; 136*4882a593Smuzhiyun unsigned int plnwt; 137*4882a593Smuzhiyun unsigned int dwgctl; 138*4882a593Smuzhiyun unsigned int alphactrl; 139*4882a593Smuzhiyun unsigned int fogcolor; 140*4882a593Smuzhiyun unsigned int wflag; 141*4882a593Smuzhiyun unsigned int tdualstage0; 142*4882a593Smuzhiyun unsigned int tdualstage1; 143*4882a593Smuzhiyun unsigned int fcol; 144*4882a593Smuzhiyun unsigned int stencil; 145*4882a593Smuzhiyun unsigned int stencilctl; 146*4882a593Smuzhiyun } drm_mga_context_regs_t; 147*4882a593Smuzhiyun 148*4882a593Smuzhiyun /* Setup registers for 2D, X server 149*4882a593Smuzhiyun */ 150*4882a593Smuzhiyun typedef struct { 151*4882a593Smuzhiyun unsigned int pitch; 152*4882a593Smuzhiyun } drm_mga_server_regs_t; 153*4882a593Smuzhiyun 154*4882a593Smuzhiyun /* Setup registers for each texture unit 155*4882a593Smuzhiyun */ 156*4882a593Smuzhiyun typedef struct { 157*4882a593Smuzhiyun unsigned int texctl; 158*4882a593Smuzhiyun unsigned int texctl2; 159*4882a593Smuzhiyun unsigned int texfilter; 160*4882a593Smuzhiyun unsigned int texbordercol; 161*4882a593Smuzhiyun unsigned int texorg; 162*4882a593Smuzhiyun unsigned int texwidth; 163*4882a593Smuzhiyun unsigned int texheight; 164*4882a593Smuzhiyun unsigned int texorg1; 165*4882a593Smuzhiyun unsigned int texorg2; 166*4882a593Smuzhiyun unsigned int texorg3; 167*4882a593Smuzhiyun unsigned int texorg4; 168*4882a593Smuzhiyun } drm_mga_texture_regs_t; 169*4882a593Smuzhiyun 170*4882a593Smuzhiyun /* General aging mechanism 171*4882a593Smuzhiyun */ 172*4882a593Smuzhiyun typedef struct { 173*4882a593Smuzhiyun unsigned int head; /* Position of head pointer */ 174*4882a593Smuzhiyun unsigned int wrap; /* Primary DMA wrap count */ 175*4882a593Smuzhiyun } drm_mga_age_t; 176*4882a593Smuzhiyun 177*4882a593Smuzhiyun typedef struct _drm_mga_sarea { 178*4882a593Smuzhiyun /* The channel for communication of state information to the kernel 179*4882a593Smuzhiyun * on firing a vertex dma buffer. 180*4882a593Smuzhiyun */ 181*4882a593Smuzhiyun drm_mga_context_regs_t context_state; 182*4882a593Smuzhiyun drm_mga_server_regs_t server_state; 183*4882a593Smuzhiyun drm_mga_texture_regs_t tex_state[2]; 184*4882a593Smuzhiyun unsigned int warp_pipe; 185*4882a593Smuzhiyun unsigned int dirty; 186*4882a593Smuzhiyun unsigned int vertsize; 187*4882a593Smuzhiyun 188*4882a593Smuzhiyun /* The current cliprects, or a subset thereof. 189*4882a593Smuzhiyun */ 190*4882a593Smuzhiyun struct drm_clip_rect boxes[MGA_NR_SAREA_CLIPRECTS]; 191*4882a593Smuzhiyun unsigned int nbox; 192*4882a593Smuzhiyun 193*4882a593Smuzhiyun /* Information about the most recently used 3d drawable. The 194*4882a593Smuzhiyun * client fills in the req_* fields, the server fills in the 195*4882a593Smuzhiyun * exported_ fields and puts the cliprects into boxes, above. 196*4882a593Smuzhiyun * 197*4882a593Smuzhiyun * The client clears the exported_drawable field before 198*4882a593Smuzhiyun * clobbering the boxes data. 199*4882a593Smuzhiyun */ 200*4882a593Smuzhiyun unsigned int req_drawable; /* the X drawable id */ 201*4882a593Smuzhiyun unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ 202*4882a593Smuzhiyun 203*4882a593Smuzhiyun unsigned int exported_drawable; 204*4882a593Smuzhiyun unsigned int exported_index; 205*4882a593Smuzhiyun unsigned int exported_stamp; 206*4882a593Smuzhiyun unsigned int exported_buffers; 207*4882a593Smuzhiyun unsigned int exported_nfront; 208*4882a593Smuzhiyun unsigned int exported_nback; 209*4882a593Smuzhiyun int exported_back_x, exported_front_x, exported_w; 210*4882a593Smuzhiyun int exported_back_y, exported_front_y, exported_h; 211*4882a593Smuzhiyun struct drm_clip_rect exported_boxes[MGA_NR_SAREA_CLIPRECTS]; 212*4882a593Smuzhiyun 213*4882a593Smuzhiyun /* Counters for aging textures and for client-side throttling. 214*4882a593Smuzhiyun */ 215*4882a593Smuzhiyun unsigned int status[4]; 216*4882a593Smuzhiyun unsigned int last_wrap; 217*4882a593Smuzhiyun 218*4882a593Smuzhiyun drm_mga_age_t last_frame; 219*4882a593Smuzhiyun unsigned int last_enqueue; /* last time a buffer was enqueued */ 220*4882a593Smuzhiyun unsigned int last_dispatch; /* age of the most recently dispatched buffer */ 221*4882a593Smuzhiyun unsigned int last_quiescent; /* */ 222*4882a593Smuzhiyun 223*4882a593Smuzhiyun /* LRU lists for texture memory in agp space and on the card. 224*4882a593Smuzhiyun */ 225*4882a593Smuzhiyun struct drm_tex_region texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS + 1]; 226*4882a593Smuzhiyun unsigned int texAge[MGA_NR_TEX_HEAPS]; 227*4882a593Smuzhiyun 228*4882a593Smuzhiyun /* Mechanism to validate card state. 229*4882a593Smuzhiyun */ 230*4882a593Smuzhiyun int ctxOwner; 231*4882a593Smuzhiyun } drm_mga_sarea_t; 232*4882a593Smuzhiyun 233*4882a593Smuzhiyun /* MGA specific ioctls 234*4882a593Smuzhiyun * The device specific ioctl range is 0x40 to 0x79. 235*4882a593Smuzhiyun */ 236*4882a593Smuzhiyun #define DRM_MGA_INIT 0x00 237*4882a593Smuzhiyun #define DRM_MGA_FLUSH 0x01 238*4882a593Smuzhiyun #define DRM_MGA_RESET 0x02 239*4882a593Smuzhiyun #define DRM_MGA_SWAP 0x03 240*4882a593Smuzhiyun #define DRM_MGA_CLEAR 0x04 241*4882a593Smuzhiyun #define DRM_MGA_VERTEX 0x05 242*4882a593Smuzhiyun #define DRM_MGA_INDICES 0x06 243*4882a593Smuzhiyun #define DRM_MGA_ILOAD 0x07 244*4882a593Smuzhiyun #define DRM_MGA_BLIT 0x08 245*4882a593Smuzhiyun #define DRM_MGA_GETPARAM 0x09 246*4882a593Smuzhiyun 247*4882a593Smuzhiyun /* 3.2: 248*4882a593Smuzhiyun * ioctls for operating on fences. 249*4882a593Smuzhiyun */ 250*4882a593Smuzhiyun #define DRM_MGA_SET_FENCE 0x0a 251*4882a593Smuzhiyun #define DRM_MGA_WAIT_FENCE 0x0b 252*4882a593Smuzhiyun #define DRM_MGA_DMA_BOOTSTRAP 0x0c 253*4882a593Smuzhiyun 254*4882a593Smuzhiyun #define DRM_IOCTL_MGA_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INIT, drm_mga_init_t) 255*4882a593Smuzhiyun #define DRM_IOCTL_MGA_FLUSH DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_FLUSH, struct drm_lock) 256*4882a593Smuzhiyun #define DRM_IOCTL_MGA_RESET DRM_IO( DRM_COMMAND_BASE + DRM_MGA_RESET) 257*4882a593Smuzhiyun #define DRM_IOCTL_MGA_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_MGA_SWAP) 258*4882a593Smuzhiyun #define DRM_IOCTL_MGA_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_CLEAR, drm_mga_clear_t) 259*4882a593Smuzhiyun #define DRM_IOCTL_MGA_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_VERTEX, drm_mga_vertex_t) 260*4882a593Smuzhiyun #define DRM_IOCTL_MGA_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INDICES, drm_mga_indices_t) 261*4882a593Smuzhiyun #define DRM_IOCTL_MGA_ILOAD DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_ILOAD, drm_mga_iload_t) 262*4882a593Smuzhiyun #define DRM_IOCTL_MGA_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_BLIT, drm_mga_blit_t) 263*4882a593Smuzhiyun #define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_GETPARAM, drm_mga_getparam_t) 264*4882a593Smuzhiyun #define DRM_IOCTL_MGA_SET_FENCE DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_SET_FENCE, __u32) 265*4882a593Smuzhiyun #define DRM_IOCTL_MGA_WAIT_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_WAIT_FENCE, __u32) 266*4882a593Smuzhiyun #define DRM_IOCTL_MGA_DMA_BOOTSTRAP DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_DMA_BOOTSTRAP, drm_mga_dma_bootstrap_t) 267*4882a593Smuzhiyun 268*4882a593Smuzhiyun typedef struct _drm_mga_warp_index { 269*4882a593Smuzhiyun int installed; 270*4882a593Smuzhiyun unsigned long phys_addr; 271*4882a593Smuzhiyun int size; 272*4882a593Smuzhiyun } drm_mga_warp_index_t; 273*4882a593Smuzhiyun 274*4882a593Smuzhiyun typedef struct drm_mga_init { 275*4882a593Smuzhiyun enum { 276*4882a593Smuzhiyun MGA_INIT_DMA = 0x01, 277*4882a593Smuzhiyun MGA_CLEANUP_DMA = 0x02 278*4882a593Smuzhiyun } func; 279*4882a593Smuzhiyun 280*4882a593Smuzhiyun unsigned long sarea_priv_offset; 281*4882a593Smuzhiyun 282*4882a593Smuzhiyun int chipset; 283*4882a593Smuzhiyun int sgram; 284*4882a593Smuzhiyun 285*4882a593Smuzhiyun unsigned int maccess; 286*4882a593Smuzhiyun 287*4882a593Smuzhiyun unsigned int fb_cpp; 288*4882a593Smuzhiyun unsigned int front_offset, front_pitch; 289*4882a593Smuzhiyun unsigned int back_offset, back_pitch; 290*4882a593Smuzhiyun 291*4882a593Smuzhiyun unsigned int depth_cpp; 292*4882a593Smuzhiyun unsigned int depth_offset, depth_pitch; 293*4882a593Smuzhiyun 294*4882a593Smuzhiyun unsigned int texture_offset[MGA_NR_TEX_HEAPS]; 295*4882a593Smuzhiyun unsigned int texture_size[MGA_NR_TEX_HEAPS]; 296*4882a593Smuzhiyun 297*4882a593Smuzhiyun unsigned long fb_offset; 298*4882a593Smuzhiyun unsigned long mmio_offset; 299*4882a593Smuzhiyun unsigned long status_offset; 300*4882a593Smuzhiyun unsigned long warp_offset; 301*4882a593Smuzhiyun unsigned long primary_offset; 302*4882a593Smuzhiyun unsigned long buffers_offset; 303*4882a593Smuzhiyun } drm_mga_init_t; 304*4882a593Smuzhiyun 305*4882a593Smuzhiyun typedef struct drm_mga_dma_bootstrap { 306*4882a593Smuzhiyun /** 307*4882a593Smuzhiyun * \name AGP texture region 308*4882a593Smuzhiyun * 309*4882a593Smuzhiyun * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, these fields will 310*4882a593Smuzhiyun * be filled in with the actual AGP texture settings. 311*4882a593Smuzhiyun * 312*4882a593Smuzhiyun * \warning 313*4882a593Smuzhiyun * If these fields are non-zero, but dma_mga_dma_bootstrap::agp_mode 314*4882a593Smuzhiyun * is zero, it means that PCI memory (most likely through the use of 315*4882a593Smuzhiyun * an IOMMU) is being used for "AGP" textures. 316*4882a593Smuzhiyun */ 317*4882a593Smuzhiyun /*@{ */ 318*4882a593Smuzhiyun unsigned long texture_handle; /**< Handle used to map AGP textures. */ 319*4882a593Smuzhiyun __u32 texture_size; /**< Size of the AGP texture region. */ 320*4882a593Smuzhiyun /*@} */ 321*4882a593Smuzhiyun 322*4882a593Smuzhiyun /** 323*4882a593Smuzhiyun * Requested size of the primary DMA region. 324*4882a593Smuzhiyun * 325*4882a593Smuzhiyun * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be 326*4882a593Smuzhiyun * filled in with the actual AGP mode. If AGP was not available 327*4882a593Smuzhiyun */ 328*4882a593Smuzhiyun __u32 primary_size; 329*4882a593Smuzhiyun 330*4882a593Smuzhiyun /** 331*4882a593Smuzhiyun * Requested number of secondary DMA buffers. 332*4882a593Smuzhiyun * 333*4882a593Smuzhiyun * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be 334*4882a593Smuzhiyun * filled in with the actual number of secondary DMA buffers 335*4882a593Smuzhiyun * allocated. Particularly when PCI DMA is used, this may be 336*4882a593Smuzhiyun * (subtantially) less than the number requested. 337*4882a593Smuzhiyun */ 338*4882a593Smuzhiyun __u32 secondary_bin_count; 339*4882a593Smuzhiyun 340*4882a593Smuzhiyun /** 341*4882a593Smuzhiyun * Requested size of each secondary DMA buffer. 342*4882a593Smuzhiyun * 343*4882a593Smuzhiyun * While the kernel \b is free to reduce 344*4882a593Smuzhiyun * dma_mga_dma_bootstrap::secondary_bin_count, it is \b not allowed 345*4882a593Smuzhiyun * to reduce dma_mga_dma_bootstrap::secondary_bin_size. 346*4882a593Smuzhiyun */ 347*4882a593Smuzhiyun __u32 secondary_bin_size; 348*4882a593Smuzhiyun 349*4882a593Smuzhiyun /** 350*4882a593Smuzhiyun * Bit-wise mask of AGPSTAT2_* values. Currently only \c AGPSTAT2_1X, 351*4882a593Smuzhiyun * \c AGPSTAT2_2X, and \c AGPSTAT2_4X are supported. If this value is 352*4882a593Smuzhiyun * zero, it means that PCI DMA should be used, even if AGP is 353*4882a593Smuzhiyun * possible. 354*4882a593Smuzhiyun * 355*4882a593Smuzhiyun * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be 356*4882a593Smuzhiyun * filled in with the actual AGP mode. If AGP was not available 357*4882a593Smuzhiyun * (i.e., PCI DMA was used), this value will be zero. 358*4882a593Smuzhiyun */ 359*4882a593Smuzhiyun __u32 agp_mode; 360*4882a593Smuzhiyun 361*4882a593Smuzhiyun /** 362*4882a593Smuzhiyun * Desired AGP GART size, measured in megabytes. 363*4882a593Smuzhiyun */ 364*4882a593Smuzhiyun __u8 agp_size; 365*4882a593Smuzhiyun } drm_mga_dma_bootstrap_t; 366*4882a593Smuzhiyun 367*4882a593Smuzhiyun typedef struct drm_mga_clear { 368*4882a593Smuzhiyun unsigned int flags; 369*4882a593Smuzhiyun unsigned int clear_color; 370*4882a593Smuzhiyun unsigned int clear_depth; 371*4882a593Smuzhiyun unsigned int color_mask; 372*4882a593Smuzhiyun unsigned int depth_mask; 373*4882a593Smuzhiyun } drm_mga_clear_t; 374*4882a593Smuzhiyun 375*4882a593Smuzhiyun typedef struct drm_mga_vertex { 376*4882a593Smuzhiyun int idx; /* buffer to queue */ 377*4882a593Smuzhiyun int used; /* bytes in use */ 378*4882a593Smuzhiyun int discard; /* client finished with buffer? */ 379*4882a593Smuzhiyun } drm_mga_vertex_t; 380*4882a593Smuzhiyun 381*4882a593Smuzhiyun typedef struct drm_mga_indices { 382*4882a593Smuzhiyun int idx; /* buffer to queue */ 383*4882a593Smuzhiyun unsigned int start; 384*4882a593Smuzhiyun unsigned int end; 385*4882a593Smuzhiyun int discard; /* client finished with buffer? */ 386*4882a593Smuzhiyun } drm_mga_indices_t; 387*4882a593Smuzhiyun 388*4882a593Smuzhiyun typedef struct drm_mga_iload { 389*4882a593Smuzhiyun int idx; 390*4882a593Smuzhiyun unsigned int dstorg; 391*4882a593Smuzhiyun unsigned int length; 392*4882a593Smuzhiyun } drm_mga_iload_t; 393*4882a593Smuzhiyun 394*4882a593Smuzhiyun typedef struct _drm_mga_blit { 395*4882a593Smuzhiyun unsigned int planemask; 396*4882a593Smuzhiyun unsigned int srcorg; 397*4882a593Smuzhiyun unsigned int dstorg; 398*4882a593Smuzhiyun int src_pitch, dst_pitch; 399*4882a593Smuzhiyun int delta_sx, delta_sy; 400*4882a593Smuzhiyun int delta_dx, delta_dy; 401*4882a593Smuzhiyun int height, ydir; /* flip image vertically */ 402*4882a593Smuzhiyun int source_pitch, dest_pitch; 403*4882a593Smuzhiyun } drm_mga_blit_t; 404*4882a593Smuzhiyun 405*4882a593Smuzhiyun /* 3.1: An ioctl to get parameters that aren't available to the 3d 406*4882a593Smuzhiyun * client any other way. 407*4882a593Smuzhiyun */ 408*4882a593Smuzhiyun #define MGA_PARAM_IRQ_NR 1 409*4882a593Smuzhiyun 410*4882a593Smuzhiyun /* 3.2: Query the actual card type. The DDX only distinguishes between 411*4882a593Smuzhiyun * G200 chips and non-G200 chips, which it calls G400. It turns out that 412*4882a593Smuzhiyun * there are some very sublte differences between the G4x0 chips and the G550 413*4882a593Smuzhiyun * chips. Using this parameter query, a client-side driver can detect the 414*4882a593Smuzhiyun * difference between a G4x0 and a G550. 415*4882a593Smuzhiyun */ 416*4882a593Smuzhiyun #define MGA_PARAM_CARD_TYPE 2 417*4882a593Smuzhiyun 418*4882a593Smuzhiyun typedef struct drm_mga_getparam { 419*4882a593Smuzhiyun int param; 420*4882a593Smuzhiyun void __user *value; 421*4882a593Smuzhiyun } drm_mga_getparam_t; 422*4882a593Smuzhiyun 423*4882a593Smuzhiyun #if defined(__cplusplus) 424*4882a593Smuzhiyun } 425*4882a593Smuzhiyun #endif 426*4882a593Smuzhiyun 427*4882a593Smuzhiyun #endif 428