From 6c72eec06e69559b4d990777c7b280aa81586797 Mon Sep 17 00:00:00 2001 From: Alex Sakhartchouk Date: Tue, 17 May 2011 12:32:47 -0700 Subject: Preparing libRS for for compilation on host. Change-Id: I851add79831331c8a8b20dcccdb0817f8ad0c359 --- libs/rs/RenderScriptDefines.h | 2 ++ libs/rs/driver/rsdGL.cpp | 4 ++-- libs/rs/driver/rsdGL.h | 3 ++- libs/rs/rs.spec | 2 +- libs/rs/rsContext.cpp | 13 +++++-------- libs/rs/rsContext.h | 6 ++---- libs/rs/rsUtils.h | 4 ---- libs/rs/rs_hal.h | 2 +- 8 files changed, 15 insertions(+), 21 deletions(-) (limited to 'libs/rs') diff --git a/libs/rs/RenderScriptDefines.h b/libs/rs/RenderScriptDefines.h index 308437d..ee9645c 100644 --- a/libs/rs/RenderScriptDefines.h +++ b/libs/rs/RenderScriptDefines.h @@ -50,6 +50,8 @@ typedef void * RsProgramFragment; typedef void * RsProgramStore; typedef void * RsProgramRaster; +typedef void * RsNativeWindow; + typedef void (* RsBitmapCallback_t)(void *); typedef struct { diff --git a/libs/rs/driver/rsdGL.cpp b/libs/rs/driver/rsdGL.cpp index de9fb51..a70589b 100644 --- a/libs/rs/driver/rsdGL.cpp +++ b/libs/rs/driver/rsdGL.cpp @@ -300,7 +300,7 @@ bool rsdGLInit(const Context *rsc) { } -bool rsdGLSetSurface(const Context *rsc, uint32_t w, uint32_t h, ANativeWindow *sur) { +bool rsdGLSetSurface(const Context *rsc, uint32_t w, uint32_t h, RsNativeWindow sur) { RsdHal *dc = (RsdHal *)rsc->mHal.drv; EGLBoolean ret; @@ -319,7 +319,7 @@ bool rsdGLSetSurface(const Context *rsc, uint32_t w, uint32_t h, ANativeWindow * dc->gl.height = 1; } - dc->gl.wndSurface = sur; + dc->gl.wndSurface = (ANativeWindow *)sur; if (dc->gl.wndSurface != NULL) { dc->gl.width = w; dc->gl.height = h; diff --git a/libs/rs/driver/rsdGL.h b/libs/rs/driver/rsdGL.h index 90cbe04..01c8438 100644 --- a/libs/rs/driver/rsdGL.h +++ b/libs/rs/driver/rsdGL.h @@ -18,6 +18,7 @@ #define RSD_GL_H #include +#include class RsdShaderCache; class RsdVertexArrayState; @@ -74,7 +75,7 @@ typedef struct RsdGLRec { bool rsdGLInit(const android::renderscript::Context *rsc); void rsdGLShutdown(const android::renderscript::Context *rsc); bool rsdGLSetSurface(const android::renderscript::Context *rsc, - uint32_t w, uint32_t h, ANativeWindow *sur); + uint32_t w, uint32_t h, RsNativeWindow sur); void rsdGLSwap(const android::renderscript::Context *rsc); void rsdGLCheckError(const android::renderscript::Context *rsc, const char *msg, bool isFatal = false); diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec index 29de5f0..4c8b5db 100644 --- a/libs/rs/rs.spec +++ b/libs/rs/rs.spec @@ -140,7 +140,7 @@ ContextResume { ContextSetSurface { param uint32_t width param uint32_t height - param ANativeWindow *sur + param RsNativeWindow sur } ContextDump { diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index a4e1b72..d3bd0d9 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -18,8 +18,6 @@ #include "rsContext.h" #include "rsThreadIO.h" #include -#include -#include #include #include @@ -246,7 +244,7 @@ void * Context::threadProc(void *vrsc) { while (!rsc->mExit) { mDraw |= rsc->mIO.playCoreCommands(rsc, !mDraw); mDraw &= (rsc->mRootScript.get() != NULL); - mDraw &= (rsc->mWndSurface != NULL); + mDraw &= rsc->mHasSurface; uint32_t targetTime = 0; if (mDraw && rsc->mIsGraphicsContext) { @@ -371,7 +369,7 @@ bool Context::initContext(Device *dev, const RsSurfaceConfig *sc) { return false; } - mWndSurface = NULL; + mHasSurface = false; timerInit(); timerSet(RS_TIMER_INTERNAL); @@ -406,7 +404,6 @@ Context::~Context() { mIO.shutdown(); int status = pthread_join(mThreadId, &res); - if (mHal.funcs.shutdownDriver) { mHal.funcs.shutdownDriver(this); } @@ -421,11 +418,11 @@ Context::~Context() { LOGV("Context::~Context done"); } -void Context::setSurface(uint32_t w, uint32_t h, ANativeWindow *sur) { +void Context::setSurface(uint32_t w, uint32_t h, RsNativeWindow sur) { rsAssert(mIsGraphicsContext); mHal.funcs.setSurface(this, w, h, sur); - mWndSurface = sur; + mHasSurface = sur != NULL; mWidth = w; mHeight = h; @@ -617,7 +614,7 @@ void rsi_ContextResume(Context *rsc) { rsc->resume(); } -void rsi_ContextSetSurface(Context *rsc, uint32_t w, uint32_t h, ANativeWindow *sur, size_t sur_length) { +void rsi_ContextSetSurface(Context *rsc, uint32_t w, uint32_t h, RsNativeWindow sur) { rsc->setSurface(w, h, sur); } diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h index 6336210..be615a3 100644 --- a/libs/rs/rsContext.h +++ b/libs/rs/rsContext.h @@ -44,8 +44,6 @@ #endif // ANDROID_RS_SERIALIZE -class ANativeWindow; - // --------------------------------------------------------------------------- namespace android { @@ -136,7 +134,7 @@ public: void pause(); void resume(); - void setSurface(uint32_t w, uint32_t h, ANativeWindow *sur); + void setSurface(uint32_t w, uint32_t h, RsNativeWindow sur); void setPriority(int32_t p); void destroyWorkerThreadResources(); @@ -244,7 +242,7 @@ private: static void * threadProc(void *); static void * helperThreadProc(void *); - ANativeWindow *mWndSurface; + bool mHasSurface; Vector mNames; diff --git a/libs/rs/rsUtils.h b/libs/rs/rsUtils.h index 3b60af5..3a6c85a 100644 --- a/libs/rs/rsUtils.h +++ b/libs/rs/rsUtils.h @@ -32,10 +32,6 @@ #include #include -#ifndef ANDROID_RS_SERIALIZE -#include -#endif - #include #include "RenderScript.h" diff --git a/libs/rs/rs_hal.h b/libs/rs/rs_hal.h index cfa4e74..9d8c906 100644 --- a/libs/rs/rs_hal.h +++ b/libs/rs/rs_hal.h @@ -47,7 +47,7 @@ typedef void *(*RsHalSymbolLookupFunc)(void *usrptr, char const *symbolName); typedef struct { bool (*initGraphics)(const Context *); void (*shutdownGraphics)(const Context *); - bool (*setSurface)(const Context *, uint32_t w, uint32_t h, ANativeWindow *); + bool (*setSurface)(const Context *, uint32_t w, uint32_t h, RsNativeWindow); void (*swap)(const Context *); void (*shutdownDriver)(Context *); -- cgit v1.1