Skip to content

Commit 450ad16

Browse files
Patrick Lerda1ace
authored andcommitted
r600: fix vertex state update clover regression
This change handles the case when "vertex_fetch_shader.cso" is null, it implements the previous behavior in this specific case. This situation is happening with clover. For instance, this issue is triggered with "piglit/bin/cl-custom-buffer-flags": ==6467==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000000c (pc 0x7ff92908fe6e bp 0x7ffe86ae5ad0 sp 0x7ffe86ae5a30 T0) ==6467==The signal is caused by a READ memory access. ==6467==Hint: address points to the zero page. #0 0x7ff92908fe6e in evergreen_emit_vertex_buffers ../src/gallium/drivers/r600/evergreen_state.c:2123 #1 0x7ff92908444b in r600_emit_atom ../src/gallium/drivers/r600/r600_pipe.h:627 #2 0x7ff92908444b in compute_emit_cs ../src/gallium/drivers/r600/evergreen_compute.c:798 #3 0x7ff92908444b in evergreen_launch_grid ../src/gallium/drivers/r600/evergreen_compute.c:927 #4 0x7ff9349f9350 in clover::kernel::launch(clover::command_queue&, std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&) ../src/gallium/frontends/clover/core/kernel.cpp:105 #5 0x7ff9349c331d in std::function<void (clover::event&)>::operator()(clover::event&) const /usr/include/c++/11.4.0/bits/std_function.h:590 #6 0x7ff9349c331d in clover::event::trigger() ../src/gallium/frontends/clover/core/event.cpp:54 #7 0x7ff9349c82f1 in clover::hard_event::hard_event(clover::command_queue&, unsigned int, clover::ref_vector<clover::event> const&, std::function<void (clover::event&)>) ../src/gallium/frontends/clover/core/event.cpp:138 #8 0x7ff9348daa47 in create<clover::hard_event, clover::command_queue&, int, clover::ref_vector<clover::event>&, clEnqueueNDRangeKernel(cl_command_queue, cl_kernel, cl_uint, const size_t*, const size_t*, const size_t*, cl_uint, _cl_event* const*, _cl_event**)::<lambda(clover::event&)> > ../src/gallium/frontends/clover/util/pointer.hpp:241 #9 0x7ff9348daa47 in clEnqueueNDRangeKernel ../src/gallium/frontends/clover/api/kernel.cpp:334 Fixes: 659b7eb ("r600: better tracking for vertex buffer emission") Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10079 Signed-off-by: Patrick Lerda <patrick9876@free.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29163> (cherry picked from commit f8a1d9f)
1 parent 331d440 commit 450ad16

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

.pick_status.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@
594594
"description": "r600: fix vertex state update clover regression",
595595
"nominated": true,
596596
"nomination_type": 1,
597-
"resolution": 0,
597+
"resolution": 1,
598598
"main_sha": null,
599599
"because_sha": "659b7eb2799bccfff817961518d0ff2ab9e65bca",
600600
"notes": null

src/gallium/drivers/r600/evergreen_state.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,7 +2137,8 @@ static void evergreen_emit_vertex_buffers(struct r600_context *rctx,
21372137
{
21382138
struct radeon_cmdbuf *cs = &rctx->b.gfx.cs;
21392139
struct r600_fetch_shader *shader = (struct r600_fetch_shader*)rctx->vertex_fetch_shader.cso;
2140-
uint32_t dirty_mask = state->dirty_mask & shader->buffer_mask;
2140+
uint32_t buffer_mask = shader ? shader->buffer_mask : ~0;
2141+
uint32_t dirty_mask = state->dirty_mask & buffer_mask;
21412142

21422143
while (dirty_mask) {
21432144
struct pipe_vertex_buffer *vb;
@@ -2176,7 +2177,7 @@ static void evergreen_emit_vertex_buffers(struct r600_context *rctx,
21762177
radeon_emit(cs, radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, rbuffer,
21772178
RADEON_USAGE_READ | RADEON_PRIO_VERTEX_BUFFER));
21782179
}
2179-
state->dirty_mask &= ~shader->buffer_mask;
2180+
state->dirty_mask &= ~buffer_mask;
21802181
}
21812182

21822183
static void evergreen_fs_emit_vertex_buffers(struct r600_context *rctx, struct r600_atom * atom)

0 commit comments

Comments
 (0)