From: Dave Airlie Date: Tue, 10 Nov 2020 00:03:47 +0000 (+1000) Subject: clover/device: store version in device at constructor. X-Git-Tag: upstream/21.0.0~2734 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=981f8d7252c17672598ec7ee4406e296876f8ab0;p=platform%2Fupstream%2Fmesa.git clover/device: store version in device at constructor. This reads the env vars once and stores the value, and converts to strings when needed Reviewed-by: Karol Herbst Part-of: --- diff --git a/src/gallium/frontends/clover/core/device.cpp b/src/gallium/frontends/clover/core/device.cpp index c055e5b..0179980 100644 --- a/src/gallium/frontends/clover/core/device.cpp +++ b/src/gallium/frontends/clover/core/device.cpp @@ -49,6 +49,14 @@ namespace { device::device(clover::platform &platform, pipe_loader_device *ldev) : platform(platform), clc_cache(NULL), ldev(ldev) { + unsigned major = 1, minor = 1; + debug_get_version_option("CLOVER_DEVICE_VERSION_OVERRIDE", &major, &minor); + version = CL_MAKE_VERSION(major, minor, 0); + + major = 1, minor = 1; + debug_get_version_option("CLOVER_DEVICE_CLC_VERSION_OVERRIDE", &major, &minor); + clc_version = CL_MAKE_VERSION(major, minor, 0); + pipe = pipe_loader_create_screen(ldev); if (pipe && pipe->get_param(pipe, PIPE_CAP_COMPUTE)) { if (supports_ir(PIPE_SHADER_IR_NATIVE)) @@ -313,16 +321,18 @@ device::endianness() const { std::string device::device_version_as_string() const { - static const std::string device_version = - debug_get_option("CLOVER_DEVICE_VERSION_OVERRIDE", "1.1"); - return device_version; + static const std::string version_string = + std::to_string(CL_VERSION_MAJOR(version)) + "." + + std::to_string(CL_VERSION_MINOR(version)); + return version_string; } std::string device::device_clc_version_as_string() const { - static const std::string device_clc_version = - debug_get_option("CLOVER_DEVICE_CLC_VERSION_OVERRIDE", "1.1"); - return device_clc_version; + static const std::string version_string = + std::to_string(CL_VERSION_MAJOR(clc_version)) + "." + + std::to_string(CL_VERSION_MINOR(clc_version)); + return version_string; } bool diff --git a/src/gallium/frontends/clover/core/device.hpp b/src/gallium/frontends/clover/core/device.hpp index 6815e7a..85e01bf 100644 --- a/src/gallium/frontends/clover/core/device.hpp +++ b/src/gallium/frontends/clover/core/device.hpp @@ -108,6 +108,8 @@ namespace clover { lazy> clc_nir; disk_cache *clc_cache; + cl_version version; + cl_version clc_version; private: pipe_screen *pipe; pipe_loader_device *ldev;