summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorPirama Arumuga Nainar <pirama@google.com>2016-04-04 23:22:57 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-04-04 23:22:57 +0000
commitd4beeb175a64c0b6d6a10766784c28466f6bfece (patch)
tree33d45068255cd54026dec4780843a6559391d4c1 /driver
parentfc67d62209f280380e709547ed926c93bff6d88d (diff)
parentbc3789bcda1e7a86a680de1bb2c16319396dae46 (diff)
downloadrs-d4beeb175a64c0b6d6a10766784c28466f6bfece.tar.gz
Merge changes from topic \'rsdebug\' into nyc-dev
am: bc3789b * commit 'bc3789bcda1e7a86a680de1bb2c16319396dae46': Test rsDebug for half Implement rsDebug for half Add rsDebug for half Change-Id: If06676bb943e4cf10b5025cd0bd1fadb01970fbd
Diffstat (limited to 'driver')
-rw-r--r--driver/rsdRuntimeStubs.cpp27
-rw-r--r--driver/runtime/rs_core.c34
2 files changed, 61 insertions, 0 deletions
diff --git a/driver/rsdRuntimeStubs.cpp b/driver/rsdRuntimeStubs.cpp
index 9fea491b..c0f5ddb5 100644
--- a/driver/rsdRuntimeStubs.cpp
+++ b/driver/rsdRuntimeStubs.cpp
@@ -1122,6 +1122,33 @@ void rsDebug(const char *s, const float4 *f4) {
ALOGD("%s {%f, %f, %f, %f}", s, f.x, f.y, f.z, f.w);
}
+// Accept a half value converted to float. This eliminates the need in the
+// driver to properly support the half datatype (either by adding compiler flags
+// for half or link against compiler_rt).
+void rsDebug(const char *s, float f, ushort us) {
+ ALOGD("%s {%f} {0x%hx}", s, f, us);
+}
+
+void rsDebug(const char *s, const float2 *f2, const ushort2 *us2) {
+ float2 f = *f2;
+ ushort2 us = *us2;
+ ALOGD("%s {%f %f} {0x%hx 0x%hx}", s, f.x, f.y, us.x, us.y);
+}
+
+void rsDebug(const char *s, const float3 *f3, const ushort3 *us3) {
+ float3 f = *f3;
+ ushort3 us = *us3;
+ ALOGD("%s {%f %f %f} {0x%hx 0x%hx 0x%hx}", s, f.x, f.y, f.z, us.x, us.y,
+ us.z);
+}
+
+void rsDebug(const char *s, const float4 *f4, const ushort4 *us4) {
+ float4 f = *f4;
+ ushort4 us = *us4;
+ ALOGD("%s {%f %f %f %f} {0x%hx 0x%hx 0x%hx 0x%hx}", s, f.x, f.y, f.z, f.w,
+ us.x, us.y, us.z, us.w);
+}
+
void rsDebug(const char *s, double d) {
ALOGD("%s %f, 0x%08llx", s, d, *((long long *) (&d)));
}
diff --git a/driver/runtime/rs_core.c b/driver/runtime/rs_core.c
index 60d8578f..6e4c6d0f 100644
--- a/driver/runtime/rs_core.c
+++ b/driver/runtime/rs_core.c
@@ -310,3 +310,37 @@ PRIM_DEBUG(double3)
PRIM_DEBUG(double4)
#undef PRIM_DEBUG
+
+// Convert the half values to float before handing off to the driver. This
+// eliminates the need in the driver to properly support the half datatype
+// (either by adding compiler flags for half or link against compiler_rt).
+// Also, pass the bit-equivalent ushort to be printed.
+extern void __attribute__((overloadable)) rsDebug(const char *s, float f,
+ ushort us);
+extern void __attribute__((overloadable)) rsDebug(const char *s, half h) {
+ rsDebug(s, (float) h, *(ushort *) &h);
+}
+
+extern void __attribute__((overloadable)) rsDebug(const char *s,
+ const float2 *f,
+ const ushort2 *us);
+extern void __attribute__((overloadable)) rsDebug(const char *s, half2 h2) {
+ float2 f = convert_float2(h2);
+ rsDebug(s, &f, (ushort2 *) &h2);
+}
+
+extern void __attribute__((overloadable)) rsDebug(const char *s,
+ const float3 *f,
+ const ushort3 *us);
+extern void __attribute__((overloadable)) rsDebug(const char *s, half3 h3) {
+ float3 f = convert_float3(h3);
+ rsDebug(s, &f, (ushort3 *) &h3);
+}
+
+extern void __attribute__((overloadable)) rsDebug(const char *s,
+ const float4 *f,
+ const ushort4 *us);
+extern void __attribute__((overloadable)) rsDebug(const char *s, half4 h4) {
+ float4 f = convert_float4(h4);
+ rsDebug(s, &f, (ushort4 *) &h4);
+}