<div dir="auto">R-b</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 24, 2019, 11:36 PM Marek Olšák <<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Marek Olšák <<a href="mailto:marek.olsak@amd.com" target="_blank" rel="noreferrer">marek.olsak@amd.com</a>><br>
<br>
need_cs_space may clear the buffer list.<br>
<br>
Fixes: 951d60f8cdc88 "radeonsi: delay adding BOs at the beginning of IBs until the first draw"<br>
---<br>
src/gallium/drivers/radeonsi/si_compute.c | 6 +++---<br>
src/gallium/drivers/radeonsi/si_state_draw.c | 6 +++---<br>
2 files changed, 6 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c<br>
index 2f444a3a1b8..541d7e6f118 100644<br>
--- a/src/gallium/drivers/radeonsi/si_compute.c<br>
+++ b/src/gallium/drivers/radeonsi/si_compute.c<br>
@@ -878,40 +878,40 @@ static void si_launch_grid(<br>
<br>
if (sctx->has_graphics) {<br>
if (sctx->last_num_draw_calls != sctx->num_draw_calls) {<br>
si_update_fb_dirtiness_after_rendering(sctx);<br>
sctx->last_num_draw_calls = sctx->num_draw_calls;<br>
}<br>
<br>
si_decompress_textures(sctx, 1 << PIPE_SHADER_COMPUTE);<br>
}<br>
<br>
- if (sctx->bo_list_add_all_compute_resources)<br>
- si_compute_resources_add_all_to_bo_list(sctx);<br>
-<br>
/* Add buffer sizes for memory checking in need_cs_space. */<br>
si_context_add_resource_size(sctx, &program->shader.bo->b.b);<br>
/* TODO: add the scratch buffer */<br>
<br>
if (info->indirect) {<br>
si_context_add_resource_size(sctx, info->indirect);<br>
<br>
/* Indirect buffers use TC L2 on GFX9, but not older hw. */<br>
if (sctx->chip_class <= VI &&<br>
si_resource(info->indirect)->TC_L2_dirty) {<br>
sctx->flags |= SI_CONTEXT_WRITEBACK_GLOBAL_L2;<br>
si_resource(info->indirect)->TC_L2_dirty = false;<br>
}<br>
}<br>
<br>
si_need_gfx_cs_space(sctx);<br>
<br>
+ if (sctx->bo_list_add_all_compute_resources)<br>
+ si_compute_resources_add_all_to_bo_list(sctx);<br>
+<br>
if (!sctx->cs_shader_state.initialized)<br>
si_initialize_compute(sctx);<br>
<br>
if (sctx->flags)<br>
si_emit_cache_flush(sctx);<br>
<br>
if (!si_switch_compute_shader(sctx, program, &program->shader,<br>
code_object, info->pc))<br>
return;<br>
<br>
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c<br>
index d2c74152337..8e01e1b35e1 100644<br>
--- a/src/gallium/drivers/radeonsi/si_state_draw.c<br>
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c<br>
@@ -1287,23 +1287,20 @@ static void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *i<br>
sctx->last_dirty_tex_counter = dirty_tex_counter;<br>
sctx->framebuffer.dirty_cbufs |=<br>
((1 << sctx->framebuffer.state.nr_cbufs) - 1);<br>
sctx->framebuffer.dirty_zsbuf = true;<br>
si_mark_atom_dirty(sctx, &sctx->atoms.s.framebuffer);<br>
si_update_all_texture_descriptors(sctx);<br>
}<br>
<br>
si_decompress_textures(sctx, u_bit_consecutive(0, SI_NUM_GRAPHICS_SHADERS));<br>
<br>
- if (sctx->bo_list_add_all_gfx_resources)<br>
- si_gfx_resources_add_all_to_bo_list(sctx);<br>
-<br>
/* Set the rasterization primitive type.<br>
*<br>
* This must be done after si_decompress_textures, which can call<br>
* draw_vbo recursively, and before si_update_shaders, which uses<br>
* current_rast_prim for this draw_vbo call. */<br>
if (sctx->gs_shader.cso)<br>
rast_prim = sctx->gs_shader.cso->gs_output_prim;<br>
else if (sctx->tes_shader.cso) {<br>
if (sctx->tes_shader.cso->info.properties[TGSI_PROPERTY_TES_POINT_MODE])<br>
rast_prim = PIPE_PRIM_POINTS;<br>
@@ -1431,20 +1428,23 @@ static void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *i<br>
if (indirect->indirect_draw_count &&<br>
si_resource(indirect->indirect_draw_count)->TC_L2_dirty) {<br>
sctx->flags |= SI_CONTEXT_WRITEBACK_GLOBAL_L2;<br>
si_resource(indirect->indirect_draw_count)->TC_L2_dirty = false;<br>
}<br>
}<br>
}<br>
<br>
si_need_gfx_cs_space(sctx);<br>
<br>
+ if (sctx->bo_list_add_all_gfx_resources)<br>
+ si_gfx_resources_add_all_to_bo_list(sctx);<br>
+<br>
/* Since we've called si_context_add_resource_size for vertex buffers,<br>
* this must be called after si_need_cs_space, because we must let<br>
* need_cs_space flush before we add buffers to the buffer list.<br>
*/<br>
if (!si_upload_vertex_buffer_descriptors(sctx))<br>
goto return_cleanup;<br>
<br>
/* Vega10/Raven scissor bug workaround. When any context register is<br>
* written (i.e. the GPU rolls the context), PA_SC_VPORT_SCISSOR<br>
* registers must be written too.<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank" rel="noreferrer">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a></blockquote></div>