<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 20, 2018 at 11:26 AM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Tue, Feb 20, 2018 at 11:25 AM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div class="m_4961502100735594612HOEnZb"><div class="m_4961502100735594612h5">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 ++++++++++++++++++++++++++----<wbr>------------<br>
> 2 files changed, 42 insertions(+), 20 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/anv_formats<wbr>.c b/src/intel/vulkan/anv_formats<wbr>.c<br>
> index 9c52ad5..3c17366 100644<br>
> --- a/src/intel/vulkan/anv_formats<wbr>.c<br>
> +++ b/src/intel/vulkan/anv_formats<wbr>.c<br>
> @@ -671,9 +671,18 @@ get_wsi_format_modifier_proper<wbr>ties_list(const 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(mod<wbr>ifiers[i]);<br>
> +<br>
> + if (mod_info->aux_usage == ISL_AUX_USAGE_CCS_E &&<br>
> + !isl_format_supports_ccs_e(&ph<wbr>ysical_device->info,<br>
> + anv_format->planes[0].isl_for<wbr>mat))<br>
> + continue;<br>
> +<br>
> vk_outarray_append(&out, mod_props) {<br>
> mod_props->modifier = modifiers[i];<br>
> if (isl_drm_modifier_has_aux(modi<wbr>fiers[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_KH<wbr>R &&<br>
> + isl_drm_modifier_has_aux(imag<wbr>e->drm_format_mod))<br>
> + surface = &image->planes[0].aux_surface;<br>
> + else<br>
> + surface = get_surface(image, subresource->aspectMask);<br>
><br>
> assert(__builtin_popcount(sub<wbr>resource->aspectMask) == 1);<br>
><br>
> @@ -862,25 +868,20 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo,<br>
> }<br>
><br>
><br>
> - case VK_IMAGE_LAYOUT_PRESENT_SRC_KH<wbr>R:<br>
> + case VK_IMAGE_LAYOUT_PRESENT_SRC_KH<wbr>R: {<br>
> assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT);<br>
><br>
> - /* On SKL+, the render buffer can be decompressed by the presentation<br>
> - * engine. Support for this feature has not yet landed in the 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, 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 for<br>
> - * presentation. We can infer that the auxiliary buffer is not used.<br>
> + /* When handing the image off to the presentation engine, we 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 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 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(ima<wbr>ge->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 gen_device_info * const devinfo,<br>
> case VK_IMAGE_LAYOUT_COLOR_ATTACHME<wbr>NT_OPTIMAL:<br>
> return ANV_FAST_CLEAR_ANY;<br>
><br>
> - case VK_IMAGE_LAYOUT_PRESENT_SRC_KH<wbr>R:<br>
> - return ANV_FAST_CLEAR_NONE;<br>
> + case VK_IMAGE_LAYOUT_PRESENT_SRC_KH<wbr>R: {<br>
> + assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT);<br>
> +<br>
> + /* When handing the image off to the presentation engine, we 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 need<br>
> + * a full resolve because the PE doesn't understand any form of<br>
> + * compression. For images with modifiers, we use the value from the<br>
> + * modifier.<br>
> + */<br>
> + const struct isl_drm_modifier_info *mod_info =<br>
> + isl_drm_modifier_get_info(ima<wbr>ge->drm_format_mod);<br>
> + return mod_info && mod_info->supports_clear_color<wbr>;<br>
<br>
</div></div></div></div>This should return an enum value, not a boolean, right?=<br></blockquote><div><br></div><div>Yup. Rebase fail. I'll rework and re-send.<br></div></div></div></div></blockquote><div><br></div><div>It's worth noting that it doesn't actually matter today because we don't have any modifiers that support fast-clear. Maybe we should just leave it returning NONE?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-Nanley<br>
<span><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>
</span>> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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>
</blockquote></span></div><br></div></div>
</blockquote></div><br></div></div>