[Mesa-dev] [PATCH 3/7] clover: Return correct value for CL_DEVICE_ENDIAN_LITTLE

Tom Stellard tom at stellard.net
Tue Jul 9 21:21:40 PDT 2013


From: Tom Stellard <thomas.stellard at amd.com>

Query the driver using PIPE_CAP_ENDIANNESS rather than always returning
true.
---
 src/gallium/state_trackers/clover/api/device.cpp  | 3 ++-
 src/gallium/state_trackers/clover/core/device.cpp | 5 +++++
 src/gallium/state_trackers/clover/core/device.hpp | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
index e132656..3e8b3f8 100644
--- a/src/gallium/state_trackers/clover/api/device.cpp
+++ b/src/gallium/state_trackers/clover/api/device.cpp
@@ -192,7 +192,8 @@ clGetDeviceInfo(cl_device_id dev, cl_device_info param,
       return scalar_property<size_t>(buf, size, size_ret, 0);
 
    case CL_DEVICE_ENDIAN_LITTLE:
-      return scalar_property<cl_bool>(buf, size, size_ret, CL_TRUE);
+      return scalar_property<cl_bool>(buf, size, size_ret,
+                                      dev->endianness() == PIPE_ENDIAN_LITTLE);
 
    case CL_DEVICE_AVAILABLE:
    case CL_DEVICE_COMPILER_AVAILABLE:
diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
index 95a422c..94faeee 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -192,3 +192,8 @@ _cl_device_id::ir_target() const {
                                                     PIPE_COMPUTE_CAP_IR_TARGET);
    return { target.data() };
 }
+
+enum pipe_endian
+_cl_device_id::endianness() const {
+   return (enum pipe_endian)pipe->get_param(pipe, PIPE_CAP_ENDIANNESS);
+}
diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp
index 4d89315..61b690b 100644
--- a/src/gallium/state_trackers/clover/core/device.hpp
+++ b/src/gallium/state_trackers/clover/core/device.hpp
@@ -66,6 +66,7 @@ public:
    std::string vendor_name() const;
    enum pipe_shader_ir ir_format() const;
    std::string ir_target() const;
+   enum pipe_endian endianness() const;
 
    friend struct _cl_command_queue;
    friend class clover::root_resource;
-- 
1.7.11.4



More information about the mesa-dev mailing list