summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2008-03-26 09:36:40 +0000
committerMichel Dänzer <michel@tungstengraphics.com>2008-03-26 09:36:40 +0000
commit4abe1eb980ed76d2b2d3383eaab520d0aa2ae6f4 (patch)
tree82ef00b79a812d6380b023e1da1a24c34437d66e /src/mesa/state_tracker
parente55dccd0bfc41dbcf306f864c01758f8e28fc660 (diff)
gallium: Change pipe->flush() interface to optionally return a fence.
The cell driver still uses an internal CELL_FLUSH_WAIT flag, in the long run proper fencing should be implemented for it.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_accum.c2
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c4
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c2
-rw-r--r--src/mesa/state_tracker/st_cb_flush.c34
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c2
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c3
-rw-r--r--src/mesa/state_tracker/st_public.h5
7 files changed, 30 insertions, 22 deletions
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index f1fddc4e02..a623d0bcc0 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -214,7 +214,7 @@ st_Accum(GLcontext *ctx, GLenum op, GLfloat value)
const GLint height = ctx->DrawBuffer->_Ymax - ypos;
/* make sure color bufs aren't cached */
- pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE);
+ pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
switch (op) {
case GL_ADD:
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 026f015fd8..43cc21d1fb 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -737,7 +737,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
GLint skipPixels;
ubyte *stmap;
- pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE);
+ pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
/* map the stencil buffer */
stmap = pipe_surface_map(ps);
@@ -952,7 +952,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
enum pipe_format srcFormat, texFormat;
/* make sure rendering has completed */
- pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE);
+ pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
st_validate_state(st);
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 5384252a8e..ec7788923a 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -366,7 +366,7 @@ st_finish_render_texture(GLcontext *ctx,
assert(strb);
- ctx->st->pipe->flush(ctx->st->pipe, PIPE_FLUSH_RENDER_CACHE);
+ ctx->st->pipe->flush(ctx->st->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
/*
printf("FINISH RENDER TO TEXTURE surf=%p\n", strb->surface);
diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
index dbec993f1b..a536a059bd 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -43,19 +43,21 @@
#include "pipe/p_winsys.h"
-void st_flush( struct st_context *st, uint pipeFlushFlags )
+void st_flush( struct st_context *st, uint pipeFlushFlags,
+ struct pipe_fence_handle **fence )
{
FLUSH_VERTICES(st->ctx, 0);
- st->pipe->flush( st->pipe, pipeFlushFlags );
+ st->pipe->flush( st->pipe, pipeFlushFlags, fence );
}
-static void st_gl_flush( struct st_context *st, uint pipeFlushFlags )
+static void st_gl_flush( struct st_context *st, uint pipeFlushFlags,
+ struct pipe_fence_handle **fence )
{
GLframebuffer *fb = st->ctx->DrawBuffer;
- FLUSH_VERTICES(st->ctx, 0);
+ st_flush( st, pipeFlushFlags, fence );
if (!fb)
return;
@@ -80,15 +82,6 @@ static void st_gl_flush( struct st_context *st, uint pipeFlushFlags )
= st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
struct pipe_surface *front_surf = strb->surface;
- /* If we aren't rendering to the frontbuffer, this is a noop.
- * This should be uncontroversial for glFlush, though people may
- * feel more strongly about glFinish.
- *
- * Additionally, need to make sure that the frontbuffer_dirty
- * flag really gets set on frontbuffer rendering.
- */
- st->pipe->flush( st->pipe, pipeFlushFlags );
-
/* Hook for copying "fake" frontbuffer if necessary:
*/
st->pipe->winsys->flush_frontbuffer( st->pipe->winsys, front_surf,
@@ -103,7 +96,18 @@ static void st_gl_flush( struct st_context *st, uint pipeFlushFlags )
*/
static void st_glFlush(GLcontext *ctx)
{
- st_gl_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE);
+ st_gl_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+}
+
+
+void st_finish( struct st_context *st )
+{
+ struct pipe_fence_handle *fence;
+
+ st_gl_flush(st, PIPE_FLUSH_RENDER_CACHE, &fence);
+
+ st->pipe->winsys->fence_finish(st->pipe->winsys, fence, 0);
+ st->pipe->winsys->fence_reference(st->pipe->winsys, &fence, NULL);
}
@@ -112,7 +116,7 @@ static void st_glFlush(GLcontext *ctx)
*/
static void st_glFinish(GLcontext *ctx)
{
- st_gl_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_WAIT);
+ st_finish( ctx->st );
}
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 4cf9adcd28..e9fcdf69a1 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -160,7 +160,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
return;
/* make sure rendering has completed */
- pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE);
+ pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
if (format == GL_STENCIL_INDEX) {
st_read_stencil_pixels(ctx, x, y, width, height, type, pack, dest);
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index d46a9178b1..075e9d1bd6 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -186,7 +186,8 @@ st_notify_swapbuffers(struct st_framebuffer *stfb)
if (ctx && ctx->DrawBuffer == &stfb->Base) {
st_flush( ctx->st,
- PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_SWAPBUFFERS);
+ PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_SWAPBUFFERS,
+ NULL );
}
}
diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h
index 3c397b126a..9d88ce9764 100644
--- a/src/mesa/state_tracker/st_public.h
+++ b/src/mesa/state_tracker/st_public.h
@@ -45,6 +45,7 @@
struct st_context;
struct st_framebuffer;
struct pipe_context;
+struct pipe_fence_handle;
struct pipe_surface;
@@ -78,7 +79,9 @@ void st_make_current(struct st_context *st,
struct st_framebuffer *draw,
struct st_framebuffer *read);
-void st_flush( struct st_context *st, uint pipeFlushFlags );
+void st_flush( struct st_context *st, uint pipeFlushFlags,
+ struct pipe_fence_handle **fence );
+void st_finish( struct st_context *st );
void st_notify_swapbuffers(struct st_framebuffer *stfb);
void st_notify_swapbuffers_complete(struct st_framebuffer *stfb);