summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2011-05-17 12:32:47 -0700
committerAlex Sakhartchouk <alexst@google.com>2011-05-17 16:42:24 -0700
commit6c72eec06e69559b4d990777c7b280aa81586797 (patch)
tree7190db025c961273573e8faa05d1a3c22ec834ba
parent51c07e717b4416dd338b0add3a3c94d1137366af (diff)
downloadframeworks_base-6c72eec06e69559b4d990777c7b280aa81586797.zip
frameworks_base-6c72eec06e69559b4d990777c7b280aa81586797.tar.gz
frameworks_base-6c72eec06e69559b4d990777c7b280aa81586797.tar.bz2
Preparing libRS for for compilation on host.
Change-Id: I851add79831331c8a8b20dcccdb0817f8ad0c359
-rw-r--r--graphics/jni/android_renderscript_RenderScript.cpp6
-rw-r--r--libs/rs/RenderScriptDefines.h2
-rw-r--r--libs/rs/driver/rsdGL.cpp4
-rw-r--r--libs/rs/driver/rsdGL.h3
-rw-r--r--libs/rs/rs.spec2
-rw-r--r--libs/rs/rsContext.cpp13
-rw-r--r--libs/rs/rsContext.h6
-rw-r--r--libs/rs/rsUtils.h4
-rw-r--r--libs/rs/rs_hal.h2
9 files changed, 18 insertions, 24 deletions
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 781c24f..60b39b0 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -190,14 +190,14 @@ nContextSetSurface(JNIEnv *_env, jobject _this, RsContext con, jint width, jint
{
LOG_API("nContextSetSurface, con(%p), width(%i), height(%i), surface(%p)", con, width, height, (Surface *)wnd);
- Surface * window = NULL;
+ ANativeWindow * window = NULL;
if (wnd == NULL) {
} else {
- window = (Surface*) android_Surface_getNativeWindow(_env, wnd).get();
+ window = android_Surface_getNativeWindow(_env, wnd).get();
}
- rsContextSetSurface(con, width, height, window, 1);
+ rsContextSetSurface(con, width, height, window);
}
static void
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 <rs_hal.h>
+#include <EGL/egl.h>
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 <ui/FramebufferNativeWindow.h>
-#include <ui/PixelFormat.h>
-#include <ui/egl/android_natives.h>
#include <sys/types.h>
#include <sys/resource.h>
@@ -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<ObjectBase *> 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 <time.h>
#include <cutils/atomic.h>
-#ifndef ANDROID_RS_SERIALIZE
-#include <EGL/egl.h>
-#endif
-
#include <math.h>
#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 *);