From: Marek Olšák Date: Wed, 11 Apr 2012 14:00:09 +0000 (+0200) Subject: r600g: don't share u_upload_mgr with u_vbuf, create its own X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=428855eea3e99d94474df6df0cb8dfc4a8819702;p=mesa.git r600g: don't share u_upload_mgr with u_vbuf, create its own --- diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index c4c27ab526b..7dfa2bfb3a7 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -28,6 +28,7 @@ #include "util/u_blitter.h" #include "util/u_format_s3tc.h" #include "util/u_simple_shaders.h" +#include "util/u_upload_mgr.h" #include "vl/vl_decoder.h" #include "vl/vl_video_buffer.h" #include "os/os_time.h" @@ -194,6 +195,9 @@ static void r600_destroy_context(struct pipe_context *context) if (rctx->vbuf_mgr) { u_vbuf_destroy(rctx->vbuf_mgr); } + if (rctx->uploader) { + u_upload_destroy(rctx->uploader); + } util_slab_destroy(&rctx->pool_transfers); r600_update_num_contexts(rctx->screen, -1); @@ -304,6 +308,12 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void if (!rctx->vbuf_mgr) goto fail; + rctx->uploader = u_upload_create(&rctx->context, 1024 * 1024, 256, + PIPE_BIND_INDEX_BUFFER | + PIPE_BIND_CONSTANT_BUFFER); + if (!rctx->uploader) + goto fail; + rctx->blitter = util_blitter_create(&rctx->context); if (rctx->blitter == NULL) goto fail; diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index c3f603c3255..69f3644d8d2 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -285,6 +285,7 @@ struct r600_context { struct r600_textures_info ps_samplers; struct u_vbuf *vbuf_mgr; + struct u_upload_mgr *uploader; struct util_slab_mempool pool_transfers; boolean have_depth_texture, have_depth_fb; diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index a5b4c911ca1..b32d89b6750 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -574,10 +574,10 @@ void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index, tmpPtr[i] = bswap_32(((uint32_t *)ptr)[i]); } - u_upload_data(rctx->vbuf_mgr->uploader, 0, size, tmpPtr, &cb->buffer_offset, &cb->buffer); + u_upload_data(rctx->uploader, 0, size, tmpPtr, &cb->buffer_offset, &cb->buffer); free(tmpPtr); } else { - u_upload_data(rctx->vbuf_mgr->uploader, 0, buffer->width0, ptr, &cb->buffer_offset, &cb->buffer); + u_upload_data(rctx->uploader, 0, buffer->width0, ptr, &cb->buffer_offset, &cb->buffer); } } else { /* Setup the hw buffer. */ @@ -780,7 +780,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo) ptr = ib.buffer->user_ptr; if (ptr) { - u_upload_data(rctx->vbuf_mgr->uploader, 0, info.count * ib.index_size, + u_upload_data(rctx->uploader, 0, info.count * ib.index_size, ptr, &ib.offset, &ib.buffer); } } else { diff --git a/src/gallium/drivers/r600/r600_translate.c b/src/gallium/drivers/r600/r600_translate.c index a5567826a7c..af3b8cad3aa 100644 --- a/src/gallium/drivers/r600/r600_translate.c +++ b/src/gallium/drivers/r600/r600_translate.c @@ -38,7 +38,7 @@ void r600_translate_index_buffer(struct r600_context *r600, switch (ib->index_size) { case 1: - u_upload_alloc(r600->vbuf_mgr->uploader, 0, count * 2, + u_upload_alloc(r600->uploader, 0, count * 2, &out_offset, &out_buffer, &ptr); util_shorten_ubyte_elts_to_userptr(