summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorDavid Gross <dgross@google.com>2017-05-15 19:19:30 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-05-15 19:19:32 +0000
commitf7ae968ba9990f8948a0d44b8c7e2e9aa0205c31 (patch)
treed87e2c7842e36988099127437719a5e8b543926f /driver
parentc33e66fee819773d5506c421dd201b05e114305c (diff)
parentf4882cb90cacad9db128e6d7f06b553258f843ff (diff)
downloadrs-f7ae968ba9990f8948a0d44b8c7e2e9aa0205c31.tar.gz
Merge "Fix CTS VLoadTest failures under debug context."
Diffstat (limited to 'driver')
-rw-r--r--driver/runtime/rs_allocation.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/driver/runtime/rs_allocation.c b/driver/runtime/rs_allocation.c
index a20d99ab..2163e77c 100644
--- a/driver/runtime/rs_allocation.c
+++ b/driver/runtime/rs_allocation.c
@@ -61,6 +61,32 @@ static void local_memcpy(void* dst, const void* src, size_t size) {
}
}
+#ifndef RS_DEBUG_RUNTIME
+uint8_t*
+rsOffset(rs_allocation a, uint32_t sizeOf, uint32_t x, uint32_t y,
+ uint32_t z) {
+ Allocation_t *alloc = (Allocation_t *)a.p;
+ uint8_t *p = (uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr;
+ const uint32_t stride = (uint32_t)alloc->mHal.drvState.lod[0].stride;
+ const uint32_t dimY = alloc->mHal.drvState.lod[0].dimY;
+ uint8_t *dp = &p[(sizeOf * x) + (y * stride) +
+ (z * stride * dimY)];
+ return dp;
+}
+#endif
+
+uint8_t*
+rsOffsetNs(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+ Allocation_t *alloc = (Allocation_t *)a.p;
+ uint8_t *p = (uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr;
+ const uint32_t stride = alloc->mHal.drvState.lod[0].stride;
+ const uint32_t dimY = alloc->mHal.drvState.lod[0].dimY;
+ const uint32_t sizeOf = alloc->mHal.state.elementSizeBytes;;
+ uint8_t *dp = &p[(sizeOf * x) + (y * stride) +
+ (z * stride * dimY)];
+ return dp;
+}
+
#ifdef RS_DEBUG_RUNTIME
#define ELEMENT_AT(T) \
extern void __attribute__((overloadable)) \
@@ -108,30 +134,6 @@ static void local_memcpy(void* dst, const void* src, size_t size) {
}
#else // NOT RS_DEBUG_RUNTIME
-uint8_t*
-rsOffset(rs_allocation a, uint32_t sizeOf, uint32_t x, uint32_t y,
- uint32_t z) {
- Allocation_t *alloc = (Allocation_t *)a.p;
- uint8_t *p = (uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr;
- const uint32_t stride = (uint32_t)alloc->mHal.drvState.lod[0].stride;
- const uint32_t dimY = alloc->mHal.drvState.lod[0].dimY;
- uint8_t *dp = &p[(sizeOf * x) + (y * stride) +
- (z * stride * dimY)];
- return dp;
-}
-
-uint8_t*
-rsOffsetNs(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
- Allocation_t *alloc = (Allocation_t *)a.p;
- uint8_t *p = (uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr;
- const uint32_t stride = alloc->mHal.drvState.lod[0].stride;
- const uint32_t dimY = alloc->mHal.drvState.lod[0].dimY;
- const uint32_t sizeOf = alloc->mHal.state.elementSizeBytes;;
- uint8_t *dp = &p[(sizeOf * x) + (y * stride) +
- (z * stride * dimY)];
- return dp;
-}
-
// The functions rsSetElementAtImpl_T and rsGetElementAtImpl_T are implemented in bitcode
// in ll32/allocation.ll and ll64/allocation.ll. To be able to provide debug info for
// these functions define them here instead, if we are linking with the debug library.