diff options
-rw-r--r-- | Android.mk | 4 | ||||
-rw-r--r-- | driver/rsdAllocation.cpp | 7 | ||||
-rw-r--r-- | driver/runtime/rs_structs.h | 16 | ||||
-rw-r--r-- | rsElement.cpp | 6 | ||||
-rw-r--r-- | rsSampler.cpp | 5 | ||||
-rw-r--r-- | rsType.cpp | 6 | ||||
-rw-r--r-- | rs_hal.h | 2 | ||||
-rw-r--r-- | scriptc/rs_types.rsh | 18 |
8 files changed, 55 insertions, 9 deletions
@@ -10,6 +10,10 @@ ifneq ($(OVERRIDE_RS_DRIVER),) rs_base_CFLAGS += -DOVERRIDE_RS_DRIVER=$(OVERRIDE_RS_DRIVER) endif +ifeq ($(RS_FIND_OFFSETS), true) + rs_base_CFLAGS += -DRS_FIND_OFFSETS +endif + include $(CLEAR_VARS) LOCAL_CLANG := true LOCAL_MODULE := libRSDriver diff --git a/driver/rsdAllocation.cpp b/driver/rsdAllocation.cpp index f488b55b..05951b96 100644 --- a/driver/rsdAllocation.cpp +++ b/driver/rsdAllocation.cpp @@ -463,6 +463,13 @@ bool rsdAllocationInit(const Context *rsc, Allocation *alloc, bool forceZero) { rsdAllocationData2D(rsc, alloc, 0, 0, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X, alloc->getType()->getDimX(), alloc->getType()->getDimY(), alloc->mHal.state.userProvidedPtr, allocSize, 0); } + +#ifdef RS_FIND_OFFSETS + ALOGE("pointer for allocation: %p", alloc); + ALOGE("pointer for allocation.drv: %p", &alloc->mHal.drv); +#endif + + return true; } diff --git a/driver/runtime/rs_structs.h b/driver/runtime/rs_structs.h index 80c129cc..e35cd54f 100644 --- a/driver/runtime/rs_structs.h +++ b/driver/runtime/rs_structs.h @@ -25,7 +25,11 @@ typedef enum { } rs_allocation_mipmap_control; typedef struct Allocation { +#ifndef __LP64__ char __pad[32]; +#else + char __pad[56]; +#endif struct { void * drv; struct { @@ -145,7 +149,11 @@ typedef struct ProgramRaster { * *****************************************************************************/ typedef struct Sampler { +#ifndef __LP64__ char __pad[32]; +#else + char __pad[56]; +#endif struct { void *drv; struct { @@ -177,7 +185,11 @@ typedef struct Sampler { * *****************************************************************************/ typedef struct Element { +#ifndef __LP64__ char __pad[32]; +#else + char __pad[56]; +#endif struct { void *drv; struct { @@ -215,7 +227,11 @@ typedef struct Element { * *****************************************************************************/ typedef struct Type { +#ifndef __LP64__ char __pad[32]; +#else + char __pad[56]; +#endif struct { void *drv; struct { diff --git a/rsElement.cpp b/rsElement.cpp index a81df48e..1418e957 100644 --- a/rsElement.cpp +++ b/rsElement.cpp @@ -243,6 +243,12 @@ ObjectBaseRef<const Element> Element::createRef(Context *rsc, RsDataType dt, RsD e->mComponent.set(dt, dk, isNorm, vecSize); e->compute(); +#ifdef RS_FIND_OFFSETS + ALOGE("pointer for element: %p", e); + ALOGE("pointer for element.drv: %p", &e->mHal.drv); +#endif + + ObjectBase::asyncLock(); rsc->mStateElement.mElements.push(e); ObjectBase::asyncUnlock(); diff --git a/rsSampler.cpp b/rsSampler.cpp index 2a8476a0..0cf0b55f 100644 --- a/rsSampler.cpp +++ b/rsSampler.cpp @@ -107,6 +107,11 @@ ObjectBaseRef<Sampler> Sampler::getSampler(Context *rsc, Sampler *s = new (allocMem) Sampler(rsc, magFilter, minFilter, wrapS, wrapT, wrapR, aniso); returnRef.set(s); +#ifdef RS_FIND_OFFSETS + ALOGE("pointer for sampler: %p", s); + ALOGE("pointer for sampler.drv: %p", &s->mHal.drv); +#endif + ObjectBase::asyncLock(); rsc->mStateSampler.mAllSamplers.push(s); ObjectBase::asyncUnlock(); @@ -228,6 +228,12 @@ ObjectBaseRef<Type> Type::getTypeRef(Context *rsc, const Element *e, Type *nt = new Type(rsc); + +#ifdef RS_FIND_OFFSETS + ALOGE("pointer for type: %p", nt); + ALOGE("pointer for type.drv: %p", &nt->mHal.drv); +#endif + nt->mDimLOD = dimLOD; returnRef.set(nt); nt->mElement.set(e); @@ -51,7 +51,7 @@ typedef struct { const void *in; void *out; const void *usr; - size_t usrLen; + uint32_t usrLen; uint32_t x; uint32_t y; uint32_t z; diff --git a/scriptc/rs_types.rsh b/scriptc/rs_types.rsh index 92ec56c7..de7e6aa8 100644 --- a/scriptc/rs_types.rsh +++ b/scriptc/rs_types.rsh @@ -106,20 +106,22 @@ typedef uint32_t uint; */ typedef uint64_t ulong; /** - * Typedef for unsigned int + * Typedef for size_t */ +#ifndef __LP64__ typedef uint32_t size_t; -/** - * Typedef for int (use for 32-bit integers) - */ typedef int32_t ssize_t; - -#ifndef __LP64__ -#define RS_BASE_OBJ typedef struct { const int* const p; } __attribute__((packed, aligned(4))) #else -#define RS_BASE_OBJ typedef struct { const int* const p; const int* const r; const int* const v1; const int* const v2; } +typedef uint64_t size_t; +typedef int64_t ssize_t; #endif +//#ifndef __LP64__ +#define RS_BASE_OBJ typedef struct { const int* const p; } __attribute__((packed, aligned(4))) +//#else +//#define RS_BASE_OBJ typedef struct { const int* const p; const int* const r; const int* const v1; const int* const v2; } +//#endif + /** * \brief Opaque handle to a RenderScript element. * |