[Mesa-dev] [PATCH 4/6] u_upload_mgr: pass alignment to u_upload_buffer manually

Marek Olšák maraeo at gmail.com
Mon Dec 21 14:35:29 PST 2015


From: Marek Olšák <marek.olsak at amd.com>

The fixed alignment of u_upload_mgr will go away.
This is the first step.

The motivation is that one u_upload_mgr can have multiple users,
each allocating from the same buffer, but requiring a different alignment.
---
 src/gallium/auxiliary/util/u_upload_mgr.c | 4 ++--
 src/gallium/auxiliary/util/u_upload_mgr.h | 2 +-
 src/gallium/drivers/ilo/ilo_state.c       | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 763c4dd..26b7170 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -260,7 +260,7 @@ void u_upload_data(struct u_upload_mgr *upload,
 void u_upload_buffer(struct u_upload_mgr *upload,
                      unsigned min_out_offset,
                      unsigned offset,
-                     unsigned size,
+                     unsigned size, unsigned alignment,
                      struct pipe_resource *inbuf,
                      unsigned *out_offset,
                      struct pipe_resource **outbuf)
@@ -282,7 +282,7 @@ void u_upload_buffer(struct u_upload_mgr *upload,
    if (0)
       debug_printf("upload ptr %p ofs %d sz %d\n", map, offset, size);
 
-   u_upload_data(upload, min_out_offset, size, upload->alignment,
+   u_upload_data(upload, min_out_offset, size, alignment,
                  map, out_offset, outbuf);
    pipe_buffer_unmap( upload->pipe, transfer );
 }
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h b/src/gallium/auxiliary/util/u_upload_mgr.h
index 11defbb..948824e 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.h
+++ b/src/gallium/auxiliary/util/u_upload_mgr.h
@@ -110,7 +110,7 @@ void u_upload_data(struct u_upload_mgr *upload,
 void u_upload_buffer(struct u_upload_mgr *upload,
                      unsigned min_out_offset,
                      unsigned offset,
-                     unsigned size,
+                     unsigned size, unsigned alignment,
                      struct pipe_resource *inbuf,
                      unsigned *out_offset,
                      struct pipe_resource **outbuf);
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index 0232713..8dc2d38 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -431,7 +431,7 @@ finalize_index_buffer(struct ilo_context *ilo)
                &hw_offset, &vec->ib.hw_resource);
       } else {
          u_upload_buffer(ilo->uploader, 0,
-               vec->ib.state.offset + offset, size, vec->ib.state.buffer,
+               vec->ib.state.offset + offset, size, 16, vec->ib.state.buffer,
                &hw_offset, &vec->ib.hw_resource);
       }
 
-- 
2.1.4



More information about the mesa-dev mailing list