WIP: anv: Emit compute batch when changing from compute to 3d pipeline

Closed Danylo Piliaiev requested to merge GL/mesa:fix/anv-geometry-flickering into master

Without doing this there is a geometry flickering in games which use compute shaders - something goes wrong with binding tables if there is MEDIA_INTERFACE_DESCRIPTOR_LOAD before 3d pipeline.


I'm not sure why it fixes the issue hence the WIP. However I think it is much closer to truth than reemitting binding tables which was previous workaround. @jekstrand

About MEDIA_INTERFACE_DESCRIPTOR_LOAD from my comment in bugzilla

A part of the dispatch which seems to lead to the issue is MEDIA_INTERFACE_DESCRIPTOR_LOAD, commenting out everything unnecessary around doesn't make flickering disappear, the moment MEDIA_INTERFACE_DESCRIPTOR_LOAD is commented out - no flicker.

So the minimal reproduction will be commenting out the dispatch and adding this at the start of cmd_buffer_flush_state:

   if((cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_PIPELINE) &&
      struct anv_pipeline *pipeline = cmd_buffer->state.compute.base.pipeline;
      cmd_buffer->state.pending_pipe_bits |= ANV_PIPE_CS_STALL_BIT;
      anv_batch_emit_batch(&cmd_buffer->batch, &pipeline->batch);

      struct anv_state state =
               GENX(INTERFACE_DESCRIPTOR_DATA_length), 64);

      uint32_t size = GENX(INTERFACE_DESCRIPTOR_DATA_length) * sizeof(uint32_t);
                     GENX(MEDIA_INTERFACE_DESCRIPTOR_LOAD), mid) {
         mid.InterfaceDescriptorTotalLength        = size;
         mid.InterfaceDescriptorDataStartAddress   = 0;

      // Just to be sure...
      cmd_buffer->state.gfx.dirty = ~0;
      cmd_buffer->state.gfx.vb_dirty = ~0;
      cmd_buffer->state.pending_pipe_bits = ~0;
      cmd_buffer->state.descriptors_dirty = ~0;
      cmd_buffer->state.push_constants_dirty = ~0;

Which produces the same issue.

Merge request reports