summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-11-07 16:59:37 -0700
committerBrian <brian.paul@tungstengraphics.com>2007-11-07 16:59:37 -0700
commitae44a81d1bd40852a7cea9b8025dfa3821adc785 (patch)
treed1e0b635f17abbe2f82687701d9802755241cf18
parent10c62bf0683437672c83339138a6802d56aeca8f (diff)
New PIPE_FLUSH_WAIT flag for pipe->flush().
The state tracker doesn't have to directly call winsys->wait_idle() anymore. glFlush and glFinish both go through pipe->flush() now.
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_context.c4
-rw-r--r--src/mesa/pipe/i915simple/i915_flush.c6
-rw-r--r--src/mesa/pipe/p_defines.h3
-rw-r--r--src/mesa/state_tracker/st_cb_flush.c11
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c2
-rw-r--r--src/mesa/state_tracker/st_public.h2
6 files changed, 15 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.c b/src/mesa/drivers/dri/intel_winsys/intel_context.c
index 47be72b233..480350492f 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_context.c
+++ b/src/mesa/drivers/dri/intel_winsys/intel_context.c
@@ -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;
}
diff --git a/src/mesa/pipe/i915simple/i915_flush.c b/src/mesa/pipe/i915simple/i915_flush.c
index 9c2adf8763..5a80ed5e2f 100644
--- a/src/mesa/pipe/i915simple/i915_flush.c
+++ b/src/mesa/pipe/i915simple/i915_flush.c
@@ -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);
+ }
}
diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h
index ca9929bfee..6b5881b64d 100644
--- a/src/mesa/pipe/p_defines.h
+++ b/src/mesa/pipe/p_defines.h
@@ -187,8 +187,9 @@
/**
* 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
/**
diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
index 6354306e75..39a9f29bca 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -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);
}
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index b04dcdb79d..4ae2837f0a 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -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);
}
}
diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h
index 9e36e1e6e5..408e1927e5 100644
--- a/src/mesa/state_tracker/st_public.h
+++ b/src/mesa/state_tracker/st_public.h
@@ -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);