r600g: don't share u_upload_mgr with u_vbuf, create its own
authorMarek Olšák <maraeo@gmail.com>
Wed, 11 Apr 2012 14:00:09 +0000 (16:00 +0200)
committerMarek Olšák <maraeo@gmail.com>
Mon, 23 Apr 2012 23:39:22 +0000 (01:39 +0200)
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_state_common.c
src/gallium/drivers/r600/r600_translate.c

index c4c27ab526b1f2e46b9189d762988eaa6cb42e6f..7dfa2bfb3a73e7fefcecc3426842048b25339c90 100644 (file)
@@ -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;
index c3f603c3255fc2a69f067bfb890b13cc46585864..69f3644d8d250d584e493e6c3b07be24c7d66c65 100644 (file)
@@ -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;
 
index a5b4c911ca112593aab31d00b0b7881e779dd0c2..b32d89b67500d7790b1545b3fc7f3e00221cdc42 100644 (file)
@@ -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 {
index a5567826a7c0e84d419ed41454793a696ed7415a..af3b8cad3aac07187eff5f713044d53b88366818 100644 (file)
@@ -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(