<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 20, 2018 at 1:57 PM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Feb 20, 2018 at 11:31:08AM -0800, Jason Ekstrand wrote:<br>
> On Tue, Feb 20, 2018 at 11:26 AM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> wrote:<br>
><br>
> > On Tue, Feb 20, 2018 at 11:25 AM, Nanley Chery <<a href="mailto:nanleychery@gmail.com">nanleychery@gmail.com</a>><br>
> > wrote:<br>
> ><br>
> >> On Fri, Feb 16, 2018 at 09:28:43AM -0800, Jason Ekstrand wrote:<br>
> >> > ---<br>
> >> >  src/intel/vulkan/anv_formats.c |  9 +++++++<br>
> >> >  src/intel/vulkan/anv_image.c   | 53 ++++++++++++++++++++++++++----<br>
> >> ------------<br>
> >> >  2 files changed, 42 insertions(+), 20 deletions(-)<br>
> >> ><br>
> >> > diff --git a/src/intel/vulkan/anv_<wbr>formats.c<br>
> >> b/src/intel/vulkan/anv_<wbr>formats.c<br>
> >> > index 9c52ad5..3c17366 100644<br>
> >> > --- a/src/intel/vulkan/anv_<wbr>formats.c<br>
> >> > +++ b/src/intel/vulkan/anv_<wbr>formats.c<br>
> >> > @@ -671,9 +671,18 @@ get_wsi_format_modifier_<wbr>properties_list(const<br>
> >> struct anv_physical_device *physic<br>
> >> >        DRM_FORMAT_MOD_LINEAR,<br>
> >> >        I915_FORMAT_MOD_X_TILED,<br>
> >> >        I915_FORMAT_MOD_Y_TILED,<br>
> >> > +      I915_FORMAT_MOD_Y_TILED_CCS,<br>
> >> >     };<br>
> >> ><br>
> >> >     for (uint32_t i = 0; i < ARRAY_SIZE(modifiers); i++) {<br>
> >> > +      const struct isl_drm_modifier_info *mod_info =<br>
> >> > +         isl_drm_modifier_get_info(<wbr>modifiers[i]);<br>
> >> > +<br>
> >> > +      if (mod_info->aux_usage == ISL_AUX_USAGE_CCS_E &&<br>
> >> > +          !isl_format_supports_ccs_e(&<wbr>physical_device->info,<br>
> >> > +                                     anv_format->planes[0].isl_for<br>
> >> mat))<br>
> >> > +         continue;<br>
> >> > +<br>
> >> >        vk_outarray_append(&out, mod_props) {<br>
> >> >           mod_props->modifier = modifiers[i];<br>
> >> >           if (isl_drm_modifier_has_aux(<wbr>modifiers[i]))<br>
> >> > diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c<br>
> >> > index a2bae7b..d7c2e55 100644<br>
> >> > --- a/src/intel/vulkan/anv_image.c<br>
> >> > +++ b/src/intel/vulkan/anv_image.c<br>
> >> > @@ -515,6 +515,7 @@ score_drm_format_mod(uint64_t modifier)<br>
> >> >     case DRM_FORMAT_MOD_LINEAR: return 1;<br>
> >> >     case I915_FORMAT_MOD_X_TILED: return 2;<br>
> >> >     case I915_FORMAT_MOD_Y_TILED: return 3;<br>
> >> > +   case I915_FORMAT_MOD_Y_TILED_CCS: return 4;<br>
> >> >     default: unreachable("bad DRM format modifier");<br>
> >> >     }<br>
> >> >  }<br>
> >> > @@ -746,8 +747,13 @@ void anv_GetImageSubresourceLayout(<br>
> >> >      VkSubresourceLayout*                        layout)<br>
> >> >  {<br>
> >> >     ANV_FROM_HANDLE(anv_image, image, _image);<br>
> >> > -   const struct anv_surface *surface =<br>
> >> > -      get_surface(image, subresource->aspectMask);<br>
> >> > +<br>
> >> > +   const struct anv_surface *surface;<br>
> >> > +   if (subresource->aspectMask == VK_IMAGE_ASPECT_PLANE_1_BIT_<wbr>KHR &&<br>
> >> > +       isl_drm_modifier_has_aux(<wbr>image->drm_format_mod))<br>
> >> > +      surface = &image->planes[0].aux_surface;<br>
> >> > +   else<br>
> >> > +      surface = get_surface(image, subresource->aspectMask);<br>
> >> ><br>
> >> >     assert(__builtin_popcount(<wbr>subresource->aspectMask) == 1);<br>
> >> ><br>
> >> > @@ -862,25 +868,20 @@ anv_layout_to_aux_usage(const struct<br>
> >> gen_device_info * const devinfo,<br>
> >> >        }<br>
> >> ><br>
> >> ><br>
> >> > -   case VK_IMAGE_LAYOUT_PRESENT_SRC_<wbr>KHR:<br>
> >> > +   case VK_IMAGE_LAYOUT_PRESENT_SRC_<wbr>KHR: {<br>
> >> >        assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT);<br>
> >> ><br>
> >> > -      /* On SKL+, the render buffer can be decompressed by the<br>
> >> presentation<br>
> >> > -       * engine. Support for this feature has not yet landed in the<br>
> >> wider<br>
> >> > -       * ecosystem. TODO: Update this code when support lands.<br>
> >> > -       *<br>
> >> > -       * From the BDW PRM, Vol 7, Render Target Resolve:<br>
> >> > -       *<br>
> >> > -       *    If the MCS is enabled on a non-multisampled render target,<br>
> >> the<br>
> >> > -       *    render target must be resolved before being used for other<br>
> >> > -       *    purposes (display, texture, CPU lock) The clear value from<br>
> >> > -       *    SURFACE_STATE is written into pixels in the render target<br>
> >> > -       *    indicated as clear in the MCS.<br>
> >> > -       *<br>
> >> > -       * Pre-SKL, the render buffer must be resolved before being used<br>
> >> for<br>
> >> > -       * presentation. We can infer that the auxiliary buffer is not<br>
> >> used.<br>
> >> > +      /* When handing the image off to the presentation engine, we<br>
> >> need to<br>
> >> > +       * ensure that things are properly resolved.  For images with no<br>
> >> > +       * modifier, we assume that they follow the old rules and always<br>
> >> need<br>
> >> > +       * a full resolve because the PE doesn't understand any form of<br>
> >> > +       * compression.  For images with modifiers, we use the aux usage<br>
> >> from<br>
> >> > +       * the modifier.<br>
> >> >         */<br>
> >> > -      return ISL_AUX_USAGE_NONE;<br>
> >> > +      const struct isl_drm_modifier_info *mod_info =<br>
> >> > +         isl_drm_modifier_get_info(<wbr>image->drm_format_mod);<br>
> >> > +      return mod_info ? mod_info->aux_usage : ISL_AUX_USAGE_NONE;<br>
> >> > +   }<br>
> >> ><br>
> >> ><br>
> >> >     /* Rendering Layouts */<br>
> >> > @@ -960,8 +961,20 @@ anv_layout_to_fast_clear_type(<wbr>const struct<br>
> >> gen_device_info * const devinfo,<br>
> >> >     case VK_IMAGE_LAYOUT_COLOR_<wbr>ATTACHMENT_OPTIMAL:<br>
> >> >        return ANV_FAST_CLEAR_ANY;<br>
> >> ><br>
> >> > -   case VK_IMAGE_LAYOUT_PRESENT_SRC_<wbr>KHR:<br>
> >> > -      return ANV_FAST_CLEAR_NONE;<br>
> >> > +   case VK_IMAGE_LAYOUT_PRESENT_SRC_<wbr>KHR: {<br>
> >> > +      assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT);<br>
> >> > +<br>
> >> > +      /* When handing the image off to the presentation engine, we<br>
> >> need to<br>
> >> > +       * ensure that things are properly resolved.  For images with no<br>
> >> > +       * modifier, we assume that they follow the old rules and always<br>
> >> need<br>
> >> > +       * a full resolve because the PE doesn't understand any form of<br>
> >> > +       * compression.  For images with modifiers, we use the value<br>
> >> from the<br>
> >> > +       * modifier.<br>
> >> > +       */<br>
> >> > +      const struct isl_drm_modifier_info *mod_info =<br>
> >> > +         isl_drm_modifier_get_info(<wbr>image->drm_format_mod);<br>
> >> > +      return mod_info && mod_info->supports_clear_<wbr>color;<br>
> >><br>
> >> This should return an enum value, not a boolean, right?=<br>
> >><br>
> ><br>
> > Yup.  Rebase fail.  I'll rework and re-send.<br>
> ><br>
><br>
> It's worth noting that it doesn't actually matter today because we don't<br>
> have any modifiers that support fast-clear.  Maybe we should just leave it<br>
> returning NONE?<br>
><br>
<br>
</div></div>It is also outside the scope of this patch, so I guess so.<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Ok, I'll do that and add an assert so that we catch it when we add the Y_TILED_CCS_CLEAR modifier.<br><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
-Nanley<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> > -Nanley<br>
> >><br>
> >> > +   }<br>
> >> ><br>
> >> >     default:<br>
> >> >        /* If the image has CCS_E enabled all the time then we can use<br>
> >> > --<br>
> >> > 2.5.0.400.gff86faf<br>
> >> ><br>
> >> > ______________________________<wbr>_________________<br>
> >> > mesa-dev mailing list<br>
> >> > <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> >> > <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
> >><br>
> ><br>
> ><br>
</div></div></blockquote></div><br></div></div>