From e004058419dc1d3315274dbdf538e57769a2db9c Mon Sep 17 00:00:00 2001 From: Stephen Hines Date: Mon, 8 Aug 2011 15:06:40 -0700 Subject: Migrate perf-critical functions away from librs. BUG=3497315 Change-Id: Ieaa0d64933767d422aa62740d72b31042dcd4a2f --- libs/rs/driver/rsdRuntimeStubs.cpp | 53 -------------------------------------- libs/rs/rsAllocation.h | 10 ++++++- 2 files changed, 9 insertions(+), 54 deletions(-) (limited to 'libs/rs') diff --git a/libs/rs/driver/rsdRuntimeStubs.cpp b/libs/rs/driver/rsdRuntimeStubs.cpp index d8050ac..90c8928 100644 --- a/libs/rs/driver/rsdRuntimeStubs.cpp +++ b/libs/rs/driver/rsdRuntimeStubs.cpp @@ -42,41 +42,6 @@ using namespace android::renderscript; // Allocation ////////////////////////////////////////////////////////////////////////////// -static uint32_t SC_allocGetDimX(Allocation *a) { - return a->mHal.state.dimensionX; -} - -static uint32_t SC_allocGetDimY(Allocation *a) { - return a->mHal.state.dimensionY; -} - -static uint32_t SC_allocGetDimZ(Allocation *a) { - return a->mHal.state.dimensionZ; -} - -static uint32_t SC_allocGetDimLOD(Allocation *a) { - return a->mHal.state.hasMipmaps; -} - -static uint32_t SC_allocGetDimFaces(Allocation *a) { - return a->mHal.state.hasFaces; -} - -static const void * SC_getElementAtX(Allocation *a, uint32_t x) { - const uint8_t *p = (const uint8_t *)a->getPtr(); - return &p[a->mHal.state.elementSizeBytes * x]; -} - -static const void * SC_getElementAtXY(Allocation *a, uint32_t x, uint32_t y) { - const uint8_t *p = (const uint8_t *)a->getPtr(); - return &p[a->mHal.state.elementSizeBytes * (x + y * a->mHal.state.dimensionX)]; -} - -static const void * SC_getElementAtXYZ(Allocation *a, uint32_t x, uint32_t y, uint32_t z) { - const uint8_t *p = (const uint8_t *)a->getPtr(); - return &p[a->mHal.state.elementSizeBytes * (x + y * a->mHal.state.dimensionX + - z * a->mHal.state.dimensionX * a->mHal.state.dimensionY)]; -} static void SC_AllocationSyncAll2(Allocation *a, RsAllocationUsageType source) { GET_TLS(); @@ -115,12 +80,6 @@ static void SC_AllocationCopy2DRange(Allocation *dstAlloc, } -const Allocation * SC_getAllocation(const void *ptr) { - GET_TLS(); - return rsrGetAllocation(rsc, sc, ptr); -} - - ////////////////////////////////////////////////////////////////////////////// // Context ////////////////////////////////////////////////////////////////////////////// @@ -599,18 +558,6 @@ static RsdSymbolTable gSyms[] = { { "_Z10rsIsObject7rs_font", (void *)&SC_IsObject, true }, // Allocation ops - { "_Z19rsAllocationGetDimX13rs_allocation", (void *)&SC_allocGetDimX, true }, - { "_Z19rsAllocationGetDimY13rs_allocation", (void *)&SC_allocGetDimY, true }, - { "_Z19rsAllocationGetDimZ13rs_allocation", (void *)&SC_allocGetDimZ, true }, - { "_Z21rsAllocationGetDimLOD13rs_allocation", (void *)&SC_allocGetDimLOD, true }, - { "_Z23rsAllocationGetDimFaces13rs_allocation", (void *)&SC_allocGetDimFaces, true }, - - { "_Z14rsGetElementAt13rs_allocationj", (void *)&SC_getElementAtX, true }, - { "_Z14rsGetElementAt13rs_allocationjj", (void *)&SC_getElementAtXY, true }, - { "_Z14rsGetElementAt13rs_allocationjjj", (void *)&SC_getElementAtXYZ, true }, - - { "_Z15rsGetAllocationPKv", (void *)&SC_getAllocation, true }, - { "_Z21rsAllocationMarkDirty13rs_allocation", (void *)&SC_AllocationSyncAll, true }, { "_Z20rsgAllocationSyncAll13rs_allocation", (void *)&SC_AllocationSyncAll, false }, { "_Z20rsgAllocationSyncAll13rs_allocationj", (void *)&SC_AllocationSyncAll2, false }, diff --git a/libs/rs/rsAllocation.h b/libs/rs/rsAllocation.h index f538dd1..f2589c0 100644 --- a/libs/rs/rsAllocation.h +++ b/libs/rs/rsAllocation.h @@ -25,8 +25,16 @@ namespace renderscript { class Program; +/***************************************************************************** + * CAUTION + * + * Any layout changes for this class may require a corresponding change to be + * made to frameworks/compile/libbcc/lib/ScriptCRT/rs_core.c, which contains + * a partial copy of the information below. + * + *****************************************************************************/ class Allocation : public ObjectBase { - // The graphics equilivent of malloc. The allocation contains a structure of elements. + // The graphics equivalent of malloc. The allocation contains a structure of elements. public: struct Hal { -- cgit v1.1