diff options
author | Miao Wang <miaowang@google.com> | 2017-03-14 14:23:52 -0700 |
---|---|---|
committer | Miao Wang <miaowang@google.com> | 2017-03-15 18:04:29 -0700 |
commit | 59f6142d7657e43b4d21e077a28387431db02edf (patch) | |
tree | 717db53d36b0d31524044e38e67e5a8403ee387f /driver | |
parent | a681bdded5327f682c01b231c64257824e5746d8 (diff) | |
download | rs-59f6142d7657e43b4d21e077a28387431db02edf.tar.gz |
Remove libgui and libui dependencies for vendor libs.
- This CL removes dependencies on libgui, libui and other remaining
dependences, if build with RS_VENDOR_LIB defined.
- We cannot remove the dependencies for platform RenderScript CPU
fallback, because of the legacy graphics APIs.
- Vendor drivers will be built without graphics APIs, the reference
build file will be posted in another CL.
Bug: 34396220
Test: mm, CTS test pass with the vendor libs.
Change-Id: If90b600a58d0f81488f56a1e21ca332f1a235162
Diffstat (limited to 'driver')
-rw-r--r-- | driver/rsdAllocation.cpp | 38 | ||||
-rw-r--r-- | driver/rsdAllocation.h | 6 | ||||
-rw-r--r-- | driver/rsdCore.cpp | 6 | ||||
-rw-r--r-- | driver/rsdCore.h | 4 | ||||
-rw-r--r-- | driver/rsdRuntimeStubs.cpp | 4 |
5 files changed, 30 insertions, 28 deletions
diff --git a/driver/rsdAllocation.cpp b/driver/rsdAllocation.cpp index f4674b9c..2db5633a 100644 --- a/driver/rsdAllocation.cpp +++ b/driver/rsdAllocation.cpp @@ -23,10 +23,6 @@ #include "rsCompatibilityLib.h" #else #include "rsdFrameBufferObj.h" -#include "gui/GLConsumer.h" -#include "gui/CpuConsumer.h" -#include "gui/Surface.h" -#include "hardware/gralloc.h" #include <GLES/gl.h> #include <GLES2/gl2.h> @@ -99,7 +95,7 @@ uint8_t *GetOffsetPtr(const android::renderscript::Allocation *alloc, static void Update2DTexture(const Context *rsc, const Allocation *alloc, const void *ptr, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face, uint32_t w, uint32_t h) { -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv; rsAssert(drv->textureID); @@ -114,7 +110,7 @@ static void Update2DTexture(const Context *rsc, const Allocation *alloc, const v } -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) static void Upload2DTexture(const Context *rsc, const Allocation *alloc, bool isFirstUpload) { DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv; @@ -158,7 +154,7 @@ static void Upload2DTexture(const Context *rsc, const Allocation *alloc, bool is #endif static void UploadToTexture(const Context *rsc, const Allocation *alloc) { -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv; if (alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_IO_INPUT) { @@ -196,7 +192,7 @@ static void UploadToTexture(const Context *rsc, const Allocation *alloc) { } static void AllocateRenderTarget(const Context *rsc, const Allocation *alloc) { -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv; if (!drv->glFormat) { @@ -221,7 +217,7 @@ static void AllocateRenderTarget(const Context *rsc, const Allocation *alloc) { } static void UploadToBufferObject(const Context *rsc, const Allocation *alloc) { -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv; rsAssert(!alloc->mHal.state.type->getDimY()); @@ -252,7 +248,7 @@ static size_t DeriveYUVLayout(int yuv, Allocation::Hal::DrvState *state) { // For the flexible YCbCr format, layout is initialized during call to // Allocation::ioReceive. Return early and avoid clobberring any // pre-existing layout. - if (yuv == HAL_PIXEL_FORMAT_YCbCr_420_888) { + if (yuv == RS_YUV_420_888) { return 0; } #endif @@ -269,7 +265,7 @@ static size_t DeriveYUVLayout(int yuv, Allocation::Hal::DrvState *state) { state->lodCount = 3; switch(yuv) { - case HAL_PIXEL_FORMAT_YV12: + case RS_YUV_YV12: state->lod[2].stride = rsRound(state->lod[0].stride >> 1, 16); state->lod[2].mallocPtr = ((uint8_t *)state->lod[0].mallocPtr) + (state->lod[0].stride * state->lod[0].dimY); @@ -280,7 +276,7 @@ static size_t DeriveYUVLayout(int yuv, Allocation::Hal::DrvState *state) { (state->lod[2].stride * state->lod[2].dimY); uvSize += state->lod[1].stride * state->lod[2].dimY; break; - case HAL_PIXEL_FORMAT_YCrCb_420_SP: // NV21 + case RS_YUV_NV21: //state->lod[1].dimX = state->lod[0].dimX; state->lod[1].stride = state->lod[0].stride; state->lod[2].stride = state->lod[0].stride; @@ -473,8 +469,9 @@ bool rsdAllocationInitStrided(const Context *rsc, Allocation *alloc, bool forceZ drv->uploadDeferred = true; } - +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) drv->readBackFBO = nullptr; +#endif // fill out the initial state of the buffer if we couldn't use the user-provided ptr and USAGE_SHARED was accepted if ((alloc->mHal.state.userProvidedPtr != 0) && (drv->useUserProvidedPtr == false)) { @@ -535,7 +532,7 @@ void rsdAllocationDestroy(const Context *rsc, Allocation *alloc) { DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv; if (alloc->mHal.state.baseAlloc == nullptr) { -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) if (drv->bufferID) { // Causes a SW crash.... //ALOGV(" mBufferID %i", mBufferID); @@ -563,11 +560,12 @@ void rsdAllocationDestroy(const Context *rsc, Allocation *alloc) { } #ifndef RS_COMPATIBILITY_LIB +#ifndef RS_VENDOR_LIB if (drv->readBackFBO != nullptr) { delete drv->readBackFBO; drv->readBackFBO = nullptr; } - +#endif if ((alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_IO_OUTPUT) && (alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_SCRIPT)) { ANativeWindow *nw = drv->wndSurface; @@ -615,7 +613,7 @@ void rsdAllocationResize(const Context *rsc, const Allocation *alloc, } static void rsdAllocationSyncFromFBO(const Context *rsc, const Allocation *alloc) { -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) if (!alloc->getIsScript()) { return; // nothing to sync } @@ -754,11 +752,13 @@ void rsdAllocationIoSend(const Context *rsc, Allocation *alloc) { #ifndef RS_COMPATIBILITY_LIB DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv; ANativeWindow *nw = drv->wndSurface; +#ifndef RS_VENDOR_LIB if (alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET) { RsdHal *dc = (RsdHal *)rsc->mHal.drv; RSD_CALL_GL(eglSwapBuffers, dc->gl.egl.display, dc->gl.egl.surface); return; } +#endif if (nw) { if (alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_SCRIPT) { int32_t r = ANativeWindow_unlockAndPost(nw); @@ -776,7 +776,7 @@ void rsdAllocationIoSend(const Context *rsc, Allocation *alloc) { } void rsdAllocationIoReceive(const Context *rsc, Allocation *alloc) { -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv; if (!(alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_SCRIPT)) { drv->surfaceTexture->updateTexImage(); @@ -842,10 +842,10 @@ void rsdAllocationData2D(const Context *rsc, const Allocation *alloc, size_t clineSize = lineSize; int lod = 1; int maxLod = 2; - if (alloc->mHal.state.yuv == HAL_PIXEL_FORMAT_YV12) { + if (alloc->mHal.state.yuv == RS_YUV_YV12) { maxLod = 3; clineSize >>= 1; - } else if (alloc->mHal.state.yuv == HAL_PIXEL_FORMAT_YCrCb_420_SP) { + } else if (alloc->mHal.state.yuv == RS_YUV_NV21) { lod = 2; maxLod = 3; } diff --git a/driver/rsdAllocation.h b/driver/rsdAllocation.h index c2d1467d..e37299e1 100644 --- a/driver/rsdAllocation.h +++ b/driver/rsdAllocation.h @@ -26,7 +26,7 @@ #include <GLES/gl.h> #include <GLES2/gl2.h> -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) #include "gui/GLConsumer.h" #endif @@ -48,7 +48,7 @@ struct DrvAllocation { // Is this a legal structure to be used as an FBO render target uint32_t renderTargetID; -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) GLenum glTarget; GLenum glType; GLenum glFormat; @@ -65,7 +65,9 @@ struct DrvAllocation { bool useUserProvidedPtr; bool uploadDeferred; +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) RsdFrameBufferObj * readBackFBO; +#endif ANativeWindow *wnd; ANativeWindow *wndSurface; }; diff --git a/driver/rsdCore.cpp b/driver/rsdCore.cpp index 07ca2a6a..cd483409 100644 --- a/driver/rsdCore.cpp +++ b/driver/rsdCore.cpp @@ -21,7 +21,7 @@ #include "rsdBcc.h" #include "rsdElement.h" #include "rsdType.h" -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) #include "rsdGL.h" #include "rsdProgramStore.h" #include "rsdProgramRaster.h" @@ -208,7 +208,7 @@ extern "C" bool rsdHalQueryHal(RsHalInitEnums entry, void **fnPtr) { // Functions below this point are for the legacy graphics api, // vendor drivers are NOT expected to implement these. They will never be called // for an external driver. -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) case RS_HAL_GRAPHICS_INIT: fnPtr[0] = (void *)rsdGLInit; break; case RS_HAL_GRAPHICS_SHUTDOWN: @@ -353,7 +353,7 @@ void SetPriority(const Context *rsc, int32_t priority) { dc->mCpuRef->setPriority(priority); -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) if (dc->mHasGraphics) { rsdGLSetPriority(rsc, priority); } diff --git a/driver/rsdCore.h b/driver/rsdCore.h index 0e46fd24..3cad348a 100644 --- a/driver/rsdCore.h +++ b/driver/rsdCore.h @@ -24,7 +24,7 @@ #include "rsMutex.h" #include "rsSignal.h" -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) #include "rsdGL.h" #endif @@ -41,7 +41,7 @@ typedef struct RsdHalRec { ScriptTLSStruct mTlsStruct; android::renderscript::RsdCpuReference *mCpuRef; -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) RsdGL gl; #endif } RsdHal; diff --git a/driver/rsdRuntimeStubs.cpp b/driver/rsdRuntimeStubs.cpp index 498cea4d..504f0980 100644 --- a/driver/rsdRuntimeStubs.cpp +++ b/driver/rsdRuntimeStubs.cpp @@ -32,7 +32,7 @@ #include <time.h> -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) using android::renderscript::Font; #endif @@ -807,7 +807,7 @@ float rsGetDt() { ////////////////////////////////////////////////////////////////////////////// // Graphics routines ////////////////////////////////////////////////////////////////////////////// -#ifndef RS_COMPATIBILITY_LIB +#if !defined(RS_VENDOR_LIB) && !defined(RS_COMPATIBILITY_LIB) static void SC_DrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2, float x3, float y3, float z3, float u3, float v3, |