diff options
Diffstat (limited to 'xc/lib/GL/mesa/src/drv/r128/r128_screen.c')
-rw-r--r-- | xc/lib/GL/mesa/src/drv/r128/r128_screen.c | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_screen.c b/xc/lib/GL/mesa/src/drv/r128/r128_screen.c new file mode 100644 index 000000000..32e72e97d --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/r128/r128_screen.c @@ -0,0 +1,160 @@ +/* $XFree86$ */ +/************************************************************************** + +Copyright 1999, 2000 ATI Technologies Inc. and 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 +on 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 +ATI, PRECISION INSIGHT AND/OR THEIR 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. + +**************************************************************************/ + +/* + * Authors: + * Kevin E. Martin <kevin@precisioninsight.com> + * + */ + +#include "r128_dri.h" +#include "r128_reg.h" + +#include "r128_init.h" +#include "r128_context.h" +#include "r128_xmesa.h" +#include "r128_tris.h" +#include "r128_vb.h" +#include "r128_fastpath.h" + +/* Create the device specific screen private data struct */ +r128ScreenPtr r128CreateScreen(__DRIscreenPrivate *sPriv) +{ + r128ScreenPtr r128Screen; + R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv; + + /* Allocate the private area */ + r128Screen = (r128ScreenPtr)Xmalloc(sizeof(*r128Screen)); + if (!r128Screen) return NULL; + + r128Screen->mmioRgn.handle = r128DRIPriv->registerHandle; + r128Screen->mmioRgn.size = r128DRIPriv->registerSize; + if (drmMap(sPriv->fd, + r128Screen->mmioRgn.handle, + r128Screen->mmioRgn.size, + (drmAddressPtr)&r128Screen->mmio)) { + Xfree(r128Screen); + return NULL; + } + + r128Screen->agpRgn.handle = r128DRIPriv->agpHandle; + r128Screen->agpRgn.size = r128DRIPriv->agpSize; + if (drmMap(sPriv->fd, + r128Screen->agpRgn.handle, + r128Screen->agpRgn.size, + (drmAddressPtr)&r128Screen->agp)) { + drmUnmap((drmAddress)r128Screen->mmio, r128Screen->mmioRgn.size); + Xfree(r128Screen); + return NULL; + } + + r128Screen->deviceID = r128DRIPriv->deviceID; + + r128Screen->width = r128DRIPriv->width; + r128Screen->height = r128DRIPriv->height; + r128Screen->depth = r128DRIPriv->depth; + r128Screen->bpp = r128DRIPriv->bpp; + + r128Screen->fb = sPriv->pFB; + r128Screen->fbOffset = sPriv->fbOrigin; + r128Screen->fbStride = sPriv->fbStride; + r128Screen->fbSize = sPriv->fbSize; + + r128Screen->fbX = r128DRIPriv->fbX; + r128Screen->fbY = r128DRIPriv->fbY; + r128Screen->backX = r128DRIPriv->backX; + r128Screen->backY = r128DRIPriv->backY; + r128Screen->depthX = r128DRIPriv->depthX; + r128Screen->depthY = r128DRIPriv->depthY; + r128Screen->textureX = r128DRIPriv->textureX; + r128Screen->textureY = r128DRIPriv->textureY; + r128Screen->textureSize = r128DRIPriv->textureSize; + r128Screen->log2TexGran = r128DRIPriv->log2TexGran; + +#if 0 + /* FIXME: For testing only */ + r128Screen->textureX = 0; + r128Screen->textureY = 8192; + r128Screen->textureSize = 4*1024*1024; + r128Screen->log2TexGran = 15; +#endif + +#if 1 + /* FIXME: For testing only */ + if (getenv("LIBGL_SHOW_BUFFERS")) { + r128Screen->backX = 0; + r128Screen->backY = r128DRIPriv->height/2; + r128Screen->depthX = r128DRIPriv->width/2; + r128Screen->depthY = r128DRIPriv->height/2; + } +#endif + + r128Screen->CCEMode = r128DRIPriv->CCEMode; + r128Screen->CCEFifoSize = r128DRIPriv->CCEFifoSize; + + r128Screen->ringStart = r128DRIPriv->ringStart; + r128Screen->ringSize = r128DRIPriv->ringSize; + r128Screen->ringWritePtr = &r128DRIPriv->ringWrite; + r128Screen->ringReadPtr = (int *)(r128Screen->agp + + r128DRIPriv->ringReadOffset); + + r128Screen->vbStart = r128DRIPriv->vbStart; + r128Screen->vbSize = r128DRIPriv->vbSize; + + r128Screen->indStart = r128DRIPriv->indStart; + r128Screen->indSize = r128DRIPriv->indSize; + + r128Screen->agpTexStart = r128DRIPriv->agpTexStart; + r128Screen->agpTexSize = r128DRIPriv->agpTexSize; + r128Screen->log2AGPTexGran = r128DRIPriv->log2AGPTexGran; + + r128Screen->MMIOFifoSlots = 0; + r128Screen->CCEFifoSlots = 0; + + r128Screen->CCEFifoAddr = R128_PM4_FIFO_DATA_EVEN; + + r128Screen->driScreen = sPriv; + + r128FastPathInit(); + r128TriangleFuncsInit(); + r128SetupInit(); + + return r128Screen; +} + +/* Destroy the device specific screen private data struct */ +void r128DestroyScreen(__DRIscreenPrivate *sPriv) +{ + r128ScreenPtr r128Screen = (r128ScreenPtr)sPriv->private; + + drmUnmap((drmAddress)r128Screen->mmio, r128Screen->mmioRgn.size); + drmUnmap((drmAddress)r128Screen->agp, r128Screen->agpRgn.size); + + Xfree(r128Screen); + sPriv->private = NULL; +} |