mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 21:40:20 +01:00
v3dv: improve handling of too large image sizes
Instead of asserting that users don't try to create images that would require 4GB+ of memory, error out with the corresponding OOM error when the user tries to actually allocate the memory for the image. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
parent
b546155cc3
commit
8116d65fbc
2 changed files with 5 additions and 2 deletions
|
|
@ -1363,10 +1363,13 @@ device_alloc(struct v3dv_device *device,
|
|||
VkDeviceSize size)
|
||||
{
|
||||
/* Our kernel interface is 32-bit */
|
||||
assert((size & 0xffffffff) == size);
|
||||
if (size > UINT32_MAX)
|
||||
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
|
||||
mem->bo = v3dv_bo_alloc(device, size, "device_alloc", false);
|
||||
if (!mem->bo)
|
||||
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ struct v3dv_image {
|
|||
bool tiled;
|
||||
|
||||
struct v3d_resource_slice slices[V3D_MAX_MIP_LEVELS];
|
||||
uint32_t size; /* Total size in bytes */
|
||||
uint64_t size; /* Total size in bytes */
|
||||
uint32_t cube_map_stride;
|
||||
uint32_t alignment;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue