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