summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/glide/fxglidew.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/glide/fxglidew.c')
-rw-r--r--src/mesa/drivers/glide/fxglidew.c230
1 files changed, 189 insertions, 41 deletions
diff --git a/src/mesa/drivers/glide/fxglidew.c b/src/mesa/drivers/glide/fxglidew.c
index 3dd52d504bd..696b8eff6c7 100644
--- a/src/mesa/drivers/glide/fxglidew.c
+++ b/src/mesa/drivers/glide/fxglidew.c
@@ -1,28 +1,47 @@
-/* $Id: fxglidew.c,v 1.3 1999/10/05 19:26:54 miklos Exp $ */
+/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
/*
* Mesa 3-D graphics library
* Version: 3.1
- *
+ *
* Copyright (C) 1999 Brian Paul 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 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
* BRIAN PAUL 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.
+ *
+ *
+ * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
+ * terms stated above.
+ *
+ * Thank you for your contribution, David!
+ *
+ * Please make note of the above copyright/license statement. If you
+ * contributed code or bug fixes to this code under the previous (GNU
+ * Library) license and object to the new license, your code will be
+ * removed at your request. Please see the Mesa docs/COPYRIGHT file
+ * for more information.
+ *
+ * Additional Mesa/3Dfx driver developers:
+ * Daryll Strauss <[email protected]>
+ * Keith Whitwell <[email protected]>
+ *
+ * See fxapi.h for more revision/author details.
*/
+
#ifdef HAVE_CONFIG_H
#include "conf.h"
@@ -36,8 +55,7 @@
#include <stdlib.h>
#include <string.h>
-
-FxI32 FX_grGetInteger(FxU32 pname)
+FxI32 grGetInteger(FxU32 pname)
{
#if !defined(FX_GLIDE3)
switch (pname)
@@ -49,7 +67,7 @@ FxI32 FX_grGetInteger(FxU32 pname)
case FX_LFB_PIXEL_PIPE:
return FXFALSE;
case FX_PENDING_BUFFERSWAPS:
- return grBufferNumPending();
+ return grBufferNumPending();
default:
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n");
@@ -74,13 +92,60 @@ FxI32 FX_grGetInteger(FxU32 pname)
}
return -1;
}
-
+
grGet(grname,4,&result);
return result;
#endif
}
+FxI32 FX_grGetInteger(FxU32 pname)
+{
+ int result;
+
+ BEGIN_BOARD_LOCK();
+ result=grGetInteger(pname);
+ END_BOARD_LOCK();
+ return result;
+}
+
+
+FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer,
+ GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,
+ FxBool pixelPipeline, GrLfbInfo_t *info ) {
+ FxBool result;
+
+ BEGIN_BOARD_LOCK();
+ result=grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info);
+ END_BOARD_LOCK();
+ return result;
+}
+
+FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info) {
+ FxU32 result;
+
+ BEGIN_BOARD_LOCK();
+ result=grTexTextureMemRequired(evenOdd, info);
+ END_BOARD_LOCK();
+ return result;
+}
+FxU32 FX_grTexMinAddress(GrChipID_t tmu) {
+ FxU32 result;
+
+ BEGIN_BOARD_LOCK();
+ result=grTexMinAddress(tmu);
+ END_BOARD_LOCK();
+ return result;
+}
+
+extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu) {
+ FxU32 result;
+
+ BEGIN_BOARD_LOCK();
+ result=grTexMaxAddress(tmu);
+ END_BOARD_LOCK();
+ return result;
+}
#if defined(FX_GLIDE3)
@@ -98,31 +163,30 @@ void FX_grSstControl(int par)
int FX_getFogTableSize(void)
{
int result;
+ BEGIN_BOARD_LOCK();
grGet(GR_FOG_TABLE_ENTRIES,sizeof(int),(void*)&result);
+ END_BOARD_LOCK();
return result;
}
int FX_getGrStateSize(void)
{
int result;
+ BEGIN_BOARD_LOCK();
grGet(GR_GLIDE_STATE_SIZE,sizeof(int),(void*)&result);
-
+ END_BOARD_LOCK();
+
return result;
}
-int FX_grBufferNumPending()
-{
- int result;
- grGet(GR_PENDING_BUFFERSWAPS,sizeof(int),(void*)&result);
-
- return result;
-}
int FX_grSstScreenWidth()
{
FxI32 result[4];
-
+
+ BEGIN_BOARD_LOCK();
grGet(GR_VIEWPORT,sizeof(FxI32)*4,result);
+ END_BOARD_LOCK();
return result[2];
}
@@ -130,15 +194,19 @@ int FX_grSstScreenWidth()
int FX_grSstScreenHeight()
{
FxI32 result[4];
-
+
+ BEGIN_BOARD_LOCK();
grGet(GR_VIEWPORT,sizeof(FxI32)*4,result);
+ END_BOARD_LOCK();
return result[3];
}
void FX_grGlideGetVersion(char *buf)
{
- strcpy(buf,grGetString(GR_VERSION));
+ BEGIN_BOARD_LOCK();
+ strcpy(buf,grGetString(GR_VERSION));
+ END_BOARD_LOCK();
}
void FX_grSstPerfStats(GrSstPerfStats_t *st)
@@ -154,11 +222,16 @@ void FX_grSstPerfStats(GrSstPerfStats_t *st)
void FX_grAADrawLine(GrVertex *a,GrVertex *b)
{
/* ToDo */
+ BEGIN_CLIP_LOOP();
grDrawLine(a,b);
+ END_CLIP_LOOP();
}
+
void FX_grAADrawPoint(GrVertex *a)
{
+ BEGIN_CLIP_LOOP();
grDrawPoint(a);
+ END_CLIP_LOOP();
}
#if FX_USE_PARGB
@@ -195,33 +268,42 @@ void FX_setupGrVertexLayout(void)
}
#endif
-void FX_grHints(GrHint_t hintType, FxU32 hintMask)
+void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask)
{
- switch(hintType) {
- case GR_HINT_STWHINT:
- {
- if (hintMask & GR_STWHINT_W_DIFF_TMU0)
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
- else
- grVertexLayout(GR_PARAM_Q0,GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
-
- if (hintMask & GR_STWHINT_ST_DIFF_TMU1)
- grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
- else
- grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ switch(hintType) {
+ case GR_HINT_STWHINT:
+ {
+ if (hintMask & GR_STWHINT_W_DIFF_TMU0)
+ grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
+ else
+ grVertexLayout(GR_PARAM_Q0,GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
+
+ if (hintMask & GR_STWHINT_ST_DIFF_TMU1)
+ grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
+ else
+ grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
- if (hintMask & GR_STWHINT_W_DIFF_TMU1)
- grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
- else
- grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
-
- }
- }
+ if (hintMask & GR_STWHINT_W_DIFF_TMU1)
+ grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
+ else
+ grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+
+ }
+ }
+}
+
+void FX_grHints(GrHint_t hintType, FxU32 hintMask) {
+ BEGIN_BOARD_LOCK();
+ FX_grHints_NoLock(hintType, hintMask);
+ END_BOARD_LOCK();
}
+
int FX_grSstQueryHardware(GrHwConfiguration *config)
{
int i,j;
int numFB;
+
+ BEGIN_BOARD_LOCK();
grGet(GR_NUM_BOARDS,4,(void*)&(config->num_sst));
if (config->num_sst == 0)
return 0;
@@ -246,11 +328,77 @@ int FX_grSstQueryHardware(GrHwConfiguration *config)
config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam /= 1024*1024;
}
}
+ END_BOARD_LOCK();
return 1;
}
-#endif
+FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
+ GrScreenResolution_t screen_resolution,
+ GrScreenRefresh_t refresh_rate,
+ GrColorFormat_t color_format,
+ GrOriginLocation_t origin_location,
+ int nColBuffers,
+ int nAuxBuffers)
+{
+ FX_GrContext_t i;
+ BEGIN_BOARD_LOCK();
+ i = grSstWinOpen( hWnd,
+ screen_resolution,
+ refresh_rate,
+ color_format,
+ origin_location,
+ nColBuffers,
+ nAuxBuffers );
+
+ fprintf(stderr,
+ "grSstWinOpen( win %d res %d ref %d fmt %d\n"
+ " org %d ncol %d naux %d )\n"
+ " ==> %d\n",
+ hWnd,
+ screen_resolution,
+ refresh_rate,
+ color_format,
+ origin_location,
+ nColBuffers,
+ nAuxBuffers,
+ i);
+ END_BOARD_LOCK();
+ return i;
+}
+
+#else /* FX_GLIDE3 */
+
+int FX_grSstScreenWidth()
+{
+ return grSstScreenWidth();
+}
+
+int FX_grSstScreenHeight()
+{
+ return grSstScreenHeight();
+}
+
+int FX_grSstQueryHardware(GrHwConfiguration *config)
+{
+ return grSstQueryHardware(config);
+}
+
+FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
+ GrScreenResolution_t screen_resolution,
+ GrScreenRefresh_t refresh_rate,
+ GrColorFormat_t color_format,
+ GrOriginLocation_t origin_location,
+ int nColBuffers,
+ int nAuxBuffers)
+{
+ return grSstWinOpen(hWnd, screen_resolution, refresh_rate,
+ color_format, origin_location, nColBuffers, nAuxBuffers);
+}
+
+
+#endif /* FX_GLIDE3 */
+
#else
/*