зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 7 changesets (bug 946958, bug 865033)
Backed out changeset 6dd0a6cb9ab3 (bug 946958) Backed out changeset 498152aec5b1 (bug 946958) Backed out changeset 7d035322f51d (bug 946958) Backed out changeset 99f8ad7561ef (bug 946958) Backed out changeset 4639c5abea80 (bug 946958) Backed out changeset 9d1a4d83eccf (bug 865033) Backed out changeset 41839e4026bc (bug 865033)
This commit is contained in:
Родитель
0cbd932c4f
Коммит
74b2dea823
|
@ -431,6 +431,7 @@ public:
|
|||
// XXX I expect we will want to move mWidget into this class and implement
|
||||
// these methods properly.
|
||||
virtual nsIWidget* GetWidget() const { return nullptr; }
|
||||
virtual const nsIntSize& GetWidgetSize() = 0;
|
||||
|
||||
// Call before and after any rendering not done by this compositor but which
|
||||
// might affect the compositor's internal state or the state of any APIs it
|
||||
|
|
|
@ -133,6 +133,15 @@ LayerManager::CreateDrawTarget(const IntSize &aSize,
|
|||
CreateOffscreenCanvasDrawTarget(aSize, aFormat);
|
||||
}
|
||||
|
||||
TextureFactoryIdentifier
|
||||
LayerManager::GetTextureFactoryIdentifier()
|
||||
{
|
||||
//TODO[nrc] make pure virtual when all layer managers use Compositor
|
||||
NS_ERROR("Should have been overridden");
|
||||
return TextureFactoryIdentifier();
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
LayerManager::Mutated(Layer* aLayer)
|
||||
|
|
|
@ -437,6 +437,12 @@ public:
|
|||
|
||||
virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) { return true; }
|
||||
|
||||
/**
|
||||
* Returns a TextureFactoryIdentifier which describes properties of the backend
|
||||
* used to decide what kind of texture and buffer clients to create
|
||||
*/
|
||||
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier();
|
||||
|
||||
/**
|
||||
* returns the maximum texture size on this layer backend, or INT32_MAX
|
||||
* if there is no maximum
|
||||
|
|
|
@ -220,6 +220,7 @@ CreateBasicDeprecatedTextureHost(SurfaceDescriptorType aDescriptorType,
|
|||
|
||||
BasicCompositor::BasicCompositor(nsIWidget *aWidget)
|
||||
: mWidget(aWidget)
|
||||
, mWidgetSize(-1, -1)
|
||||
{
|
||||
MOZ_COUNT_CTOR(BasicCompositor);
|
||||
sBackend = LAYERS_BASIC;
|
||||
|
@ -539,6 +540,7 @@ BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion,
|
|||
nsIntRect intRect;
|
||||
mWidget->GetClientBounds(intRect);
|
||||
Rect rect = Rect(0, 0, intRect.width, intRect.height);
|
||||
mWidgetSize = intRect.Size();
|
||||
|
||||
nsIntRect invalidRect = aInvalidRegion.GetBounds();
|
||||
mInvalidRect = IntRect(invalidRect.x, invalidRect.y, invalidRect.width, invalidRect.height);
|
||||
|
|
|
@ -119,6 +119,10 @@ public:
|
|||
virtual const char* Name() const { return "Basic"; }
|
||||
|
||||
virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; }
|
||||
virtual const nsIntSize& GetWidgetSize() MOZ_OVERRIDE
|
||||
{
|
||||
return mWidgetSize;
|
||||
}
|
||||
|
||||
gfx::DrawTarget *GetDrawTarget() { return mDrawTarget; }
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
virtual already_AddRefed<ColorLayer> CreateColorLayer();
|
||||
virtual already_AddRefed<RefLayer> CreateRefLayer();
|
||||
|
||||
TextureFactoryIdentifier GetTextureFactoryIdentifier()
|
||||
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE
|
||||
{
|
||||
return mForwarder->GetTextureFactoryIdentifier();
|
||||
}
|
||||
|
|
|
@ -203,7 +203,6 @@ LayerManagerComposite::EndTransaction(DrawThebesLayerCallback aCallback,
|
|||
EndTransactionFlags aFlags)
|
||||
{
|
||||
NS_ASSERTION(mInTransaction, "Didn't call BeginTransaction?");
|
||||
NS_ASSERTION(!aCallback && !aCallbackData, "Not expecting callbacks here");
|
||||
mInTransaction = false;
|
||||
|
||||
if (!mIsCompositorReady) {
|
||||
|
@ -241,7 +240,13 @@ LayerManagerComposite::EndTransaction(DrawThebesLayerCallback aCallback,
|
|||
// so we don't need to pass any global transform here.
|
||||
mRoot->ComputeEffectiveTransforms(gfx3DMatrix());
|
||||
|
||||
mThebesLayerCallback = aCallback;
|
||||
mThebesLayerCallbackData = aCallbackData;
|
||||
|
||||
Render();
|
||||
|
||||
mThebesLayerCallback = nullptr;
|
||||
mThebesLayerCallbackData = nullptr;
|
||||
}
|
||||
|
||||
mCompositor->SetTargetContext(nullptr);
|
||||
|
@ -302,7 +307,7 @@ LayerManagerComposite::RootLayer() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return ToLayerComposite(mRoot);
|
||||
return static_cast<LayerComposite*>(mRoot->ImplData());
|
||||
}
|
||||
|
||||
static uint16_t sFrameCount = 0;
|
||||
|
@ -718,7 +723,7 @@ LayerManagerComposite::AutoAddMaskEffect::AutoAddMaskEffect(Layer* aMaskLayer,
|
|||
return;
|
||||
}
|
||||
|
||||
mCompositable = ToLayerComposite(aMaskLayer)->GetCompositableHost();
|
||||
mCompositable = static_cast<LayerComposite*>(aMaskLayer->ImplData())->GetCompositableHost();
|
||||
if (!mCompositable) {
|
||||
NS_WARNING("Mask layer with no compositable host");
|
||||
return;
|
||||
|
@ -781,6 +786,25 @@ LayerComposite::Destroy()
|
|||
}
|
||||
}
|
||||
|
||||
const nsIntSize&
|
||||
LayerManagerComposite::GetWidgetSize()
|
||||
{
|
||||
return mCompositor->GetWidgetSize();
|
||||
}
|
||||
|
||||
void
|
||||
LayerManagerComposite::SetCompositorID(uint32_t aID)
|
||||
{
|
||||
NS_ASSERTION(mCompositor, "No compositor");
|
||||
mCompositor->SetCompositorID(aID);
|
||||
}
|
||||
|
||||
void
|
||||
LayerManagerComposite::NotifyShadowTreeTransaction()
|
||||
{
|
||||
mCompositor->NotifyLayersTransaction();
|
||||
}
|
||||
|
||||
bool
|
||||
LayerManagerComposite::CanUseCanvasLayerForSize(const gfxIntSize &aSize)
|
||||
{
|
||||
|
@ -788,6 +812,18 @@ LayerManagerComposite::CanUseCanvasLayerForSize(const gfxIntSize &aSize)
|
|||
aSize.height));
|
||||
}
|
||||
|
||||
TextureFactoryIdentifier
|
||||
LayerManagerComposite::GetTextureFactoryIdentifier()
|
||||
{
|
||||
return mCompositor->GetTextureFactoryIdentifier();
|
||||
}
|
||||
|
||||
int32_t
|
||||
LayerManagerComposite::GetMaxTextureSize() const
|
||||
{
|
||||
return mCompositor->GetMaxTextureSize();
|
||||
}
|
||||
|
||||
#ifndef MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
|
||||
|
||||
/*static*/ bool
|
||||
|
|
|
@ -110,6 +110,8 @@ public:
|
|||
}
|
||||
void BeginTransactionWithDrawTarget(gfx::DrawTarget* aTarget);
|
||||
|
||||
void NotifyShadowTreeTransaction();
|
||||
|
||||
virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE;
|
||||
virtual void EndTransaction(DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData,
|
||||
|
@ -117,14 +119,11 @@ public:
|
|||
|
||||
virtual void SetRoot(Layer* aLayer) MOZ_OVERRIDE { mRoot = aLayer; }
|
||||
|
||||
// XXX[nrc]: never called, we should move this logic to ClientLayerManager
|
||||
// (bug 946926).
|
||||
virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) MOZ_OVERRIDE;
|
||||
|
||||
virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_CRASH("Call on compositor, not LayerManagerComposite");
|
||||
}
|
||||
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE;
|
||||
|
||||
virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE;
|
||||
|
||||
virtual void ClearCachedResources(Layer* aSubtree = nullptr) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -142,16 +141,24 @@ public:
|
|||
|
||||
virtual LayersBackend GetBackendType() MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_CRASH("Shouldn't be called for composited layer manager");
|
||||
return LAYERS_NONE;
|
||||
}
|
||||
virtual void GetBackendName(nsAString& name) MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_CRASH("Shouldn't be called for composited layer manager");
|
||||
MOZ_ASSERT(false, "Shouldn't be called for composited layer manager");
|
||||
name.AssignLiteral("Composite");
|
||||
}
|
||||
|
||||
virtual already_AddRefed<gfxASurface>
|
||||
CreateOptimalMaskSurface(const gfxIntSize &aSize) MOZ_OVERRIDE;
|
||||
|
||||
|
||||
DrawThebesLayerCallback GetThebesLayerCallback() const
|
||||
{ return mThebesLayerCallback; }
|
||||
|
||||
void* GetThebesLayerCallbackData() const
|
||||
{ return mThebesLayerCallbackData; }
|
||||
|
||||
virtual const char* Name() const MOZ_OVERRIDE { return ""; }
|
||||
|
||||
enum WorldTransforPolicy {
|
||||
|
@ -188,9 +195,11 @@ public:
|
|||
* layermanager.
|
||||
*/
|
||||
virtual TemporaryRef<mozilla::gfx::DrawTarget>
|
||||
CreateDrawTarget(const mozilla::gfx::IntSize& aSize,
|
||||
CreateDrawTarget(const mozilla::gfx::IntSize &aSize,
|
||||
mozilla::gfx::SurfaceFormat aFormat) MOZ_OVERRIDE;
|
||||
|
||||
const nsIntSize& GetWidgetSize();
|
||||
|
||||
/**
|
||||
* Calculates the 'completeness' of the rendering that intersected with the
|
||||
* screen on the last render. This is only useful when progressive tile
|
||||
|
@ -208,6 +217,8 @@ public:
|
|||
|
||||
static void PlatformSyncBeforeReplyUpdate();
|
||||
|
||||
void SetCompositorID(uint32_t aID);
|
||||
|
||||
void AddInvalidRegion(const nsIntRegion& aRegion)
|
||||
{
|
||||
mInvalidRegion.Or(mInvalidRegion, aRegion);
|
||||
|
@ -234,7 +245,7 @@ private:
|
|||
nsIntRect mRenderBounds;
|
||||
|
||||
/** Current root layer. */
|
||||
LayerComposite* RootLayer() const;
|
||||
LayerComposite *RootLayer() const;
|
||||
|
||||
/**
|
||||
* Recursive helper method for use by ComputeRenderIntegrity. Subtracts
|
||||
|
@ -264,6 +275,10 @@ private:
|
|||
/** Our more efficient but less powerful alter ego, if one is available. */
|
||||
nsRefPtr<Composer2D> mComposer2D;
|
||||
|
||||
/* Thebes layer callbacks; valid at the end of a transaciton,
|
||||
* while rendering */
|
||||
DrawThebesLayerCallback mThebesLayerCallback;
|
||||
void *mThebesLayerCallbackData;
|
||||
gfxMatrix mWorldMatrix;
|
||||
|
||||
bool mInTransaction;
|
||||
|
|
|
@ -139,6 +139,14 @@ public:
|
|||
virtual void NotifyLayersTransaction() MOZ_OVERRIDE { }
|
||||
|
||||
virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; }
|
||||
virtual const nsIntSize& GetWidgetSize() MOZ_OVERRIDE
|
||||
{
|
||||
NS_ASSERTION(false, "Getting the widget size on windows causes some kind of resizing of buffers. "
|
||||
"You should not do that outside of BeginFrame, so the best we can do is return "
|
||||
"the last size we got, that might not be up to date. So you probably shouldn't "
|
||||
"use this method.");
|
||||
return mSize;
|
||||
}
|
||||
|
||||
ID3D11Device* GetDevice() { return mDevice; }
|
||||
|
||||
|
|
|
@ -86,6 +86,14 @@ public:
|
|||
virtual void NotifyLayersTransaction() MOZ_OVERRIDE {}
|
||||
|
||||
virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; }
|
||||
virtual const nsIntSize& GetWidgetSize() MOZ_OVERRIDE
|
||||
{
|
||||
NS_ASSERTION(false, "Getting the widget size on windows causes some kind of resizing of buffers. "
|
||||
"You should not do that outside of BeginFrame, so the best we can do is return "
|
||||
"the last size we got, that might not be up to date. So you probably shouldn't "
|
||||
"use this method.");
|
||||
return mSize;
|
||||
}
|
||||
|
||||
IDirect3DDevice9* device() const
|
||||
{
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=2 et tw=80 : */
|
||||
/* 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 "CompositorParent.h"
|
||||
#include "CompositorCocoaWidgetHelper.h"
|
||||
#include "nsDebug.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
namespace compositor {
|
||||
|
||||
LayerManagerComposite*
|
||||
GetLayerManager(CompositorParent* aParent)
|
||||
{
|
||||
return aParent->GetLayerManager();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_layers_CompositorCocoaWidgetHelper_h
|
||||
#define mozilla_layers_CompositorCocoaWidgetHelper_h
|
||||
|
||||
// Note we can't include IPDL-generated headers here, since this file is being
|
||||
// used as a workaround for Bug 719036.
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class CompositorParent;
|
||||
class LayerManagerComposite;
|
||||
|
||||
namespace compositor {
|
||||
|
||||
// Needed when we cannot directly include CompositorParent.h since it includes
|
||||
// an IPDL-generated header (e.g. in widget/cocoa/nsChildView.mm; see Bug 719036).
|
||||
LayerManagerComposite* GetLayerManager(CompositorParent* aParent);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // mozilla_layers_CompositorCocoaWidgetHelper_h
|
||||
|
|
@ -62,7 +62,6 @@ namespace layers {
|
|||
|
||||
CompositorParent::LayerTreeState::LayerTreeState()
|
||||
: mParent(nullptr)
|
||||
, mLayerManager(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -238,7 +237,6 @@ CompositorParent::Destroy()
|
|||
|
||||
// Ensure that the layer manager is destructed on the compositor thread.
|
||||
mLayerManager = nullptr;
|
||||
mCompositor = nullptr;
|
||||
mCompositionManager = nullptr;
|
||||
mApzcTreeManager->ClearTree();
|
||||
mApzcTreeManager = nullptr;
|
||||
|
@ -265,12 +263,10 @@ CompositorParent::RecvWillStop()
|
|||
LayerTreeState* lts = &it->second;
|
||||
if (lts->mParent == this) {
|
||||
mLayerManager->ClearCachedResources(lts->mRoot);
|
||||
lts->mLayerManager = nullptr;
|
||||
}
|
||||
}
|
||||
mLayerManager->Destroy();
|
||||
mLayerManager = nullptr;
|
||||
mCompositor = nullptr;
|
||||
mCompositionManager = nullptr;
|
||||
}
|
||||
|
||||
|
@ -375,9 +371,7 @@ CompositorParent::ActorDestroy(ActorDestroyReason why)
|
|||
if (mLayerManager) {
|
||||
mLayerManager->Destroy();
|
||||
mLayerManager = nullptr;
|
||||
sIndirectLayerTrees[mRootLayerTreeID].mLayerManager = nullptr;
|
||||
mCompositionManager = nullptr;
|
||||
mCompositor = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -400,7 +394,7 @@ CompositorParent::PauseComposition()
|
|||
if (!mPaused) {
|
||||
mPaused = true;
|
||||
|
||||
mCompositor->Pause();
|
||||
mLayerManager->GetCompositor()->Pause();
|
||||
}
|
||||
|
||||
// if anyone's waiting to make sure that composition really got paused, tell them
|
||||
|
@ -415,7 +409,7 @@ CompositorParent::ResumeComposition()
|
|||
|
||||
MonitorAutoLock lock(mResumeCompositionMonitor);
|
||||
|
||||
if (!mCompositor->Resume()) {
|
||||
if (!mLayerManager->GetCompositor()->Resume()) {
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// We can't get a surface. This could be because the activity changed between
|
||||
// the time resume was scheduled and now.
|
||||
|
@ -446,8 +440,8 @@ CompositorParent::SetEGLSurfaceSize(int width, int height)
|
|||
{
|
||||
NS_ASSERTION(mUseExternalSurfaceSize, "Compositor created without UseExternalSurfaceSize provided");
|
||||
mEGLSurfaceSize.SizeTo(width, height);
|
||||
if (mCompositor) {
|
||||
mCompositor->SetDestinationSurfaceSize(gfx::IntSize(mEGLSurfaceSize.width, mEGLSurfaceSize.height));
|
||||
if (mLayerManager) {
|
||||
mLayerManager->GetCompositor()->SetDestinationSurfaceSize(gfx::IntSize(mEGLSurfaceSize.width, mEGLSurfaceSize.height));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -509,7 +503,7 @@ CompositorParent::NotifyShadowTreeTransaction(uint64_t aId, bool aIsFirstPaint)
|
|||
AutoResolveRefLayers resolve(mCompositionManager);
|
||||
mApzcTreeManager->UpdatePanZoomControllerTree(this, mLayerManager->GetRoot(), aIsFirstPaint, aId);
|
||||
|
||||
mCompositor->NotifyLayersTransaction();
|
||||
mLayerManager->AsLayerManagerComposite()->NotifyShadowTreeTransaction();
|
||||
}
|
||||
ScheduleComposition();
|
||||
}
|
||||
|
@ -703,7 +697,7 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
|||
}
|
||||
}
|
||||
ScheduleComposition();
|
||||
mCompositor->NotifyLayersTransaction();
|
||||
mLayerManager->NotifyShadowTreeTransaction();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -712,32 +706,34 @@ CompositorParent::InitializeLayerManager(const nsTArray<LayersBackend>& aBackend
|
|||
NS_ASSERTION(!mLayerManager, "Already initialised mLayerManager");
|
||||
|
||||
for (size_t i = 0; i < aBackendHints.Length(); ++i) {
|
||||
RefPtr<Compositor> compositor;
|
||||
RefPtr<LayerManagerComposite> layerManager;
|
||||
if (aBackendHints[i] == LAYERS_OPENGL) {
|
||||
compositor = new CompositorOGL(mWidget,
|
||||
mEGLSurfaceSize.width,
|
||||
mEGLSurfaceSize.height,
|
||||
mUseExternalSurfaceSize);
|
||||
layerManager =
|
||||
new LayerManagerComposite(new CompositorOGL(mWidget,
|
||||
mEGLSurfaceSize.width,
|
||||
mEGLSurfaceSize.height,
|
||||
mUseExternalSurfaceSize));
|
||||
} else if (aBackendHints[i] == LAYERS_BASIC) {
|
||||
compositor = new BasicCompositor(mWidget);
|
||||
layerManager =
|
||||
new LayerManagerComposite(new BasicCompositor(mWidget));
|
||||
#ifdef XP_WIN
|
||||
} else if (aBackendHints[i] == LAYERS_D3D11) {
|
||||
compositor = new CompositorD3D11(mWidget);
|
||||
layerManager =
|
||||
new LayerManagerComposite(new CompositorD3D11(mWidget));
|
||||
} else if (aBackendHints[i] == LAYERS_D3D9) {
|
||||
compositor = new CompositorD3D9(this, mWidget);
|
||||
layerManager =
|
||||
new LayerManagerComposite(new CompositorD3D9(this, mWidget));
|
||||
#endif
|
||||
}
|
||||
|
||||
MOZ_ASSERT(compositor, "Passed invalid backend hint");
|
||||
if (!layerManager) {
|
||||
continue;
|
||||
}
|
||||
|
||||
compositor->SetCompositorID(mCompositorID);
|
||||
RefPtr<LayerManagerComposite> layerManager = new LayerManagerComposite(compositor);
|
||||
layerManager->SetCompositorID(mCompositorID);
|
||||
|
||||
if (layerManager->Initialize()) {
|
||||
mLayerManager = layerManager;
|
||||
MOZ_ASSERT(compositor);
|
||||
mCompositor = compositor;
|
||||
sIndirectLayerTrees[mRootLayerTreeID].mLayerManager = layerManager;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -769,7 +765,7 @@ CompositorParent::AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aB
|
|||
mCompositionManager = new AsyncCompositionManager(mLayerManager);
|
||||
*aSuccess = true;
|
||||
|
||||
*aTextureFactoryIdentifier = mCompositor->GetTextureFactoryIdentifier();
|
||||
*aTextureFactoryIdentifier = mLayerManager->GetTextureFactoryIdentifier();
|
||||
LayerTransactionParent* p = new LayerTransactionParent(mLayerManager, this, 0);
|
||||
p->AddIPDLReference();
|
||||
return p;
|
||||
|
@ -925,17 +921,6 @@ CompositorParent::GetAPZCTreeManager(uint64_t aLayersId)
|
|||
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
|
||||
|
@ -1086,9 +1071,9 @@ CrossProcessCompositorParent::AllocPLayerTransactionParent(const nsTArray<Layers
|
|||
{
|
||||
MOZ_ASSERT(aId != 0);
|
||||
|
||||
if (sIndirectLayerTrees[aId].mLayerManager) {
|
||||
LayerManagerComposite* lm = sIndirectLayerTrees[aId].mLayerManager;
|
||||
*aTextureFactoryIdentifier = lm->GetCompositor()->GetTextureFactoryIdentifier();
|
||||
if (sIndirectLayerTrees[aId].mParent) {
|
||||
LayerManagerComposite* lm = sIndirectLayerTrees[aId].mParent->GetLayerManager();
|
||||
*aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier();
|
||||
*aSuccess = true;
|
||||
LayerTransactionParent* p = new LayerTransactionParent(lm, this, aId);
|
||||
p->AddIPDLReference();
|
||||
|
|
|
@ -47,7 +47,6 @@ namespace layers {
|
|||
|
||||
class APZCTreeManager;
|
||||
class AsyncCompositionManager;
|
||||
class Compositor;
|
||||
class LayerManagerComposite;
|
||||
class LayerTransactionParent;
|
||||
|
||||
|
@ -108,6 +107,8 @@ public:
|
|||
void ForceIsFirstPaint();
|
||||
void Destroy();
|
||||
|
||||
LayerManagerComposite* GetLayerManager() { return mLayerManager; }
|
||||
|
||||
void NotifyChildCreated(uint64_t aChild);
|
||||
|
||||
void AsyncRender();
|
||||
|
@ -202,7 +203,6 @@ public:
|
|||
nsRefPtr<Layer> mRoot;
|
||||
nsRefPtr<GeckoContentController> mController;
|
||||
CompositorParent* mParent;
|
||||
LayerManagerComposite* mLayerManager;
|
||||
TargetConfig mTargetConfig;
|
||||
};
|
||||
|
||||
|
@ -213,8 +213,6 @@ public:
|
|||
*/
|
||||
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
|
||||
|
@ -297,7 +295,6 @@ private:
|
|||
bool CanComposite();
|
||||
|
||||
nsRefPtr<LayerManagerComposite> mLayerManager;
|
||||
nsRefPtr<Compositor> mCompositor;
|
||||
RefPtr<AsyncCompositionManager> mCompositionManager;
|
||||
nsIWidget* mWidget;
|
||||
CancelableTask *mCurrentCompositeTask;
|
||||
|
|
|
@ -128,6 +128,7 @@ EXPORTS.mozilla.layers += [
|
|||
'ipc/CompositableForwarder.h',
|
||||
'ipc/CompositableTransactionParent.h',
|
||||
'ipc/CompositorChild.h',
|
||||
'ipc/CompositorCocoaWidgetHelper.h',
|
||||
'ipc/CompositorParent.h',
|
||||
'ipc/GeckoContentController.h',
|
||||
'ipc/GestureEventListener.h',
|
||||
|
@ -239,6 +240,7 @@ UNIFIED_SOURCES += [
|
|||
'ipc/Axis.cpp',
|
||||
'ipc/CompositableTransactionParent.cpp',
|
||||
'ipc/CompositorChild.cpp',
|
||||
'ipc/CompositorCocoaWidgetHelper.cpp',
|
||||
'ipc/CompositorParent.cpp',
|
||||
'ipc/GestureEventListener.cpp',
|
||||
'ipc/ImageBridgeChild.cpp',
|
||||
|
|
|
@ -158,6 +158,9 @@ public:
|
|||
virtual bool Resume() MOZ_OVERRIDE;
|
||||
|
||||
virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; }
|
||||
virtual const nsIntSize& GetWidgetSize() MOZ_OVERRIDE {
|
||||
return mWidgetSize;
|
||||
}
|
||||
|
||||
GLContext* gl() const { return mGLContext; }
|
||||
ShaderProgramType GetFBOLayerProgramType() const {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#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
|
||||
|
@ -14,6 +15,7 @@
|
|||
#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;
|
||||
|
||||
|
@ -47,14 +49,21 @@ private:
|
|||
};
|
||||
|
||||
/* static */ GLManager*
|
||||
GLManager::CreateGLManager(LayerManagerComposite* aManager)
|
||||
GLManager::CreateGLManager(LayerManager* aManager)
|
||||
{
|
||||
if (aManager &&
|
||||
Compositor::GetBackend() == LAYERS_OPENGL) {
|
||||
return new GLManagerCompositor(static_cast<CompositorOGL*>(
|
||||
aManager->GetCompositor()));
|
||||
if (!aManager) {
|
||||
return nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class GLContext;
|
|||
|
||||
namespace layers {
|
||||
|
||||
class LayerManagerComposite;
|
||||
class LayerManager;
|
||||
|
||||
/**
|
||||
* Minimal interface to allow widgets to draw using OpenGL. Abstracts
|
||||
|
@ -26,7 +26,7 @@ class LayerManagerComposite;
|
|||
class GLManager
|
||||
{
|
||||
public:
|
||||
static GLManager* CreateGLManager(LayerManagerComposite* aManager);
|
||||
static GLManager* CreateGLManager(LayerManager* aManager);
|
||||
|
||||
virtual ~GLManager() {}
|
||||
|
||||
|
|
|
@ -647,8 +647,7 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
|
|||
nsRefPtr<LayerManager> lm = GetFrom(mFrameLoader);
|
||||
// Perhaps the document containing this frame currently has no presentation?
|
||||
if (lm && lm->GetBackendType() == LAYERS_CLIENT) {
|
||||
*aTextureFactoryIdentifier =
|
||||
static_cast<ClientLayerManager*>(lm.get())->GetTextureFactoryIdentifier();
|
||||
*aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier();
|
||||
} else {
|
||||
*aTextureFactoryIdentifier = TextureFactoryIdentifier();
|
||||
}
|
||||
|
|
|
@ -2328,7 +2328,7 @@ nsWindow::GetIMEUpdatePreference()
|
|||
}
|
||||
|
||||
void
|
||||
nsWindow::DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect)
|
||||
nsWindow::DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect)
|
||||
{
|
||||
JNIEnv *env = GetJNIForThread();
|
||||
NS_ABORT_IF_FALSE(env, "No JNI environment at DrawWindowUnderlay()!");
|
||||
|
@ -2362,7 +2362,7 @@ nsWindow::DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect)
|
|||
}
|
||||
|
||||
void
|
||||
nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect)
|
||||
nsWindow::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect)
|
||||
{
|
||||
PROFILER_LABEL("nsWindow", "DrawWindowOverlay");
|
||||
JNIEnv *env = GetJNIForThread();
|
||||
|
@ -2430,7 +2430,11 @@ float
|
|||
nsWindow::ComputeRenderIntegrity()
|
||||
{
|
||||
if (sCompositorParent) {
|
||||
return sCompositorParent->ComputeRenderIntegrity();
|
||||
mozilla::layers::LayerManagerComposite* manager =
|
||||
static_cast<mozilla::layers::LayerManagerComposite*>(sCompositorParent->GetLayerManager());
|
||||
if (manager) {
|
||||
return manager->ComputeRenderIntegrity();
|
||||
}
|
||||
}
|
||||
|
||||
return 1.f;
|
||||
|
|
|
@ -153,8 +153,8 @@ public:
|
|||
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
||||
|
||||
virtual bool NeedsPaint();
|
||||
virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect);
|
||||
virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect);
|
||||
virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect);
|
||||
virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect);
|
||||
|
||||
virtual mozilla::layers::CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight) MOZ_OVERRIDE;
|
||||
|
||||
|
|
|
@ -549,9 +549,9 @@ public:
|
|||
virtual gfxASurface* GetThebesSurface();
|
||||
virtual void PrepareWindowEffects() MOZ_OVERRIDE;
|
||||
virtual void CleanupWindowEffects() 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 bool PreRender(LayerManager* aManager) MOZ_OVERRIDE;
|
||||
virtual void PostRender(LayerManager* aManager) MOZ_OVERRIDE;
|
||||
virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) MOZ_OVERRIDE;
|
||||
|
||||
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries);
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "GLContext.h"
|
||||
#include "GLUploadHelpers.h"
|
||||
#include "mozilla/layers/GLManager.h"
|
||||
#include "mozilla/layers/CompositorCocoaWidgetHelper.h"
|
||||
#include "mozilla/layers/CompositorOGL.h"
|
||||
#include "mozilla/layers/BasicCompositor.h"
|
||||
#include "gfxUtils.h"
|
||||
|
@ -2046,7 +2047,7 @@ nsChildView::CleanupWindowEffects()
|
|||
}
|
||||
|
||||
bool
|
||||
nsChildView::PreRender(LayerManagerComposite* aManager)
|
||||
nsChildView::PreRender(LayerManager* aManager)
|
||||
{
|
||||
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
|
||||
if (!manager) {
|
||||
|
@ -2068,7 +2069,7 @@ nsChildView::PreRender(LayerManagerComposite* aManager)
|
|||
}
|
||||
|
||||
void
|
||||
nsChildView::PostRender(LayerManagerComposite* aManager)
|
||||
nsChildView::PostRender(LayerManager* aManager)
|
||||
{
|
||||
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
|
||||
if (!manager) {
|
||||
|
@ -2080,7 +2081,7 @@ nsChildView::PostRender(LayerManagerComposite* aManager)
|
|||
}
|
||||
|
||||
void
|
||||
nsChildView::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect)
|
||||
nsChildView::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect)
|
||||
{
|
||||
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
|
||||
if (manager) {
|
||||
|
|
|
@ -41,7 +41,6 @@ namespace layers {
|
|||
class Composer2D;
|
||||
class CompositorChild;
|
||||
class LayerManager;
|
||||
class LayerManagerComposite;
|
||||
class PLayerTransactionChild;
|
||||
}
|
||||
namespace gfx {
|
||||
|
@ -97,8 +96,8 @@ typedef void* nsNativeWidget;
|
|||
#endif
|
||||
|
||||
#define NS_IWIDGET_IID \
|
||||
{ 0x746cb189, 0x9793, 0x4e53, \
|
||||
{ 0x89, 0x47, 0x78, 0x56, 0xb6, 0xcd, 0x9f, 0x71 } }
|
||||
{ 0xa1f684e6, 0x2ae1, 0x4513, \
|
||||
{ 0xb6, 0x89, 0xf4, 0xd4, 0xfe, 0x9d, 0x2c, 0xdb } }
|
||||
|
||||
/*
|
||||
* Window shadow styles
|
||||
|
@ -465,7 +464,6 @@ class nsIWidget : public nsISupports {
|
|||
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;
|
||||
|
@ -1218,36 +1216,38 @@ class nsIWidget : public nsISupports {
|
|||
virtual void CleanupWindowEffects() = 0;
|
||||
|
||||
/**
|
||||
* Called before rendering using OMTC. Returns false when the widget is
|
||||
* Called before rendering using OpenGL. 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(LayerManagerComposite* aManager) = 0;
|
||||
virtual bool PreRender(LayerManager* aManager) = 0;
|
||||
|
||||
/**
|
||||
* Called after rendering using OMTC. Not called when rendering was
|
||||
* Called after rendering using OpenGL. 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(LayerManagerComposite* aManager) = 0;
|
||||
virtual void PostRender(LayerManager* aManager) = 0;
|
||||
|
||||
/**
|
||||
* Called before the LayerManager draws the layer tree.
|
||||
*
|
||||
* Always called from the compositing thread.
|
||||
* Always called from the compositing thread, which may be the main-thread if
|
||||
* OMTC is not enabled.
|
||||
*/
|
||||
virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) = 0;
|
||||
virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) = 0;
|
||||
|
||||
/**
|
||||
* Called after the LayerManager draws the layer tree
|
||||
*
|
||||
* Always called from the compositing thread.
|
||||
* Always called from the compositing thread, which may be the main-thread if
|
||||
* OMTC is not enabled.
|
||||
*/
|
||||
virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) = 0;
|
||||
virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) = 0;
|
||||
|
||||
/**
|
||||
* Return a DrawTarget for the window which can be composited into.
|
||||
|
|
|
@ -136,10 +136,10 @@ public:
|
|||
virtual void CreateCompositor(int aWidth, int aHeight);
|
||||
virtual void PrepareWindowEffects() {}
|
||||
virtual void CleanupWindowEffects() {}
|
||||
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 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 mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing();
|
||||
virtual void EndRemoteDrawing() { };
|
||||
virtual void CleanupRemoteDrawing() { };
|
||||
|
|
Загрузка…
Ссылка в новой задаче