sis_dri.h revision 72b676d7
172b676d7Smrg/* $XFree86$ */
272b676d7Smrg/* $XdotOrg$ */
372b676d7Smrg/*
472b676d7Smrg * SiS DRI wrapper
572b676d7Smrg *
672b676d7Smrg * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
772b676d7Smrg *
872b676d7Smrg * Licensed under the following terms:
972b676d7Smrg *
1072b676d7Smrg * Permission to use, copy, modify, distribute, and sell this software and its
1172b676d7Smrg * documentation for any purpose is hereby granted without fee, provided that
1272b676d7Smrg * the above copyright notice appears in all copies and that both that copyright
1372b676d7Smrg * notice and this permission notice appear in supporting documentation, and
1472b676d7Smrg * and that the name of the copyright holder not be used in advertising
1572b676d7Smrg * or publicity pertaining to distribution of the software without specific,
1672b676d7Smrg * written prior permission. The copyright holder makes no representations
1772b676d7Smrg * about the suitability of this software for any purpose.  It is provided
1872b676d7Smrg * "as is" without expressed or implied warranty.
1972b676d7Smrg *
2072b676d7Smrg * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
2172b676d7Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
2272b676d7Smrg * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
2372b676d7Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
2472b676d7Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
2572b676d7Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2672b676d7Smrg * PERFORMANCE OF THIS SOFTWARE.
2772b676d7Smrg *
2872b676d7Smrg * Authors: 	Can-Ru Yeou, SiS Inc.,
2972b676d7Smrg *		Thomas Winischhofer <thomas@winischhofer.net>,
3072b676d7Smrg *		others.
3172b676d7Smrg *
3272b676d7Smrg * Previously taken and modified from tdfx_dri.h
3372b676d7Smrg */
3472b676d7Smrg
3572b676d7Smrg#ifndef _SIS_DRI_H_
3672b676d7Smrg#define _SIS_DRI_H_
3772b676d7Smrg
3872b676d7Smrg#include "xf86drm.h"
3972b676d7Smrg
4072b676d7Smrg/* Hack: When the types were changed, the typedefs
4172b676d7Smrg * went into drm.h. This file did not exist earlier.
4272b676d7Smrg */
4372b676d7Smrg#ifndef _DRM_H_
4472b676d7Smrg#define drm_handle_t drmHandle
4572b676d7Smrg#define drm_context_t drmContext
4672b676d7Smrg#endif
4772b676d7Smrg
4872b676d7Smrg#define SIS_MAX_DRAWABLES 256
4972b676d7Smrg#define SISIOMAPSIZE (64*1024)
5072b676d7Smrg
5172b676d7Smrgtypedef struct {
5272b676d7Smrg  int CtxOwner;
5372b676d7Smrg  int QueueLength;		/* (300: current, 315/etc: total) length of command queue */
5472b676d7Smrg  unsigned int AGPCmdBufNext;   /* (rename to AGPVtxBufNext) */
5572b676d7Smrg  unsigned int FrameCount;
5672b676d7Smrg#ifdef SIS315DRI
5772b676d7Smrg  unsigned int  sharedWPoffset;	/* Offset to current queue position (shared with 2D) */
5872b676d7Smrg  unsigned int  cmdQueueOffset;	/* Offset of start of command queue in VRAM */
5972b676d7Smrg#endif
6072b676d7Smrg} SISSAREAPriv, *SISSAREAPrivPtr;
6172b676d7Smrg
6272b676d7Smrg#define AGPVtxBufNext AGPCmdBufNext
6372b676d7Smrg
6472b676d7Smrg#define SIS_FRONT 0
6572b676d7Smrg#define SIS_BACK 1
6672b676d7Smrg#define SIS_DEPTH 2
6772b676d7Smrg
6872b676d7Smrgtypedef struct {
6972b676d7Smrg  drm_handle_t handle;
7072b676d7Smrg  drmSize size;
7172b676d7Smrg#ifndef SISISXORG6899900
7272b676d7Smrg  drmAddress map;
7372b676d7Smrg#endif
7472b676d7Smrg} sisRegion, *sisRegionPtr;
7572b676d7Smrg
7672b676d7Smrgtypedef struct {
7772b676d7Smrg  sisRegion regs;			/* MMIO registers */
7872b676d7Smrg  sisRegion agp;			/* AGP public area */
7972b676d7Smrg  int deviceID;				/* = pSiS->Chipset (PCI ID) */
8072b676d7Smrg  int width;				/* = pScrn->virtualX */
8172b676d7Smrg  int height;				/* = pScrn->virtualY */
8272b676d7Smrg  int mem;				/* total video RAM; seems unused */
8372b676d7Smrg  int bytesPerPixel;			/* Screen's bpp/8 */
8472b676d7Smrg  int priv1;				/* unused */
8572b676d7Smrg  int priv2;				/* unused */
8672b676d7Smrg  int fbOffset;				/* Front buffer; set up, but unused by DRI driver*/
8772b676d7Smrg  int backOffset;			/* unused (handled by the DRI driver) */
8872b676d7Smrg  int depthOffset;			/* unused (handled by the DRI driver) */
8972b676d7Smrg  int textureOffset;			/* unused (handled by the DRI driver) */
9072b676d7Smrg  int textureSize;			/* unused (handled by the DRI driver) */
9172b676d7Smrg  unsigned int AGPCmdBufOffset;		/* (rename to AGPVtxBufOffset) */
9272b676d7Smrg  unsigned int AGPCmdBufSize;		/* (rename to AGPVtxBufSize)   */
9372b676d7Smrg  int irqEnabled;
9472b676d7Smrg  unsigned int scrnX;			/* TODO: = width = pScrn->virtualX */
9572b676d7Smrg  unsigned int scrnY;			/* TODO: = height = pScrn->virtualY */
9672b676d7Smrg#ifdef SIS315DRI
9772b676d7Smrg  unsigned char *AGPCmdBufBase;
9872b676d7Smrg  unsigned long AGPCmdBufAddr;
9972b676d7Smrg  unsigned long AGPCmdBufOffset2;	/* (rename to AGPCmdBufOffset) */
10072b676d7Smrg  unsigned int  AGPCmdBufSize2;		/* (rename to AGPCmdBufSize)   */
10172b676d7Smrg  int deviceRev;			/* Chip revision */
10272b676d7Smrg#endif
10372b676d7Smrg} SISDRIRec, *SISDRIPtr;
10472b676d7Smrg
10572b676d7Smrg#define AGPVtxBufOffset AGPCmdBufOffset
10672b676d7Smrg#define AGPVtxBufSize AGPCmdBufSize
10772b676d7Smrg
10872b676d7Smrgtypedef struct {
10972b676d7Smrg  /* Nothing here yet */
11072b676d7Smrg  int dummy;
11172b676d7Smrg} SISConfigPrivRec, *SISConfigPrivPtr;
11272b676d7Smrg
11372b676d7Smrgtypedef struct {
11472b676d7Smrg  /* Nothing here yet */
11572b676d7Smrg  int dummy;
11672b676d7Smrg} SISDRIContextRec, *SISDRIContextPtr;
11772b676d7Smrg
11872b676d7Smrg#ifdef XFree86Server
11972b676d7Smrg
12072b676d7Smrg#include "screenint.h"
12172b676d7Smrg
12272b676d7SmrgBool SISDRIScreenInit(ScreenPtr pScreen);
12372b676d7Smrgvoid SISDRICloseScreen(ScreenPtr pScreen);
12472b676d7SmrgBool SISDRIFinishScreenInit(ScreenPtr pScreen);
12572b676d7Smrg
12672b676d7Smrg#endif
12772b676d7Smrg#endif
128