diff options
author | Jason Sams <jsams@google.com> | 2015-05-20 18:24:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-20 18:24:54 +0000 |
commit | c705223e0e5dff3bbd10f82c216784316f3c3398 (patch) | |
tree | 088ed87d31d7cac23ced948cfc857f553ae029fc | |
parent | 93fbc61ad282cbbf4a6a93396fdd8747b1fe3451 (diff) | |
parent | fa578a3a3404bafaae1ac23164a563a70e00fd44 (diff) | |
download | rs-c705223e0e5dff3bbd10f82c216784316f3c3398.tar.gz |
Merge "Notify drivers when user get a pointer to allocation" into mnc-dev
-rw-r--r-- | driver/rsdCore.cpp | 2 | ||||
-rw-r--r-- | rsAllocation.cpp | 6 | ||||
-rw-r--r-- | rsDriverLoader.cpp | 1 | ||||
-rw-r--r-- | rs_hal.h | 5 |
4 files changed, 13 insertions, 1 deletions
diff --git a/driver/rsdCore.cpp b/driver/rsdCore.cpp index 9c4755c5..d65460c8 100644 --- a/driver/rsdCore.cpp +++ b/driver/rsdCore.cpp @@ -154,6 +154,8 @@ extern "C" bool rsdHalQueryHal(RsHalInitEnums entry, void **fnPtr) { fnPtr[0] = (void *)rsdAllocationUpdateCachedObject; break; case RS_HAL_ALLOCATION_ADAPTER_OFFSET: fnPtr[0] = (void *)rsdAllocationAdapterOffset; break; + case RS_HAL_ALLOCATION_GET_POINTER: + fnPtr[0] = (void *)nullptr; break; case RS_HAL_SAMPLER_INIT: fnPtr[0] = (void *)rsdSamplerInit; break; diff --git a/rsAllocation.cpp b/rsAllocation.cpp index a7601a46..3bdbf7b9 100644 --- a/rsAllocation.cpp +++ b/rsAllocation.cpp @@ -167,8 +167,12 @@ void * Allocation::getPointer(const Context *rsc, uint32_t lod, RsAllocationCube return nullptr; } + if (mRSC->mHal.funcs.allocation.getPointer != nullptr) { + // Notify the driver, if present that the user is mapping the buffer + mRSC->mHal.funcs.allocation.getPointer(rsc, this, lod, face, z, array); + } + size_t s = 0; - //void *ptr = mRSC->mHal.funcs.allocation.lock1D(rsc, this); if ((stride != nullptr) && mHal.drvState.lod[0].dimY) { *stride = mHal.drvState.lod[lod].stride; } diff --git a/rsDriverLoader.cpp b/rsDriverLoader.cpp index 2bc53b6a..5bfb8e5c 100644 --- a/rsDriverLoader.cpp +++ b/rsDriverLoader.cpp @@ -108,6 +108,7 @@ static bool LoadHalTable(Context *rsc, HalQueryHal fn, bool loadGraphics) { ret &= fn(RS_HAL_ALLOCATION_GENERATE_MIPMAPS, (void **)&rsc->mHal.funcs.allocation.generateMipmaps); ret &= fn(RS_HAL_ALLOCATION_UPDATE_CACHED_OBJECT, (void **)&rsc->mHal.funcs.allocation.updateCachedObject); ret &= fn(RS_HAL_ALLOCATION_ADAPTER_OFFSET, (void **)&rsc->mHal.funcs.allocation.adapterOffset); + ret &= fn(RS_HAL_ALLOCATION_GET_POINTER, (void **)&rsc->mHal.funcs.allocation.getPointer); ret &= fn(RS_HAL_SAMPLER_INIT, (void **)&rsc->mHal.funcs.sampler.init); ret &= fn(RS_HAL_SAMPLER_DESTROY, (void **)&rsc->mHal.funcs.sampler.destroy); @@ -275,6 +275,10 @@ typedef struct { void (*updateCachedObject)(const Context *rsc, const Allocation *alloc, rs_allocation *obj); void (*adapterOffset)(const Context *rsc, const Allocation *alloc); + + void (*getPointer)(const Context *rsc, const Allocation *alloc, + uint32_t lod, RsAllocationCubemapFace face, + uint32_t z, uint32_t array); } allocation; struct { @@ -402,6 +406,7 @@ enum RsHalInitEnums { RS_HAL_ALLOCATION_UPDATE_CACHED_OBJECT = 2024, RS_HAL_ALLOCATION_ADAPTER_OFFSET = 2025, RS_HAL_ALLOCATION_INIT_OEM = 2026, + RS_HAL_ALLOCATION_GET_POINTER = 2027, RS_HAL_SAMPLER_INIT = 3000, RS_HAL_SAMPLER_DESTROY = 3001, |