From a1d9a58b825825723f1c5f7705f2ed3ef834038a Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 19 Sep 2010 19:27:30 +0200 Subject: r600g: Flush upload buffers before draws instead of before flushes. If a upload buffer is used by a previous draw that's still in the CS, accessing it would need a context flush. However, doing a context flush when mapping the upload buffer would then flush/destroy the same buffer we're trying to map there. Flushing the upload buffers before a draw avoids both the CS flush and the upload buffer going away while it's being used. Note that u_upload_data() could e.g. use a pool of buffers instead of allocating new ones all the time if that turns out to be a significant issue. --- src/gallium/drivers/r600/r600_context.c | 4 ---- src/gallium/drivers/r600/r600_draw.c | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 776dc24569b..f07cbfc2ccf 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -70,10 +70,6 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, struct r600_context *rctx = r600_context(ctx); struct r600_query *rquery = NULL; - /* flush upload buffers */ - u_upload_flush(rctx->upload_vb); - u_upload_flush(rctx->upload_ib); - /* suspend queries */ r600_queries_suspend(ctx); diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index cbfa44868e8..00a6aeaef25 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "radeon.h" #include "r600_screen.h" #include "r600_context.h" @@ -125,6 +126,10 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) memset(&draw, 0, sizeof(draw)); + /* flush upload buffers */ + u_upload_flush(rctx->upload_vb); + u_upload_flush(rctx->upload_ib); + if (rctx->any_user_vbs) { r600_upload_user_buffers(rctx); rctx->any_user_vbs = false; -- cgit v1.2.3