mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Progress on omtc integration
This commit is contained in:
parent
ccfd344226
commit
a1415e44f6
@ -1930,12 +1930,16 @@ CreateSurfaceForWindow(nsIWidget *aWidget, EGLConfig config)
|
||||
{
|
||||
EGLSurface surface;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
sEGLLibrary.DumpEGLConfig(config);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
if (true) {
|
||||
printf_stderr("... registering OGL compositor with bridge\n");
|
||||
return mozilla::AndroidBridge::Bridge()->RegisterCompositor();
|
||||
}
|
||||
#ifdef MOZ_JAVA_COMPOSITOR
|
||||
#elif defined(MOZ_WIDGET_ANDROID)
|
||||
printf_stderr("... requesting window surface from bridge\n");
|
||||
|
||||
// On Android, we have to ask Java to make the eglCreateWindowSurface
|
||||
|
@ -290,7 +290,7 @@ CompositorParent::AllocPLayers(const LayersBackend &backendType)
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// Registering with the compositor will create the surface view that
|
||||
// the layer manager expects to attach to.
|
||||
RegisterCompositorWithJava();
|
||||
//RegisterCompositorWithJava();
|
||||
#endif
|
||||
|
||||
if (backendType == LayerManager::LAYERS_OPENGL) {
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
package org.mozilla.gecko.gfx;
|
||||
|
||||
import org.mozilla.gecko.GeckoApp;
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.opengl.GLSurfaceView;
|
||||
@ -156,6 +157,11 @@ public class FlexibleGLSurfaceView extends SurfaceView implements SurfaceHolder.
|
||||
// Called from the compositor thread
|
||||
public static GLController registerCxxCompositor() {
|
||||
System.out.println("register layer comp");
|
||||
FlexibleGLSurfaceView flexView = (FlexibleGLSurfaceView)GeckoApp.mAppContext.getLayerController().getView();
|
||||
try {
|
||||
flexView.destroyGLThread().join();
|
||||
} catch (InterruptedException e) {}
|
||||
return flexView.getGLController();
|
||||
/*
|
||||
synchronized (FlexibleGLSurfaceView.class) {
|
||||
// Wait for the layer controller if by some miracle
|
||||
@ -184,7 +190,6 @@ public class FlexibleGLSurfaceView extends SurfaceView implements SurfaceHolder.
|
||||
} catch (InterruptedException e) {}
|
||||
}
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class FlexibleGLSurfaceViewException extends RuntimeException {
|
||||
|
@ -1020,18 +1020,25 @@ AndroidBridge::CallEglCreateWindowSurface(void *dpy, void *config, AndroidGeckoS
|
||||
return (void*) realSurface;
|
||||
}
|
||||
|
||||
void
|
||||
static AndroidGLController sController;
|
||||
|
||||
EGLSurface
|
||||
AndroidBridge::RegisterCompositor()
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::RegisterCompositor");
|
||||
JNIEnv *env = GetJNIForThread();
|
||||
if (!env)
|
||||
return;
|
||||
return NULL;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env, 3);
|
||||
jmethodID registerCompositor = env->GetStaticMethodID(jFlexSurfaceView, "registerCxxCompositor", "()Lorg/mozilla/gecko/gfx/GLController;");
|
||||
|
||||
jobject glController = env->CallStaticObjectMethod(jFlexSurfaceView, registerCompositor);
|
||||
|
||||
AndroidGLController::Init(env);
|
||||
sController.Acquire(env, glController);
|
||||
|
||||
return sController.GetEGLSurface();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "nsIObserver.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#include "AndroidFlexViewWrapper.h"
|
||||
#include "AndroidJavaWrappers.h"
|
||||
|
||||
#include "nsIMutableArray.h"
|
||||
@ -308,7 +309,7 @@ public:
|
||||
void *CallEglCreateWindowSurface(void *dpy, void *config, AndroidGeckoSurfaceView& surfaceView);
|
||||
|
||||
// Switch Java to composite with the Gecko Compositor thread
|
||||
void RegisterCompositor();
|
||||
EGLSurface RegisterCompositor();
|
||||
|
||||
bool GetStaticStringField(const char *classID, const char *field, nsAString &result);
|
||||
|
||||
|
@ -37,8 +37,34 @@
|
||||
|
||||
#include "AndroidFlexViewWrapper.h"
|
||||
|
||||
|
||||
static AndroidGLController sController;
|
||||
|
||||
template<>
|
||||
const char *AndroidEGLDisplay::sClassName = "com/google/android/gles_jni/EGLDisplayImpl";
|
||||
template<>
|
||||
const char *AndroidEGLDisplay::sPointerFieldName = "mEGLDisplay";
|
||||
template<>
|
||||
jfieldID AndroidEGLDisplay::jPointerField = 0;
|
||||
template<>
|
||||
const char *AndroidEGLConfig::sClassName = "com/google/android/gles_jni/EGLConfigImpl";
|
||||
template<>
|
||||
const char *AndroidEGLConfig::sPointerFieldName = "mEGLConfig";
|
||||
template<>
|
||||
jfieldID AndroidEGLConfig::jPointerField = 0;
|
||||
template<>
|
||||
const char *AndroidEGLContext::sClassName = "com/google/android/gles_jni/EGLContextImpl";
|
||||
template<>
|
||||
const char *AndroidEGLContext::sPointerFieldName = "mEGLContext";
|
||||
template<>
|
||||
jfieldID AndroidEGLContext::jPointerField = 0;
|
||||
template<>
|
||||
const char *AndroidEGLSurface::sClassName = "com/google/android/gles_jni/EGLSurfaceImpl";
|
||||
template<>
|
||||
const char *AndroidEGLSurface::sPointerFieldName = "mEGLSurface";
|
||||
template<>
|
||||
jfieldID AndroidEGLSurface::jPointerField = 0;
|
||||
|
||||
jmethodID AndroidGLController::jSetGLVersionMethod = 0;
|
||||
jmethodID AndroidGLController::jInitGLContextMethod = 0;
|
||||
jmethodID AndroidGLController::jDisposeGLContextMethod = 0;
|
||||
@ -56,7 +82,7 @@ jmethodID AndroidGLController::jGetHeightMethod = 0;
|
||||
void
|
||||
AndroidGLController::Init(JNIEnv *aJEnv)
|
||||
{
|
||||
const char *className = "org/mozilla/testnewglsurfaceview/GLController";
|
||||
const char *className = "org/mozilla/gecko/gfx/GLController";
|
||||
jclass jClass = reinterpret_cast<jclass>(aJEnv->NewGlobalRef(aJEnv->FindClass(className)));
|
||||
|
||||
jSetGLVersionMethod = aJEnv->GetMethodID(jClass, "setGLVersion", "(I)V");
|
||||
@ -183,3 +209,5 @@ AndroidGLController::GetHeight()
|
||||
{
|
||||
return mJEnv->CallIntMethod(mJObj, jGetHeightMethod);
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,20 +35,16 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef AndroidFlexViewWrapper_h__
|
||||
#define AndroidFlexViewWrapper_h__
|
||||
|
||||
#include <jni.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
//#include <GLES/gl.h>
|
||||
//#include <GLES/glext.h>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
//#include <EGL/egl.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define NS_ASSERTION(cond, msg) assert((cond) && msg)
|
||||
|
||||
namespace {
|
||||
|
||||
JavaVM *sJVM = NULL;
|
||||
|
||||
template<typename T>
|
||||
class AndroidEGLObject {
|
||||
public:
|
||||
@ -152,4 +148,5 @@ private:
|
||||
jobject mJObj;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -47,11 +47,6 @@
|
||||
#define EGL_NATIVE_BUFFER_ANDROID 0x3140
|
||||
#define EGL_IMAGE_PRESERVED_KHR 0x30D2
|
||||
|
||||
typedef void* EGLContext;
|
||||
typedef void* EGLImageKHR;
|
||||
typedef void* EGLClientBuffer;
|
||||
typedef void* EGLDisplay;
|
||||
|
||||
typedef PRUint32 EGLenum;
|
||||
typedef PRInt32 EGLint;
|
||||
typedef PRUint32 EGLBoolean;
|
||||
|
@ -41,6 +41,9 @@
|
||||
#include "gfxASurface.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
typedef void* EGLImageKHR;
|
||||
typedef void* EGLClientBuffer;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
|
@ -95,7 +95,7 @@ XPIDLSRCS = \
|
||||
|
||||
SHARED_LIBRARY_LIBS = ../xpwidgets/libxpwidgets_s.a
|
||||
|
||||
EXPORTS = AndroidBridge.h AndroidJavaWrappers.h
|
||||
EXPORTS = AndroidBridge.h AndroidJavaWrappers.h AndroidFlexViewWrapper.h
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user