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 18ba53c4e6d..7798f325082 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -122,12 +122,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); } @@ -161,6 +166,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; } @@ -183,6 +189,7 @@ make_ccs_surface_maybe(const struct anv_device *dev, if (!ok) return; + set_min_surface_offset(image, &image->aux_surface); add_surface(image, &image->aux_surface); /* For images created without MUTABLE_FORMAT_BIT set, we know that they will @@ -214,6 +221,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); image->aux_usage = ISL_AUX_USAGE_MCS; } @@ -283,6 +291,7 @@ make_main_surface(const struct anv_device *dev, */ assert(ok); + set_min_surface_offset(image, anv_surf); add_surface(image, anv_surf); } -- 2.12.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev