1/*
2 * DRI wrapper for 300 and 315 series
3 *
4 * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
5 *
6 * Preliminary 315/330 support by Thomas Winischhofer
7 * Portions of Mesa 4/5 changes by Eric Anholt
8 *
9 * Licensed under the following terms:
10 *
11 * Permission to use, copy, modify, distribute, and sell this software and its
12 * documentation for any purpose is hereby granted without fee, provided that
13 * the above copyright notice appears in all copies and that both that copyright
14 * notice and this permission notice appear in supporting documentation, and
15 * and that the name of the copyright holder not be used in advertising
16 * or publicity pertaining to distribution of the software without specific,
17 * written prior permission. The copyright holder makes no representations
18 * about the suitability of this software for any purpose.  It is provided
19 * "as is" without expressed or implied warranty.
20 *
21 * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
22 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
23 * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
24 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
25 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
26 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27 * PERFORMANCE OF THIS SOFTWARE.
28 *
29 * Previously taken and modified from tdfx_dri.c, mga_dri.c
30 *
31 * Authors:	Can-Ru Yeou, SiS Inc.
32 *		Alan Hourihane, Wigan, England,
33 *		Thomas Winischhofer <thomas@winischhofer.net>
34 *		others.
35 */
36
37#ifndef _XGI_DRI_
38#define _XGI_DRI_
39
40#include <xf86drm.h>
41
42#define XGI_MAX_DRAWABLES 256
43#define XGIIOMAPSIZE (64*1024)
44
45typedef struct {
46  int CtxOwner;
47  int QueueLength;
48  unsigned long AGPVtxBufNext;
49  unsigned int FrameCount;
50
51  unsigned long shareWPoffset;
52  /*CARD16*/
53  /*unsigned short RelIO;*/
54
55  /* 2001/12/16 added by jjtseng for some bala reasons .... */
56  unsigned char *AGPCmdBufBase;
57  unsigned long AGPCmdBufAddr;
58  unsigned long AGPCmdBufOffset;
59  unsigned int  AGPCmdBufSize;
60  unsigned long AGPCmdBufNext;
61  /*~ 2001/12/16 added by jjtseng for some bala reasons .... */
62  /* chiawen@2005/0601 for agp heap */
63  int isAGPHeapCreated;
64} XGISAREAPriv;
65
66#define XGI_FRONT 0
67#define XGI_BACK 1
68#define XGI_DEPTH 2
69
70typedef struct {
71  drm_handle_t handle;
72  drmSize size;
73  drmAddress map;
74} xgiRegion, *xgiRegionPtr;
75
76typedef struct {
77  xgiRegion regs, agp;
78  int deviceID;
79  int revisionID;
80  int width;
81  int height;
82  int mem;
83  int bytesPerPixel;
84  int priv1;
85  int priv2;
86  int fbOffset;
87  int backOffset;
88  int depthOffset;
89  int textureOffset;
90  int textureSize;
91  unsigned int AGPVtxBufOffset;
92  unsigned int AGPVtxBufSize;
93  /* 2001/12/16 added by jjtseng for some bala reasons .... */
94  unsigned char *AGPCmdBufBase;
95  unsigned long AGPCmdBufAddr;
96  unsigned long AGPCmdBufOffset;
97  unsigned int AGPCmdBufSize;
98  unsigned long *pAGPCmdBufNext;
99  /*~ 2001/12/16 added by jjtseng for some bala reasons .... */
100  int irqEnabled;
101  unsigned int scrnX, scrnY;
102} XGIDRIRec, *XGIDRIPtr;
103
104typedef struct {
105  /* Nothing here yet */
106  int dummy;
107} XGIConfigPrivRec, *XGIConfigPrivPtr;
108
109typedef struct {
110  /* Nothing here yet */
111  int dummy;
112} XGIDRIContextRec, *XGIDRIContextPtr;
113
114Bool XGIDRIScreenInit(ScreenPtr pScreen);
115void XGIDRICloseScreen(ScreenPtr pScreen);
116Bool XGIDRIFinishScreenInit(ScreenPtr pScreen);
117
118#endif
119