treewide: use uint64_t / (u)intptr_t in image address calculations

16K * 16K * 16bpp = 4G, which overflows int32, so layer_stride needs to
have 64 bits. More generally, any "byte_stride * height" computation
can overflow int32.

Use (u)intptr_t in some gallium and st/mesa places where we do CPU access.
Use uint64_t otherwise.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23389>
This commit is contained in:
Marek Olšák
2023-06-02 04:01:40 -04:00
committed by Marge Bot
parent d72d13bbb5
commit 68735f4e86
41 changed files with 103 additions and 91 deletions
+1 -1
View File
@@ -893,7 +893,7 @@ struct pipe_context {
const struct pipe_box *,
const void *data,
unsigned stride,
unsigned layer_stride);
uintptr_t layer_stride);
/**
* Flush any pending framebuffer writes and invalidate texture caches.
+1 -1
View File
@@ -638,7 +638,7 @@ struct pipe_transfer
unsigned level:8; /**< texture mipmap level */
struct pipe_box box; /**< region of the resource to access */
unsigned stride; /**< row stride in bytes */
unsigned layer_stride; /**< image/layer stride in bytes */
uintptr_t layer_stride; /**< image/layer stride in bytes */
/* Offset into a driver-internal staging buffer to make use of unused
* padding in this structure.