OSDN Git Service

Preparing libRS for for compilation on host.
authorAlex Sakhartchouk <alexst@google.com>
Tue, 17 May 2011 19:32:47 +0000 (12:32 -0700)
committerAlex Sakhartchouk <alexst@google.com>
Tue, 17 May 2011 23:42:24 +0000 (16:42 -0700)
Change-Id: I851add79831331c8a8b20dcccdb0817f8ad0c359

graphics/jni/android_renderscript_RenderScript.cpp
libs/rs/RenderScriptDefines.h
libs/rs/driver/rsdGL.cpp
libs/rs/driver/rsdGL.h
libs/rs/rs.spec
libs/rs/rsContext.cpp
libs/rs/rsContext.h
libs/rs/rsUtils.h
libs/rs/rs_hal.h

index 781c24f..60b39b0 100644 (file)
@@ -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
index 308437d..ee9645c 100644 (file)
@@ -50,6 +50,8 @@ typedef void * RsProgramFragment;
 typedef void * RsProgramStore;
 typedef void * RsProgramRaster;
 
+typedef void * RsNativeWindow;
+
 typedef void (* RsBitmapCallback_t)(void *);
 
 typedef struct {
index de9fb51..a70589b 100644 (file)
@@ -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;
index 90cbe04..01c8438 100644 (file)
@@ -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);
index 29de5f0..4c8b5db 100644 (file)
@@ -140,7 +140,7 @@ ContextResume {
 ContextSetSurface {
        param uint32_t width
        param uint32_t height
-       param ANativeWindow *sur
+       param RsNativeWindow sur
        }
 
 ContextDump {
index a4e1b72..d3bd0d9 100644 (file)
@@ -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);
 }
 
index 6336210..be615a3 100644 (file)
@@ -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;
 
index 3b60af5..3a6c85a 100644 (file)
 #include <time.h>
 #include <cutils/atomic.h>
 
-#ifndef ANDROID_RS_SERIALIZE
-#include <EGL/egl.h>
-#endif
-
 #include <math.h>
 
 #include "RenderScript.h"
index cfa4e74..9d8c906 100644 (file)
@@ -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 *);