aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
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
commite0f932846c91e6eca6495c86b72e87af64dfefb5 (patch)
tree36778f580024fa572d58017f1e0a4df914405e23 /src/gallium
parent020009f7ccdffa84c6e1649c4e915954f5fd7cc0 (diff)
u_upload_mgr: pass alignment to u_upload_data manually
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c4
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.c6
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.h1
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c2
-rw-r--r--src/gallium/drivers/ilo/ilo_gpgpu.c2
-rw-r--r--src/gallium/drivers/ilo/ilo_state.c4
-rw-r--r--src/gallium/drivers/r300/r300_render.c2
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.c2
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c6
-rw-r--r--src/gallium/drivers/radeonsi/si_state_draw.c2
-rw-r--r--src/gallium/drivers/vc4/vc4_draw.c2
-rw-r--r--src/gallium/drivers/virgl/virgl_context.c2
-rw-r--r--src/gallium/state_trackers/nine/device9.c8
-rw-r--r--src/gallium/state_trackers/nine/device9.h1
-rw-r--r--src/gallium/state_trackers/nine/nine_ff.c2
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c2
16 files changed, 29 insertions, 19 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 05b4567130e..a72d77df301 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -1191,7 +1191,7 @@ static void blitter_draw(struct blitter_context_priv *ctx,
vb.stride = 8 * sizeof(float);
- u_upload_data(ctx->upload, 0, sizeof(ctx->vertices), ctx->vertices,
+ u_upload_data(ctx->upload, 0, sizeof(ctx->vertices), 4, ctx->vertices,
&vb.buffer_offset, &vb.buffer);
if (!vb.buffer)
return;
@@ -2111,7 +2111,7 @@ void util_blitter_clear_buffer(struct blitter_context *blitter,
return;
}
- u_upload_data(ctx->upload, 0, num_channels*4, clear_value,
+ u_upload_data(ctx->upload, 0, num_channels*4, 4, clear_value,
&vb.buffer_offset, &vb.buffer);
if (!vb.buffer)
goto out;
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 3f790400e40..646965c4070 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -243,13 +243,14 @@ u_upload_alloc(struct u_upload_mgr *upload,
void u_upload_data(struct u_upload_mgr *upload,
unsigned min_out_offset,
unsigned size,
+ unsigned alignment,
const void *data,
unsigned *out_offset,
struct pipe_resource **outbuf)
{
uint8_t *ptr;
- u_upload_alloc(upload, min_out_offset, size, upload->alignment,
+ u_upload_alloc(upload, min_out_offset, size, alignment,
out_offset, outbuf,
(void**)&ptr);
if (ptr)
@@ -282,6 +283,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, map, out_offset, outbuf);
+ u_upload_data(upload, min_out_offset, size, upload->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 ad7135fc8da..46624587257 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.h
+++ b/src/gallium/auxiliary/util/u_upload_mgr.h
@@ -97,6 +97,7 @@ void u_upload_alloc(struct u_upload_mgr *upload,
void u_upload_data(struct u_upload_mgr *upload,
unsigned min_out_offset,
unsigned size,
+ unsigned alignment,
const void *data,
unsigned *out_offset,
struct pipe_resource **outbuf);
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index dd64e2d7949..6e2c9aab26f 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -987,7 +987,7 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr,
real_vb = &mgr->real_vertex_buffer[i];
ptr = mgr->vertex_buffer[i].user_buffer;
- u_upload_data(mgr->uploader, start, end - start, ptr + start,
+ u_upload_data(mgr->uploader, start, end - start, 4, ptr + start,
&real_vb->buffer_offset, &real_vb->buffer);
if (!real_vb->buffer)
return PIPE_ERROR_OUT_OF_MEMORY;
diff --git a/src/gallium/drivers/ilo/ilo_gpgpu.c b/src/gallium/drivers/ilo/ilo_gpgpu.c
index 9a2ca007f80..b7415901a88 100644
--- a/src/gallium/drivers/ilo/ilo_gpgpu.c
+++ b/src/gallium/drivers/ilo/ilo_gpgpu.c
@@ -92,7 +92,7 @@ ilo_launch_grid(struct pipe_context *pipe,
input_buf.buffer_size =
ilo_shader_get_kernel_param(cs, ILO_KERNEL_CS_INPUT_SIZE);
if (input_buf.buffer_size) {
- u_upload_data(ilo->uploader, 0, input_buf.buffer_size, input,
+ u_upload_data(ilo->uploader, 0, input_buf.buffer_size, 16, input,
&input_buf.buffer_offset, &input_buf.buffer);
}
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index d89765a9d23..0232713f7a2 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -376,7 +376,7 @@ finalize_cbuf_state(struct ilo_context *ilo,
if (cbuf->cso[i].resource)
continue;
- u_upload_data(ilo->uploader, 0, cbuf->cso[i].info.size,
+ u_upload_data(ilo->uploader, 0, cbuf->cso[i].info.size, 16,
cbuf->cso[i].user_buffer, &offset, &cbuf->cso[i].resource);
cbuf->cso[i].info.vma = ilo_resource_get_vma(cbuf->cso[i].resource);
@@ -426,7 +426,7 @@ finalize_index_buffer(struct ilo_context *ilo)
unsigned hw_offset;
if (vec->ib.state.user_buffer) {
- u_upload_data(ilo->uploader, 0, size,
+ u_upload_data(ilo->uploader, 0, size, 16,
vec->ib.state.user_buffer + offset,
&hw_offset, &vec->ib.hw_resource);
} else {
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index b482fa140ed..7eda6753d0d 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -1010,7 +1010,7 @@ static void r300_render_draw_elements(struct vbuf_render* render,
CS_LOCALS(r300);
DBG(r300, DBG_DRAW, "r300: render_draw_elements (count: %d)\n", count);
- u_upload_data(r300->uploader, 0, count * 2, indices,
+ u_upload_data(r300->uploader, 0, count * 2, 4, indices,
&index_buffer_offset, &index_buffer);
if (!index_buffer) {
return;
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
index 737a6f5e4f8..42c8e3a0fc5 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -42,7 +42,7 @@ void r300_upload_index_buffer(struct r300_context *r300,
*index_buffer = NULL;
u_upload_data(r300->uploader,
- 0, count * index_size,
+ 0, count * index_size, 4,
ptr + (*start * index_size),
&index_offset,
index_buffer);
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 3051c9af09c..c3346f29811 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -1106,10 +1106,10 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint
tmpPtr[i] = util_cpu_to_le32(((uint32_t *)ptr)[i]);
}
- u_upload_data(rctx->b.uploader, 0, size, tmpPtr, &cb->buffer_offset, &cb->buffer);
+ u_upload_data(rctx->b.uploader, 0, size, 256, tmpPtr, &cb->buffer_offset, &cb->buffer);
free(tmpPtr);
} else {
- u_upload_data(rctx->b.uploader, 0, input->buffer_size, ptr, &cb->buffer_offset, &cb->buffer);
+ u_upload_data(rctx->b.uploader, 0, input->buffer_size, 256, ptr, &cb->buffer_offset, &cb->buffer);
}
/* account it in gtt */
rctx->b.gtt += input->buffer_size;
@@ -1753,7 +1753,7 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
if (ib.user_buffer && (R600_BIG_ENDIAN || info.indirect ||
info.instance_count > 1 ||
info.count*ib.index_size > 20)) {
- u_upload_data(rctx->b.uploader, 0, info.count * ib.index_size,
+ u_upload_data(rctx->b.uploader, 0, info.count * ib.index_size, 256,
ib.user_buffer, &ib.offset, &ib.buffer);
ib.user_buffer = NULL;
}
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index d5540bec71d..87a5afbbc97 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -842,7 +842,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
start_offset = start * ib.index_size;
u_upload_data(sctx->b.uploader, start_offset, count * ib.index_size,
- (char*)ib.user_buffer + start_offset,
+ 256, (char*)ib.user_buffer + start_offset,
&ib.offset, &ib.buffer);
if (!ib.buffer)
return;
diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c
index c00855698b8..9b0b540d3fc 100644
--- a/src/gallium/drivers/vc4/vc4_draw.c
+++ b/src/gallium/drivers/vc4/vc4_draw.c
@@ -319,7 +319,7 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
if (vc4->indexbuf.user_buffer) {
prsc = NULL;
u_upload_data(vc4->uploader, 0,
- info->count * index_size,
+ info->count * index_size, 4,
vc4->indexbuf.user_buffer,
&offset, &prsc);
} else {
diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c
index 527f7637cb6..58fe95736d1 100644
--- a/src/gallium/drivers/virgl/virgl_context.c
+++ b/src/gallium/drivers/virgl/virgl_context.c
@@ -605,7 +605,7 @@ static void virgl_draw_vbo(struct pipe_context *ctx,
ib.offset = vctx->index_buffer.offset + info.start * ib.index_size;
if (ib.user_buffer) {
- u_upload_data(vctx->uploader, 0, info.count * ib.index_size,
+ u_upload_data(vctx->uploader, 0, info.count * ib.index_size, 256,
ib.user_buffer, &ib.offset, &ib.buffer);
ib.user_buffer = NULL;
}
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index f14ffea13e1..4e2a03b0eee 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -397,10 +397,9 @@ NineDevice9_ctor( struct NineDevice9 *This,
if (!This->driver_caps.user_ibufs)
This->index_uploader = u_upload_create(This->pipe, 128 * 1024, 4, PIPE_BIND_INDEX_BUFFER);
if (!This->driver_caps.user_cbufs) {
- unsigned alignment = GET_PCAP(CONSTANT_BUFFER_OFFSET_ALIGNMENT);
-
+ This->constbuf_alignment = GET_PCAP(CONSTANT_BUFFER_OFFSET_ALIGNMENT);
This->constbuf_uploader = u_upload_create(This->pipe, This->vs_const_size,
- alignment, PIPE_BIND_CONSTANT_BUFFER);
+ This->constbuf_alignment, PIPE_BIND_CONSTANT_BUFFER);
}
This->driver_caps.window_space_position_support = GET_PCAP(TGSI_VS_WINDOW_SPACE_POSITION);
@@ -2955,6 +2954,7 @@ NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
u_upload_data(This->vertex_uploader,
0,
(info.max_index + 1) * VertexStreamZeroStride, /* XXX */
+ 4,
vtxbuf.user_buffer,
&vtxbuf.buffer_offset,
&vtxbuf.buffer);
@@ -3027,6 +3027,7 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This,
base,
(info.max_index -
info.min_index + 1) * VertexStreamZeroStride, /* XXX */
+ 4,
(const uint8_t *)vbuf.user_buffer + base,
&vbuf.buffer_offset,
&vbuf.buffer);
@@ -3039,6 +3040,7 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This,
u_upload_data(This->index_uploader,
0,
info.count * ibuf.index_size,
+ 4,
ibuf.user_buffer,
&ibuf.offset,
&ibuf.buffer);
diff --git a/src/gallium/state_trackers/nine/device9.h b/src/gallium/state_trackers/nine/device9.h
index 98d9c4df06a..cbc1e61f5db 100644
--- a/src/gallium/state_trackers/nine/device9.h
+++ b/src/gallium/state_trackers/nine/device9.h
@@ -128,6 +128,7 @@ struct NineDevice9
struct u_upload_mgr *vertex_uploader;
struct u_upload_mgr *index_uploader;
struct u_upload_mgr *constbuf_uploader;
+ unsigned constbuf_alignment;
struct nine_range_pool range_pool;
diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c
index fe8933be69a..fe26086ef3d 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -1866,6 +1866,7 @@ nine_ff_update(struct NineDevice9 *device)
u_upload_data(device->constbuf_uploader,
0,
cb.buffer_size,
+ device->constbuf_alignment,
cb.user_buffer,
&cb.buffer_offset,
&cb.buffer);
@@ -1888,6 +1889,7 @@ nine_ff_update(struct NineDevice9 *device)
u_upload_data(device->constbuf_uploader,
0,
cb.buffer_size,
+ device->constbuf_alignment,
cb.user_buffer,
&cb.buffer_offset,
&cb.buffer);
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 558d07a2bd0..aee31622088 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -260,6 +260,7 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device)
u_upload_data(device->constbuf_uploader,
0,
cb.buffer_size,
+ device->constbuf_alignment,
cb.user_buffer,
&cb.buffer_offset,
&cb.buffer);
@@ -336,6 +337,7 @@ prepare_ps_constants_userbuf(struct NineDevice9 *device)
u_upload_data(device->constbuf_uploader,
0,
cb.buffer_size,
+ device->constbuf_alignment,
cb.user_buffer,
&cb.buffer_offset,
&cb.buffer);