<div dir="ltr">ping?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 21, 2018 at 11:17 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">v2 (Jason Ekstrand):<br>
- Return the correct enum values from anv_layout_to_fast_clear_type<br>
<br>
v3 (Jason Ekstrand):<br>
- Always return ANV_FAST_CLEAR_NONE and leave doing the right thing for<br>
the patch which adds a modifier which supports fast-clears.<br>
---<br>
src/intel/vulkan/anv_formats.c | 9 ++++++++<br>
src/intel/vulkan/anv_image.c | 50 ++++++++++++++++++++++++++----<wbr>------------<br>
2 files changed, 40 insertions(+), 19 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_<wbr>formats.c 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 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_<wbr>format))<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..9897e58 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,14 @@ 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>
+ image->drm_format_mod != DRM_FORMAT_MOD_INVALID &&<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 +869,20 @@ anv_layout_to_aux_usage(const struct 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 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(<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 +962,18 @@ anv_layout_to_fast_clear_type(<wbr>const struct 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>
+ case VK_IMAGE_LAYOUT_PRESENT_SRC_<wbr>KHR: {<br>
+ assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT);<br>
+#ifndef NDEBUG<br>
+ /* We do not yet support any modifiers which support clear color so we<br>
+ * just always return NONE. One day, this will change.<br>
+ */<br>
+ const struct isl_drm_modifier_info *mod_info =<br>
+ isl_drm_modifier_get_info(<wbr>image->drm_format_mod);<br>
+ assert(!mod_info || !mod_info->supports_clear_<wbr>color);<br>
+#endif<br>
return ANV_FAST_CLEAR_NONE;<br>
+ }<br>
<br>
default:<br>
/* If the image has CCS_E enabled all the time then we can use<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.0.400.gff86faf<br>
<br>
</font></span></blockquote></div><br></div>