summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorFelix Kuehling <[email protected]>2005-01-21 01:39:09 +0000
committerFelix Kuehling <[email protected]>2005-01-21 01:39:09 +0000
commitfa15f6c840bcab5a37e42bca4b80668024352c98 (patch)
treef126b062ea8e9cfb4ef10daec083c7df895dab82 /src/mesa/drivers
parent677d1d07c41050e7474f44c592641b14ffd73e8c (diff)
Small cleanup:
* Remove some unused (mostly empty) functions * Added context parameter to WAIT_IDLE_EMPTY[_LOCKED] for consistency * Added debug messages to WAIT_IDLE_EMPTY[_LOCKED] * Don't flush empty command buffers
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c4
-rw-r--r--src/mesa/drivers/dri/savage/savageioctl.c43
-rw-r--r--src/mesa/drivers/dri/savage/savageioctl.h23
-rw-r--r--src/mesa/drivers/dri/savage/savagespan.c8
-rw-r--r--src/mesa/drivers/dri/savage/savagetex.c2
-rw-r--r--src/mesa/drivers/dri/savage/savagetris.c6
6 files changed, 30 insertions, 56 deletions
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index 34f334817c5..c2eb8d10b17 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -537,7 +537,7 @@ savageDestroyContext(__DRIcontextPrivate *driContextPriv)
savageFlushVertices(imesa);
savageReleaseIndexedVerts(imesa);
savageFlushCmdBuf(imesa, GL_TRUE); /* release DMA buffer */
- WAIT_IDLE_EMPTY;
+ WAIT_IDLE_EMPTY(imesa);
/* update for multi-tex*/
{
@@ -701,7 +701,7 @@ savageCloseFullScreen(__DRIcontextPrivate *driContextPriv)
if (driContextPriv) {
savageContextPtr imesa = (savageContextPtr) driContextPriv->driverPrivate;
- WAIT_IDLE_EMPTY;
+ WAIT_IDLE_EMPTY(imesa);
imesa->IsFullScreen = GL_FALSE;
imesa->savageScreen->frontOffset = imesa->backup_frontOffset;
imesa->savageScreen->backOffset = imesa->backup_backOffset;
diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c
index 27747c3cd89..d914aad38e0 100644
--- a/src/mesa/drivers/dri/savage/savageioctl.c
+++ b/src/mesa/drivers/dri/savage/savageioctl.c
@@ -455,30 +455,6 @@ void savageSwapBuffers( __DRIdrawablePrivate *dPriv )
#endif
}
-/* This waits for *everybody* to finish rendering -- overkill.
- */
-void savageDmaFinish( savageContextPtr imesa )
-{
- savageWaitEvent( imesa, savageEmitEventLocked( imesa, SAVAGE_WAIT_3D ) );
-}
-
-
-void savageRegetLockQuiescent( savageContextPtr imesa )
-{
-
-
-}
-
-void savageWaitAgeLocked( savageContextPtr imesa, int age )
-{
-}
-
-
-void savageWaitAge( savageContextPtr imesa, int age )
-{
-}
-
-
unsigned int savageEmitEventLocked( savageContextPtr imesa, unsigned int flags )
{
drm_savage_event_emit_t event;
@@ -559,9 +535,15 @@ void savageFlushCmdBufLocked( savageContextPtr imesa, GLboolean discard )
drm_savage_cmd_header_t *start;
int ret;
+ if (!imesa->dmaVtxBuf.total)
+ discard = GL_FALSE;
+
/* complete indexed drawing commands */
savageFlushElts(imesa);
+ if (imesa->cmdBuf.write == imesa->cmdBuf.start && !discard)
+ return;
+
/* If we lost the context we must restore the initial state (at
* the start of the command buffer). */
if (imesa->lostContext) {
@@ -570,9 +552,6 @@ void savageFlushCmdBufLocked( savageContextPtr imesa, GLboolean discard )
} else
start = imesa->cmdBuf.start;
- if (!imesa->dmaVtxBuf.total)
- discard = GL_FALSE;
-
if ((SAVAGE_DEBUG & DEBUG_DMA) && discard)
fprintf (stderr, "Discarding DMA buffer, used=%u\n",
imesa->dmaVtxBuf.used);
@@ -647,9 +626,7 @@ static void savageDDFlush( GLcontext *ctx )
fprintf (stderr, "%s\n", __FUNCTION__);
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
savageFlushVertices (imesa);
- LOCK_HARDWARE(imesa);
- savageFlushCmdBufLocked(imesa, GL_FALSE);
- UNLOCK_HARDWARE(imesa);
+ savageFlushCmdBuf(imesa, GL_FALSE);
}
static void savageDDFinish( GLcontext *ctx )
@@ -658,10 +635,8 @@ static void savageDDFinish( GLcontext *ctx )
fprintf (stderr, "%s\n", __FUNCTION__);
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
savageFlushVertices (imesa);
- LOCK_HARDWARE(imesa);
- savageFlushCmdBufLocked(imesa, GL_FALSE);
- savageDmaFinish (imesa);
- UNLOCK_HARDWARE(imesa);
+ savageFlushCmdBuf(imesa, GL_FALSE);
+ WAIT_IDLE_EMPTY(imesa);
}
void savageDDInitIoctlFuncs( GLcontext *ctx )
diff --git a/src/mesa/drivers/dri/savage/savageioctl.h b/src/mesa/drivers/dri/savage/savageioctl.h
index 8f50324c3f7..c7ff0017fde 100644
--- a/src/mesa/drivers/dri/savage/savageioctl.h
+++ b/src/mesa/drivers/dri/savage/savageioctl.h
@@ -28,14 +28,8 @@
#include "savagecontext.h"
-void savageGetGeneralDmaBufferLocked( savageContextPtr mmesa );
-
void savageFlushVertices( savageContextPtr mmesa );
-void savageFlushGeneralLocked( savageContextPtr imesa );
-void savageWaitAgeLocked( savageContextPtr imesa, int age );
-void savageWaitAge( savageContextPtr imesa, int age );
-
unsigned int savageEmitEventLocked( savageContextPtr imesa, unsigned int flags );
unsigned int savageEmitEvent( savageContextPtr imesa, unsigned int flags );
void savageWaitEvent( savageContextPtr imesa, unsigned int event);
@@ -43,17 +37,22 @@ void savageWaitEvent( savageContextPtr imesa, unsigned int event);
void savageFlushCmdBufLocked( savageContextPtr imesa, GLboolean discard );
void savageFlushCmdBuf( savageContextPtr imesa, GLboolean discard );
-void savageDmaFinish( savageContextPtr imesa );
-
-void savageRegetLockQuiescent( savageContextPtr imesa );
-
void savageDDInitIoctlFuncs( GLcontext *ctx );
void savageSwapBuffers( __DRIdrawablePrivate *dPriv );
-#define WAIT_IDLE_EMPTY do { \
+#define WAIT_IDLE_EMPTY(imesa) do { \
+ if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) \
+ fprintf (stderr, "WAIT_IDLE_EMPTY in %s\n", __FUNCTION__); \
savageWaitEvent(imesa, \
- savageEmitEvent(imesa, SAVAGE_WAIT_3D|SAVAGE_WAIT_2D)); \
+ savageEmitEvent(imesa, SAVAGE_WAIT_2D|SAVAGE_WAIT_3D)); \
+} while (0)
+
+#define WAIT_IDLE_EMPTY_LOCKED(imesa) do { \
+ if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) \
+ fprintf (stderr, "WAIT_IDLE_EMPTY_LOCKED in %s\n", __FUNCTION__); \
+ savageWaitEvent(imesa, savageEmitEventLocked( \
+ imesa, SAVAGE_WAIT_2D|SAVAGE_WAIT_3D)); \
} while (0)
#define FLUSH_BATCH(imesa) do { \
diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c
index 417fd3864cd..8af0384b445 100644
--- a/src/mesa/drivers/dri/savage/savagespan.c
+++ b/src/mesa/drivers/dri/savage/savagespan.c
@@ -259,7 +259,7 @@ savageCopyPixels( GLcontext *ctx,
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY;
+ WAIT_IDLE_EMPTY(imesa);
_swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type);
}
static void
@@ -272,7 +272,7 @@ savageDrawPixels( GLcontext *ctx,
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY;
+ WAIT_IDLE_EMPTY(imesa);
_swrast_DrawPixels(ctx, x, y, width, height, format, type, packing, pixels);
}
static void
@@ -284,7 +284,7 @@ savageReadPixels( GLcontext *ctx,
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY;
+ WAIT_IDLE_EMPTY(imesa);
_swrast_ReadPixels(ctx, x, y, width, height, format, type, packing, pixels);
}
@@ -295,7 +295,7 @@ static void savageSpanRenderStart( GLcontext *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY;
+ WAIT_IDLE_EMPTY(imesa);
}
diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c
index 62031f76c3b..dd8b4e89043 100644
--- a/src/mesa/drivers/dri/savage/savagetex.c
+++ b/src/mesa/drivers/dri/savage/savagetex.c
@@ -800,7 +800,7 @@ int savageUploadTexImages( savageContextPtr imesa, savageTextureObjectPtr t )
savageFlushVertices (imesa);
LOCK_HARDWARE(imesa);
savageFlushCmdBufLocked (imesa, GL_FALSE);
- savageDmaFinish (imesa);
+ WAIT_IDLE_EMPTY_LOCKED(imesa);
if (SAVAGE_DEBUG & DEBUG_VERBOSE_LRU)
fprintf(stderr, "*");
diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c
index 4e0ad469a8b..fdd0f12724d 100644
--- a/src/mesa/drivers/dri/savage/savagetris.c
+++ b/src/mesa/drivers/dri/savage/savagetris.c
@@ -557,7 +557,7 @@ savage_fallback_tri( savageContextPtr imesa,
GLcontext *ctx = imesa->glCtx;
SWvertex v[3];
FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY;
+ WAIT_IDLE_EMPTY(imesa);
_swsetup_Translate( ctx, v0, &v[0] );
_swsetup_Translate( ctx, v1, &v[1] );
_swsetup_Translate( ctx, v2, &v[2] );
@@ -573,7 +573,7 @@ savage_fallback_line( savageContextPtr imesa,
GLcontext *ctx = imesa->glCtx;
SWvertex v[2];
FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY;
+ WAIT_IDLE_EMPTY(imesa);
_swsetup_Translate( ctx, v0, &v[0] );
_swsetup_Translate( ctx, v1, &v[1] );
_swrast_Line( ctx, &v[0], &v[1] );
@@ -587,7 +587,7 @@ savage_fallback_point( savageContextPtr imesa,
GLcontext *ctx = imesa->glCtx;
SWvertex v[1];
FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY;
+ WAIT_IDLE_EMPTY(imesa);
_swsetup_Translate( ctx, v0, &v[0] );
_swrast_Point( ctx, &v[0] );
}