summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2015-05-18 17:28:59 -0700
committerJason Sams <jsams@google.com>2015-05-18 17:28:59 -0700
commitfa578a3a3404bafaae1ac23164a563a70e00fd44 (patch)
tree256e409c31ed15ec3b1747084b450e24b89faeac
parent874ed8dee9ab7118efb517f6a8a9c1758818fd4c (diff)
downloadrs-fa578a3a3404bafaae1ac23164a563a70e00fd44.tar.gz
Notify drivers when user get a pointer to allocation
Requested by vendor for driver bring-up. bug 20894664 Change-Id: I7a1540236e557ef42ffde1c832b5d5ef36b91c96
-rw-r--r--driver/rsdCore.cpp2
-rw-r--r--rsAllocation.cpp6
-rw-r--r--rsDriverLoader.cpp1
-rw-r--r--rs_hal.h5
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);
diff --git a/rs_hal.h b/rs_hal.h
index 77c2d261..c500e5a2 100644
--- a/rs_hal.h
+++ b/rs_hal.h
@@ -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,