From: Chad Versace <chadvers...@chromium.org> Set anv_surface::offset *before* calling add_surface().
No intended change in behavior. This patch prepares for supporting user-provided surface offsets, a feature required for VK_MESAX_external_image_dma_buf. --- src/intel/vulkan/anv_image.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 25f834b6c7..3905fcf0b4 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -124,12 +124,17 @@ choose_isl_tiling_flags(const struct anv_image_create_info *anv_info) } static void -add_surface(struct anv_image *image, struct anv_surface *surf) +set_min_surface_offset(const struct anv_image *image, struct anv_surface *surf) { assert(surf->isl.size > 0); /* isl surface must be initialized */ - surf->offset = align_u32(image->size, surf->isl.alignment); - image->size = surf->offset + surf->isl.size; +} + +static void +add_surface(struct anv_image *image, const struct anv_surface *surf) +{ + assert(surf->isl.size > 0); /* isl surface must be initialized */ + image->size = MAX2(image->size, surf->offset + surf->isl.size); image->alignment = MAX2(image->alignment, surf->isl.alignment); } @@ -242,6 +247,7 @@ make_hiz_surface_maybe(const struct anv_device *dev, if (!ok) return; + set_min_surface_offset(image, &image->aux_surface); add_surface(image, &image->aux_surface); image->aux_usage = ISL_AUX_USAGE_HIZ; } @@ -278,6 +284,7 @@ make_ccs_surface_maybe(const struct anv_device *dev, return; } + set_min_surface_offset(image, &image->aux_surface); add_surface(image, &image->aux_surface); add_fast_clear_state_buffer(image, dev); @@ -310,6 +317,7 @@ make_mcs_surface_maybe(const struct anv_device *dev, if (!ok) return; + set_min_surface_offset(image, &image->aux_surface); add_surface(image, &image->aux_surface); add_fast_clear_state_buffer(image, dev); image->aux_usage = ISL_AUX_USAGE_MCS; @@ -380,6 +388,7 @@ make_main_surface(const struct anv_device *dev, */ assert(ok); + set_min_surface_offset(image, anv_surf); add_surface(image, anv_surf); } -- 2.13.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev