зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 1453501) for bustage in build/build/src/gfx/gl/GLContextProviderEGL.cpp on a CLOSED TREE
Backed out changeset 8b53a7b34121 (bug 1453501) Backed out changeset c07588586701 (bug 1453501) Backed out changeset 6c231423492b (bug 1453501)
This commit is contained in:
Родитель
4ea8668f02
Коммит
42cb453a11
|
@ -117,7 +117,6 @@ public:
|
|||
const EGLConfig mConfig;
|
||||
protected:
|
||||
EGLSurface mSurface;
|
||||
const EGLSurface mFallbackSurface;
|
||||
public:
|
||||
const EGLContext mContext;
|
||||
protected:
|
||||
|
|
|
@ -131,35 +131,10 @@ DestroySurface(EGLSurface oldSurface) {
|
|||
}
|
||||
|
||||
static EGLSurface
|
||||
CreateFallbackSurface(const EGLConfig& config)
|
||||
{
|
||||
if (sEGLLibrary.IsExtensionSupported(GLLibraryEGL::KHR_surfaceless_context)) {
|
||||
// We don't need a PBuffer surface in this case
|
||||
return EGL_NO_SURFACE;
|
||||
}
|
||||
CreateSurfaceFromNativeWindow(EGLNativeWindowType window, const EGLConfig& config) {
|
||||
EGLSurface newSurface = nullptr;
|
||||
|
||||
std::vector<EGLint> pbattrs;
|
||||
pbattrs.push_back(LOCAL_EGL_WIDTH); pbattrs.push_back(1);
|
||||
pbattrs.push_back(LOCAL_EGL_HEIGHT); pbattrs.push_back(1);
|
||||
|
||||
for (const auto& cur : kTerminationAttribs) {
|
||||
pbattrs.push_back(cur);
|
||||
}
|
||||
|
||||
EGLSurface surface = sEGLLibrary.fCreatePbufferSurface(EGL_DISPLAY(), config, pbattrs.data());
|
||||
if (!surface) {
|
||||
MOZ_CRASH("Failed to create fallback EGLSurface");
|
||||
}
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
static EGLSurface
|
||||
CreateSurfaceFromNativeWindow(EGLNativeWindowType window, const EGLConfig& config)
|
||||
{
|
||||
MOZ_ASSERT(window);
|
||||
EGLSurface newSurface = EGL_NO_SURFACE;
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
JNIEnv* const env = jni::GetEnvForThread();
|
||||
ANativeWindow* const nativeWindow = ANativeWindow_fromSurface(
|
||||
|
@ -193,6 +168,7 @@ already_AddRefed<GLContext>
|
|||
GLContextEGLFactory::Create(EGLNativeWindowType aWindow,
|
||||
bool aWebRender)
|
||||
{
|
||||
MOZ_ASSERT(aWindow);
|
||||
nsCString discardFailureId;
|
||||
if (!sEGLLibrary.EnsureInitialized(false, &discardFailureId)) {
|
||||
gfxCriticalNote << "Failed to load EGL library 3!";
|
||||
|
@ -217,9 +193,11 @@ GLContextEGLFactory::Create(EGLNativeWindowType aWindow,
|
|||
}
|
||||
}
|
||||
|
||||
EGLSurface surface = EGL_NO_SURFACE;
|
||||
if (aWindow) {
|
||||
surface = mozilla::gl::CreateSurfaceFromNativeWindow(aWindow, config);
|
||||
EGLSurface surface = mozilla::gl::CreateSurfaceFromNativeWindow(aWindow, config);
|
||||
|
||||
if (!surface) {
|
||||
gfxCriticalNote << "Failed to create EGLSurface!";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CreateContextFlags flags = CreateContextFlags::NONE;
|
||||
|
@ -250,7 +228,6 @@ GLContextEGL::GLContextEGL(CreateContextFlags flags, const SurfaceCaps& caps,
|
|||
: GLContext(flags, caps, nullptr, isOffscreen, false)
|
||||
, mConfig(config)
|
||||
, mSurface(surface)
|
||||
, mFallbackSurface(CreateFallbackSurface(config))
|
||||
, mContext(context)
|
||||
, mSurfaceOverride(EGL_NO_SURFACE)
|
||||
, mThebesSurface(nullptr)
|
||||
|
@ -282,7 +259,6 @@ GLContextEGL::~GLContextEGL()
|
|||
sEGLLibrary.fDestroyContext(EGL_DISPLAY(), mContext);
|
||||
|
||||
mozilla::gl::DestroySurface(mSurface);
|
||||
mozilla::gl::DestroySurface(mFallbackSurface);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -380,12 +356,8 @@ GLContextEGL::SetEGLSurfaceOverride(EGLSurface surf) {
|
|||
bool
|
||||
GLContextEGL::MakeCurrentImpl() const
|
||||
{
|
||||
EGLSurface surface = (mSurfaceOverride != EGL_NO_SURFACE) ? mSurfaceOverride
|
||||
: mSurface;
|
||||
if (!surface) {
|
||||
surface = mFallbackSurface;
|
||||
}
|
||||
|
||||
const EGLSurface surface = (mSurfaceOverride != EGL_NO_SURFACE) ? mSurfaceOverride
|
||||
: mSurface;
|
||||
const bool succeeded = sEGLLibrary.fMakeCurrent(EGL_DISPLAY(), surface, surface,
|
||||
mContext);
|
||||
if (!succeeded) {
|
||||
|
@ -419,16 +391,10 @@ GLContextEGL::RenewSurface(CompositorWidget* aWidget) {
|
|||
// If we get here, then by definition we know that we want to get a new surface.
|
||||
ReleaseSurface();
|
||||
MOZ_ASSERT(aWidget);
|
||||
|
||||
void* nativeWindow = GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget);
|
||||
if (nativeWindow) {
|
||||
mSurface = mozilla::gl::CreateSurfaceFromNativeWindow(nativeWindow, mConfig);
|
||||
if (!mSurface) {
|
||||
NS_WARNING("Failed to create EGLSurface from native window");
|
||||
return false;
|
||||
}
|
||||
mSurface = mozilla::gl::CreateSurfaceFromNativeWindow(GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget), mConfig);
|
||||
if (!mSurface) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return MakeCurrent(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ static const char* sEGLExtensionNames[] = {
|
|||
"EGL_ANGLE_stream_producer_d3d_texture",
|
||||
"EGL_ANGLE_device_creation",
|
||||
"EGL_ANGLE_device_creation_d3d11",
|
||||
"EGL_KHR_surfaceless_context"
|
||||
};
|
||||
|
||||
#if defined(ANDROID)
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
* IsExtensionSupported. The results of this are cached, and as
|
||||
* such it's safe to use this even in performance critical code.
|
||||
* If you add to this array, remember to add to the string names
|
||||
* in GLLibraryEGL.cpp.
|
||||
* in GLContext.cpp.
|
||||
*/
|
||||
enum EGLExtensions {
|
||||
KHR_image_base,
|
||||
|
@ -99,7 +99,6 @@ public:
|
|||
ANGLE_stream_producer_d3d_texture,
|
||||
ANGLE_device_creation,
|
||||
ANGLE_device_creation_d3d11,
|
||||
KHR_surfaceless_context,
|
||||
Extensions_Max
|
||||
};
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ public:
|
|||
: mUseAPZ(false)
|
||||
, mUseWebRender(false)
|
||||
, mUseAdvancedLayers(false)
|
||||
, mInitiallyPaused(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -42,23 +41,17 @@ public:
|
|||
: mUseAPZ(aUseAPZ)
|
||||
, mUseWebRender(aUseWebRender)
|
||||
, mUseAdvancedLayers(false)
|
||||
, mInitiallyPaused(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool UseAPZ() const { return mUseAPZ; }
|
||||
bool UseWebRender() const { return mUseWebRender; }
|
||||
bool UseAdvancedLayers() const { return mUseAdvancedLayers; }
|
||||
bool InitiallyPaused() const { return mInitiallyPaused; }
|
||||
|
||||
void SetUseAdvancedLayers(bool aUseAdvancedLayers) {
|
||||
mUseAdvancedLayers = aUseAdvancedLayers;
|
||||
}
|
||||
|
||||
void SetInitiallyPaused(bool aPauseAtStartup) {
|
||||
mInitiallyPaused = aPauseAtStartup;
|
||||
}
|
||||
|
||||
bool operator==(const CompositorOptions& aOther) const {
|
||||
return mUseAPZ == aOther.mUseAPZ &&
|
||||
mUseWebRender == aOther.mUseWebRender &&
|
||||
|
@ -71,10 +64,8 @@ private:
|
|||
bool mUseAPZ;
|
||||
bool mUseWebRender;
|
||||
bool mUseAdvancedLayers;
|
||||
bool mInitiallyPaused;
|
||||
|
||||
// Make sure to add new fields to the ParamTraits implementation
|
||||
// in LayersMessageUtils.h
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -411,8 +411,6 @@ CompositorBridgeParent::Initialize()
|
|||
mApzUpdater = new APZUpdater(mApzcTreeManager, mOptions.UseWebRender());
|
||||
}
|
||||
|
||||
mPaused = mOptions.InitiallyPaused();
|
||||
|
||||
mCompositorBridgeID = 0;
|
||||
// FIXME: This holds on the the fact that right now the only thing that
|
||||
// can destroy this instance is initialized on the compositor thread after
|
||||
|
|
|
@ -635,14 +635,12 @@ struct ParamTraits<mozilla::layers::CompositorOptions>
|
|||
WriteParam(aMsg, aParam.mUseAPZ);
|
||||
WriteParam(aMsg, aParam.mUseWebRender);
|
||||
WriteParam(aMsg, aParam.mUseAdvancedLayers);
|
||||
WriteParam(aMsg, aParam.mInitiallyPaused);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mUseAPZ)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mUseWebRender)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mUseAdvancedLayers)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mInitiallyPaused);
|
||||
&& ReadParam(aMsg, aIter, &aResult->mUseAdvancedLayers);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -82,6 +82,10 @@ public class LayerSession {
|
|||
@WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
|
||||
public native void onBoundsChanged(int left, int top, int width, int height);
|
||||
|
||||
// Gecko thread creates compositor; blocks UI thread.
|
||||
@WrapForJNI(calledFrom = "ui", dispatchTo = "proxy")
|
||||
public native void createCompositor(int width, int height, Object surface);
|
||||
|
||||
// Gecko thread pauses compositor; blocks UI thread.
|
||||
@WrapForJNI(calledFrom = "ui", dispatchTo = "current")
|
||||
public native void syncPauseCompositor();
|
||||
|
@ -159,6 +163,7 @@ public class LayerSession {
|
|||
private CompositorController mController;
|
||||
|
||||
private boolean mAttachedCompositor;
|
||||
private boolean mCalledCreateCompositor;
|
||||
private boolean mCompositorReady;
|
||||
private Surface mSurface;
|
||||
|
||||
|
@ -356,8 +361,6 @@ public class LayerSession {
|
|||
// Leave mSurface alone because we'll need it later for onCompositorReady.
|
||||
onSurfaceChanged(mSurface, mWidth, mHeight);
|
||||
}
|
||||
|
||||
mCompositor.sendToolbarAnimatorMessage(IS_COMPOSITOR_CONTROLLER_OPEN);
|
||||
}
|
||||
|
||||
/* package */ void onCompositorDetached() {
|
||||
|
@ -370,6 +373,7 @@ public class LayerSession {
|
|||
}
|
||||
|
||||
mAttachedCompositor = false;
|
||||
mCalledCreateCompositor = false;
|
||||
mCompositorReady = false;
|
||||
}
|
||||
|
||||
|
@ -548,6 +552,12 @@ public class LayerSession {
|
|||
return;
|
||||
}
|
||||
|
||||
if (mAttachedCompositor && !mCalledCreateCompositor) {
|
||||
mCompositor.createCompositor(width, height, surface);
|
||||
mCompositor.sendToolbarAnimatorMessage(IS_COMPOSITOR_CONTROLLER_OPEN);
|
||||
mCalledCreateCompositor = true;
|
||||
}
|
||||
|
||||
// We have a valid surface but we're not attached or the compositor
|
||||
// is not ready; save the surface for later when we're ready.
|
||||
mSurface = surface;
|
||||
|
|
|
@ -823,6 +823,19 @@ class nsWindow::LayerViewSupport final
|
|||
public:
|
||||
typedef LayerSession::Compositor::Natives<LayerViewSupport> Base;
|
||||
|
||||
template<class Functor>
|
||||
static void OnNativeCall(Functor&& aCall)
|
||||
{
|
||||
if (aCall.IsTarget(&LayerViewSupport::CreateCompositor)) {
|
||||
// This call is blocking.
|
||||
nsAppShell::SyncRunEvent(nsAppShell::LambdaEvent<Functor>(
|
||||
mozilla::Move(aCall)), &LayerViewEvent::MakeEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_CRASH("Unexpected call");
|
||||
}
|
||||
|
||||
static LayerViewSupport*
|
||||
FromNative(const LayerSession::Compositor::LocalRef& instance)
|
||||
{
|
||||
|
@ -917,6 +930,20 @@ public:
|
|||
mWindow->Resize(aLeft, aTop, aWidth, aHeight, /* repaint */ false);
|
||||
}
|
||||
|
||||
void CreateCompositor(int32_t aWidth, int32_t aHeight,
|
||||
jni::Object::Param aSurface)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!mWindow) {
|
||||
return; // Already shut down.
|
||||
}
|
||||
|
||||
mSurface = aSurface;
|
||||
mWindow->CreateLayerManager(aWidth, aHeight);
|
||||
|
||||
mCompositorPaused = false;
|
||||
}
|
||||
|
||||
void SyncPauseCompositor()
|
||||
{
|
||||
MOZ_ASSERT(AndroidBridge::IsJavaUiThread());
|
||||
|
@ -1396,14 +1423,6 @@ nsWindow::Create(nsIWidget* aParent,
|
|||
mParent = parent;
|
||||
}
|
||||
|
||||
// A default size of 1x1 confuses MobileViewportManager, so
|
||||
// use 0x0 instead. This is also a little more fitting since
|
||||
// we don't yet have a surface yet (and therefore a valid size)
|
||||
// and 0x0 is usually recognized as invalid.
|
||||
Resize(0, 0, false);
|
||||
|
||||
CreateLayerManager();
|
||||
|
||||
#ifdef DEBUG_ANDROID_WIDGET
|
||||
DumpWindows();
|
||||
#endif
|
||||
|
@ -1840,7 +1859,7 @@ nsWindow::GetLayerManager(PLayerTransactionChild*, LayersBackend, LayerManagerPe
|
|||
}
|
||||
|
||||
void
|
||||
nsWindow::CreateLayerManager()
|
||||
nsWindow::CreateLayerManager(int aCompositorWidth, int aCompositorHeight)
|
||||
{
|
||||
if (mLayerManager) {
|
||||
return;
|
||||
|
@ -1856,8 +1875,7 @@ nsWindow::CreateLayerManager()
|
|||
gfxPlatform::GetPlatform();
|
||||
|
||||
if (ShouldUseOffMainThreadCompositing()) {
|
||||
LayoutDeviceIntRect rect = GetBounds();
|
||||
CreateCompositor(rect.Width(), rect.Height());
|
||||
CreateCompositor(aCompositorWidth, aCompositorHeight);
|
||||
if (mLayerManager) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -341,7 +341,7 @@ protected:
|
|||
static void LogWindow(nsWindow *win, int index, int indent);
|
||||
|
||||
private:
|
||||
void CreateLayerManager();
|
||||
void CreateLayerManager(int aCompositorWidth, int aCompositorHeight);
|
||||
void RedrawAll();
|
||||
|
||||
mozilla::layers::LayersId GetRootLayerId() const;
|
||||
|
|
|
@ -1323,12 +1323,6 @@ nsBaseWidget::CreateCompositorSession(int aWidth,
|
|||
bool enableAL = gfx::gfxConfig::IsEnabled(gfx::Feature::ADVANCED_LAYERS);
|
||||
options.SetUseAdvancedLayers(enableAL);
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
if (!GetNativeData(NS_JAVA_SURFACE)) {
|
||||
options.SetInitiallyPaused(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
RefPtr<LayerManager> lm;
|
||||
if (options.UseWebRender()) {
|
||||
lm = new WebRenderLayerManager(this);
|
||||
|
|
Загрузка…
Ссылка в новой задаче