patch to import Jon Smirl's work from Bitkeeper
[mesa.git] / src / mesa / drivers / dri / r128 / server / r128_dri.h
1 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.7 2002/10/30 12:52:12 alanh Exp $ */
2 /*
3 * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
4 * Precision Insight, Inc., Cedar Park, Texas, and
5 * VA Linux Systems Inc., Fremont, California.
6 *
7 * All Rights Reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining
10 * a copy of this software and associated documentation files (the
11 * "Software"), to deal in the Software without restriction, including
12 * without limitation on the rights to use, copy, modify, merge,
13 * publish, distribute, sublicense, and/or sell copies of the Software,
14 * and to permit persons to whom the Software is furnished to do so,
15 * subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice (including the
18 * next paragraph) shall be included in all copies or substantial
19 * portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
25 * SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
29 */
30
31 /*
32 * Authors:
33 * Kevin E. Martin <martin@valinux.com>
34 * Rickard E. Faith <faith@valinux.com>
35 * Gareth Hughes <gareth@valinux.com>
36 *
37 */
38
39 #ifndef _R128_DRI_
40 #define _R128_DRI_
41
42 #include "xf86drm.h"
43 #include "r128_common.h"
44
45 /* DRI Driver defaults */
46 #define R128_DEFAULT_CCE_PIO_MODE R128_PM4_64PIO_64VCBM_64INDBM
47 #define R128_DEFAULT_CCE_BM_MODE R128_PM4_64BM_64VCBM_64INDBM
48 #define R128_DEFAULT_AGP_MODE 1
49 #define R128_DEFAULT_AGP_SIZE 8 /* MB (must be a power of 2 and > 4MB) */
50 #define R128_DEFAULT_RING_SIZE 1 /* MB (must be page aligned) */
51 #define R128_DEFAULT_BUFFER_SIZE 2 /* MB (must be page aligned) */
52 #define R128_DEFAULT_AGP_TEX_SIZE 1 /* MB (must be page aligned) */
53
54 #define R128_DEFAULT_CCE_TIMEOUT 10000 /* usecs */
55
56 #define R128_AGP_MAX_MODE 4
57 #define R128_BUFFER_ALIGN 0x00000fff
58
59 #define R128_CARD_TYPE_R128 1
60 #define R128_CARD_TYPE_R128_PRO 2
61 #define R128_CARD_TYPE_R128_MOBILITY 3
62
63 #define R128CCE_USE_RING_BUFFER(m) \
64 (((m) == R128_PM4_192BM) || \
65 ((m) == R128_PM4_128BM_64INDBM) || \
66 ((m) == R128_PM4_64BM_128INDBM) || \
67 ((m) == R128_PM4_64BM_64VCBM_64INDBM))
68
69 typedef struct {
70 /* DRI screen private data */
71 int deviceID; /* PCI device ID */
72 int width; /* Width in pixels of display */
73 int height; /* Height in scanlines of display */
74 int depth; /* Depth of display (8, 15, 16, 24) */
75 int bpp; /* Bit depth of display (8, 16, 24, 32) */
76
77 int IsPCI; /* Current card is a PCI card */
78 int AGPMode;
79
80 int frontOffset; /* Start of front buffer */
81 int frontPitch;
82 int backOffset; /* Start of shared back buffer */
83 int backPitch;
84 int depthOffset; /* Start of shared depth buffer */
85 int depthPitch;
86 int spanOffset; /* Start of scratch spanline */
87 int textureOffset;/* Start of texture data in frame buffer */
88 int textureSize;
89 int log2TexGran;
90
91 /* MMIO register data */
92 drmHandle registerHandle;
93 drmSize registerSize;
94
95 /* CCE AGP Texture data */
96 drmHandle agpTexHandle;
97 drmSize agpTexMapSize;
98 int log2AGPTexGran;
99 int agpTexOffset;
100 unsigned int sarea_priv_offset;
101 } R128DRIRec, *R128DRIPtr;
102
103 #endif