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