From e508f7f08e6fa4292136a377150fc058c041fbc0 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Tue, 30 Sep 2003 11:28:16 +0000 Subject: add gamma driver - no kernel driver yet (build tested, not physically tested) --- src/mesa/drivers/dri/gamma/server/glint_common.h | 64 ++++++++++++ src/mesa/drivers/dri/gamma/server/glint_dri.h | 123 +++++++++++++++++++++++ 2 files changed, 187 insertions(+) create mode 100644 src/mesa/drivers/dri/gamma/server/glint_common.h create mode 100644 src/mesa/drivers/dri/gamma/server/glint_dri.h (limited to 'src/mesa/drivers/dri/gamma/server') diff --git a/src/mesa/drivers/dri/gamma/server/glint_common.h b/src/mesa/drivers/dri/gamma/server/glint_common.h new file mode 100644 index 0000000000..ec601f942d --- /dev/null +++ b/src/mesa/drivers/dri/gamma/server/glint_common.h @@ -0,0 +1,64 @@ +/* glint_common.h -- common header definitions for Gamma 2D/3D/DRM suite + * + * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Converted to common header format: + * Jens Owen + * + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_common.h,v 1.2 2003/04/03 16:52:18 dawes Exp $ + * + */ + +#ifndef _GLINT_COMMON_H_ +#define _GLINT_COMMON_H_ + +/* + * WARNING: If you change any of these defines, make sure to change + * the kernel include file as well (gamma_drm.h) + */ + +/* Driver specific DRM command indices + * NOTE: these are not OS specific, but they are driver specific + */ +#define DRM_GAMMA_INIT 0x00 +#define DRM_GAMMA_COPY 0x01 + +typedef struct { + enum { + GAMMA_INIT_DMA = 0x01, + GAMMA_CLEANUP_DMA = 0x02 + } func; + int sarea_priv_offset; + int pcimode; + unsigned int mmio0; + unsigned int mmio1; + unsigned int mmio2; + unsigned int mmio3; + unsigned int buffers_offset; + int num_rast; +} drmGAMMAInit; + +extern int drmGAMMAInitDMA( int fd, drmGAMMAInit *info ); +extern int drmGAMMACleanupDMA( int fd ); + +#endif diff --git a/src/mesa/drivers/dri/gamma/server/glint_dri.h b/src/mesa/drivers/dri/gamma/server/glint_dri.h new file mode 100644 index 0000000000..3952759f83 --- /dev/null +++ b/src/mesa/drivers/dri/gamma/server/glint_dri.h @@ -0,0 +1,123 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h,v 1.7 2002/10/30 12:52:16 alanh Exp $ */ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +/* + * Author: + * Jens Owen + * + */ + +#ifndef _GLINT_DRI_H_ +#define _GLINT_DRI_H_ + +#include "xf86drm.h" +#include "glint_common.h" + +typedef struct { + unsigned int GDeltaMode; + unsigned int GDepthMode; + unsigned int GGeometryMode; + unsigned int GTransformMode; +} GAMMAContextRegionRec, *GAMMAContextRegionPtr; + +typedef struct { + unsigned char next, prev; /* indices to form a circular LRU */ + unsigned char in_use; /* owned by a client, or free? */ + int age; /* tracked by clients to update local LRU's */ +} GAMMATextureRegionRec, *GAMMATextureRegionPtr; + +typedef struct { + GAMMAContextRegionRec context_state; + + unsigned int dirty; + + /* Maintain an LRU of contiguous regions of texture space. If + * you think you own a region of texture memory, and it has an + * age different to the one you set, then you are mistaken and + * it has been stolen by another client. If global texAge + * hasn't changed, there is no need to walk the list. + * + * These regions can be used as a proxy for the fine-grained + * texture information of other clients - by maintaining them + * in the same lru which is used to age their own textures, + * clients have an approximate lru for the whole of global + * texture space, and can make informed decisions as to which + * areas to kick out. There is no need to choose whether to + * kick out your own texture or someone else's - simply eject + * them all in LRU order. + */ + +#define GAMMA_NR_TEX_REGIONS 64 + GAMMATextureRegionRec texList[GAMMA_NR_TEX_REGIONS+1]; + /* Last elt is sentinal */ + int texAge; /* last time texture was uploaded */ + int last_enqueue; /* last time a buffer was enqueued */ + int last_dispatch; /* age of the most recently dispatched buffer */ + int last_quiescent; /* */ + int ctxOwner; /* last context to upload state */ + + int vertex_prim; +} GLINTSAREADRIRec, *GLINTSAREADRIPtr; + +/* + * Glint specific record passed back to client driver + * via DRIGetDeviceInfo request + */ +typedef struct { + drmRegion registers0; + drmRegion registers1; + drmRegion registers2; + drmRegion registers3; + int numMultiDevices; + int pprod; + int cpp; + int frontOffset; + int frontPitch; + int backOffset; + int backPitch; + int backX; + int backY; + int depthOffset; + int depthPitch; + int textureSize; + int logTextureGranularity; +} GLINTDRIRec, *GLINTDRIPtr; + +#define GLINT_DRI_BUF_COUNT 256 +#define GLINT_DRI_BUF_SIZE 4096 + +#define GAMMA_NR_TEX_REGIONS 64 + +#define DMA_WRITE(val,reg) \ +do { \ + pGlint->buf2D++ = Glint##reg##Tag; \ + pGlint->buf2D++ = val; \ +} while (0) + +#endif /* _GLINT_DRI_H_ */ -- cgit v1.2.3