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