Mesa (staging/21.3): zink: use align64 for allocation sizes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 28 20:03:31 UTC 2021


Module: Mesa
Branch: staging/21.3
Commit: a2776a409077d01fcaa607657de99cf8de38181a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a2776a409077d01fcaa607657de99cf8de38181a

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Oct 27 16:37:03 2021 -0400

zink: use align64 for allocation sizes

avoid 32bit sint overflows

fixes #5568

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13560>
(cherry picked from commit c4a513d978e6fb5344b465d981c70b1823906331)

---

 .pick_status.json                  | 2 +-
 src/gallium/drivers/zink/zink_bo.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index bf5d9ac1fc8..5f6c00bc9c3 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -184,7 +184,7 @@
         "description": "zink: use align64 for allocation sizes",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/zink/zink_bo.c b/src/gallium/drivers/zink/zink_bo.c
index e673efefb3e..6a554ec91f2 100644
--- a/src/gallium/drivers/zink/zink_bo.c
+++ b/src/gallium/drivers/zink/zink_bo.c
@@ -263,7 +263,7 @@ bo_create_internal(struct zink_screen *screen,
    mai.memoryTypeIndex = screen->heap_map[heap];
    if (screen->info.mem_props.memoryTypes[mai.memoryTypeIndex].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) {
       alignment = MAX2(alignment, screen->info.props.limits.minMemoryMapAlignment);
-      mai.allocationSize = align(mai.allocationSize, screen->info.props.limits.minMemoryMapAlignment);
+      mai.allocationSize = align64(mai.allocationSize, screen->info.props.limits.minMemoryMapAlignment);
    }
    VkResult ret = VKSCR(AllocateMemory)(screen->dev, &mai, NULL, &bo->mem);
    if (!zink_screen_handle_vkresult(screen, ret))



More information about the mesa-commit mailing list