summaryrefslogtreecommitdiff
path: root/src/mga_common.h
blob: 6a3a83db4d3383824b76903e463261481ae03b55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/* mga_common.h -- common header definitions for MGA 2D/3D/DRM suite
 *
 * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
 * All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 * Converted to common header format:
 *   Jens Owen <jens@tungstengraphics.com>
 *
 * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_common.h,v 1.1 2002/10/30 12:52:19 alanh Exp $
 *
 */

#ifndef _MGA_COMMON_H_
#define _MGA_COMMON_H_

/*
 * WARNING: If you change any of these defines, make sure to change
 * the kernel include file as well (mga_drm.h)
 */

#define  DRM_MGA_IDLE_RETRY          2048
#define  DRM_MGA_NR_TEX_HEAPS        2

typedef struct {
   int installed;
   unsigned long phys_addr;
   int size;
} drmMGAWarpIndex;

/* Driver specific DRM command indices
 * NOTE: these are not OS specific, but they are driver specific
 */
#define DRM_MGA_INIT              0x00
#define DRM_MGA_FLUSH             0x01
#define DRM_MGA_RESET             0x02
#define DRM_MGA_SWAP              0x03
#define DRM_MGA_CLEAR             0x04
#define DRM_MGA_VERTEX            0x05
#define DRM_MGA_INDICES           0x06
#define DRM_MGA_ILOAD             0x07
#define DRM_MGA_BLIT              0x08
#define DRM_MGA_GETPARAM          0x09

typedef struct {
   enum {
      MGA_INIT_DMA    = 0x01,
      MGA_CLEANUP_DMA = 0x02
   } func;

   unsigned long sarea_priv_offset;

   int chipset;
   int sgram;

   unsigned int maccess;

   unsigned int fb_cpp;
   unsigned int front_offset, front_pitch;
   unsigned int back_offset, back_pitch;

   unsigned int depth_cpp;
   unsigned int depth_offset, depth_pitch;

   unsigned int texture_offset[DRM_MGA_NR_TEX_HEAPS];
   unsigned int texture_size[DRM_MGA_NR_TEX_HEAPS];

   unsigned long fb_offset;
   unsigned long mmio_offset;
   unsigned long status_offset;
   unsigned long warp_offset;
   unsigned long primary_offset;
   unsigned long buffers_offset;
} drmMGAInit;

typedef enum {
   DRM_MGA_LOCK_READY      = 0x01, /* Wait until hardware is ready for DMA */
   DRM_MGA_LOCK_QUIESCENT  = 0x02, /* Wait until hardware quiescent        */
   DRM_MGA_LOCK_FLUSH      = 0x04, /* Flush this context's DMA queue first */
   DRM_MGA_LOCK_FLUSH_ALL  = 0x08, /* Flush all DMA queues first           */
                                   /* These *HALT* flags aren't supported yet
                                      -- they will be used to support the
                                         full-screen DGA-like mode.        */
   DRM_MGA_HALT_ALL_QUEUES = 0x10, /* Halt all current and future queues   */
   DRM_MGA_HALT_CUR_QUEUES = 0x20  /* Halt all current queues              */
} drmMGALockFlags;

typedef struct {
   int             context;
   drmMGALockFlags flags;
} drmMGALock;

typedef struct {
   int idx;
   unsigned int dstorg;
   unsigned int length;
} drmMGAIload;

typedef struct {
   unsigned int flags;
   unsigned int clear_color;
   unsigned int clear_depth;
   unsigned int color_mask;
   unsigned int depth_mask;
} drmMGAClearRec;

typedef struct {
   int idx;                        /* buffer to queue */
   int used;                       /* bytes in use */
   int discard;                    /* client finished with buffer?  */
} drmMGAVertex;

typedef struct {
        unsigned int planemask;
        unsigned int srcorg;
        unsigned int dstorg;
        int src_pitch, dst_pitch;
        int delta_sx, delta_sy;
        int delta_dx, delta_dy;
        int height, ydir;               /* flip image vertically */
        int source_pitch, dest_pitch;
} drmMGABlit;

/* 3.1: An ioctl to get parameters that aren't available to the 3d
 * client any other way.  
 */
#define MGA_PARAM_IRQ_NR            1

typedef struct {
	int param;
	int *value;
} drmMGAGetParam;

#endif