Mesa (master): vallium: limit buffer allocations to gallium max.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 31 03:35:23 UTC 2020


Module: Mesa
Branch: master
Commit: 668e4c235657ba230eab326d5001f60f37e403c3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=668e4c235657ba230eab326d5001f60f37e403c3

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Jul 17 11:30:25 2020 +1000

vallium: limit buffer allocations to gallium max.

Don't allocate buffers greater than gallium can handle.

Fixes:
dEQP-VK.api.buffer.basic.size_max_uint64

Fixes: b38879f8c5f57b7f1802 ("vallium: initial import of the vulkan frontend")

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6381>

---

 src/gallium/frontends/vallium/val_image.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/frontends/vallium/val_image.c b/src/gallium/frontends/vallium/val_image.c
index 29a493e77fe..b40e5b9dccb 100644
--- a/src/gallium/frontends/vallium/val_image.c
+++ b/src/gallium/frontends/vallium/val_image.c
@@ -198,6 +198,10 @@ VkResult val_CreateBuffer(
 
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO);
 
+   /* gallium has max 32-bit buffer sizes */
+   if (pCreateInfo->size > UINT32_MAX)
+      return VK_ERROR_OUT_OF_DEVICE_MEMORY;
+
    buffer = vk_alloc2(&device->alloc, pAllocator, sizeof(*buffer), 8,
                        VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (buffer == NULL)



More information about the mesa-commit mailing list