author | Nicholas Cameron <ncameron@mozilla.com> |
Mon, 09 Dec 2013 14:40:59 +1300 | |
changeset 159648 | c105bff9ee1d26bfc260ab20db6405a69102128a |
parent 159647 | f0f2576c33402c9bfa288e6e6d35529d687be523 |
child 159649 | 3d9dc352e2cb00365bc55e0200ab517546e9bd51 |
push id | 25808 |
push user | cbook@mozilla.com |
push date | Tue, 10 Dec 2013 12:03:31 +0000 |
treeherder | mozilla-central@7fb91a422c5e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | kats |
bugs | 946958 |
milestone | 29.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -921,16 +921,27 @@ CompositorParent::GetAPZCTreeManager(uin { const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(aLayersId); if (state && state->mParent) { return state->mParent->mApzcTreeManager; } return nullptr; } +float +CompositorParent::ComputeRenderIntegrity() +{ + if (mLayerManager) { + return mLayerManager->ComputeRenderIntegrity(); + } + + return 1.0f; +} + + /** * This class handles layer updates pushed directly from child * processes to the compositor thread. It's associated with a * CompositorParent on the compositor thread. While it uses the * PCompositor protocol to manage these updates, it doesn't actually * drive compositing itself. For that it hands off work to the * CompositorParent it's associated with. */
--- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -208,16 +208,18 @@ public: /** * Lookup the indirect shadow tree for |aId| and return it if it * exists. Otherwise null is returned. This must only be called on * the compositor thread. */ static const LayerTreeState* GetIndirectShadowTree(uint64_t aId); + float ComputeRenderIntegrity(); + /** * Tell all CompositorParents to update their last refresh to aTime and sample * animations at this time stamp. If aIsTesting is true, the * CompositorParents will become "paused" and continue sampling animations at * this time stamp until this function is called again with aIsTesting set to * false. */ static void SetTimeAndSampleAnimations(TimeStamp aTime, bool aIsTesting);
--- a/gfx/layers/opengl/GLManager.cpp +++ b/gfx/layers/opengl/GLManager.cpp @@ -1,26 +1,24 @@ /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "GLManager.h" #include "CompositorOGL.h" // for CompositorOGL #include "GLContext.h" // for GLContext -#include "Layers.h" // for LayerManager #include "mozilla/Assertions.h" // for MOZ_CRASH #include "mozilla/Attributes.h" // for MOZ_OVERRIDE #include "mozilla/RefPtr.h" // for RefPtr #include "mozilla/layers/Compositor.h" // for Compositor #include "mozilla/layers/LayerManagerComposite.h" #include "mozilla/layers/LayersTypes.h" #include "mozilla/mozalloc.h" // for operator new, etc #include "nsAutoPtr.h" // for nsRefPtr -#include "nsISupportsImpl.h" // for LayerManager::AddRef, etc using namespace mozilla::gl; namespace mozilla { namespace layers { class GLManagerCompositor : public GLManager { @@ -44,27 +42,20 @@ public: mImpl->BindAndDrawQuad(aProg); } private: RefPtr<CompositorOGL> mImpl; }; /* static */ GLManager* -GLManager::CreateGLManager(LayerManager* aManager) +GLManager::CreateGLManager(LayerManagerComposite* aManager) { - if (!aManager) { - return nullptr; + if (aManager && + Compositor::GetBackend() == LAYERS_OPENGL) { + return new GLManagerCompositor(static_cast<CompositorOGL*>( + aManager->GetCompositor())); } - if (aManager->GetBackendType() == LAYERS_NONE) { - if (Compositor::GetBackend() == LAYERS_OPENGL) { - return new GLManagerCompositor(static_cast<CompositorOGL*>( - static_cast<LayerManagerComposite*>(aManager)->GetCompositor())); - } else { - return nullptr; - } - } - - MOZ_CRASH("Cannot create GLManager for non-GL layer manager"); + return nullptr; } } }
--- a/gfx/layers/opengl/GLManager.h +++ b/gfx/layers/opengl/GLManager.h @@ -11,27 +11,27 @@ namespace mozilla { namespace gl { class GLContext; } namespace layers { -class LayerManager; +class LayerManagerComposite; /** * Minimal interface to allow widgets to draw using OpenGL. Abstracts * CompositorOGL. Call CreateGLManager with a LayerManagerComposite * backed by a CompositorOGL. */ class GLManager { public: - static GLManager* CreateGLManager(LayerManager* aManager); + static GLManager* CreateGLManager(LayerManagerComposite* aManager); virtual ~GLManager() {} virtual gl::GLContext* gl() const = 0; virtual ShaderProgramOGL* GetProgram(ShaderProgramType aType) = 0; virtual void BindAndDrawQuad(ShaderProgramOGL *aProg) = 0; ShaderProgramOGL* GetProgram(gfx::SurfaceFormat aFormat) {
--- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -2323,17 +2323,17 @@ nsIMEUpdatePreference nsWindow::GetIMEUpdatePreference() { int8_t notifications = (nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE | nsIMEUpdatePreference::NOTIFY_TEXT_CHANGE); return nsIMEUpdatePreference(notifications, true); } void -nsWindow::DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) +nsWindow::DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) { JNIEnv *env = GetJNIForThread(); NS_ABORT_IF_FALSE(env, "No JNI environment at DrawWindowUnderlay()!"); if (!env) return; AutoLocalJNIFrame jniFrame(env); @@ -2357,17 +2357,17 @@ nsWindow::DrawWindowUnderlay(LayerManage client->ActivateProgram(); if (!mLayerRendererFrame.BeginDrawing(&jniFrame)) return; if (!mLayerRendererFrame.DrawBackground(&jniFrame)) return; client->DeactivateProgram(); // redundant, but in case somebody adds code after this... } void -nsWindow::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) +nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) { PROFILER_LABEL("nsWindow", "DrawWindowOverlay"); JNIEnv *env = GetJNIForThread(); NS_ABORT_IF_FALSE(env, "No JNI environment at DrawWindowOverlay()!"); if (!env) return; AutoLocalJNIFrame jniFrame(env); @@ -2425,21 +2425,17 @@ nsWindow::ForceIsFirstPaint() sCompositorParent->ForceIsFirstPaint(); } } float nsWindow::ComputeRenderIntegrity() { if (sCompositorParent) { - mozilla::layers::LayerManagerComposite* manager = - static_cast<mozilla::layers::LayerManagerComposite*>(sCompositorParent->GetLayerManager()); - if (manager) { - return manager->ComputeRenderIntegrity(); - } + return sCompositorParent->ComputeRenderIntegrity(); } return 1.f; } bool nsWindow::WidgetPaintsBackground() {
--- a/widget/android/nsWindow.h +++ b/widget/android/nsWindow.h @@ -148,18 +148,18 @@ public: LayerManager* GetLayerManager (PLayerTransactionChild* aShadowManager = nullptr, LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE, LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr); NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent); virtual bool NeedsPaint(); - virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect); - virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect); + virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect); + virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect); virtual mozilla::layers::CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight) MOZ_OVERRIDE; static void SetCompositor(mozilla::layers::LayerManager* aLayerManager, mozilla::layers::CompositorParent* aCompositorParent, mozilla::layers::CompositorChild* aCompositorChild); static void ScheduleComposite(); static void ScheduleResumeComposition(int width, int height);
--- a/widget/cocoa/nsChildView.h +++ b/widget/cocoa/nsChildView.h @@ -544,19 +544,19 @@ public: #ifdef ACCESSIBILITY already_AddRefed<mozilla::a11y::Accessible> GetDocumentAccessible(); #endif virtual void CreateCompositor(); virtual gfxASurface* GetThebesSurface(); virtual void PrepareWindowEffects() MOZ_OVERRIDE; virtual void CleanupWindowEffects() MOZ_OVERRIDE; - virtual bool PreRender(LayerManager* aManager) MOZ_OVERRIDE; - virtual void PostRender(LayerManager* aManager) MOZ_OVERRIDE; - virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) MOZ_OVERRIDE; + virtual bool PreRender(LayerManagerComposite* aManager) MOZ_OVERRIDE; + virtual void PostRender(LayerManagerComposite* aManager) MOZ_OVERRIDE; + virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) MOZ_OVERRIDE; virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries); void HidePlugin(); void UpdatePluginPort(); void ResetParent();
--- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -2041,17 +2041,17 @@ void nsChildView::CleanupWindowEffects() { mResizerImage = nullptr; mCornerMaskImage = nullptr; mTitlebarImage = nullptr; } bool -nsChildView::PreRender(LayerManager* aManager) +nsChildView::PreRender(LayerManagerComposite* aManager) { nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager)); if (!manager) { return true; } // The lock makes sure that we don't attempt to tear down the view while // compositing. That would make us unable to call postRender on it when the @@ -2063,29 +2063,29 @@ nsChildView::PreRender(LayerManager* aMa if (![(ChildView*)mView preRender:glContext]) { mViewTearDownLock.Unlock(); return false; } return true; } void -nsChildView::PostRender(LayerManager* aManager) +nsChildView::PostRender(LayerManagerComposite* aManager) { nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager)); if (!manager) { return; } NSOpenGLContext *glContext = (NSOpenGLContext *)manager->gl()->GetNativeData(GLContext::NativeGLContext); [(ChildView*)mView postRender:glContext]; mViewTearDownLock.Unlock(); } void -nsChildView::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) +nsChildView::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) { nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager)); if (manager) { DrawWindowOverlay(manager, aRect); } } void
--- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -36,16 +36,17 @@ class nsIntRegion; namespace mozilla { namespace dom { class TabChild; } namespace layers { class Composer2D; class CompositorChild; class LayerManager; +class LayerManagerComposite; class PLayerTransactionChild; } namespace gfx { class DrawTarget; } } /** @@ -91,18 +92,18 @@ typedef void* nsNativeWidget; #ifdef XP_WIN #define NS_NATIVE_TSF_THREAD_MGR 100 #define NS_NATIVE_TSF_CATEGORY_MGR 101 #define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102 #define NS_NATIVE_ICOREWINDOW 103 // winrt specific #endif #define NS_IWIDGET_IID \ -{ 0xa1f684e6, 0x2ae1, 0x4513, \ - { 0xb6, 0x89, 0xf4, 0xd4, 0xfe, 0x9d, 0x2c, 0xdb } } +{ 0x746cb189, 0x9793, 0x4e53, \ + { 0x89, 0x47, 0x78, 0x56, 0xb6, 0xcd, 0x9f, 0x71 } } /* * Window shadow styles * Also used for the -moz-window-shadow CSS property */ #define NS_STYLE_WINDOW_SHADOW_NONE 0 #define NS_STYLE_WINDOW_SHADOW_DEFAULT 1 @@ -459,16 +460,17 @@ enum NotificationToIME { class nsIWidget : public nsISupports { protected: typedef mozilla::dom::TabChild TabChild; public: typedef mozilla::layers::Composer2D Composer2D; typedef mozilla::layers::CompositorChild CompositorChild; typedef mozilla::layers::LayerManager LayerManager; + typedef mozilla::layers::LayerManagerComposite LayerManagerComposite; typedef mozilla::layers::LayersBackend LayersBackend; typedef mozilla::layers::PLayerTransactionChild PLayerTransactionChild; typedef mozilla::widget::NotificationToIME NotificationToIME; typedef mozilla::widget::IMEState IMEState; typedef mozilla::widget::InputContext InputContext; typedef mozilla::widget::InputContextAction InputContextAction; typedef mozilla::widget::SizeConstraints SizeConstraints; @@ -1211,48 +1213,46 @@ class nsIWidget : public nsISupports { * Called when shutting down the LayerManager to clean-up any cached resources. * * Always called from the compositing thread, which may be the main-thread if * OMTC is not enabled. */ virtual void CleanupWindowEffects() = 0; /** - * Called before rendering using OpenGL. Returns false when the widget is + * Called before rendering using OMTC. Returns false when the widget is * not ready to be rendered (for example while the window is closed). * * Always called from the compositing thread, which may be the main-thread if * OMTC is not enabled. */ - virtual bool PreRender(LayerManager* aManager) = 0; + virtual bool PreRender(LayerManagerComposite* aManager) = 0; /** - * Called after rendering using OpenGL. Not called when rendering was + * Called after rendering using OMTC. Not called when rendering was * cancelled by a negative return value from PreRender. * * Always called from the compositing thread, which may be the main-thread if * OMTC is not enabled. */ - virtual void PostRender(LayerManager* aManager) = 0; + virtual void PostRender(LayerManagerComposite* aManager) = 0; /** * Called before the LayerManager draws the layer tree. * - * Always called from the compositing thread, which may be the main-thread if - * OMTC is not enabled. + * Always called from the compositing thread. */ - virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) = 0; + virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) = 0; /** * Called after the LayerManager draws the layer tree * - * Always called from the compositing thread, which may be the main-thread if - * OMTC is not enabled. + * Always called from the compositing thread. */ - virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) = 0; + virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) = 0; /** * Return a DrawTarget for the window which can be composited into. * * Called by BasicCompositor on the compositor thread for OMTC drawing * before each composition. */ virtual mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing() = 0;
--- a/widget/xpwidgets/nsBaseWidget.h +++ b/widget/xpwidgets/nsBaseWidget.h @@ -131,20 +131,20 @@ public: LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr); virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight); virtual void CreateCompositor(); virtual void CreateCompositor(int aWidth, int aHeight); virtual void PrepareWindowEffects() {} virtual void CleanupWindowEffects() {} - virtual bool PreRender(LayerManager* aManager) { return true; } - virtual void PostRender(LayerManager* aManager) {} - virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) {} - virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) {} + virtual bool PreRender(LayerManagerComposite* aManager) { return true; } + virtual void PostRender(LayerManagerComposite* aManager) {} + virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) {} + virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) {} virtual mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing(); virtual void EndRemoteDrawing() { }; virtual void CleanupRemoteDrawing() { }; virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) {} virtual gfxASurface* GetThebesSurface(); NS_IMETHOD SetModal(bool aModal); NS_IMETHOD SetWindowClass(const nsAString& xulWinType); // Return whether this widget interprets parameters to Move and Resize APIs