<div dir="auto"><div dir="auto">It should be fixed with: "[PATCH] radeonsi: fix a regression in si_rebind_buffer"</div><div dir="auto"><br></div><div dir="auto">Marek</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 21, 2019, 6:24 AM Mike Lothian <<a href="mailto:mike@fireburn.co.uk" target="_blank" rel="noreferrer">mike@fireburn.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Can someone with access revert from master until this is fixed? It's<br>
been broken for 3 days now<br>
<br>
On Tue, 21 May 2019 at 09:01, Juan A. Suarez Romero <<a href="mailto:jasuarez@igalia.com" rel="noreferrer noreferrer" target="_blank">jasuarez@igalia.com</a>> wrote:<br>
><br>
> On Tue, 2019-05-21 at 09:36 +0200, Gert Wollny wrote:<br>
> > Hi Marek,<br>
> ><br>
> > it seems that this patch is causing a few issues [1], any idea what is<br>
> > going on? Maybe it is best to revert the patch for now?<br>
> ><br>
> > Best,<br>
> > Gert<br>
> ><br>
><br>
><br>
> As this is commit is causing issues, I'm withdrawing it out of 19.1 branch.<br>
><br>
> If later a fix is provided, let me know so I can re-add it to the branch,<br>
> together with the fix.<br>
><br>
> Thanks.<br>
><br>
> J.A.<br>
><br>
> > [1] <a href="https://bugzilla.freedesktop.org/show_bug.cgi?id=110701" rel="noreferrer noreferrer noreferrer" target="_blank">https://bugzilla.freedesktop.org/show_bug.cgi?id=110701</a><br>
> ><br>
> > On Fr, 2019-05-10 at 01:19 -0400, Marek Olšák wrote:<br>
> > > From: Marek Olšák <<a href="mailto:marek.olsak@amd.com" rel="noreferrer noreferrer" target="_blank">marek.olsak@amd.com</a>><br>
> > ><br>
> > > Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=108824" rel="noreferrer noreferrer noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=108824</a><br>
> > ><br>
> > > Cc: 19.1 <<a href="mailto:mesa-stable@lists.freedesktop.org" rel="noreferrer noreferrer" target="_blank">mesa-stable@lists.freedesktop.org</a>><br>
> > > ---<br>
> > > src/gallium/drivers/radeonsi/si_descriptors.c | 94 ++++++++++++-----<br>
> > > --<br>
> > > src/gallium/drivers/radeonsi/si_pipe.h | 2 +<br>
> > > src/gallium/drivers/radeonsi/si_state_draw.c | 9 +-<br>
> > > 3 files changed, 72 insertions(+), 33 deletions(-)<br>
> > ><br>
> > > diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c<br>
> > > b/src/gallium/drivers/radeonsi/si_descriptors.c<br>
> > > index 744fc9a15d7..6a4dcacc0f3 100644<br>
> > > --- a/src/gallium/drivers/radeonsi/si_descriptors.c<br>
> > > +++ b/src/gallium/drivers/radeonsi/si_descriptors.c<br>
> > > @@ -1580,242 +1580,272 @@ void<br>
> > > si_update_needs_color_decompress_masks(struct si_context *sctx)<br>
> > > si_samplers_update_needs_color_decompress_mask(&sctx-<br>
> > > > samplers[i]);<br>
> > > si_images_update_needs_color_decompress_mask(&sctx-<br>
> > > > images[i]);<br>
> > > si_update_shader_needs_decompress_mask(sctx, i);<br>
> > > }<br>
> > ><br>
> > > si_resident_handles_update_needs_color_decompress(sctx);<br>
> > > }<br>
> > ><br>
> > > /* BUFFER DISCARD/INVALIDATION */<br>
> > ><br>
> > > -/** Reset descriptors of buffer resources after \p buf has been<br>
> > > invalidated. */<br>
> > > +/* Reset descriptors of buffer resources after \p buf has been<br>
> > > invalidated.<br>
> > > + * If buf == NULL, reset all descriptors.<br>
> > > + */<br>
> > > static void si_reset_buffer_resources(struct si_context *sctx,<br>
> > > struct si_buffer_resources<br>
> > > *buffers,<br>
> > > unsigned descriptors_idx,<br>
> > > unsigned slot_mask,<br>
> > > struct pipe_resource *buf,<br>
> > > enum radeon_bo_priority priority)<br>
> > > {<br>
> > > struct si_descriptors *descs = &sctx-<br>
> > > > descriptors[descriptors_idx];<br>
> > > unsigned mask = buffers->enabled_mask & slot_mask;<br>
> > ><br>
> > > while (mask) {<br>
> > > unsigned i = u_bit_scan(&mask);<br>
> > > - if (buffers->buffers[i] == buf) {<br>
> > > - si_set_buf_desc_address(si_resource(buf),<br>
> > > buffers->offsets[i],<br>
> > > + struct pipe_resource *buffer = buffers->buffers[i];<br>
> > > +<br>
> > > + if (buffer && (!buf || buffer == buf)) {<br>
> > > + si_set_buf_desc_address(si_resource(buffer),<br>
> > > buffers->offsets[i],<br>
> > > descs->list + i*4);<br>
> > > sctx->descriptors_dirty |= 1u <<<br>
> > > descriptors_idx;<br>
> > ><br>
> > > radeon_add_to_gfx_buffer_list_check_mem(sctx,<br>
> > > - si_reso<br>
> > > urce(buf),<br>
> > > + si_reso<br>
> > > urce(buffer),<br>
> > > buffers<br>
> > > ->writable_mask & (1u << i) ?<br>
> > ><br>
> > > RADEON_USAGE_READWRITE :<br>
> > ><br>
> > > RADEON_USAGE_READ,<br>
> > > priorit<br>
> > > y, true);<br>
> > > }<br>
> > > }<br>
> > > }<br>
> > ><br>
> > > -/* Update all resource bindings where the buffer is bound, including<br>
> > > +/* Update all buffer bindings where the buffer is bound, including<br>
> > > * all resource descriptors. This is invalidate_buffer without<br>
> > > - * the invalidation. */<br>
> > > + * the invalidation.<br>
> > > + *<br>
> > > + * If buf == NULL, update all buffer bindings.<br>
> > > + */<br>
> > > void si_rebind_buffer(struct si_context *sctx, struct pipe_resource<br>
> > > *buf)<br>
> > > {<br>
> > > struct si_resource *buffer = si_resource(buf);<br>
> > > unsigned i, shader;<br>
> > > unsigned num_elems = sctx->vertex_elements ?<br>
> > > sctx->vertex_elements->count :<br>
> > > 0;<br>
> > ><br>
> > > /* We changed the buffer, now we need to bind it where the old<br>
> > > one<br>
> > > * was bound. This consists of 2 things:<br>
> > > * 1) Updating the resource descriptor and dirtying it.<br>
> > > * 2) Adding a relocation to the CS, so that it's usable.<br>
> > > */<br>
> > ><br>
> > > /* Vertex buffers. */<br>
> > > - if (buffer->bind_history & PIPE_BIND_VERTEX_BUFFER) {<br>
> > > + if (!buffer) {<br>
> > > + if (num_elems)<br>
> > > + sctx->vertex_buffers_dirty = true;<br>
> > > + } else if (buffer->bind_history & PIPE_BIND_VERTEX_BUFFER) {<br>
> > > for (i = 0; i < num_elems; i++) {<br>
> > > int vb = sctx->vertex_elements-<br>
> > > > vertex_buffer_index[i];<br>
> > ><br>
> > > if (vb >= ARRAY_SIZE(sctx->vertex_buffer))<br>
> > > continue;<br>
> > > if (!sctx->vertex_buffer[vb].buffer.resource)<br>
> > > continue;<br>
> > ><br>
> > > if (sctx->vertex_buffer[vb].buffer.resource ==<br>
> > > buf) {<br>
> > > sctx->vertex_buffers_dirty = true;<br>
> > > break;<br>
> > > }<br>
> > > }<br>
> > > }<br>
> > ><br>
> > > /* Streamout buffers. (other internal buffers can't be<br>
> > > invalidated) */<br>
> > > - if (buffer->bind_history & PIPE_BIND_STREAM_OUTPUT) {<br>
> > > + if (!buffer || buffer->bind_history & PIPE_BIND_STREAM_OUTPUT)<br>
> > > {<br>
> > > for (i = SI_VS_STREAMOUT_BUF0; i <=<br>
> > > SI_VS_STREAMOUT_BUF3; i++) {<br>
> > > struct si_buffer_resources *buffers = &sctx-<br>
> > > > rw_buffers;<br>
> > > struct si_descriptors *descs =<br>
> > > &sctx-<br>
> > > > descriptors[SI_DESCS_RW_BUFFERS];<br>
> > > + struct pipe_resource *buffer = buffers-<br>
> > > > buffers[i];<br>
> > ><br>
> > > - if (buffers->buffers[i] != buf)<br>
> > > + if (!buffer || (buf && buffer != buf))<br>
> > > continue;<br>
> > ><br>
> > > - si_set_buf_desc_address(si_resource(buf),<br>
> > > buffers->offsets[i],<br>
> > > + si_set_buf_desc_address(si_resource(buffer),<br>
> > > buffers->offsets[i],<br>
> > > descs->list + i*4);<br>
> > > sctx->descriptors_dirty |= 1u <<<br>
> > > SI_DESCS_RW_BUFFERS;<br>
> > ><br>
> > > radeon_add_to_gfx_buffer_list_check_mem(sctx,<br>
> > > - buffer,<br>
> > > RADEON_USAGE_WRITE,<br>
> > > + si_reso<br>
> > > urce(buffer),<br>
> > > + RADEON_<br>
> > > USAGE_WRITE,<br>
> > > RADEON_<br>
> > > PRIO_SHADER_RW_BUFFER,<br>
> > > true);<br>
> > ><br>
> > > /* Update the streamout state. */<br>
> > > if (sctx->streamout.begin_emitted)<br>
> > > si_emit_streamout_end(sctx);<br>
> > > sctx->streamout.append_bitmask =<br>
> > > sctx->streamout.enabled_mask;<br>
> > > si_streamout_buffers_dirty(sctx);<br>
> > > }<br>
> > > }<br>
> > ><br>
> > > /* Constant and shader buffers. */<br>
> > > - if (buffer->bind_history & PIPE_BIND_CONSTANT_BUFFER) {<br>
> > > + if (!buffer || buffer->bind_history &<br>
> > > PIPE_BIND_CONSTANT_BUFFER) {<br>
> > > for (shader = 0; shader < SI_NUM_SHADERS; shader++)<br>
> > > si_reset_buffer_resources(sctx, &sctx-<br>
> > > > const_and_shader_buffers[shader],<br>
> > > si_const_and_shader_b<br>
> > > uffer_descriptors_idx(shader),<br>
> > > u_bit_consecutive(SI_<br>
> > > NUM_SHADER_BUFFERS, SI_NUM_CONST_BUFFERS),<br>
> > > buf,<br>
> > > sctx-<br>
> > > > const_and_shader_buffers[shader].priority_constbuf);<br>
> > > }<br>
> > ><br>
> > > - if (buffer->bind_history & PIPE_BIND_SHADER_BUFFER) {<br>
> > > + if (!buffer || buffer->bind_history & PIPE_BIND_SHADER_BUFFER)<br>
> > > {<br>
> > > for (shader = 0; shader < SI_NUM_SHADERS; shader++)<br>
> > > si_reset_buffer_resources(sctx, &sctx-<br>
> > > > const_and_shader_buffers[shader],<br>
> > > si_const_and_shader_b<br>
> > > uffer_descriptors_idx(shader),<br>
> > > u_bit_consecutive(0,<br>
> > > SI_NUM_SHADER_BUFFERS),<br>
> > > buf,<br>
> > > sctx-<br>
> > > > const_and_shader_buffers[shader].priority);<br>
> > > }<br>
> > ><br>
> > > - if (buffer->bind_history & PIPE_BIND_SAMPLER_VIEW) {<br>
> > > + if (!buffer || buffer->bind_history & PIPE_BIND_SAMPLER_VIEW) {<br>
> > > /* Texture buffers - update bindings. */<br>
> > > for (shader = 0; shader < SI_NUM_SHADERS; shader++) {<br>
> > > struct si_samplers *samplers = &sctx-<br>
> > > > samplers[shader];<br>
> > > struct si_descriptors *descs =<br>
> > > si_sampler_and_image_descriptors(sctx,<br>
> > > shader);<br>
> > > unsigned mask = samplers->enabled_mask;<br>
> > ><br>
> > > while (mask) {<br>
> > > unsigned i = u_bit_scan(&mask);<br>
> > > - if (samplers->views[i]->texture == buf)<br>
> > > {<br>
> > > + struct pipe_resource *buffer =<br>
> > > samplers->views[i]->texture;<br>
> > > +<br>
> > > + if (buffer && (!buf || buffer == buf))<br>
> > > {<br>
> > > unsigned desc_slot =<br>
> > > si_get_sampler_slot(i);<br>
> > ><br>
> > > - si_set_buf_desc_address(si_reso<br>
> > > urce(buf),<br>
> > > + si_set_buf_desc_address(si_reso<br>
> > > urce(buffer),<br>
> > > sampler<br>
> > > s->views[i]->u.buf.offset,<br>
> > > descs-<br>
> > > > list + desc_slot * 16 + 4);<br>
> > > sctx->descriptors_dirty |=<br>
> > > 1u <<<br>
> > > si_sampler_and_image_descriptors_idx(shader);<br>
> > ><br>
> > > - radeon_add_to_gfx_buffer_list_c<br>
> > > heck_mem(sctx,<br>
> > > -<br>
> > > buffer, RADEON_USAGE_READ,<br>
> > > -<br>
> > > RADEON_PRIO_SAMPLER_BUFFER,<br>
> > > -<br>
> > > true);<br>
> > > + radeon_add_to_gfx_buffer_list_c<br>
> > > heck_mem(<br>
> > > + sctx,<br>
> > > si_resource(buffer),<br>
> > > + RADEON_USAGE_READ,<br>
> > > + RADEON_PRIO_SAMPLER_BUF<br>
> > > FER, true);<br>
> > > }<br>
> > > }<br>
> > > }<br>
> > > }<br>
> > ><br>
> > > /* Shader images */<br>
> > > - if (buffer->bind_history & PIPE_BIND_SHADER_IMAGE) {<br>
> > > + if (!buffer || buffer->bind_history & PIPE_BIND_SHADER_IMAGE) {<br>
> > > for (shader = 0; shader < SI_NUM_SHADERS; ++shader) {<br>
> > > struct si_images *images = &sctx-<br>
> > > > images[shader];<br>
> > > struct si_descriptors *descs =<br>
> > > si_sampler_and_image_descriptors(sctx,<br>
> > > shader);<br>
> > > unsigned mask = images->enabled_mask;<br>
> > ><br>
> > > while (mask) {<br>
> > > unsigned i = u_bit_scan(&mask);<br>
> > > + struct pipe_resource *buffer = images-<br>
> > > > views[i].resource;<br>
> > ><br>
> > > - if (images->views[i].resource == buf) {<br>
> > > + if (buffer && (!buf || buffer == buf))<br>
> > > {<br>
> > > unsigned desc_slot =<br>
> > > si_get_image_slot(i);<br>
> > ><br>
> > > if (images->views[i].access &<br>
> > > PIPE_IMAGE_ACCESS_WRITE)<br>
> > > si_mark_image_range_val<br>
> > > id(&images->views[i]);<br>
> > ><br>
> > > - si_set_buf_desc_address(si_reso<br>
> > > urce(buf),<br>
> > > + si_set_buf_desc_address(si_reso<br>
> > > urce(buffer),<br>
> > > images-<br>
> > > > views[i].u.buf.offset,<br>
> > > descs-<br>
> > > > list + desc_slot * 8 + 4);<br>
> > > sctx->descriptors_dirty |=<br>
> > > 1u <<<br>
> > > si_sampler_and_image_descriptors_idx(shader);<br>
> > ><br>
> > > radeon_add_to_gfx_buffer_list_c<br>
> > > heck_mem(<br>
> > > - sctx, buffer,<br>
> > > + sctx,<br>
> > > si_resource(buffer),<br>
> > > RADEON_USAGE_READWRITE,<br>
> > > RADEON_PRIO_SAMPLER_BUF<br>
> > > FER, true);<br>
> > > }<br>
> > > }<br>
> > > }<br>
> > > }<br>
> > ><br>
> > > /* Bindless texture handles */<br>
> > > - if (buffer->texture_handle_allocated) {<br>
> > > + if (!buffer || buffer->texture_handle_allocated) {<br>
> > > struct si_descriptors *descs = &sctx-<br>
> > > > bindless_descriptors;<br>
> > ><br>
> > > util_dynarray_foreach(&sctx->resident_tex_handles,<br>
> > > struct si_texture_handle *,<br>
> > > tex_handle) {<br>
> > > struct pipe_sampler_view *view = (*tex_handle)-<br>
> > > > view;<br>
> > > unsigned desc_slot = (*tex_handle)->desc_slot;<br>
> > > + struct pipe_resource *buffer = view->texture;<br>
> > ><br>
> > > - if (view->texture == buf) {<br>
> > > - si_set_buf_desc_address(buffer,<br>
> > > + if (buffer && (!buf || buffer == buf)) {<br>
> > > + si_set_buf_desc_address(si_resource(buf<br>
> > > fer),<br>
> > > view-<br>
> > > > u.buf.offset,<br>
> > > descs->list +<br>
> > > desc_slot * 16<br>
> > > + 4);<br>
> > ><br>
> > > (*tex_handle)->desc_dirty = true;<br>
> > > sctx->bindless_descriptors_dirty =<br>
> > > true;<br>
> > ><br>
> > > radeon_add_to_gfx_buffer_list_check_mem<br>
> > > (<br>
> > > - sctx, buffer,<br>
> > > + sctx, si_resource(buffer),<br>
> > > RADEON_USAGE_READ,<br>
> > > RADEON_PRIO_SAMPLER_BUFFER,<br>
> > > true);<br>
> > > }<br>
> > > }<br>
> > > }<br>
> > ><br>
> > > /* Bindless image handles */<br>
> > > - if (buffer->image_handle_allocated) {<br>
> > > + if (!buffer || buffer->image_handle_allocated) {<br>
> > > struct si_descriptors *descs = &sctx-<br>
> > > > bindless_descriptors;<br>
> > ><br>
> > > util_dynarray_foreach(&sctx->resident_img_handles,<br>
> > > struct si_image_handle *,<br>
> > > img_handle) {<br>
> > > struct pipe_image_view *view = &(*img_handle)-<br>
> > > > view;<br>
> > > unsigned desc_slot = (*img_handle)->desc_slot;<br>
> > > + struct pipe_resource *buffer = view->resource;<br>
> > ><br>
> > > - if (view->resource == buf) {<br>
> > > + if (buffer && (!buf || buffer == buf)) {<br>
> > > if (view->access &<br>
> > > PIPE_IMAGE_ACCESS_WRITE)<br>
> > > si_mark_image_range_valid(view)<br>
> > > ;<br>
> > ><br>
> > > - si_set_buf_desc_address(buffer,<br>
> > > + si_set_buf_desc_address(si_resource(buf<br>
> > > fer),<br>
> > > view-<br>
> > > > u.buf.offset,<br>
> > > descs->list +<br>
> > > desc_slot * 16<br>
> > > + 4);<br>
> > ><br>
> > > (*img_handle)->desc_dirty = true;<br>
> > > sctx->bindless_descriptors_dirty =<br>
> > > true;<br>
> > ><br>
> > > radeon_add_to_gfx_buffer_list_check_mem<br>
> > > (<br>
> > > - sctx, buffer,<br>
> > > + sctx, si_resource(buffer),<br>
> > > RADEON_USAGE_READWRITE,<br>
> > > RADEON_PRIO_SAMPLER_BUFFER,<br>
> > > true);<br>
> > > }<br>
> > > }<br>
> > > }<br>
> > > +<br>
> > > + if (buffer) {<br>
> > > + /* Do the same for other contexts. They will invoke<br>
> > > this function<br>
> > > + * with buffer == NULL.<br>
> > > + */<br>
> > > + unsigned new_counter = p_atomic_inc_return(&sctx-<br>
> > > > screen->dirty_buf_counter);<br>
> > > +<br>
> > > + /* Skip the update for the current context, because we<br>
> > > have already updated<br>
> > > + * the buffer bindings.<br>
> > > + */<br>
> > > + if (new_counter == sctx->last_dirty_buf_counter + 1)<br>
> > > + sctx->last_dirty_buf_counter = new_counter;<br>
> > > + }<br>
> > > }<br>
> > ><br>
> > > static void si_upload_bindless_descriptor(struct si_context *sctx,<br>
> > > unsigned desc_slot,<br>
> > > unsigned num_dwords)<br>
> > > {<br>
> > > struct si_descriptors *desc = &sctx->bindless_descriptors;<br>
> > > unsigned desc_slot_offset = desc_slot * 16;<br>
> > > uint32_t *data;<br>
> > > uint64_t va;<br>
> > > diff --git a/src/gallium/drivers/radeonsi/si_pipe.h<br>
> > > b/src/gallium/drivers/radeonsi/si_pipe.h<br>
> > > index d3ddb912245..949fa0755cb 100644<br>
> > > --- a/src/gallium/drivers/radeonsi/si_pipe.h<br>
> > > +++ b/src/gallium/drivers/radeonsi/si_pipe.h<br>
> > > @@ -519,20 +519,21 @@ struct si_screen {<br>
> > > struct si_perfcounters *perfcounters;<br>
> > ><br>
> > > /* If pipe_screen wants to recompute and re-emit the<br>
> > > framebuffer,<br>
> > > * sampler, and image states of all contexts, it should<br>
> > > atomically<br>
> > > * increment this.<br>
> > > *<br>
> > > * Each context will compare this with its own last known value<br>
> > > of<br>
> > > * the counter before drawing and re-emit the states<br>
> > > accordingly.<br>
> > > */<br>
> > > unsigned dirty_tex_counter;<br>
> > > + unsigned dirty_buf_counter;<br>
> > ><br>
> > > /* Atomically increment this counter when an existing texture's<br>
> > > * metadata is enabled or disabled in a way that requires<br>
> > > changing<br>
> > > * contexts' compressed texture binding masks.<br>
> > > */<br>
> > > unsigned compressed_colortex_counter;<br>
> > ><br>
> > > struct {<br>
> > > /* Context flags to set so that all writes from earlier<br>
> > > jobs<br>
> > > * in the CP are seen by L2 clients.<br>
> > > @@ -845,20 +846,21 @@ struct si_context {<br>
> > ><br>
> > > bool has_graphics;<br>
> > > bool gfx_flush_in_progress:1;<br>
> > > bool gfx_last_ib_is_busy:1;<br>
> > > bool compute_is_busy:1;<br>
> > ><br>
> > > unsigned num_gfx_cs_flushes;<br>
> > > unsigned initial_gfx_cs_size;<br>
> > > unsigned gpu_reset_counter;<br>
> > > unsigned last_dirty_tex_counter;<br>
> > > + unsigned last_dirty_buf_counter;<br>
> > > unsigned last_compressed_colortex_counter;<br>
> > > unsigned last_num_draw_calls;<br>
> > > unsigned flags; /* flush flags */<br>
> > > /* Current unaccounted memory usage. */<br>
> > > uint64_t vram;<br>
> > > uint64_t gtt;<br>
> > ><br>
> > > /* Atoms (direct states). */<br>
> > > union si_state_atoms atoms;<br>
> > > unsigned dirty_atoms; /* mask */<br>
> > > diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c<br>
> > > b/src/gallium/drivers/radeonsi/si_state_draw.c<br>
> > > index 8e01e1b35e1..d9dfef0a381 100644<br>
> > > --- a/src/gallium/drivers/radeonsi/si_state_draw.c<br>
> > > +++ b/src/gallium/drivers/radeonsi/si_state_draw.c<br>
> > > @@ -1247,21 +1247,21 @@ static void si_emit_all_states(struct<br>
> > > si_context *sctx, const struct pipe_draw_i<br>
> > > /* Emit draw states. */<br>
> > > si_emit_vs_state(sctx, info);<br>
> > > si_emit_draw_registers(sctx, info, num_patches);<br>
> > > }<br>
> > ><br>
> > > static void si_draw_vbo(struct pipe_context *ctx, const struct<br>
> > > pipe_draw_info *info)<br>
> > > {<br>
> > > struct si_context *sctx = (struct si_context *)ctx;<br>
> > > struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;<br>
> > > struct pipe_resource *indexbuf = info->index.resource;<br>
> > > - unsigned dirty_tex_counter;<br>
> > > + unsigned dirty_tex_counter, dirty_buf_counter;<br>
> > > enum pipe_prim_type rast_prim;<br>
> > > unsigned index_size = info->index_size;<br>
> > > unsigned index_offset = info->indirect ? info->start *<br>
> > > index_size : 0;<br>
> > ><br>
> > > if (likely(!info->indirect)) {<br>
> > > /* SI-CI treat instance_count==0 as instance_count==1.<br>
> > > There is<br>
> > > * no workaround for indirect draws, but we can at<br>
> > > least skip<br>
> > > * direct draws.<br>
> > > */<br>
> > > if (unlikely(!info->instance_count))<br>
> > > @@ -1285,20 +1285,27 @@ static void si_draw_vbo(struct pipe_context<br>
> > > *ctx, const struct pipe_draw_info *i<br>
> > > dirty_tex_counter = p_atomic_read(&sctx->screen-<br>
> > > > dirty_tex_counter);<br>
> > > if (unlikely(dirty_tex_counter != sctx-<br>
> > > > last_dirty_tex_counter)) {<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>
> > > + dirty_buf_counter = p_atomic_read(&sctx->screen-<br>
> > > > dirty_buf_counter);<br>
> > > + if (unlikely(dirty_buf_counter != sctx-<br>
> > > > last_dirty_buf_counter)) {<br>
> > > + sctx->last_dirty_buf_counter = dirty_buf_counter;<br>
> > > + /* Rebind all buffers unconditionally. */<br>
> > > + si_rebind_buffer(sctx, NULL);<br>
> > > + }<br>
> > > +<br>
> > > si_decompress_textures(sctx, u_bit_consecutive(0,<br>
> > > SI_NUM_GRAPHICS_SHADERS));<br>
> > ><br>
> > > /* Set the rasterization primitive type.<br>
> > > *<br>
> > > * This must be done after si_decompress_textures, which can<br>
> > > call<br>
> > > * draw_vbo recursively, and before si_update_shaders, which<br>
> > > 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>
> ><br>
> > _______________________________________________<br>
> > mesa-dev mailing list<br>
> > <a href="mailto:mesa-dev@lists.freedesktop.org" rel="noreferrer noreferrer" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
> > <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
><br>
</blockquote></div></div>