<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, Oct 10, 2018 at 5:17 PM Chad Versace <<a href="mailto:chadversary@chromium.org">chadversary@chromium.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon 01 Oct 2018, Jason Ekstrand wrote:<br>
> The DRM format modifiers extension adds a TILING_DRM_FORMAT_MODIFIER<br>
> which will be used for modifiers so we can no longer use OPTIMAL to<br>
> indicate tiled inside the driver.<br>
> ---<br>
> src/intel/vulkan/anv_formats.c | 2 +-<br>
> src/intel/vulkan/anv_image.c | 6 +++---<br>
> src/intel/vulkan/genX_cmd_buffer.c | 2 +-<br>
> 3 files changed, 5 insertions(+), 5 deletions(-)<br>
<br>
This patch needs to also fixup some places that test tiling ==<br>
VK_IMAGE_TILING_LINEAR. I found at least one such place in<br>
anv_formats.c. The patch also needs to fixup any functions that use<br>
early returns that are conditioned (perhaps indirectly) on tiling;<br>
anv_get_format_plane() comes to mind.<br>
<br>
I quickly tried, as an experiment, to expand this patch into a correct<br>
patch. After a few minutes of typing, I concluded that this patch series<br>
takes the wrong order-of-implementation approach.<br>
<br>
For example, what happens to all the calls to anv_get_format_plane() in<br>
anv_blorp.c? Those need fixing too. Simply fixing the tiling checks is<br>
not enough, especially because VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT<br>
allows DRM_FORMAT_MOD_LINEAR.<br>
<br>
Instead, I think the right way to do this is to incrementally, following<br>
the callchains bottom-up, teach each function to understand<br>
VK_EXT_image_drm_format_modifier. Only when that's complete, then move<br>
WSI to the new structs. Otherwise, there is too much room for<br>
accidential implementation gaps; gaps that may not hurt WSI, but will<br>
make it more difficult to discern what-works-and-what-doesn't while<br>
implementing the full extension.<br>
<br>
Just now, I tried writing a patch that starts at the bottom of the<br>
callchain, anv_get_format_plane(), and teaches it about modifiers. The<br>
patch is more invasive than expected. Maybe the patch is messy because<br>
more preliminary cleanups are needed. I'm unsure; I need to take a break<br>
and revisit it in the morning.<br>
</blockquote><div><br></div><div>I just took a look at anv_get_format_plane and my hopes of this being a quick extension to implement instantly evaporated. :-( In the light of modifiers, piles of assumptions we've been making are invalid. *sigh* Time to go rewrite the driver...</div><div><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">
> <br>
> diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c<br>
> index 33faf7cc37f..d44aae1c127 100644<br>
> --- a/src/intel/vulkan/anv_formats.c<br>
> +++ b/src/intel/vulkan/anv_formats.c<br>
> @@ -508,7 +508,7 @@ get_image_format_features(const struct gen_device_info *devinfo,<br>
> return 0;<br>
> <br>
> struct anv_format_plane base_plane_format = plane_format;<br>
> - if (vk_tiling == VK_IMAGE_TILING_OPTIMAL) {<br>
> + if (vk_tiling != VK_IMAGE_TILING_LINEAR) {<br>
> base_plane_format = anv_get_format_plane(devinfo, vk_format,<br>
> VK_IMAGE_ASPECT_COLOR_BIT,<br>
> VK_IMAGE_TILING_LINEAR);<br>
> diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c<br>
> index b0d8c560adb..70594d6c053 100644<br>
> --- a/src/intel/vulkan/anv_image.c<br>
> +++ b/src/intel/vulkan/anv_image.c<br>
> @@ -334,7 +334,7 @@ make_surface(const struct anv_device *dev,<br>
> bool needs_shadow = false;<br>
> if (dev->info.gen <= 8 &&<br>
> (vk_info->flags & VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT) &&<br>
> - vk_info->tiling == VK_IMAGE_TILING_OPTIMAL) {<br>
> + vk_info->tiling != VK_IMAGE_TILING_LINEAR) {<br>
> assert(isl_format_is_compressed(plane_format.isl_format));<br>
> tiling_flags = ISL_TILING_LINEAR_BIT;<br>
> needs_shadow = true;<br>
> @@ -829,7 +829,7 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo,<br>
> return ISL_AUX_USAGE_NONE;<br>
> <br>
> /* All images that use an auxiliary surface are required to be tiled. */<br>
> - assert(image->tiling == VK_IMAGE_TILING_OPTIMAL);<br>
> + assert(image->planes[plane].surface.isl.tiling != ISL_TILING_LINEAR);<br>
> <br>
> /* Stencil has no aux */<br>
> assert(aspect != VK_IMAGE_ASPECT_STENCIL_BIT);<br>
> @@ -953,7 +953,7 @@ anv_layout_to_fast_clear_type(const struct gen_device_info * const devinfo,<br>
> return ANV_FAST_CLEAR_NONE;<br>
> <br>
> /* All images that use an auxiliary surface are required to be tiled. */<br>
> - assert(image->tiling == VK_IMAGE_TILING_OPTIMAL);<br>
> + assert(image->planes[plane].surface.isl.tiling != ISL_TILING_LINEAR);<br>
> <br>
> /* Stencil has no aux */<br>
> assert(aspect != VK_IMAGE_ASPECT_STENCIL_BIT);<br>
> diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c<br>
> index 099c30f3d66..821506761e2 100644<br>
> --- a/src/intel/vulkan/genX_cmd_buffer.c<br>
> +++ b/src/intel/vulkan/genX_cmd_buffer.c<br>
> @@ -967,7 +967,7 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,<br>
> if (base_layer >= anv_image_aux_layers(image, aspect, base_level))<br>
> return;<br>
> <br>
> - assert(image->tiling == VK_IMAGE_TILING_OPTIMAL);<br>
> + assert(image->planes[plane].surface.isl.tiling != ISL_TILING_LINEAR);<br>
> <br>
> if (initial_layout == VK_IMAGE_LAYOUT_UNDEFINED ||<br>
> initial_layout == VK_IMAGE_LAYOUT_PREINITIALIZED) {<br>
> -- <br>
> 2.17.1<br>
> <br>
> _______________________________________________<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/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>