savageFlushVertices(imesa);
savageReleaseIndexedVerts(imesa);
savageFlushCmdBuf(imesa, GL_TRUE); /* release DMA buffer */
- WAIT_IDLE_EMPTY;
+ WAIT_IDLE_EMPTY(imesa);
/* update for multi-tex*/
{
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;
#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;
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) {
} 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);
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 )
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 )
#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);
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 { \
{
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
{
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
{
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);
}
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY;
+ WAIT_IDLE_EMPTY(imesa);
}
savageFlushVertices (imesa);
LOCK_HARDWARE(imesa);
savageFlushCmdBufLocked (imesa, GL_FALSE);
- savageDmaFinish (imesa);
+ WAIT_IDLE_EMPTY_LOCKED(imesa);
if (SAVAGE_DEBUG & DEBUG_VERBOSE_LRU)
fprintf(stderr, "*");
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] );
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] );
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] );
}