New PIPE_FLUSH_WAIT flag for pipe->flush().
authorBrian <brian.paul@tungstengraphics.com>
Wed, 7 Nov 2007 23:59:37 +0000 (16:59 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Wed, 7 Nov 2007 23:59:37 +0000 (16:59 -0700)
The state tracker doesn't have to directly call winsys->wait_idle() anymore.
glFlush and glFinish both go through pipe->flush() now.

src/mesa/drivers/dri/intel_winsys/intel_context.c
src/mesa/pipe/i915simple/i915_flush.c
src/mesa/pipe/p_defines.h
src/mesa/state_tracker/st_cb_flush.c
src/mesa/state_tracker/st_framebuffer.c
src/mesa/state_tracker/st_public.h

index 47be72b..4803504 100644 (file)
@@ -227,7 +227,7 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
 
    assert(intel);               /* should never be null */
    if (intel) {
-      st_flush(intel->st);
+      st_flush(intel->st, PIPE_FLUSH_WAIT);
 
       intel_batchbuffer_free(intel->batch);
 
@@ -255,7 +255,7 @@ GLboolean
 intelUnbindContext(__DRIcontextPrivate * driContextPriv)
 {
    struct intel_context *intel = intel_context(driContextPriv);
-   st_flush(intel->st);
+   st_flush(intel->st, 0x0);
    /* XXX make_current(NULL)? */
    return GL_TRUE;
 }
index 9c2adf8..5a80ed5 100644 (file)
@@ -47,7 +47,7 @@ static void i915_flush( struct pipe_context *pipe,
    /* Do we need to emit an MI_FLUSH command to flush the hardware
     * caches?
     */
-   if (flags) {
+   if (flags & (PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE)) {
       unsigned flush = MI_FLUSH;
       
       if (!(flags & PIPE_FLUSH_RENDER_CACHE))
@@ -67,6 +67,10 @@ static void i915_flush( struct pipe_context *pipe,
    /* If there are no flags, just flush pending commands to hardware:
     */
    FLUSH_BATCH();
+
+   if (flags & PIPE_FLUSH_WAIT) {
+      i915->pipe.winsys->wait_idle(i915->pipe.winsys, i915->pipe.private);
+   }
 }
 
 
index ca9929b..6b5881b 100644 (file)
 /** 
  * Flush types:
  */
-#define PIPE_FLUSH_RENDER_CACHE  0x1
+#define PIPE_FLUSH_RENDER_CACHE   0x1
 #define PIPE_FLUSH_TEXTURE_CACHE  0x2
+#define PIPE_FLUSH_WAIT           0x4
 
 
 /**
index 6354306..39a9f29 100644 (file)
@@ -43,7 +43,7 @@
 #include "pipe/p_winsys.h"
 
 
-void st_flush( struct st_context *st )
+void st_flush( struct st_context *st, uint pipeFlushFlags )
 {
    GLframebuffer *fb = st->ctx->DrawBuffer;
 
@@ -53,7 +53,7 @@ void st_flush( struct st_context *st )
     * short-circuiting this, or perhaps pass an "optional" flag down
     * to the driver so that it can make the decision.
     */
-   st->pipe->flush( st->pipe, 0 );
+   st->pipe->flush( st->pipe, pipeFlushFlags );
 
    if (!fb)
       return;
@@ -83,7 +83,7 @@ void st_flush( struct st_context *st )
  */
 static void st_Flush(GLcontext *ctx)
 {
-   st_flush(ctx->st);
+   st_flush(ctx->st, 0x0);
 }
 
 
@@ -92,10 +92,7 @@ static void st_Flush(GLcontext *ctx)
  */
 static void st_Finish(GLcontext *ctx)
 {
-   struct st_context *st = ctx->st;
-
-   st_flush( st );
-   st->pipe->winsys->wait_idle( st->pipe->winsys, st->pipe->private );
+   st_flush(ctx->st, PIPE_FLUSH_WAIT);
 }
 
 
index b04dcdb..4ae2837 100644 (file)
@@ -179,7 +179,7 @@ st_notify_swapbuffers(struct st_framebuffer *stfb)
    GET_CURRENT_CONTEXT(ctx);
 
    if (ctx && ctx->DrawBuffer == &stfb->Base) {
-      st_flush(ctx->st);
+      st_flush(ctx->st, 0x0);
    }
 }
 
index 9e36e1e..408e192 100644 (file)
@@ -70,7 +70,7 @@ void st_make_current(struct st_context *st,
                      struct st_framebuffer *draw,
                      struct st_framebuffer *read);
 
-void st_flush( struct st_context *st );
+void st_flush( struct st_context *st, uint pipeFlushFlags );
 
 void st_notify_swapbuffers(struct st_framebuffer *stfb);