<div dir="auto">Oops. No, r-b</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 19, 2019, 9:48 AM Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <div class="m_-7423817597569915536moz-cite-prefix">On 6/17/19 12:24 PM, Bas Nieuwenhuizen
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div dir="ltr"><br>
        </div>
        <div dir="auto"><br>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">On Thu, Jun 13, 2019, 3:42
              PM Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com" target="_blank" rel="noreferrer">samuel.pitoiset@gmail.com</a>>
              wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This allows us to
              disable the FMASK decompress pass when<br>
              transitioning from CB writes to shader reads.<br>
              <br>
              This will likely be improved and enabled by default in the
              future.<br>
              <br>
              No CTS regressions on GFX8 but a few number of multisample
              CTS<br>
              failures on GFX9 (they look related to the small hint).<br>
              <br>
              Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com" rel="noreferrer noreferrer" target="_blank">samuel.pitoiset@gmail.com</a>><br>
              ---<br>
               src/amd/vulkan/radv_cmd_buffer.c      |  9 ++++++<br>
               src/amd/vulkan/radv_debug.h           |  1 +<br>
               src/amd/vulkan/radv_device.c          | 15 ++++++++++<br>
               src/amd/vulkan/radv_image.c           | 42
              +++++++++++++++++++++++++++<br>
               src/amd/vulkan/radv_meta.h            | 26
              +++++++++++++++++<br>
               src/amd/vulkan/radv_meta_fast_clear.c |  2 +-<br>
               src/amd/vulkan/radv_private.h         | 10 +++++++<br>
               7 files changed, 104 insertions(+), 1 deletion(-)<br>
              <br>
              diff --git a/src/amd/vulkan/radv_cmd_buffer.c
              b/src/amd/vulkan/radv_cmd_buffer.c<br>
              index 2fd5f8b7a07..bf208899887 100644<br>
              --- a/src/amd/vulkan/radv_cmd_buffer.c<br>
              +++ b/src/amd/vulkan/radv_cmd_buffer.c<br>
              @@ -1254,6 +1254,15 @@ radv_emit_fb_color_state(struct
              radv_cmd_buffer *cmd_buffer,<br>
                              cb_color_info &= C_028C70_DCC_ENABLE;<br>
                      }<br>
              <br>
              +       if (radv_image_is_tc_compat_cmask(image)
              &&<br>
              +           (radv_is_fmask_decompress_pipeline(cmd_buffer)
              ||<br>
              +            radv_is_dcc_decompress_pipeline(cmd_buffer)))
              {<br>
              +               /* If this bit is set, the FMASK
              decompression operation<br>
              +                * doesn't occur (DCC_COMPRESS also
              implies FMASK_DECOMPRESS).<br>
              +                */<br>
              +               cb_color_info &=
              C_028C70_FMASK_COMPRESS_1FRAG_ONLY;<br>
              +       }<br>
              +<br>
                      if
              (cmd_buffer->device->physical_device->rad_info.chip_class
              >= GFX9) {<br>
                             
              radeon_set_context_reg_seq(cmd_buffer->cs,
              R_028C60_CB_COLOR0_BASE + index * 0x3c, 11);<br>
                              radeon_emit(cmd_buffer->cs,
              cb->cb_color_base);<br>
              diff --git a/src/amd/vulkan/radv_debug.h
              b/src/amd/vulkan/radv_debug.h<br>
              index 652a3b677d2..29793e549ce 100644<br>
              --- a/src/amd/vulkan/radv_debug.h<br>
              +++ b/src/amd/vulkan/radv_debug.h<br>
              @@ -61,6 +61,7 @@ enum {<br>
                      RADV_PERFTEST_OUT_OF_ORDER   =   0x8,<br>
                      RADV_PERFTEST_DCC_MSAA       =  0x10,<br>
                      RADV_PERFTEST_BO_LIST        =  0x20,<br>
              +       RADV_PERFTEST_TC_COMPAT_CMASK = 0x40,<br>
               };<br>
              <br>
               bool<br>
              diff --git a/src/amd/vulkan/radv_device.c
              b/src/amd/vulkan/radv_device.c<br>
              index 3b69e457496..b75ce59dfc3 100644<br>
              --- a/src/amd/vulkan/radv_device.c<br>
              +++ b/src/amd/vulkan/radv_device.c<br>
              @@ -479,6 +479,7 @@ static const struct debug_control
              radv_perftest_options[] = {<br>
                      {"localbos", RADV_PERFTEST_LOCAL_BOS},<br>
                      {"dccmsaa", RADV_PERFTEST_DCC_MSAA},<br>
                      {"bolist", RADV_PERFTEST_BO_LIST},<br>
              +       {"tccompatcmask", RADV_PERFTEST_TC_COMPAT_CMASK},<br>
                      {NULL, 0}<br>
               };<br>
              <br>
              @@ -4389,6 +4390,20 @@
              radv_initialise_color_surface(struct radv_device *device,<br>
                                      unsigned fmask_bankh =
              util_logbase2(iview->image->fmask.bank_height);<br>
                                      cb->cb_color_attrib |=
              S_028C74_FMASK_BANK_HEIGHT(fmask_bankh);<br>
                              }<br>
              +<br>
              +               if
              (radv_image_is_tc_compat_cmask(iview->image)) {<br>
              +                       /* Allow the texture block to read
              FMASK directly<br>
              +                        * without decompressing it. This
              bit must be cleared<br>
              +                        * when performing
              FMASK_DECOMPRESS or DCC_COMPRESS,<br>
              +                        * otherwise the operation doesn't
              happen.<br>
              +                        */<br>
              +                       cb->cb_color_info |=
              S_028C70_FMASK_COMPRESS_1FRAG_ONLY(1);<br>
              +<br>
              +                       /* Set CMASK into a tiling format
              that allows the<br>
              +                        * texture block to read it.<br>
              +                        */<br>
              +                       cb->cb_color_info |=
              S_028C70_CMASK_ADDR_TYPE(2);<br>
              +               }<br>
                      }<br>
              <br>
                      if (radv_image_has_cmask(iview->image)
              &&<br>
              diff --git a/src/amd/vulkan/radv_image.c
              b/src/amd/vulkan/radv_image.c<br>
              index d8dc2dfabde..c58c08fca59 100644<br>
              --- a/src/amd/vulkan/radv_image.c<br>
              +++ b/src/amd/vulkan/radv_image.c<br>
              @@ -219,6 +219,29 @@ radv_use_dcc_for_image(struct
              radv_device *device,<br>
                      return true;<br>
               }<br>
              <br>
              +static bool<br>
              +radv_use_tc_compat_cmask_for_image(struct radv_device
              *device,<br>
              +                                  struct radv_image
              *image)<br>
              +{</blockquote>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              +       if (!(device->instance->perftest_flags &
              RADV_PERFTEST_TC_COMPAT_CMASK))<br>
              +               return false;<br>
              +<br>
              +       /* TC-compat CMASK is only available for GFX8+. */<br>
              +       if
              (device->physical_device->rad_info.chip_class <
              GFX8)<br>
              +               return false;<br>
              +<br>
              +       if (image->usage &
              VK_IMAGE_USAGE_STORAGE_BIT)<br>
              +               return false;<br>
              +<br>
              +       if (radv_image_has_dcc(image))<br>
              +               return false;<br>
              +<br>
              +       if (!radv_image_has_cmask(image))<br>
              +               return false;<br>
              +<br>
              +       return true;<br>
              +}<br>
              +<br>
               static void<br>
               radv_prefill_surface_from_metadata(struct radv_device
              *device,<br>
                                                  struct radeon_surf
              *surface,<br>
              @@ -726,11 +749,26 @@ si_make_texture_descriptor(struct
              radv_device *device,<br>
                                                       
              S_008F20_PITCH(image->planes[0].surface.u.gfx9.fmask.epitch);<br>
                                      fmask_state[5] |=
S_008F24_META_PIPE_ALIGNED(image->planes[0].surface.u.gfx9.cmask.pipe_aligned)
              |<br>
                                                       
S_008F24_META_RB_ALIGNED(image->planes[0].surface.u.gfx9.cmask.rb_aligned);<br>
              +<br>
              +                       if
              (radv_image_is_tc_compat_cmask(image)) {<br>
              +                               va = gpu_address +
              image->offset + image->cmask.offset;<br>
              +<br>
              +                               fmask_state[5] |=
              S_008F24_META_DATA_ADDRESS(va >> 40);<br>
              +                               fmask_state[6] |=
              S_008F28_COMPRESSION_EN(1);<br>
              +                               fmask_state[7] |= va
              >> 8;<br>
              +                       }<br>
                              } else {<br>
                                      fmask_state[3] |=
              S_008F1C_TILING_INDEX(image->fmask.tile_mode_index);<br>
                                      fmask_state[4] |=
              S_008F20_DEPTH(depth - 1) |<br>
                                             
              S_008F20_PITCH(image->fmask.pitch_in_pixels - 1);<br>
                                      fmask_state[5] |=
              S_008F24_LAST_ARRAY(last_layer);<br>
              +<br>
              +                       if
              (radv_image_is_tc_compat_cmask(image)) {<br>
              +                               va = gpu_address +
              image->offset + image->cmask.offset;<br>
              +<br>
              +                               fmask_state[6] |=
              S_008F28_COMPRESSION_EN(1);<br>
              +                               fmask_state[7] |= va
              >> 8;<br>
              +                       }<br>
                              }<br>
                      } else if (fmask_state)<br>
                              memset(fmask_state, 0, 8 * 4);<br>
              @@ -1034,6 +1072,7 @@ radv_image_can_enable_fmask(struct
              radv_image *image)<br>
                      return image->info.samples > 1 &&
              vk_format_is_color(image->vk_format);<br>
               }<br>
              <br>
              +<br>
            </blockquote>
            <div> </div>
            <div>spurious change?</div>
          </div>
        </div>
      </div>
    </blockquote>
    <p>Yeah, I will remove. Anything else?<br>
    </p>
    <blockquote type="cite">
      <div dir="ltr">
        <div dir="auto">
          <div class="gmail_quote">
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
               static inline bool<br>
               radv_image_can_enable_htile(struct radv_image *image)<br>
               {<br>
              @@ -1158,6 +1197,9 @@ radv_image_create(VkDevice _device,<br>
                              /* Try to enable FMASK for multisampled
              images. */<br>
                              if (radv_image_can_enable_fmask(image)) {<br>
                                      radv_image_alloc_fmask(device,
              image);<br>
              +<br>
              +                       if
              (radv_use_tc_compat_cmask_for_image(device, image))<br>
              +                             
               image->tc_compatible_cmask = true;<br>
                              } else {<br>
                                      /* Otherwise, try to enable HTILE
              for depth surfaces. */<br>
                                      if
              (radv_image_can_enable_htile(image) &&<br>
              diff --git a/src/amd/vulkan/radv_meta.h
              b/src/amd/vulkan/radv_meta.h<br>
              index 59b9121cf39..2aa2d15770b 100644<br>
              --- a/src/amd/vulkan/radv_meta.h<br>
              +++ b/src/amd/vulkan/radv_meta.h<br>
              @@ -221,6 +221,32 @@ uint32_t radv_clear_htile(struct
              radv_cmd_buffer *cmd_buffer,<br>
                                        struct radv_image *image,<br>
                                        const VkImageSubresourceRange
              *range, uint32_t value);<br>
              <br>
              +/**<br>
              + * Return whether the bound pipeline is the FMASK
              decompress pass.<br>
              + */<br>
              +static inline bool<br>
              +radv_is_fmask_decompress_pipeline(struct radv_cmd_buffer
              *cmd_buffer)<br>
              +{<br>
              +       struct radv_meta_state *meta_state =
              &cmd_buffer->device->meta_state;<br>
              +       struct radv_pipeline *pipeline =
              cmd_buffer->state.pipeline;<br>
              +<br>
              +       return radv_pipeline_to_handle(pipeline) ==<br>
              +             
              meta_state->fast_clear_flush.fmask_decompress_pipeline;<br>
              +}<br>
              +<br>
              +/**<br>
              + * Return whether the bound pipeline is the DCC
              decompress pass.<br>
              + */<br>
              +static inline bool<br>
              +radv_is_dcc_decompress_pipeline(struct radv_cmd_buffer
              *cmd_buffer)<br>
              +{<br>
              +       struct radv_meta_state *meta_state =
              &cmd_buffer->device->meta_state;<br>
              +       struct radv_pipeline *pipeline =
              cmd_buffer->state.pipeline;<br>
              +<br>
              +       return radv_pipeline_to_handle(pipeline) ==<br>
              +             
              meta_state->fast_clear_flush.dcc_decompress_pipeline;<br>
              +}<br>
              +<br>
               /* common nir builder helpers */<br>
               #include "nir/nir_builder.h"<br>
              <br>
              diff --git a/src/amd/vulkan/radv_meta_fast_clear.c
              b/src/amd/vulkan/radv_meta_fast_clear.c<br>
              index 8f97c1a8f15..94c83dc96be 100644<br>
              --- a/src/amd/vulkan/radv_meta_fast_clear.c<br>
              +++ b/src/amd/vulkan/radv_meta_fast_clear.c<br>
              @@ -595,7 +595,7 @@ radv_emit_color_decompress(struct
              radv_cmd_buffer *cmd_buffer,<br>
              <br>
                      if (decompress_dcc &&
              radv_image_has_dcc(image)) {<br>
                              pipeline =
cmd_buffer->device->meta_state.fast_clear_flush.dcc_decompress_pipeline;<br>
              -       } else if (radv_image_has_fmask(image)) {<br>
              +       } else if (radv_image_has_fmask(image) &&
              !image->tc_compatible_cmask) {<br>
                              pipeline =
cmd_buffer->device->meta_state.fast_clear_flush.fmask_decompress_pipeline;<br>
                      } else {<br>
                              pipeline =
cmd_buffer->device->meta_state.fast_clear_flush.cmask_eliminate_pipeline;<br>
              diff --git a/src/amd/vulkan/radv_private.h
              b/src/amd/vulkan/radv_private.h<br>
              index 8f2e80b3017..1a7797b55e1 100644<br>
              --- a/src/amd/vulkan/radv_private.h<br>
              +++ b/src/amd/vulkan/radv_private.h<br>
              @@ -1555,6 +1555,7 @@ struct radv_image {<br>
                      uint64_t dcc_offset;<br>
                      uint64_t htile_offset;<br>
                      bool tc_compatible_htile;<br>
              +       bool tc_compatible_cmask;<br>
              <br>
                      struct radv_fmask_info fmask;<br>
                      struct radv_cmask_info cmask;<br>
              @@ -1628,6 +1629,15 @@ radv_image_has_dcc(const struct
              radv_image *image)<br>
                      return image->planes[0].surface.dcc_size;<br>
               }<br>
              <br>
              +/**<br>
              + * Return whether the image is TC-compatible CMASK.<br>
              + */<br>
              +static inline bool<br>
              +radv_image_is_tc_compat_cmask(const struct radv_image
              *image)<br>
              +{<br>
              +       return radv_image_has_fmask(image) &&
              image->tc_compatible_cmask;<br>
              +}<br>
              +<br>
               /**<br>
                * Return whether DCC metadata is enabled for a level.<br>
                */<br>
              -- <br>
              2.22.0<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></blockquote>
          </div>
        </div>
      </div>
    </blockquote>
  </div>

</blockquote></div>