From 94f465856c27c5056cd86eed240c487c0bfcb998 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sun, 26 Dec 2021 12:45:49 -0800 Subject: [PATCH] clover: Move min image support check If the gallium driver supports images, but not the minimum image requirements for CL, then simply don't claim to support images. This is better than not claiming to support CL at all. Signed-off-by: Rob Clark Reviewed-by: Karol Herbst Part-of: --- src/gallium/frontends/clover/core/device.cpp | 27 +++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/gallium/frontends/clover/core/device.cpp b/src/gallium/frontends/clover/core/device.cpp index 2e3d77d2bf3..f7183b5086e 100644 --- a/src/gallium/frontends/clover/core/device.cpp +++ b/src/gallium/frontends/clover/core/device.cpp @@ -76,13 +76,7 @@ namespace { dev.max_const_buffer_size() < 64 * 1024 || dev.max_const_buffers() < 8 || dev.max_mem_local() < 16 * 1024 || - dev.clc_version < CL_MAKE_VERSION(1, 0, 0) || - (supports_images && - (dev.max_images_read() < 128 || - dev.max_images_write() < 8 || - dev.max_image_size() < 8192 || - dev.max_image_size_3d() < 2048 || - dev.max_samplers() < 16))) { + dev.clc_version < CL_MAKE_VERSION(1, 0, 0)) { return version; } version = CL_MAKE_VERSION(1, 0, 0); @@ -318,8 +312,23 @@ device::max_printf_buffer_size() const { bool device::image_support() const { - return get_compute_param(pipe, ir_format(), - PIPE_COMPUTE_CAP_IMAGES_SUPPORTED)[0]; + bool supports_images = get_compute_param(pipe, ir_format(), + PIPE_COMPUTE_CAP_IMAGES_SUPPORTED)[0]; + if (!supports_images) + return false; + + /* If the gallium driver supports images, but does not support the + * minimum requirements for opencl 1.0 images, then don't claim to + * support images. + */ + if (max_images_read() < 128 || + max_images_write() < 8 || + max_image_size() < 8192 || + max_image_size_3d() < 2048 || + max_samplers() < 16) + return false; + + return true; } bool