diff options
author | Marek Olšák <[email protected]> | 2017-02-17 12:55:24 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-03-01 13:34:40 +0000 |
commit | bc8d047068df9a2a2281b96ffc53885071a930ae (patch) | |
tree | 9e7325f292e48f8a4c9960961f14fc2cd5808517 | |
parent | 91b3b54286709566dd4226480996eddcff85aa82 (diff) |
gallium/u_index_modify: don't add PIPE_TRANSFER_UNSYNCHRONIZED unconditionally
It's OK for r300g (because r300g can't write to buffers via the GPU), but
not later hardware. This issue was spotted randomly.
Cc: [email protected]
Reviewed-by: Nicolai Hähnle <[email protected]>
(cherry picked from commit c8ef5123980f9f538c79e626b0092660a2256ae6)
-rw-r--r-- | src/gallium/auxiliary/util/u_index_modify.c | 9 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_index_modify.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_render_translate.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state_common.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_draw.c | 2 |
5 files changed, 14 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/util/u_index_modify.c b/src/gallium/auxiliary/util/u_index_modify.c index 5c4fc3c05d1..7b072b29a0f 100644 --- a/src/gallium/auxiliary/util/u_index_modify.c +++ b/src/gallium/auxiliary/util/u_index_modify.c @@ -28,6 +28,7 @@ void util_shorten_ubyte_elts_to_userptr(struct pipe_context *context, struct pipe_index_buffer *ib, + unsigned add_transfer_flags, int index_bias, unsigned start, unsigned count, @@ -43,7 +44,7 @@ void util_shorten_ubyte_elts_to_userptr(struct pipe_context *context, } else { in_map = pipe_buffer_map(context, ib->buffer, PIPE_TRANSFER_READ | - PIPE_TRANSFER_UNSYNCHRONIZED, + add_transfer_flags, &src_transfer); } in_map += start; @@ -62,6 +63,7 @@ void util_shorten_ubyte_elts_to_userptr(struct pipe_context *context, void util_rebuild_ushort_elts_to_userptr(struct pipe_context *context, struct pipe_index_buffer *ib, + unsigned add_transfer_flags, int index_bias, unsigned start, unsigned count, void *out) @@ -76,7 +78,7 @@ void util_rebuild_ushort_elts_to_userptr(struct pipe_context *context, } else { in_map = pipe_buffer_map(context, ib->buffer, PIPE_TRANSFER_READ | - PIPE_TRANSFER_UNSYNCHRONIZED, + add_transfer_flags, &in_transfer); } in_map += start; @@ -95,6 +97,7 @@ void util_rebuild_ushort_elts_to_userptr(struct pipe_context *context, void util_rebuild_uint_elts_to_userptr(struct pipe_context *context, struct pipe_index_buffer *ib, + unsigned add_transfer_flags, int index_bias, unsigned start, unsigned count, void *out) @@ -109,7 +112,7 @@ void util_rebuild_uint_elts_to_userptr(struct pipe_context *context, } else { in_map = pipe_buffer_map(context, ib->buffer, PIPE_TRANSFER_READ | - PIPE_TRANSFER_UNSYNCHRONIZED, + add_transfer_flags, &in_transfer); } in_map += start; diff --git a/src/gallium/auxiliary/util/u_index_modify.h b/src/gallium/auxiliary/util/u_index_modify.h index 1d34b12e519..0cfc189ede1 100644 --- a/src/gallium/auxiliary/util/u_index_modify.h +++ b/src/gallium/auxiliary/util/u_index_modify.h @@ -29,6 +29,7 @@ struct pipe_index_buffer; void util_shorten_ubyte_elts_to_userptr(struct pipe_context *context, struct pipe_index_buffer *ib, + unsigned add_transfer_flags, int index_bias, unsigned start, unsigned count, @@ -36,12 +37,14 @@ void util_shorten_ubyte_elts_to_userptr(struct pipe_context *context, void util_rebuild_ushort_elts_to_userptr(struct pipe_context *context, struct pipe_index_buffer *ib, + unsigned add_transfer_flags, int index_bias, unsigned start, unsigned count, void *out); void util_rebuild_uint_elts_to_userptr(struct pipe_context *context, struct pipe_index_buffer *ib, + unsigned add_transfer_flags, int index_bias, unsigned start, unsigned count, void *out); diff --git a/src/gallium/drivers/r300/r300_render_translate.c b/src/gallium/drivers/r300/r300_render_translate.c index 7221211deea..7800f6eea22 100644 --- a/src/gallium/drivers/r300/r300_render_translate.c +++ b/src/gallium/drivers/r300/r300_render_translate.c @@ -41,7 +41,7 @@ void r300_translate_index_buffer(struct r300_context *r300, &out_offset, out_buffer, &ptr); util_shorten_ubyte_elts_to_userptr( - &r300->context, ib, index_offset, + &r300->context, ib, PIPE_TRANSFER_UNSYNCHRONIZED, index_offset, *start, count, ptr); *index_size = 2; @@ -55,6 +55,7 @@ void r300_translate_index_buffer(struct r300_context *r300, &out_offset, out_buffer, &ptr); util_rebuild_ushort_elts_to_userptr(&r300->context, ib, + PIPE_TRANSFER_UNSYNCHRONIZED, index_offset, *start, count, ptr); @@ -69,6 +70,7 @@ void r300_translate_index_buffer(struct r300_context *r300, &out_offset, out_buffer, &ptr); util_rebuild_uint_elts_to_userptr(&r300->context, ib, + PIPE_TRANSFER_UNSYNCHRONIZED, index_offset, *start, count, ptr); diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index a9dbc8bc982..bfeaadcc75d 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -1740,7 +1740,7 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info &out_offset, &out_buffer, &ptr); util_shorten_ubyte_elts_to_userptr( - &rctx->b.b, &ib, 0, ib.offset + start, count, ptr); + &rctx->b.b, &ib, 0, 0, ib.offset + start, count, ptr); pipe_resource_reference(&ib.buffer, NULL); 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 4bd087c8965..2ea11689ebf 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -1069,7 +1069,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) return; } - util_shorten_ubyte_elts_to_userptr(&sctx->b.b, &ib, 0, + util_shorten_ubyte_elts_to_userptr(&sctx->b.b, &ib, 0, 0, ib.offset + start, count, ptr); |