18c2ecf20Sopenharmony_ci/* mga_drm.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*- 28c2ecf20Sopenharmony_ci * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 58c2ecf20Sopenharmony_ci * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 68c2ecf20Sopenharmony_ci * All rights reserved. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 98c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 108c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation 118c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 128c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 138c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next 168c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 178c2ecf20Sopenharmony_ci * Software. 188c2ecf20Sopenharmony_ci * 198c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 208c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 218c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 228c2ecf20Sopenharmony_ci * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 238c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 248c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 258c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * Authors: 288c2ecf20Sopenharmony_ci * Jeff Hartmann <jhartmann@valinux.com> 298c2ecf20Sopenharmony_ci * Keith Whitwell <keith@tungstengraphics.com> 308c2ecf20Sopenharmony_ci * 318c2ecf20Sopenharmony_ci * Rewritten by: 328c2ecf20Sopenharmony_ci * Gareth Hughes <gareth@valinux.com> 338c2ecf20Sopenharmony_ci */ 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#ifndef __MGA_DRM_H__ 368c2ecf20Sopenharmony_ci#define __MGA_DRM_H__ 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#include "drm.h" 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#if defined(__cplusplus) 418c2ecf20Sopenharmony_ciextern "C" { 428c2ecf20Sopenharmony_ci#endif 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci/* WARNING: If you change any of these defines, make sure to change the 458c2ecf20Sopenharmony_ci * defines in the Xserver file (mga_sarea.h) 468c2ecf20Sopenharmony_ci */ 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#ifndef __MGA_SAREA_DEFINES__ 498c2ecf20Sopenharmony_ci#define __MGA_SAREA_DEFINES__ 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/* WARP pipe flags 528c2ecf20Sopenharmony_ci */ 538c2ecf20Sopenharmony_ci#define MGA_F 0x1 /* fog */ 548c2ecf20Sopenharmony_ci#define MGA_A 0x2 /* alpha */ 558c2ecf20Sopenharmony_ci#define MGA_S 0x4 /* specular */ 568c2ecf20Sopenharmony_ci#define MGA_T2 0x8 /* multitexture */ 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci#define MGA_WARP_TGZ 0 598c2ecf20Sopenharmony_ci#define MGA_WARP_TGZF (MGA_F) 608c2ecf20Sopenharmony_ci#define MGA_WARP_TGZA (MGA_A) 618c2ecf20Sopenharmony_ci#define MGA_WARP_TGZAF (MGA_F|MGA_A) 628c2ecf20Sopenharmony_ci#define MGA_WARP_TGZS (MGA_S) 638c2ecf20Sopenharmony_ci#define MGA_WARP_TGZSF (MGA_S|MGA_F) 648c2ecf20Sopenharmony_ci#define MGA_WARP_TGZSA (MGA_S|MGA_A) 658c2ecf20Sopenharmony_ci#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) 668c2ecf20Sopenharmony_ci#define MGA_WARP_T2GZ (MGA_T2) 678c2ecf20Sopenharmony_ci#define MGA_WARP_T2GZF (MGA_T2|MGA_F) 688c2ecf20Sopenharmony_ci#define MGA_WARP_T2GZA (MGA_T2|MGA_A) 698c2ecf20Sopenharmony_ci#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) 708c2ecf20Sopenharmony_ci#define MGA_WARP_T2GZS (MGA_T2|MGA_S) 718c2ecf20Sopenharmony_ci#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) 728c2ecf20Sopenharmony_ci#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) 738c2ecf20Sopenharmony_ci#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#define MGA_MAX_G200_PIPES 8 /* no multitex */ 768c2ecf20Sopenharmony_ci#define MGA_MAX_G400_PIPES 16 778c2ecf20Sopenharmony_ci#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES 788c2ecf20Sopenharmony_ci#define MGA_WARP_UCODE_SIZE 32768 /* in bytes */ 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci#define MGA_CARD_TYPE_G200 1 818c2ecf20Sopenharmony_ci#define MGA_CARD_TYPE_G400 2 828c2ecf20Sopenharmony_ci#define MGA_CARD_TYPE_G450 3 /* not currently used */ 838c2ecf20Sopenharmony_ci#define MGA_CARD_TYPE_G550 4 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#define MGA_FRONT 0x1 868c2ecf20Sopenharmony_ci#define MGA_BACK 0x2 878c2ecf20Sopenharmony_ci#define MGA_DEPTH 0x4 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci/* What needs to be changed for the current vertex dma buffer? 908c2ecf20Sopenharmony_ci */ 918c2ecf20Sopenharmony_ci#define MGA_UPLOAD_CONTEXT 0x1 928c2ecf20Sopenharmony_ci#define MGA_UPLOAD_TEX0 0x2 938c2ecf20Sopenharmony_ci#define MGA_UPLOAD_TEX1 0x4 948c2ecf20Sopenharmony_ci#define MGA_UPLOAD_PIPE 0x8 958c2ecf20Sopenharmony_ci#define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */ 968c2ecf20Sopenharmony_ci#define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */ 978c2ecf20Sopenharmony_ci#define MGA_UPLOAD_2D 0x40 988c2ecf20Sopenharmony_ci#define MGA_WAIT_AGE 0x80 /* handled client-side */ 998c2ecf20Sopenharmony_ci#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ 1008c2ecf20Sopenharmony_ci#if 0 1018c2ecf20Sopenharmony_ci#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock 1028c2ecf20Sopenharmony_ci quiescent */ 1038c2ecf20Sopenharmony_ci#endif 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci/* 32 buffers of 64k each, total 2 meg. 1068c2ecf20Sopenharmony_ci */ 1078c2ecf20Sopenharmony_ci#define MGA_BUFFER_SIZE (1 << 16) 1088c2ecf20Sopenharmony_ci#define MGA_NUM_BUFFERS 128 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci/* Keep these small for testing. 1118c2ecf20Sopenharmony_ci */ 1128c2ecf20Sopenharmony_ci#define MGA_NR_SAREA_CLIPRECTS 8 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci/* 2 heaps (1 for card, 1 for agp), each divided into up to 128 1158c2ecf20Sopenharmony_ci * regions, subject to a minimum region size of (1<<16) == 64k. 1168c2ecf20Sopenharmony_ci * 1178c2ecf20Sopenharmony_ci * Clients may subdivide regions internally, but when sharing between 1188c2ecf20Sopenharmony_ci * clients, the region size is the minimum granularity. 1198c2ecf20Sopenharmony_ci */ 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci#define MGA_CARD_HEAP 0 1228c2ecf20Sopenharmony_ci#define MGA_AGP_HEAP 1 1238c2ecf20Sopenharmony_ci#define MGA_NR_TEX_HEAPS 2 1248c2ecf20Sopenharmony_ci#define MGA_NR_TEX_REGIONS 16 1258c2ecf20Sopenharmony_ci#define MGA_LOG_MIN_TEX_REGION_SIZE 16 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci#define DRM_MGA_IDLE_RETRY 2048 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci#endif /* __MGA_SAREA_DEFINES__ */ 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci/* Setup registers for 3D context 1328c2ecf20Sopenharmony_ci */ 1338c2ecf20Sopenharmony_citypedef struct { 1348c2ecf20Sopenharmony_ci unsigned int dstorg; 1358c2ecf20Sopenharmony_ci unsigned int maccess; 1368c2ecf20Sopenharmony_ci unsigned int plnwt; 1378c2ecf20Sopenharmony_ci unsigned int dwgctl; 1388c2ecf20Sopenharmony_ci unsigned int alphactrl; 1398c2ecf20Sopenharmony_ci unsigned int fogcolor; 1408c2ecf20Sopenharmony_ci unsigned int wflag; 1418c2ecf20Sopenharmony_ci unsigned int tdualstage0; 1428c2ecf20Sopenharmony_ci unsigned int tdualstage1; 1438c2ecf20Sopenharmony_ci unsigned int fcol; 1448c2ecf20Sopenharmony_ci unsigned int stencil; 1458c2ecf20Sopenharmony_ci unsigned int stencilctl; 1468c2ecf20Sopenharmony_ci} drm_mga_context_regs_t; 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci/* Setup registers for 2D, X server 1498c2ecf20Sopenharmony_ci */ 1508c2ecf20Sopenharmony_citypedef struct { 1518c2ecf20Sopenharmony_ci unsigned int pitch; 1528c2ecf20Sopenharmony_ci} drm_mga_server_regs_t; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci/* Setup registers for each texture unit 1558c2ecf20Sopenharmony_ci */ 1568c2ecf20Sopenharmony_citypedef struct { 1578c2ecf20Sopenharmony_ci unsigned int texctl; 1588c2ecf20Sopenharmony_ci unsigned int texctl2; 1598c2ecf20Sopenharmony_ci unsigned int texfilter; 1608c2ecf20Sopenharmony_ci unsigned int texbordercol; 1618c2ecf20Sopenharmony_ci unsigned int texorg; 1628c2ecf20Sopenharmony_ci unsigned int texwidth; 1638c2ecf20Sopenharmony_ci unsigned int texheight; 1648c2ecf20Sopenharmony_ci unsigned int texorg1; 1658c2ecf20Sopenharmony_ci unsigned int texorg2; 1668c2ecf20Sopenharmony_ci unsigned int texorg3; 1678c2ecf20Sopenharmony_ci unsigned int texorg4; 1688c2ecf20Sopenharmony_ci} drm_mga_texture_regs_t; 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci/* General aging mechanism 1718c2ecf20Sopenharmony_ci */ 1728c2ecf20Sopenharmony_citypedef struct { 1738c2ecf20Sopenharmony_ci unsigned int head; /* Position of head pointer */ 1748c2ecf20Sopenharmony_ci unsigned int wrap; /* Primary DMA wrap count */ 1758c2ecf20Sopenharmony_ci} drm_mga_age_t; 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_citypedef struct _drm_mga_sarea { 1788c2ecf20Sopenharmony_ci /* The channel for communication of state information to the kernel 1798c2ecf20Sopenharmony_ci * on firing a vertex dma buffer. 1808c2ecf20Sopenharmony_ci */ 1818c2ecf20Sopenharmony_ci drm_mga_context_regs_t context_state; 1828c2ecf20Sopenharmony_ci drm_mga_server_regs_t server_state; 1838c2ecf20Sopenharmony_ci drm_mga_texture_regs_t tex_state[2]; 1848c2ecf20Sopenharmony_ci unsigned int warp_pipe; 1858c2ecf20Sopenharmony_ci unsigned int dirty; 1868c2ecf20Sopenharmony_ci unsigned int vertsize; 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci /* The current cliprects, or a subset thereof. 1898c2ecf20Sopenharmony_ci */ 1908c2ecf20Sopenharmony_ci struct drm_clip_rect boxes[MGA_NR_SAREA_CLIPRECTS]; 1918c2ecf20Sopenharmony_ci unsigned int nbox; 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci /* Information about the most recently used 3d drawable. The 1948c2ecf20Sopenharmony_ci * client fills in the req_* fields, the server fills in the 1958c2ecf20Sopenharmony_ci * exported_ fields and puts the cliprects into boxes, above. 1968c2ecf20Sopenharmony_ci * 1978c2ecf20Sopenharmony_ci * The client clears the exported_drawable field before 1988c2ecf20Sopenharmony_ci * clobbering the boxes data. 1998c2ecf20Sopenharmony_ci */ 2008c2ecf20Sopenharmony_ci unsigned int req_drawable; /* the X drawable id */ 2018c2ecf20Sopenharmony_ci unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci unsigned int exported_drawable; 2048c2ecf20Sopenharmony_ci unsigned int exported_index; 2058c2ecf20Sopenharmony_ci unsigned int exported_stamp; 2068c2ecf20Sopenharmony_ci unsigned int exported_buffers; 2078c2ecf20Sopenharmony_ci unsigned int exported_nfront; 2088c2ecf20Sopenharmony_ci unsigned int exported_nback; 2098c2ecf20Sopenharmony_ci int exported_back_x, exported_front_x, exported_w; 2108c2ecf20Sopenharmony_ci int exported_back_y, exported_front_y, exported_h; 2118c2ecf20Sopenharmony_ci struct drm_clip_rect exported_boxes[MGA_NR_SAREA_CLIPRECTS]; 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci /* Counters for aging textures and for client-side throttling. 2148c2ecf20Sopenharmony_ci */ 2158c2ecf20Sopenharmony_ci unsigned int status[4]; 2168c2ecf20Sopenharmony_ci unsigned int last_wrap; 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci drm_mga_age_t last_frame; 2198c2ecf20Sopenharmony_ci unsigned int last_enqueue; /* last time a buffer was enqueued */ 2208c2ecf20Sopenharmony_ci unsigned int last_dispatch; /* age of the most recently dispatched buffer */ 2218c2ecf20Sopenharmony_ci unsigned int last_quiescent; /* */ 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ci /* LRU lists for texture memory in agp space and on the card. 2248c2ecf20Sopenharmony_ci */ 2258c2ecf20Sopenharmony_ci struct drm_tex_region texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS + 1]; 2268c2ecf20Sopenharmony_ci unsigned int texAge[MGA_NR_TEX_HEAPS]; 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci /* Mechanism to validate card state. 2298c2ecf20Sopenharmony_ci */ 2308c2ecf20Sopenharmony_ci int ctxOwner; 2318c2ecf20Sopenharmony_ci} drm_mga_sarea_t; 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci/* MGA specific ioctls 2348c2ecf20Sopenharmony_ci * The device specific ioctl range is 0x40 to 0x79. 2358c2ecf20Sopenharmony_ci */ 2368c2ecf20Sopenharmony_ci#define DRM_MGA_INIT 0x00 2378c2ecf20Sopenharmony_ci#define DRM_MGA_FLUSH 0x01 2388c2ecf20Sopenharmony_ci#define DRM_MGA_RESET 0x02 2398c2ecf20Sopenharmony_ci#define DRM_MGA_SWAP 0x03 2408c2ecf20Sopenharmony_ci#define DRM_MGA_CLEAR 0x04 2418c2ecf20Sopenharmony_ci#define DRM_MGA_VERTEX 0x05 2428c2ecf20Sopenharmony_ci#define DRM_MGA_INDICES 0x06 2438c2ecf20Sopenharmony_ci#define DRM_MGA_ILOAD 0x07 2448c2ecf20Sopenharmony_ci#define DRM_MGA_BLIT 0x08 2458c2ecf20Sopenharmony_ci#define DRM_MGA_GETPARAM 0x09 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci/* 3.2: 2488c2ecf20Sopenharmony_ci * ioctls for operating on fences. 2498c2ecf20Sopenharmony_ci */ 2508c2ecf20Sopenharmony_ci#define DRM_MGA_SET_FENCE 0x0a 2518c2ecf20Sopenharmony_ci#define DRM_MGA_WAIT_FENCE 0x0b 2528c2ecf20Sopenharmony_ci#define DRM_MGA_DMA_BOOTSTRAP 0x0c 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci#define DRM_IOCTL_MGA_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INIT, drm_mga_init_t) 2558c2ecf20Sopenharmony_ci#define DRM_IOCTL_MGA_FLUSH DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_FLUSH, struct drm_lock) 2568c2ecf20Sopenharmony_ci#define DRM_IOCTL_MGA_RESET DRM_IO( DRM_COMMAND_BASE + DRM_MGA_RESET) 2578c2ecf20Sopenharmony_ci#define DRM_IOCTL_MGA_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_MGA_SWAP) 2588c2ecf20Sopenharmony_ci#define DRM_IOCTL_MGA_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_CLEAR, drm_mga_clear_t) 2598c2ecf20Sopenharmony_ci#define DRM_IOCTL_MGA_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_VERTEX, drm_mga_vertex_t) 2608c2ecf20Sopenharmony_ci#define DRM_IOCTL_MGA_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INDICES, drm_mga_indices_t) 2618c2ecf20Sopenharmony_ci#define DRM_IOCTL_MGA_ILOAD DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_ILOAD, drm_mga_iload_t) 2628c2ecf20Sopenharmony_ci#define DRM_IOCTL_MGA_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_BLIT, drm_mga_blit_t) 2638c2ecf20Sopenharmony_ci#define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_GETPARAM, drm_mga_getparam_t) 2648c2ecf20Sopenharmony_ci#define DRM_IOCTL_MGA_SET_FENCE DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_SET_FENCE, __u32) 2658c2ecf20Sopenharmony_ci#define DRM_IOCTL_MGA_WAIT_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_WAIT_FENCE, __u32) 2668c2ecf20Sopenharmony_ci#define DRM_IOCTL_MGA_DMA_BOOTSTRAP DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_DMA_BOOTSTRAP, drm_mga_dma_bootstrap_t) 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_citypedef struct _drm_mga_warp_index { 2698c2ecf20Sopenharmony_ci int installed; 2708c2ecf20Sopenharmony_ci unsigned long phys_addr; 2718c2ecf20Sopenharmony_ci int size; 2728c2ecf20Sopenharmony_ci} drm_mga_warp_index_t; 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_citypedef struct drm_mga_init { 2758c2ecf20Sopenharmony_ci enum { 2768c2ecf20Sopenharmony_ci MGA_INIT_DMA = 0x01, 2778c2ecf20Sopenharmony_ci MGA_CLEANUP_DMA = 0x02 2788c2ecf20Sopenharmony_ci } func; 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci unsigned long sarea_priv_offset; 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ci int chipset; 2838c2ecf20Sopenharmony_ci int sgram; 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci unsigned int maccess; 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci unsigned int fb_cpp; 2888c2ecf20Sopenharmony_ci unsigned int front_offset, front_pitch; 2898c2ecf20Sopenharmony_ci unsigned int back_offset, back_pitch; 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ci unsigned int depth_cpp; 2928c2ecf20Sopenharmony_ci unsigned int depth_offset, depth_pitch; 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ci unsigned int texture_offset[MGA_NR_TEX_HEAPS]; 2958c2ecf20Sopenharmony_ci unsigned int texture_size[MGA_NR_TEX_HEAPS]; 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci unsigned long fb_offset; 2988c2ecf20Sopenharmony_ci unsigned long mmio_offset; 2998c2ecf20Sopenharmony_ci unsigned long status_offset; 3008c2ecf20Sopenharmony_ci unsigned long warp_offset; 3018c2ecf20Sopenharmony_ci unsigned long primary_offset; 3028c2ecf20Sopenharmony_ci unsigned long buffers_offset; 3038c2ecf20Sopenharmony_ci} drm_mga_init_t; 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_citypedef struct drm_mga_dma_bootstrap { 3068c2ecf20Sopenharmony_ci /** 3078c2ecf20Sopenharmony_ci * \name AGP texture region 3088c2ecf20Sopenharmony_ci * 3098c2ecf20Sopenharmony_ci * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, these fields will 3108c2ecf20Sopenharmony_ci * be filled in with the actual AGP texture settings. 3118c2ecf20Sopenharmony_ci * 3128c2ecf20Sopenharmony_ci * \warning 3138c2ecf20Sopenharmony_ci * If these fields are non-zero, but dma_mga_dma_bootstrap::agp_mode 3148c2ecf20Sopenharmony_ci * is zero, it means that PCI memory (most likely through the use of 3158c2ecf20Sopenharmony_ci * an IOMMU) is being used for "AGP" textures. 3168c2ecf20Sopenharmony_ci */ 3178c2ecf20Sopenharmony_ci /*@{ */ 3188c2ecf20Sopenharmony_ci unsigned long texture_handle; /**< Handle used to map AGP textures. */ 3198c2ecf20Sopenharmony_ci __u32 texture_size; /**< Size of the AGP texture region. */ 3208c2ecf20Sopenharmony_ci /*@} */ 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ci /** 3238c2ecf20Sopenharmony_ci * Requested size of the primary DMA region. 3248c2ecf20Sopenharmony_ci * 3258c2ecf20Sopenharmony_ci * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be 3268c2ecf20Sopenharmony_ci * filled in with the actual AGP mode. If AGP was not available 3278c2ecf20Sopenharmony_ci */ 3288c2ecf20Sopenharmony_ci __u32 primary_size; 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_ci /** 3318c2ecf20Sopenharmony_ci * Requested number of secondary DMA buffers. 3328c2ecf20Sopenharmony_ci * 3338c2ecf20Sopenharmony_ci * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be 3348c2ecf20Sopenharmony_ci * filled in with the actual number of secondary DMA buffers 3358c2ecf20Sopenharmony_ci * allocated. Particularly when PCI DMA is used, this may be 3368c2ecf20Sopenharmony_ci * (subtantially) less than the number requested. 3378c2ecf20Sopenharmony_ci */ 3388c2ecf20Sopenharmony_ci __u32 secondary_bin_count; 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci /** 3418c2ecf20Sopenharmony_ci * Requested size of each secondary DMA buffer. 3428c2ecf20Sopenharmony_ci * 3438c2ecf20Sopenharmony_ci * While the kernel \b is free to reduce 3448c2ecf20Sopenharmony_ci * dma_mga_dma_bootstrap::secondary_bin_count, it is \b not allowed 3458c2ecf20Sopenharmony_ci * to reduce dma_mga_dma_bootstrap::secondary_bin_size. 3468c2ecf20Sopenharmony_ci */ 3478c2ecf20Sopenharmony_ci __u32 secondary_bin_size; 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci /** 3508c2ecf20Sopenharmony_ci * Bit-wise mask of AGPSTAT2_* values. Currently only \c AGPSTAT2_1X, 3518c2ecf20Sopenharmony_ci * \c AGPSTAT2_2X, and \c AGPSTAT2_4X are supported. If this value is 3528c2ecf20Sopenharmony_ci * zero, it means that PCI DMA should be used, even if AGP is 3538c2ecf20Sopenharmony_ci * possible. 3548c2ecf20Sopenharmony_ci * 3558c2ecf20Sopenharmony_ci * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be 3568c2ecf20Sopenharmony_ci * filled in with the actual AGP mode. If AGP was not available 3578c2ecf20Sopenharmony_ci * (i.e., PCI DMA was used), this value will be zero. 3588c2ecf20Sopenharmony_ci */ 3598c2ecf20Sopenharmony_ci __u32 agp_mode; 3608c2ecf20Sopenharmony_ci 3618c2ecf20Sopenharmony_ci /** 3628c2ecf20Sopenharmony_ci * Desired AGP GART size, measured in megabytes. 3638c2ecf20Sopenharmony_ci */ 3648c2ecf20Sopenharmony_ci __u8 agp_size; 3658c2ecf20Sopenharmony_ci} drm_mga_dma_bootstrap_t; 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_citypedef struct drm_mga_clear { 3688c2ecf20Sopenharmony_ci unsigned int flags; 3698c2ecf20Sopenharmony_ci unsigned int clear_color; 3708c2ecf20Sopenharmony_ci unsigned int clear_depth; 3718c2ecf20Sopenharmony_ci unsigned int color_mask; 3728c2ecf20Sopenharmony_ci unsigned int depth_mask; 3738c2ecf20Sopenharmony_ci} drm_mga_clear_t; 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_citypedef struct drm_mga_vertex { 3768c2ecf20Sopenharmony_ci int idx; /* buffer to queue */ 3778c2ecf20Sopenharmony_ci int used; /* bytes in use */ 3788c2ecf20Sopenharmony_ci int discard; /* client finished with buffer? */ 3798c2ecf20Sopenharmony_ci} drm_mga_vertex_t; 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_citypedef struct drm_mga_indices { 3828c2ecf20Sopenharmony_ci int idx; /* buffer to queue */ 3838c2ecf20Sopenharmony_ci unsigned int start; 3848c2ecf20Sopenharmony_ci unsigned int end; 3858c2ecf20Sopenharmony_ci int discard; /* client finished with buffer? */ 3868c2ecf20Sopenharmony_ci} drm_mga_indices_t; 3878c2ecf20Sopenharmony_ci 3888c2ecf20Sopenharmony_citypedef struct drm_mga_iload { 3898c2ecf20Sopenharmony_ci int idx; 3908c2ecf20Sopenharmony_ci unsigned int dstorg; 3918c2ecf20Sopenharmony_ci unsigned int length; 3928c2ecf20Sopenharmony_ci} drm_mga_iload_t; 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_citypedef struct _drm_mga_blit { 3958c2ecf20Sopenharmony_ci unsigned int planemask; 3968c2ecf20Sopenharmony_ci unsigned int srcorg; 3978c2ecf20Sopenharmony_ci unsigned int dstorg; 3988c2ecf20Sopenharmony_ci int src_pitch, dst_pitch; 3998c2ecf20Sopenharmony_ci int delta_sx, delta_sy; 4008c2ecf20Sopenharmony_ci int delta_dx, delta_dy; 4018c2ecf20Sopenharmony_ci int height, ydir; /* flip image vertically */ 4028c2ecf20Sopenharmony_ci int source_pitch, dest_pitch; 4038c2ecf20Sopenharmony_ci} drm_mga_blit_t; 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_ci/* 3.1: An ioctl to get parameters that aren't available to the 3d 4068c2ecf20Sopenharmony_ci * client any other way. 4078c2ecf20Sopenharmony_ci */ 4088c2ecf20Sopenharmony_ci#define MGA_PARAM_IRQ_NR 1 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_ci/* 3.2: Query the actual card type. The DDX only distinguishes between 4118c2ecf20Sopenharmony_ci * G200 chips and non-G200 chips, which it calls G400. It turns out that 4128c2ecf20Sopenharmony_ci * there are some very sublte differences between the G4x0 chips and the G550 4138c2ecf20Sopenharmony_ci * chips. Using this parameter query, a client-side driver can detect the 4148c2ecf20Sopenharmony_ci * difference between a G4x0 and a G550. 4158c2ecf20Sopenharmony_ci */ 4168c2ecf20Sopenharmony_ci#define MGA_PARAM_CARD_TYPE 2 4178c2ecf20Sopenharmony_ci 4188c2ecf20Sopenharmony_citypedef struct drm_mga_getparam { 4198c2ecf20Sopenharmony_ci int param; 4208c2ecf20Sopenharmony_ci void __user *value; 4218c2ecf20Sopenharmony_ci} drm_mga_getparam_t; 4228c2ecf20Sopenharmony_ci 4238c2ecf20Sopenharmony_ci#if defined(__cplusplus) 4248c2ecf20Sopenharmony_ci} 4258c2ecf20Sopenharmony_ci#endif 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_ci#endif 428