Module: Mesa Branch: main Commit: 9b6ac56d72d6d74cfe85ed9caff663f841dd6def URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9b6ac56d72d6d74cfe85ed9caff663f841dd6def
Author: Karol Herbst <[email protected]> Date: Sun Oct 22 16:53:54 2023 +0200 rusticl/device: restrict image_buffer_size It's pointless to advertise more than CL_DEVICE_MAX_MEM_ALLOC_SIZE and also the CTS tests against this. Cc: mesa-stable Signed-off-by: Karol Herbst <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25837> --- src/gallium/frontends/rusticl/core/device.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index 2565598edac..8058f5cbb79 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -750,8 +750,12 @@ impl Device { } pub fn image_buffer_size(&self) -> usize { - self.screen - .param(pipe_cap::PIPE_CAP_MAX_TEXEL_BUFFER_ELEMENTS_UINT) as usize + min( + // the CTS requires it to not exceed `CL_MAX_MEM_ALLOC_SIZE` + self.max_mem_alloc(), + self.screen + .param(pipe_cap::PIPE_CAP_MAX_TEXEL_BUFFER_ELEMENTS_UINT) as cl_ulong, + ) as usize } pub fn image_read_count(&self) -> cl_uint {
