1/*
2 * SiS DRI wrapper
3 *
4 * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
5 *
6 * Licensed under the following terms:
7 *
8 * Permission to use, copy, modify, distribute, and sell this software and its
9 * documentation for any purpose is hereby granted without fee, provided that
10 * the above copyright notice appears in all copies and that both that copyright
11 * notice and this permission notice appear in supporting documentation, and
12 * and that the name of the copyright holder not be used in advertising
13 * or publicity pertaining to distribution of the software without specific,
14 * written prior permission. The copyright holder makes no representations
15 * about the suitability of this software for any purpose.  It is provided
16 * "as is" without expressed or implied warranty.
17 *
18 * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
19 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
20 * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
21 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
22 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
23 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
24 * PERFORMANCE OF THIS SOFTWARE.
25 *
26 * Authors: 	Can-Ru Yeou, SiS Inc.,
27 *		Thomas Winischhofer <thomas@winischhofer.net>,
28 *		others.
29 *
30 * Previously taken and modified from tdfx_dri.h
31 */
32
33#ifndef _SIS_DRI_H_
34#define _SIS_DRI_H_
35
36#include "xf86drm.h"
37
38/* Hack: When the types were changed, the typedefs
39 * went into drm.h. This file did not exist earlier.
40 */
41#ifndef _DRM_H_
42#define drm_handle_t drmHandle
43#define drm_context_t drmContext
44#endif
45
46#define SIS_MAX_DRAWABLES 256
47#define SISIOMAPSIZE (64*1024)
48
49typedef struct {
50  int CtxOwner;
51  int QueueLength;		/* (300: current, 315/etc: total) length of command queue */
52  unsigned int AGPCmdBufNext;   /* (rename to AGPVtxBufNext) */
53  unsigned int FrameCount;
54#ifdef SIS315DRI
55  unsigned int  sharedWPoffset;	/* Offset to current queue position (shared with 2D) */
56  unsigned int  cmdQueueOffset;	/* Offset of start of command queue in VRAM */
57#endif
58} SISSAREAPriv, *SISSAREAPrivPtr;
59
60#define AGPVtxBufNext AGPCmdBufNext
61
62#define SIS_FRONT 0
63#define SIS_BACK 1
64#define SIS_DEPTH 2
65
66typedef struct {
67  drm_handle_t handle;
68  drmSize size;
69#ifndef SISISXORG6899900
70  drmAddress map;
71#endif
72} sisRegion, *sisRegionPtr;
73
74typedef struct {
75  sisRegion regs;			/* MMIO registers */
76  sisRegion agp;			/* AGP public area */
77  int deviceID;				/* = pSiS->Chipset (PCI ID) */
78  int width;				/* = pScrn->virtualX */
79  int height;				/* = pScrn->virtualY */
80  int mem;				/* total video RAM; seems unused */
81  int bytesPerPixel;			/* Screen's bpp/8 */
82  int priv1;				/* unused */
83  int priv2;				/* unused */
84  int fbOffset;				/* Front buffer; set up, but unused by DRI driver*/
85  int backOffset;			/* unused (handled by the DRI driver) */
86  int depthOffset;			/* unused (handled by the DRI driver) */
87  int textureOffset;			/* unused (handled by the DRI driver) */
88  int textureSize;			/* unused (handled by the DRI driver) */
89  unsigned int AGPCmdBufOffset;		/* (rename to AGPVtxBufOffset) */
90  unsigned int AGPCmdBufSize;		/* (rename to AGPVtxBufSize)   */
91  int irqEnabled;
92  unsigned int scrnX;			/* TODO: = width = pScrn->virtualX */
93  unsigned int scrnY;			/* TODO: = height = pScrn->virtualY */
94#ifdef SIS315DRI
95  unsigned char *AGPCmdBufBase;
96  unsigned long AGPCmdBufAddr;
97  unsigned long AGPCmdBufOffset2;	/* (rename to AGPCmdBufOffset) */
98  unsigned int  AGPCmdBufSize2;		/* (rename to AGPCmdBufSize)   */
99  int deviceRev;			/* Chip revision */
100#endif
101} SISDRIRec, *SISDRIPtr;
102
103#define AGPVtxBufOffset AGPCmdBufOffset
104#define AGPVtxBufSize AGPCmdBufSize
105
106typedef struct {
107  /* Nothing here yet */
108  int dummy;
109} SISDRIContextRec, *SISDRIContextPtr;
110
111#include "screenint.h"
112
113Bool SISDRIScreenInit(ScreenPtr pScreen);
114void SISDRICloseScreen(ScreenPtr pScreen);
115Bool SISDRIFinishScreenInit(ScreenPtr pScreen);
116
117#endif
118