[Mesa-dev] [PATCH 16/21] r300g: don't share u_upload_mgr with u_vbuf, create its own

Marek Olšák maraeo at gmail.com
Wed Apr 11 08:38:50 PDT 2012


---
 src/gallium/drivers/r300/r300_context.c          |    5 +++++
 src/gallium/drivers/r300/r300_context.h          |    1 +
 src/gallium/drivers/r300/r300_render_translate.c |    6 +++---
 src/gallium/drivers/r300/r300_screen_buffer.c    |    2 +-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 6a93575..658ce1e 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -103,6 +103,8 @@ static void r300_destroy_context(struct pipe_context* context)
     if (r300->vbuf_mgr)
         u_vbuf_destroy(r300->vbuf_mgr);
 
+    u_upload_destroy(r300->uploader);
+
     /* XXX: This function assumes r300->query_list was initialized */
     r300_release_referenced_objects(r300);
 
@@ -440,6 +442,9 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
             goto fail;
     }
 
+    r300->uploader = u_upload_create(&r300->context, 256 * 1024, 16,
+                                     PIPE_BIND_INDEX_BUFFER);
+
     r300->blitter = util_blitter_create(&r300->context);
     if (r300->blitter == NULL)
         goto fail;
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 29f2717..8f125d1 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -580,6 +580,7 @@ struct r300_context {
     struct pipe_index_buffer index_buffer;
     struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
     unsigned nr_vertex_buffers;
+    struct u_upload_mgr *uploader;
 
     struct util_slab_mempool pool_transfers;
 
diff --git a/src/gallium/drivers/r300/r300_render_translate.c b/src/gallium/drivers/r300/r300_render_translate.c
index c2eb3c5..022e8a7 100644
--- a/src/gallium/drivers/r300/r300_render_translate.c
+++ b/src/gallium/drivers/r300/r300_render_translate.c
@@ -36,7 +36,7 @@ void r300_translate_index_buffer(struct r300_context *r300,
 
     switch (*index_size) {
     case 1:
-        u_upload_alloc(r300->vbuf_mgr->uploader, 0, count * 2,
+        u_upload_alloc(r300->uploader, 0, count * 2,
                        &out_offset, &out_buffer, &ptr);
 
         util_shorten_ubyte_elts_to_userptr(
@@ -51,7 +51,7 @@ void r300_translate_index_buffer(struct r300_context *r300,
 
     case 2:
         if (index_offset) {
-            u_upload_alloc(r300->vbuf_mgr->uploader, 0, count * 2,
+            u_upload_alloc(r300->uploader, 0, count * 2,
                            &out_offset, &out_buffer, &ptr);
 
             util_rebuild_ushort_elts_to_userptr(&r300->context, *index_buffer,
@@ -66,7 +66,7 @@ void r300_translate_index_buffer(struct r300_context *r300,
 
     case 4:
         if (index_offset) {
-            u_upload_alloc(r300->vbuf_mgr->uploader, 0, count * 4,
+            u_upload_alloc(r300->uploader, 0, count * 4,
                            &out_offset, &out_buffer, &ptr);
 
             util_rebuild_uint_elts_to_userptr(&r300->context, *index_buffer,
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
index c92b831..d89cceb 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -41,7 +41,7 @@ void r300_upload_index_buffer(struct r300_context *r300,
 
     *index_buffer = NULL;
 
-    u_upload_data(r300->vbuf_mgr->uploader,
+    u_upload_data(r300->uploader,
                   0, count * index_size,
                   ptr + (*start * index_size),
                   &index_offset,
-- 
1.7.5.4



More information about the mesa-dev mailing list