vulkan/wsi: Allow for larger linear images
For images of size 32768 × 32768 (which NVK allows), the linear image ends up being 4GB which overflows the uint32_t size as well as some of our alignment calculations. Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25729>
This commit is contained in:

committed by
Marge Bot

parent
7a83109835
commit
7fb561eff2
@@ -1947,17 +1947,18 @@ wsi_configure_buffer_image(UNUSED const struct wsi_swapchain *chain,
|
|||||||
|
|
||||||
const uint32_t cpp = vk_format_get_blocksize(pCreateInfo->imageFormat);
|
const uint32_t cpp = vk_format_get_blocksize(pCreateInfo->imageFormat);
|
||||||
info->linear_stride = pCreateInfo->imageExtent.width * cpp;
|
info->linear_stride = pCreateInfo->imageExtent.width * cpp;
|
||||||
info->linear_stride = ALIGN_POT(info->linear_stride, stride_align);
|
info->linear_stride = align(info->linear_stride, stride_align);
|
||||||
|
|
||||||
/* Since we can pick the stride to be whatever we want, also align to the
|
/* Since we can pick the stride to be whatever we want, also align to the
|
||||||
* device's optimalBufferCopyRowPitchAlignment so we get efficient copies.
|
* device's optimalBufferCopyRowPitchAlignment so we get efficient copies.
|
||||||
*/
|
*/
|
||||||
assert(wsi->optimalBufferCopyRowPitchAlignment > 0);
|
assert(wsi->optimalBufferCopyRowPitchAlignment > 0);
|
||||||
info->linear_stride = ALIGN_POT(info->linear_stride,
|
info->linear_stride = align(info->linear_stride,
|
||||||
wsi->optimalBufferCopyRowPitchAlignment);
|
wsi->optimalBufferCopyRowPitchAlignment);
|
||||||
|
|
||||||
info->linear_size = info->linear_stride * pCreateInfo->imageExtent.height;
|
info->linear_size = (uint64_t)info->linear_stride *
|
||||||
info->linear_size = ALIGN_POT(info->linear_size, size_align);
|
pCreateInfo->imageExtent.height;
|
||||||
|
info->linear_size = align64(info->linear_size, size_align);
|
||||||
|
|
||||||
info->finish_create = wsi_finish_create_blit_context;
|
info->finish_create = wsi_finish_create_blit_context;
|
||||||
}
|
}
|
||||||
|
@@ -96,7 +96,7 @@ struct wsi_image_info {
|
|||||||
uint32_t linear_stride;
|
uint32_t linear_stride;
|
||||||
|
|
||||||
/* For buffer blit images, the size of the buffer in bytes */
|
/* For buffer blit images, the size of the buffer in bytes */
|
||||||
uint32_t linear_size;
|
uint64_t linear_size;
|
||||||
|
|
||||||
wsi_memory_type_select_cb select_image_memory_type;
|
wsi_memory_type_select_cb select_image_memory_type;
|
||||||
wsi_memory_type_select_cb select_blit_dst_memory_type;
|
wsi_memory_type_select_cb select_blit_dst_memory_type;
|
||||||
|
Reference in New Issue
Block a user