Commit df49f517 authored by Markus Stange's avatar Markus Stange
Browse files

Bug 1597585 - Make LayerManagerComposite use mGL to pass the GL context to...

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
parent d582a451
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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

  {
+1 −3
Original line number Diff line number Diff line
@@ -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
};

+2 −4
Original line number Diff line number Diff line
@@ -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;