mach64_common.h revision 32b578d3
1/* mach64_common.h -- common header definitions for Rage Pro 2D/3D/DRM suite
2 * Created: Sun Dec 03 11:34:16 2000 by gareth@valinux.com
3 *
4 * Copyright 2000 Gareth Hughes
5 * All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the next
15 * paragraph) shall be included in all copies or substantial portions of the
16 * Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21 * GARETH HUGHES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 * Author:
26 *	Gareth Hughes <gareth@valinux.com>
27 *      Leif Delgass <ldelgass@retinalburn.net>
28 */
29
30#ifndef __MACH64_COMMON_H__
31#define __MACH64_COMMON_H__ 1
32
33/* WARNING: If you change any of these defines, make sure to change
34 * the kernel include file as well (mach64_drm.h)
35 */
36
37/* Driver specific DRM command indices
38 * NOTE: these are not OS specific, but they are driver specific
39 */
40#define DRM_MACH64_INIT           0x00
41#define DRM_MACH64_IDLE           0x01
42#define DRM_MACH64_RESET          0x02
43#define DRM_MACH64_SWAP           0x03
44#define DRM_MACH64_CLEAR          0x04
45#define DRM_MACH64_VERTEX         0x05
46#define DRM_MACH64_BLIT           0x06
47#define DRM_MACH64_FLUSH          0x07
48#define DRM_MACH64_GETPARAM       0x08
49
50/* Buffer flags for clears
51 */
52#define MACH64_FRONT	          0x1
53#define MACH64_BACK	          0x2
54#define MACH64_DEPTH	          0x4
55
56/* Primitive types for vertex buffers
57 */
58#define MACH64_PRIM_POINTS		0x00000000
59#define MACH64_PRIM_LINES		0x00000001
60#define MACH64_PRIM_LINE_LOOP		0x00000002
61#define MACH64_PRIM_LINE_STRIP		0x00000003
62#define MACH64_PRIM_TRIANGLES		0x00000004
63#define MACH64_PRIM_TRIANGLE_STRIP	0x00000005
64#define MACH64_PRIM_TRIANGLE_FAN	0x00000006
65#define MACH64_PRIM_QUADS		0x00000007
66#define MACH64_PRIM_QUAD_STRIP		0x00000008
67#define MACH64_PRIM_POLYGON		0x00000009
68
69
70typedef enum _drmMach64DMAMode {
71   MACH64_MODE_DMA_ASYNC,
72   MACH64_MODE_DMA_SYNC,
73   MACH64_MODE_MMIO
74} drmMach64DMAMode;
75
76typedef struct {
77   enum {
78      DRM_MACH64_INIT_DMA    = 0x01,
79      DRM_MACH64_CLEANUP_DMA = 0x02
80   } func;
81   unsigned long sarea_priv_offset;
82   int is_pci;
83   drmMach64DMAMode dma_mode;
84
85   unsigned int fb_bpp;
86   unsigned int front_offset, front_pitch;
87   unsigned int back_offset, back_pitch;
88
89   unsigned int depth_bpp;
90   unsigned int depth_offset, depth_pitch;
91
92   unsigned long fb_offset;
93   unsigned long mmio_offset;
94   unsigned long ring_offset;
95   unsigned long buffers_offset;
96   unsigned long agp_textures_offset;
97} drmMach64Init;
98
99typedef struct {
100   unsigned int flags;
101   int x, y, w, h;
102   unsigned int clear_color;
103   unsigned int clear_depth;
104} drmMach64Clear;
105
106typedef struct {
107   int prim;
108   void *buf;			/* Address of vertex buffer */
109   unsigned long used;		/* Number of bytes in buffer */
110   int discard;			/* Client finished with buffer? */
111} drmMach64Vertex;
112
113typedef struct {
114   void *buf;
115   int pitch;
116   int offset;
117   int format;
118   unsigned short x, y;
119   unsigned short width, height;
120} drmMach64Blit;
121
122typedef struct {
123   int param;
124   int *value;
125} drmMach64GetParam;
126
127#define MACH64_PARAM_FRAMES_QUEUED 1
128#define MACH64_PARAM_IRQ_NR       2
129
130#endif /* __MACH64_COMMON_H__ */
131