1c582b7e3Smrg/* r128_common.h -- common header definitions for R128 2D/3D/DRM suite
2c582b7e3Smrg * Created: Sun Apr  9 18:16:28 2000 by kevin@precisioninsight.com
3c582b7e3Smrg *
4c582b7e3Smrg * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
5c582b7e3Smrg * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
6c582b7e3Smrg * All Rights Reserved.
7c582b7e3Smrg *
8c582b7e3Smrg * Permission is hereby granted, free of charge, to any person obtaining a
9c582b7e3Smrg * copy of this software and associated documentation files (the "Software"),
10c582b7e3Smrg * to deal in the Software without restriction, including without limitation
11c582b7e3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12c582b7e3Smrg * and/or sell copies of the Software, and to permit persons to whom the
13c582b7e3Smrg * Software is furnished to do so, subject to the following conditions:
14c582b7e3Smrg *
15c582b7e3Smrg * The above copyright notice and this permission notice (including the next
16c582b7e3Smrg * paragraph) shall be included in all copies or substantial portions of the
17c582b7e3Smrg * Software.
18c582b7e3Smrg *
19c582b7e3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20c582b7e3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21c582b7e3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22c582b7e3Smrg * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23c582b7e3Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24c582b7e3Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25c582b7e3Smrg * DEALINGS IN THE SOFTWARE.
26c582b7e3Smrg *
27c582b7e3Smrg * Author:
28c582b7e3Smrg *   Gareth Hughes <gareth@valinux.com>
29c582b7e3Smrg *   Kevin E. Martin <martin@valinux.com>
30c582b7e3Smrg *
31c582b7e3Smrg * Converted to common header format:
32c582b7e3Smrg *   Jens Owen <jens@tungstengraphics.com>
33c582b7e3Smrg *
34c582b7e3Smrg */
35c582b7e3Smrg
36c582b7e3Smrg#ifndef _R128_COMMON_H_
37c582b7e3Smrg#define _R128_COMMON_H_
38c582b7e3Smrg
39c582b7e3Smrg#include <X11/Xmd.h>
40c582b7e3Smrg
41c582b7e3Smrg/*
42c582b7e3Smrg * WARNING: If you change any of these defines, make sure to change
43c582b7e3Smrg * the kernel include file as well (r128_drm.h)
44c582b7e3Smrg */
45c582b7e3Smrg
46c582b7e3Smrg/* Driver specific DRM command indices
47c582b7e3Smrg * NOTE: these are not OS specific, but they are driver specific
48c582b7e3Smrg */
49c582b7e3Smrg#define DRM_R128_INIT           0x00
50c582b7e3Smrg#define DRM_R128_CCE_START      0x01
51c582b7e3Smrg#define DRM_R128_CCE_STOP       0x02
52c582b7e3Smrg#define DRM_R128_CCE_RESET      0x03
53c582b7e3Smrg#define DRM_R128_CCE_IDLE       0x04
54c582b7e3Smrg#define DRM_R128_UNDEFINED1     0x05
55c582b7e3Smrg#define DRM_R128_RESET          0x06
56c582b7e3Smrg#define DRM_R128_SWAP           0x07
57c582b7e3Smrg#define DRM_R128_CLEAR          0x08
58c582b7e3Smrg#define DRM_R128_VERTEX         0x09
59c582b7e3Smrg#define DRM_R128_INDICES        0x0a
60c582b7e3Smrg#define DRM_R128_BLIT           0x0b
61c582b7e3Smrg#define DRM_R128_DEPTH          0x0c
62c582b7e3Smrg#define DRM_R128_STIPPLE        0x0d
63c582b7e3Smrg#define DRM_R128_UNDEFINED2     0x0e
64c582b7e3Smrg#define DRM_R128_INDIRECT       0x0f
65c582b7e3Smrg#define DRM_R128_FULLSCREEN     0x10
66c582b7e3Smrg#define DRM_R128_CLEAR2         0x11
67c582b7e3Smrg#define DRM_R128_GETPARAM       0x12
68c582b7e3Smrg#define DRM_R128_FLIP           0x13
69c582b7e3Smrg
70c582b7e3Smrg#define DRM_R128_FRONT_BUFFER	0x1
71c582b7e3Smrg#define DRM_R128_BACK_BUFFER	0x2
72c582b7e3Smrg#define DRM_R128_DEPTH_BUFFER	0x4
73c582b7e3Smrg
74c582b7e3Smrgtypedef struct {
75c582b7e3Smrg   enum {
76c582b7e3Smrg      DRM_R128_INIT_CCE    = 0x01,
77c582b7e3Smrg      DRM_R128_CLEANUP_CCE = 0x02
78c582b7e3Smrg   } func;
79c582b7e3Smrg   unsigned long sarea_priv_offset;
80c582b7e3Smrg   int is_pci;
81c582b7e3Smrg   int cce_mode;
82c582b7e3Smrg   int cce_secure;		/* FIXME: Deprecated, we should remove this */
83c582b7e3Smrg   int ring_size;
84c582b7e3Smrg   int usec_timeout;
85c582b7e3Smrg
86c582b7e3Smrg   unsigned int fb_bpp;
87c582b7e3Smrg   unsigned int front_offset, front_pitch;
88c582b7e3Smrg   unsigned int back_offset, back_pitch;
89c582b7e3Smrg   unsigned int depth_bpp;
90c582b7e3Smrg   unsigned int depth_offset, depth_pitch;
91c582b7e3Smrg   unsigned int span_offset;
92c582b7e3Smrg
93c582b7e3Smrg   unsigned long fb_offset;
94c582b7e3Smrg   unsigned long mmio_offset;
95c582b7e3Smrg   unsigned long ring_offset;
96c582b7e3Smrg   unsigned long ring_rptr_offset;
97c582b7e3Smrg   unsigned long buffers_offset;
98c582b7e3Smrg   unsigned long agp_textures_offset;
99c582b7e3Smrg} drmR128Init;
100c582b7e3Smrg
101c582b7e3Smrgtypedef struct {
102c582b7e3Smrg   int flush;
103c582b7e3Smrg   int idle;
104c582b7e3Smrg} drmR128CCEStop;
105c582b7e3Smrg
106c582b7e3Smrgtypedef struct {
107c582b7e3Smrg   int idx;
108c582b7e3Smrg   int start;
109c582b7e3Smrg   int end;
110c582b7e3Smrg   int discard;
111c582b7e3Smrg} drmR128Indirect;
112c582b7e3Smrg
113c582b7e3Smrgtypedef struct {
114c582b7e3Smrg   int idx;
115c582b7e3Smrg   int pitch;
116c582b7e3Smrg   int offset;
117c582b7e3Smrg   int format;
118c582b7e3Smrg   unsigned short x, y;
119c582b7e3Smrg   unsigned short width, height;
120c582b7e3Smrg} drmR128Blit;
121c582b7e3Smrg
122c582b7e3Smrgtypedef struct {
123c582b7e3Smrg   enum {
124c582b7e3Smrg      DRM_R128_WRITE_SPAN         = 0x01,
125c582b7e3Smrg      DRM_R128_WRITE_PIXELS       = 0x02,
126c582b7e3Smrg      DRM_R128_READ_SPAN          = 0x03,
127c582b7e3Smrg      DRM_R128_READ_PIXELS        = 0x04
128c582b7e3Smrg   } func;
129c582b7e3Smrg   int n;
130c582b7e3Smrg   int *x;
131c582b7e3Smrg   int *y;
132c582b7e3Smrg   unsigned int *buffer;
133c582b7e3Smrg   unsigned char *mask;
134c582b7e3Smrg} drmR128Depth;
135c582b7e3Smrg
136c582b7e3Smrgtypedef struct {
137c582b7e3Smrg   int prim;
138c582b7e3Smrg   int idx;                        /* Index of vertex buffer */
139c582b7e3Smrg   int count;                      /* Number of vertices in buffer */
140c582b7e3Smrg   int discard;                    /* Client finished with buffer? */
141c582b7e3Smrg} drmR128Vertex;
142c582b7e3Smrg
143c582b7e3Smrgtypedef struct {
144c582b7e3Smrg   unsigned int *mask;
145c582b7e3Smrg} drmR128Stipple;
146c582b7e3Smrg
147c582b7e3Smrgtypedef struct {
148c582b7e3Smrg   unsigned int flags;
149c582b7e3Smrg   unsigned int clear_color;
150c582b7e3Smrg   unsigned int clear_depth;
151c582b7e3Smrg   unsigned int color_mask;
152c582b7e3Smrg   unsigned int depth_mask;
153c582b7e3Smrg} drmR128Clear;
154c582b7e3Smrg
155c582b7e3Smrgtypedef struct {
156c582b7e3Smrg   enum {
157c582b7e3Smrg      DRM_R128_INIT_FULLSCREEN    = 0x01,
158c582b7e3Smrg      DRM_R128_CLEANUP_FULLSCREEN = 0x02
159c582b7e3Smrg   } func;
160c582b7e3Smrg} drmR128Fullscreen;
161c582b7e3Smrg
162c582b7e3Smrgtypedef struct drm_r128_getparam {
163c582b7e3Smrg	int param;
164c582b7e3Smrg	int *value;
165c582b7e3Smrg} drmR128GetParam;
166c582b7e3Smrg
167c582b7e3Smrg#define R128_PARAM_IRQ_NR            1
168c582b7e3Smrg
169c582b7e3Smrg#endif
170