summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorPirama Arumuga Nainar <pirama@google.com>2016-04-04 12:01:14 -0700
committerPirama Arumuga Nainar <pirama@google.com>2016-04-04 15:03:04 -0700
commit92185a7b5e7821ce5b584329a2483f224ca12e0f (patch)
tree3b1cb925aaf4340d6537f87b490163386b7b033e /driver
parent69a2af08d9f329e102052fa8066e900d15cf4d83 (diff)
downloadrs-92185a7b5e7821ce5b584329a2483f224ca12e0f.tar.gz
Implement rsDebug for half
http://b/27556050 Add needed support in libRSDriver and libclcore. Change-Id: I374b4372bd4f550e99f9916e1c0a08b8c406f0fc
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 10e360e7..73fc503a 100644
--- a/driver/runtime/rs_core.c
+++ b/driver/runtime/rs_core.c
@@ -279,3 +279,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);
+}