summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-12-19 17:15:02 +0100
committerMarek Olšák <[email protected]>2016-01-02 15:15:44 +0100
commit020009f7ccdffa84c6e1649c4e915954f5fd7cc0 (patch)
tree41ef13eda4f8f44bc31ea900e18328b2ce9e2d23 /src/gallium/auxiliary
parentffc4716e9730ca162ce5dfcf0298125269c6d908 (diff)
u_upload_mgr: pass alignment to u_upload_alloc manually
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. Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/hud/hud_context.c2
-rw-r--r--src/gallium/auxiliary/indices/u_primconvert.c2
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.c4
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.h2
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c4
-rw-r--r--src/gallium/auxiliary/vl/vl_compositor.c1
6 files changed, 9 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index c5c33327702..691de81f20a 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -431,7 +431,7 @@ hud_alloc_vertices(struct hud_context *hud, struct vertex_queue *v,
v->max_num_vertices = num_vertices;
v->vbuf.stride = stride;
u_upload_alloc(hud->uploader, 0, v->vbuf.stride * v->max_num_vertices,
- &v->vbuf.buffer_offset, &v->vbuf.buffer,
+ 16, &v->vbuf.buffer_offset, &v->vbuf.buffer,
(void**)&v->vertices);
}
diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c
index 70d3e8530b8..c0a31548433 100644
--- a/src/gallium/auxiliary/indices/u_primconvert.c
+++ b/src/gallium/auxiliary/indices/u_primconvert.c
@@ -156,7 +156,7 @@ util_primconvert_draw_vbo(struct primconvert_context *pc,
pc->upload = u_upload_create(pc->pipe, 4096, 4, PIPE_BIND_INDEX_BUFFER);
}
- u_upload_alloc(pc->upload, 0, new_ib.index_size * new_info.count,
+ u_upload_alloc(pc->upload, 0, new_ib.index_size * new_info.count, 4,
&new_ib.offset, &new_ib.buffer, &dst);
if (info->indexed) {
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 4148bae5ab5..3f790400e40 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -181,11 +181,11 @@ void
u_upload_alloc(struct u_upload_mgr *upload,
unsigned min_out_offset,
unsigned size,
+ unsigned alignment,
unsigned *out_offset,
struct pipe_resource **outbuf,
void **ptr)
{
- unsigned alignment = upload->alignment;
unsigned buffer_size = upload->buffer ? upload->buffer->width0 : 0;
unsigned offset;
@@ -249,7 +249,7 @@ void u_upload_data(struct u_upload_mgr *upload,
{
uint8_t *ptr;
- u_upload_alloc(upload, min_out_offset, size,
+ u_upload_alloc(upload, min_out_offset, size, upload->alignment,
out_offset, outbuf,
(void**)&ptr);
if (ptr)
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h b/src/gallium/auxiliary/util/u_upload_mgr.h
index 67c6daa4e7f..ad7135fc8da 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.h
+++ b/src/gallium/auxiliary/util/u_upload_mgr.h
@@ -74,6 +74,7 @@ void u_upload_unmap( struct u_upload_mgr *upload );
* \param upload Upload manager
* \param min_out_offset Minimum offset that should be returned in out_offset.
* \param size Size of the allocation.
+ * \param alignment Alignment of the suballocation within the buffer
* \param out_offset Pointer to where the new buffer offset will be returned.
* \param outbuf Pointer to where the upload buffer will be returned.
* \param ptr Pointer to the allocated memory that is returned.
@@ -81,6 +82,7 @@ void u_upload_unmap( struct u_upload_mgr *upload );
void u_upload_alloc(struct u_upload_mgr *upload,
unsigned min_out_offset,
unsigned size,
+ unsigned alignment,
unsigned *out_offset,
struct pipe_resource **outbuf,
void **ptr);
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index 54e9e717104..dd64e2d7949 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -454,7 +454,7 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
/* Create and map the output buffer. */
u_upload_alloc(mgr->uploader, 0,
- key->output_stride * num_indices,
+ key->output_stride * num_indices, 4,
&out_offset, &out_buffer,
(void**)&out_map);
if (!out_buffer)
@@ -487,7 +487,7 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
/* Create and map the output buffer. */
u_upload_alloc(mgr->uploader,
key->output_stride * start_vertex,
- key->output_stride * num_vertices,
+ key->output_stride * num_vertices, 4,
&out_offset, &out_buffer,
(void**)&out_map);
if (!out_buffer)
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
index afe53063b48..f160df63aa5 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -716,6 +716,7 @@ gen_vertex_data(struct vl_compositor *c, struct vl_compositor_state *s, struct u
/* Allocate new memory for vertices. */
u_upload_alloc(c->upload, 0,
c->vertex_buf.stride * VL_COMPOSITOR_MAX_LAYERS * 4, /* size */
+ 4, /* alignment */
&c->vertex_buf.buffer_offset, &c->vertex_buf.buffer,
(void**)&vb);