summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r600/r600_context.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-09-17 14:01:50 +1000
committerDave Airlie <airlied@redhat.com>2010-09-17 15:29:31 +1000
commit0d76bb5d4c5c867155f7fb381c46018e1560b790 (patch)
tree41449f2f5ba46b87ab76a864931ce36ba738223c /src/gallium/drivers/r600/r600_context.c
parenta927d0477a47e29d72e518880979e11e8c0f98e7 (diff)
r600g: add upload manager support.
this add support for the upload manager for uploading user vbo/index buffers. this provides a considerable speedup in q3 type games.
Diffstat (limited to 'src/gallium/drivers/r600/r600_context.c')
-rw-r--r--src/gallium/drivers/r600/r600_context.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c
index cca1e35673..776dc24569 100644
--- a/src/gallium/drivers/r600/r600_context.c
+++ b/src/gallium/drivers/r600/r600_context.c
@@ -28,6 +28,7 @@
#include <util/u_inlines.h>
#include <util/u_format.h>
#include <util/u_memory.h>
+#include <util/u_upload_mgr.h>
#include <util/u_blitter.h>
#include "r600_screen.h"
#include "r600_context.h"
@@ -56,6 +57,9 @@ static void r600_destroy_context(struct pipe_context *context)
free(rctx->vs_constant);
free(rctx->vs_resource);
+ u_upload_destroy(rctx->upload_vb);
+ u_upload_destroy(rctx->upload_ib);
+
radeon_ctx_fini(rctx->ctx);
FREE(rctx);
}
@@ -66,6 +70,10 @@ 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);
@@ -123,25 +131,37 @@ struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv)
rctx->vtbl->init_config(rctx);
+ rctx->upload_ib = u_upload_create(&rctx->context, 32 * 1024, 16,
+ PIPE_BIND_INDEX_BUFFER);
+ if (rctx->upload_ib == NULL) {
+ goto out_free;
+ }
+
+ rctx->upload_vb = u_upload_create(&rctx->context, 128 * 1024, 16,
+ PIPE_BIND_VERTEX_BUFFER);
+ if (rctx->upload_vb == NULL) {
+ goto out_free;
+ }
+
rctx->vs_constant = (struct radeon_state *)calloc(R600_MAX_CONSTANT, sizeof(struct radeon_state));
if (!rctx->vs_constant) {
- FREE(rctx);
- return NULL;
+ goto out_free;
}
rctx->ps_constant = (struct radeon_state *)calloc(R600_MAX_CONSTANT, sizeof(struct radeon_state));
if (!rctx->ps_constant) {
- FREE(rctx);
- return NULL;
+ goto out_free;
}
rctx->vs_resource = (struct radeon_state *)calloc(R600_MAX_RESOURCE, sizeof(struct radeon_state));
if (!rctx->vs_resource) {
- FREE(rctx);
- return NULL;
+ goto out_free;
}
rctx->ctx = radeon_ctx_init(rscreen->rw);
radeon_draw_init(&rctx->draw, rscreen->rw);
return &rctx->context;
+ out_free:
+ FREE(rctx);
+ return NULL;
}