Mesa (main): clover: Move min image support check

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 4 17:04:45 UTC 2022


Module: Mesa
Branch: main
Commit: 94f465856c27c5056cd86eed240c487c0bfcb998
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=94f465856c27c5056cd86eed240c487c0bfcb998

Author: Rob Clark <robdclark at chromium.org>
Date:   Sun Dec 26 12:45:49 2021 -0800

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 <robdclark at chromium.org>
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14310>

---

 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<uint32_t>(pipe, ir_format(),
-                                      PIPE_COMPUTE_CAP_IMAGES_SUPPORTED)[0];
+   bool supports_images = get_compute_param<uint32_t>(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



More information about the mesa-commit mailing list