Bug 1597585 - Make LayerManagerComposite use mGL to pass the GL context to PreRender, just like WebRender. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D53772

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Markus Stange 2019-11-20 23:22:58 +00:00
parent d582a45148
commit df49f517a5
3 changed files with 7 additions and 9 deletions

View File

@ -41,6 +41,7 @@
#include "mozilla/gfx/Rect.h" // for Rect
#include "mozilla/gfx/Types.h" // for Color, SurfaceFormat
#include "mozilla/layers/Compositor.h" // for Compositor
#include "mozilla/layers/CompositorOGL.h"
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
#include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
@ -62,7 +63,6 @@
# include <android/native_window.h>
# include "mozilla/jni/Utils.h"
# include "mozilla/widget/AndroidCompositorWidget.h"
# include "opengl/CompositorOGL.h"
# include "GLConsts.h"
# include "GLContextEGL.h"
# include "GLContextProvider.h"
@ -1103,7 +1103,9 @@ bool LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion,
mozilla::widget::WidgetRenderingContext widgetContext;
#if defined(XP_MACOSX)
widgetContext.mLayerManager = this;
if (CompositorOGL* compositorOGL = mCompositor->AsCompositorOGL()) {
widgetContext.mGL = compositorOGL->gl();
}
#endif
{

View File

@ -75,9 +75,7 @@ class CompositorWidgetChild;
class WidgetRenderingContext {
public:
#if defined(XP_MACOSX)
WidgetRenderingContext() : mLayerManager(nullptr), mGL(nullptr) {}
layers::LayerManagerComposite* mLayerManager;
gl::GLContext* mGL;
gl::GLContext* mGL = nullptr;
#endif
};

View File

@ -1708,10 +1708,8 @@ bool nsChildView::PreRender(WidgetRenderingContext* aContext) {
// composition is done, thus keeping the GL context locked forever.
mViewTearDownLock.Lock();
UniquePtr<GLManager> manager(GLManager::CreateGLManager(aContext->mLayerManager));
gl::GLContext* gl = manager ? manager->gl() : aContext->mGL;
if (gl) {
GLContextCGL::Cast(gl)->MigrateToActiveGPU();
if (aContext->mGL) {
GLContextCGL::Cast(aContext->mGL)->MigrateToActiveGPU();
}
return true;