[Mesa-dev] [PATCH 1/2] clover: Allow overriding platform/device version numbers

Francisco Jerez currojerez at riseup.net
Thu Mar 1 22:35:23 UTC 2018


Aaron Watry <awatry at gmail.com> writes:

> Useful for testing API, builtin library, and device completeness of
> not-yet-supported versions.
>
> Signed-off-by: Aaron Watry <awatry at gmail.com>
> Cc: Pierre Moreau <pierre.morrow at free.fr>
> Cc: Jan Vesely <jan.vesely at rutgers.edu>
> Cc: Francisco Jerez <currojerez at riseup.net>
> ---
>  src/gallium/state_trackers/clover/api/platform.cpp | 7 ++++++-
>  src/gallium/state_trackers/clover/core/device.cpp  | 5 +++--
>  2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/platform.cpp b/src/gallium/state_trackers/clover/api/platform.cpp
> index ed86163311..8cb2718973 100644
> --- a/src/gallium/state_trackers/clover/api/platform.cpp
> +++ b/src/gallium/state_trackers/clover/api/platform.cpp
> @@ -23,6 +23,7 @@
>  #include "api/util.hpp"
>  #include "core/platform.hpp"
>  #include "git_sha1.h"
> +#include "util/u_debug.h"
>  
>  using namespace clover;
>  
> @@ -51,6 +52,7 @@ clover::GetPlatformInfo(cl_platform_id d_platform, cl_platform_info param,
>     property_buffer buf { r_buf, size, r_size };
>  
>     obj(d_platform);
> +   std::string version_string;
>  
>     switch (param) {
>     case CL_PLATFORM_PROFILE:
> @@ -58,7 +60,10 @@ clover::GetPlatformInfo(cl_platform_id d_platform, cl_platform_info param,
>        break;
>  
>     case CL_PLATFORM_VERSION:
> -      buf.as_string() = "OpenCL 1.1 Mesa " PACKAGE_VERSION
> +      version_string = std::string(
> +            debug_get_option("CLOVER_PLATFORM_VERSION_OVERRIDE", "1.1"));

Can you make the version_string declaration local to this case block and
mark as const?  With that fixed:

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

> +
> +      buf.as_string() = "OpenCL " + version_string + " Mesa " PACKAGE_VERSION
>  #ifdef MESA_GIT_SHA1
>                          " (" MESA_GIT_SHA1 ")"
>  #endif
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
> index 71cf4bf60a..245d728886 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -25,6 +25,7 @@
>  #include "core/platform.hpp"
>  #include "pipe/p_screen.h"
>  #include "pipe/p_state.h"
> +#include "util/u_debug.h"
>  
>  using namespace clover;
>  
> @@ -268,10 +269,10 @@ device::endianness() const {
>  
>  std::string
>  device::device_version() const {
> -    return "1.1";
> +   return std::string(debug_get_option("CLOVER_DEVICE_VERSION_OVERRIDE", "1.1"));
>  }
>  
>  std::string
>  device::device_clc_version() const {
> -    return "1.1";
> +   return std::string(debug_get_option("CLOVER_DEVICE_CLC_VERSION_OVERRIDE", "1.1"));
>  }
> -- 
> 2.14.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180301/b8cab607/attachment-0001.sig>


More information about the mesa-dev mailing list