mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-23 10:14:13 +08:00
panfrost: use 64-bits for layout calculations
On modern Mali GPUs, we can have 16 bits for the X and Y sizes, already
overflowing 32-bit barrier even with a single layer of byte-sized
formats.
So let's make sure we have enough bits to avoid overflows here.
Fixes: d5ed77800e
("panvk: Fix GetPhysicalDeviceProperties2() to report accurate info")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32221>
This commit is contained in:
parent
92446a2dcc
commit
00b25ec769
@ -485,7 +485,7 @@ pan_image_layout_init(unsigned arch, struct pan_image_layout *layout,
|
||||
bool linear = layout->modifier == DRM_FORMAT_MOD_LINEAR;
|
||||
bool is_3d = layout->dim == MALI_TEXTURE_DIMENSION_3D;
|
||||
|
||||
unsigned offset = explicit_layout ? explicit_layout->offset : 0;
|
||||
uint64_t offset = explicit_layout ? explicit_layout->offset : 0;
|
||||
struct pan_block_size block_size =
|
||||
panfrost_block_size(layout->modifier, layout->format);
|
||||
|
||||
@ -543,8 +543,8 @@ pan_image_layout_init(unsigned arch, struct pan_image_layout *layout,
|
||||
row_stride = ALIGN_POT(row_stride, 64);
|
||||
}
|
||||
|
||||
unsigned slice_one_size =
|
||||
row_stride * (effective_height / block_size.height);
|
||||
uint64_t slice_one_size =
|
||||
(uint64_t)row_stride * (effective_height / block_size.height);
|
||||
|
||||
/* Compute AFBC sizes if necessary */
|
||||
if (afbc) {
|
||||
@ -583,7 +583,7 @@ pan_image_layout_init(unsigned arch, struct pan_image_layout *layout,
|
||||
slice->row_stride = row_stride;
|
||||
}
|
||||
|
||||
unsigned slice_full_size = slice_one_size * depth * layout->nr_samples;
|
||||
uint64_t slice_full_size = slice_one_size * depth * layout->nr_samples;
|
||||
|
||||
slice->surface_stride = slice_one_size;
|
||||
|
||||
|
@ -112,7 +112,7 @@ struct pan_image_layout {
|
||||
struct pan_image_slice_layout slices[MAX_MIP_LEVELS];
|
||||
|
||||
uint64_t data_size;
|
||||
unsigned array_stride;
|
||||
uint64_t array_stride;
|
||||
};
|
||||
|
||||
struct pan_image_mem {
|
||||
|
Loading…
Reference in New Issue
Block a user