mga_common.h revision 0bb88ba4
1/* mga_common.h -- common header definitions for MGA 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#ifndef _MGA_COMMON_H_ 31#define _MGA_COMMON_H_ 32 33/* 34 * WARNING: If you change any of these defines, make sure to change 35 * the kernel include file as well (mga_drm.h) 36 */ 37 38#define DRM_MGA_IDLE_RETRY 2048 39#define DRM_MGA_NR_TEX_HEAPS 2 40 41typedef struct { 42 int installed; 43 unsigned long phys_addr; 44 int size; 45} drmMGAWarpIndex; 46 47/* Driver specific DRM command indices 48 * NOTE: these are not OS specific, but they are driver specific 49 */ 50#define DRM_MGA_INIT 0x00 51#define DRM_MGA_FLUSH 0x01 52#define DRM_MGA_RESET 0x02 53#define DRM_MGA_SWAP 0x03 54#define DRM_MGA_CLEAR 0x04 55#define DRM_MGA_VERTEX 0x05 56#define DRM_MGA_INDICES 0x06 57#define DRM_MGA_ILOAD 0x07 58#define DRM_MGA_BLIT 0x08 59#define DRM_MGA_GETPARAM 0x09 60 61typedef struct { 62 enum { 63 MGA_INIT_DMA = 0x01, 64 MGA_CLEANUP_DMA = 0x02 65 } func; 66 67 unsigned long sarea_priv_offset; 68 69 int chipset; 70 int sgram; 71 72 unsigned int maccess; 73 74 unsigned int fb_cpp; 75 unsigned int front_offset, front_pitch; 76 unsigned int back_offset, back_pitch; 77 78 unsigned int depth_cpp; 79 unsigned int depth_offset, depth_pitch; 80 81 unsigned int texture_offset[DRM_MGA_NR_TEX_HEAPS]; 82 unsigned int texture_size[DRM_MGA_NR_TEX_HEAPS]; 83 84 unsigned long fb_offset; 85 unsigned long mmio_offset; 86 unsigned long status_offset; 87 unsigned long warp_offset; 88 unsigned long primary_offset; 89 unsigned long buffers_offset; 90} drmMGAInit; 91 92typedef enum { 93 DRM_MGA_LOCK_READY = 0x01, /* Wait until hardware is ready for DMA */ 94 DRM_MGA_LOCK_QUIESCENT = 0x02, /* Wait until hardware quiescent */ 95 DRM_MGA_LOCK_FLUSH = 0x04, /* Flush this context's DMA queue first */ 96 DRM_MGA_LOCK_FLUSH_ALL = 0x08, /* Flush all DMA queues first */ 97 /* These *HALT* flags aren't supported yet 98 -- they will be used to support the 99 full-screen DGA-like mode. */ 100 DRM_MGA_HALT_ALL_QUEUES = 0x10, /* Halt all current and future queues */ 101 DRM_MGA_HALT_CUR_QUEUES = 0x20 /* Halt all current queues */ 102} drmMGALockFlags; 103 104typedef struct { 105 int context; 106 drmMGALockFlags flags; 107} drmMGALock; 108 109typedef struct { 110 int idx; 111 unsigned int dstorg; 112 unsigned int length; 113} drmMGAIload; 114 115typedef struct { 116 unsigned int flags; 117 unsigned int clear_color; 118 unsigned int clear_depth; 119 unsigned int color_mask; 120 unsigned int depth_mask; 121} drmMGAClearRec; 122 123typedef struct { 124 int idx; /* buffer to queue */ 125 int used; /* bytes in use */ 126 int discard; /* client finished with buffer? */ 127} drmMGAVertex; 128 129typedef struct { 130 unsigned int planemask; 131 unsigned int srcorg; 132 unsigned int dstorg; 133 int src_pitch, dst_pitch; 134 int delta_sx, delta_sy; 135 int delta_dx, delta_dy; 136 int height, ydir; /* flip image vertically */ 137 int source_pitch, dest_pitch; 138} drmMGABlit; 139 140/* 3.1: An ioctl to get parameters that aren't available to the 3d 141 * client any other way. 142 */ 143#define MGA_PARAM_IRQ_NR 1 144 145typedef struct { 146 int param; 147 int *value; 148} drmMGAGetParam; 149 150#endif 151