anv/image: Use align_u64 for image offsets
authorJason Ekstrand <jason@jlekstrand.net>
Wed, 1 Apr 2020 22:24:10 +0000 (17:24 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 2 Apr 2020 15:08:42 +0000 (15:08 +0000)
The ALIGN functions in util/u_math.h work on uintptr_t whose size
changes depending on your platform.  Use ones which take an explicit
64-bit type instead to avoid 32-bit platform issues.

Cc: mesa-stable@lists.freedesktop.org
Reported-by: Mark Janes <mark.a.janes@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4414>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4414>

src/intel/vulkan/anv_image.c

index e0b5ea8db187c5bbebbcb2da0f1b6f5082b578dc..5d7845d721af21d05735853135830a5811a71259 100644 (file)
@@ -328,8 +328,8 @@ add_aux_state_tracking_buffer(struct anv_image *image,
     * a 4K alignment. We believe that 256B might be enough, but due to lack of
     * testing we will leave this as 4K for now.
     */
     * a 4K alignment. We believe that 256B might be enough, but due to lack of
     * testing we will leave this as 4K for now.
     */
-   image->planes[plane].size = ALIGN(image->planes[plane].size, 4096);
-   image->size = ALIGN(image->size, 4096);
+   image->planes[plane].size = align_u64(image->planes[plane].size, 4096);
+   image->size = align_u64(image->size, 4096);
 
    assert(image->planes[plane].offset % 4096 == 0);
 
 
    assert(image->planes[plane].offset % 4096 == 0);