1 /*
2  * Copyright 2000 VA Linux Systems Inc., Fremont, California.
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES
20  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22  * OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * Authors:
25  *   Keith Whitwell <keith@tungstengraphics.com>
26  *   Gareth Hughes <gareth@valinux.com>
27  */
28 
29 #ifndef __MGA_DRI_H__
30 #define __MGA_DRI_H__
31 
32 #include <X11/Xfuncproto.h>
33 #include "xf86drm.h"
34 
35 #define MGA_DEFAULT_AGP_MODE     1
36 #define MGA_MAX_AGP_MODE         4
37 
38 /* Buffer are aligned on 4096 byte boundaries.
39  */
40 #define MGA_BUFFER_ALIGN	0x00000fff
41 
42 typedef struct {
43    unsigned int frontOffset;
44    unsigned int frontPitch;
45 
46    unsigned int backOffset;
47    unsigned int backPitch;
48 
49    unsigned int depthOffset;
50    unsigned int depthPitch;
51 
52    unsigned int textureOffset;
53    int textureSize;
54 
55    drmRegion agp;
56 
57    /* PCI mappings */
58    drmRegion fb;
59    drmRegion registers;
60    drmRegion status;
61 
62    /* AGP mappings */
63    drmRegion warp;
64    drmRegion primary;
65    drmRegion buffers;
66    drmRegion agpTextures;
67 
68    drmBufMapPtr drmBuffers;
69 
70    int drm_version_major;
71    int drm_version_minor;
72 } MGADRIServerPrivateRec, *MGADRIServerPrivatePtr;
73 
74 /**
75  * Hardware information sent from server to client-side DRI driver.
76  *
77  * \todo
78  * Several of these fields are no longer used (and will never be used
79  * again) on the client-side.  At some point when it is safe to do so
80  * (probably for the X.org 6.9 / 7.0 release), these fields should be removed.
81  */
82 #if 1
83 typedef struct _mgaDrmRegion {
84     drm_handle_t     handle;
85     unsigned int  offset;
86     drmSize       size;
87 } mgaDrmRegion, *mgaDrmRegionPtr;
88 #else
89 #define mgaDrmRegion drmRegion
90 #endif
91 
92 typedef struct {
93    int chipset;
94    int width;
95    int height;
96    int mem _X_DEPRECATED;           /**< Unused client-side since forever. */
97    int cpp;
98 
99    int agpMode;
100 
101    unsigned int frontOffset;
102    unsigned int frontPitch;
103 
104    unsigned int backOffset;
105    unsigned int backPitch;
106 
107    unsigned int depthOffset;
108    unsigned int depthPitch;
109 
110    unsigned int textureOffset;
111    unsigned int textureSize;
112    int logTextureGranularity;    /**< Unused client-side since 2003-Aug-06 */
113 
114    unsigned int agpBufferOffset _X_DEPRECATED; /**< Unused client-side since forever. */
115 
116    unsigned int agpTextureOffset;
117    unsigned int agpTextureSize;
118    int logAgpTextureGranularity; /**< Unused client-side since 2003-Aug-06 */
119 
120    unsigned int mAccess _X_DEPRECATED; /**< Unused client-side since forever. */
121 
122    /**
123     * \name DRM memory regions.
124     */
125    /*@{*/
126    mgaDrmRegion registers;            /**< MMIO registers. */
127    mgaDrmRegion status;               /**< Unused client-side since forever. */
128    mgaDrmRegion primary;              /**< Primary DMA region. */
129    mgaDrmRegion buffers;              /**< Unused client-side since forever. */
130    /*@}*/
131 
132    unsigned int sarea_priv_offset;
133 } MGADRIRec, *MGADRIPtr;
134 
135 #endif
136