2010-07-22 01:17:33 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2010-07-22 01:17:33 +04:00
|
|
|
|
|
|
|
#include "ShadowLayers.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
#include <set> // for _Rb_tree_const_iterator, etc
|
|
|
|
#include <vector> // for vector
|
2013-08-22 11:11:51 +04:00
|
|
|
#include "GeckoProfiler.h" // for PROFILER_LABEL
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "ISurfaceAllocator.h" // for IsSurfaceDescriptorValid
|
|
|
|
#include "Layers.h" // for Layer
|
|
|
|
#include "RenderTrace.h" // for RenderTraceScope
|
|
|
|
#include "ShadowLayerChild.h" // for ShadowLayerChild
|
2013-12-20 20:46:29 +04:00
|
|
|
#include "gfx2DGlue.h" // for Moz2D transition helpers
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "gfxPlatform.h" // for gfxImageFormat, gfxPlatform
|
|
|
|
#include "gfxSharedImageSurface.h" // for gfxSharedImageSurface
|
|
|
|
#include "ipc/IPCMessageUtils.h" // for gfxContentType, null_t
|
|
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
2013-12-20 20:46:30 +04:00
|
|
|
#include "mozilla/gfx/Point.h" // for IntSize
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/layers/CompositableClient.h" // for CompositableClient, etc
|
2013-09-06 19:41:00 +04:00
|
|
|
#include "mozilla/layers/LayersMessages.h" // for Edit, etc
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
|
|
|
|
#include "mozilla/layers/LayersTypes.h" // for MOZ_LAYERS_LOG
|
2013-11-27 19:19:34 +04:00
|
|
|
#include "mozilla/layers/LayerTransactionChild.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "ShadowLayerUtils.h"
|
|
|
|
#include "mozilla/layers/TextureClient.h" // for TextureClient
|
|
|
|
#include "mozilla/mozalloc.h" // for operator new, etc
|
|
|
|
#include "nsAutoPtr.h" // for nsRefPtr, getter_AddRefs, etc
|
|
|
|
#include "nsTArray.h" // for nsAutoTArray, nsTArray, etc
|
|
|
|
#include "nsXULAppAPI.h" // for XRE_GetProcessType, etc
|
2014-07-31 10:44:31 +04:00
|
|
|
#include "mozilla/ReentrantMonitor.h"
|
2010-07-22 01:17:33 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
2013-08-12 03:17:23 +04:00
|
|
|
namespace ipc {
|
|
|
|
class Shmem;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace ipc
|
2013-08-12 03:17:23 +04:00
|
|
|
|
2010-07-22 01:17:33 +04:00
|
|
|
namespace layers {
|
|
|
|
|
2015-07-04 01:52:42 +03:00
|
|
|
using namespace mozilla::gfx;
|
2014-05-22 14:11:45 +04:00
|
|
|
using namespace mozilla::gl;
|
2015-07-04 01:52:42 +03:00
|
|
|
using namespace mozilla::ipc;
|
2014-05-22 14:11:45 +04:00
|
|
|
|
2014-03-08 01:34:04 +04:00
|
|
|
class ClientTiledLayerBuffer;
|
2013-08-12 03:17:23 +04:00
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
typedef nsTArray<SurfaceDescriptor> BufferArray;
|
2010-07-22 01:17:33 +04:00
|
|
|
typedef std::vector<Edit> EditVector;
|
|
|
|
typedef std::set<ShadowableLayer*> ShadowableLayerSet;
|
|
|
|
|
|
|
|
class Transaction
|
|
|
|
{
|
|
|
|
public:
|
2012-05-01 23:23:39 +04:00
|
|
|
Transaction()
|
2013-02-26 09:18:20 +04:00
|
|
|
: mTargetRotation(ROTATION_0)
|
|
|
|
, mSwapRequired(false)
|
2012-05-18 12:29:38 +04:00
|
|
|
, mOpen(false)
|
2012-11-06 13:11:43 +04:00
|
|
|
, mRotationChanged(false)
|
2012-05-01 23:23:39 +04:00
|
|
|
{}
|
2010-07-22 01:17:33 +04:00
|
|
|
|
2015-04-21 18:04:57 +03:00
|
|
|
void Begin(const gfx::IntRect& aTargetBounds, ScreenRotation aRotation,
|
2015-08-19 00:55:09 +03:00
|
|
|
dom::ScreenOrientationInternal aOrientation)
|
2012-07-24 23:01:09 +04:00
|
|
|
{
|
|
|
|
mOpen = true;
|
|
|
|
mTargetBounds = aTargetBounds;
|
2012-11-06 13:11:43 +04:00
|
|
|
if (aRotation != mTargetRotation) {
|
2013-02-26 09:18:20 +04:00
|
|
|
// the first time this is called, mRotationChanged will be false if
|
|
|
|
// aRotation is 0, but we should be OK because for the first transaction
|
|
|
|
// we should only compose if it is non-empty. See the caller(s) of
|
|
|
|
// RotationChanged.
|
|
|
|
mRotationChanged = true;
|
2012-11-06 13:11:43 +04:00
|
|
|
}
|
2012-07-24 23:01:09 +04:00
|
|
|
mTargetRotation = aRotation;
|
2012-11-22 06:40:57 +04:00
|
|
|
mTargetOrientation = aOrientation;
|
2012-07-24 23:01:09 +04:00
|
|
|
}
|
2013-09-12 18:50:28 +04:00
|
|
|
void MarkSyncTransaction()
|
|
|
|
{
|
|
|
|
mSwapRequired = true;
|
|
|
|
}
|
2010-07-22 01:17:33 +04:00
|
|
|
void AddEdit(const Edit& aEdit)
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(!Finished(), "forgot BeginTransaction?");
|
2010-07-22 01:17:33 +04:00
|
|
|
mCset.push_back(aEdit);
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
void AddEdit(const CompositableOperation& aEdit)
|
|
|
|
{
|
|
|
|
AddEdit(Edit(aEdit));
|
|
|
|
}
|
2010-09-16 01:03:13 +04:00
|
|
|
void AddPaint(const Edit& aPaint)
|
2012-05-01 23:23:39 +04:00
|
|
|
{
|
|
|
|
AddNoSwapPaint(aPaint);
|
|
|
|
mSwapRequired = true;
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
void AddPaint(const CompositableOperation& aPaint)
|
|
|
|
{
|
|
|
|
AddNoSwapPaint(Edit(aPaint));
|
|
|
|
mSwapRequired = true;
|
|
|
|
}
|
|
|
|
|
2012-05-01 23:23:39 +04:00
|
|
|
void AddNoSwapPaint(const Edit& aPaint)
|
2010-09-16 01:03:13 +04:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(!Finished(), "forgot BeginTransaction?");
|
2010-09-16 01:03:13 +04:00
|
|
|
mPaints.push_back(aPaint);
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
void AddNoSwapPaint(const CompositableOperation& aPaint)
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(!Finished(), "forgot BeginTransaction?");
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
mPaints.push_back(Edit(aPaint));
|
|
|
|
}
|
2010-07-22 01:17:33 +04:00
|
|
|
void AddMutant(ShadowableLayer* aLayer)
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(!Finished(), "forgot BeginTransaction?");
|
2010-07-22 01:17:33 +04:00
|
|
|
mMutants.insert(aLayer);
|
|
|
|
}
|
|
|
|
void End()
|
|
|
|
{
|
|
|
|
mCset.clear();
|
2010-09-16 01:03:13 +04:00
|
|
|
mPaints.clear();
|
2010-07-22 01:17:33 +04:00
|
|
|
mMutants.clear();
|
2011-10-17 18:59:28 +04:00
|
|
|
mOpen = false;
|
2012-05-01 23:23:39 +04:00
|
|
|
mSwapRequired = false;
|
2012-11-06 13:11:43 +04:00
|
|
|
mRotationChanged = false;
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Empty() const {
|
2010-09-16 01:03:13 +04:00
|
|
|
return mCset.empty() && mPaints.empty() && mMutants.empty();
|
|
|
|
}
|
2012-11-06 13:11:43 +04:00
|
|
|
bool RotationChanged() const {
|
|
|
|
return mRotationChanged;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Finished() const { return !mOpen && Empty(); }
|
2010-07-22 01:17:33 +04:00
|
|
|
|
2014-10-07 22:37:15 +04:00
|
|
|
bool Opened() const { return mOpen; }
|
|
|
|
|
2010-07-22 01:17:33 +04:00
|
|
|
EditVector mCset;
|
2010-09-16 01:03:13 +04:00
|
|
|
EditVector mPaints;
|
2010-07-22 01:17:33 +04:00
|
|
|
ShadowableLayerSet mMutants;
|
2015-04-21 18:04:57 +03:00
|
|
|
gfx::IntRect mTargetBounds;
|
2012-07-24 23:01:09 +04:00
|
|
|
ScreenRotation mTargetRotation;
|
2015-08-19 00:55:09 +03:00
|
|
|
dom::ScreenOrientationInternal mTargetOrientation;
|
2012-05-01 23:23:39 +04:00
|
|
|
bool mSwapRequired;
|
2010-07-22 01:17:33 +04:00
|
|
|
|
|
|
|
private:
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mOpen;
|
2012-11-06 13:11:43 +04:00
|
|
|
bool mRotationChanged;
|
2010-07-22 01:17:33 +04:00
|
|
|
|
|
|
|
// disabled
|
|
|
|
Transaction(const Transaction&);
|
|
|
|
Transaction& operator=(const Transaction&);
|
|
|
|
};
|
|
|
|
struct AutoTxnEnd {
|
2014-08-20 08:55:14 +04:00
|
|
|
explicit AutoTxnEnd(Transaction* aTxn) : mTxn(aTxn) {}
|
2010-07-22 01:17:33 +04:00
|
|
|
~AutoTxnEnd() { mTxn->End(); }
|
|
|
|
Transaction* mTxn;
|
|
|
|
};
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
void
|
|
|
|
CompositableForwarder::IdentifyTextureHost(const TextureFactoryIdentifier& aIdentifier)
|
|
|
|
{
|
2013-07-12 06:32:09 +04:00
|
|
|
mTextureFactoryIdentifier = aIdentifier;
|
2014-12-13 04:50:47 +03:00
|
|
|
|
|
|
|
mSyncObject = SyncObject::CreateSyncObject(aIdentifier.mSyncHandle);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2010-12-31 10:40:19 +03:00
|
|
|
ShadowLayerForwarder::ShadowLayerForwarder()
|
2014-04-26 06:34:06 +04:00
|
|
|
: mDiagnosticTypes(DiagnosticTypes::NO_DIAGNOSTIC)
|
2012-03-12 19:50:15 +04:00
|
|
|
, mIsFirstPaint(false)
|
2013-06-20 17:01:20 +04:00
|
|
|
, mWindowOverlayChanged(false)
|
2015-08-18 21:27:20 +03:00
|
|
|
, mPaintSyncId(0)
|
2010-07-22 01:17:33 +04:00
|
|
|
{
|
|
|
|
mTxn = new Transaction();
|
|
|
|
}
|
|
|
|
|
|
|
|
ShadowLayerForwarder::~ShadowLayerForwarder()
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(mTxn->Finished(), "unfinished transaction?");
|
2010-07-22 01:17:33 +04:00
|
|
|
delete mTxn;
|
2014-05-06 05:56:40 +04:00
|
|
|
if (mShadowManager) {
|
|
|
|
mShadowManager->SetForwarder(nullptr);
|
2014-05-07 17:23:14 +04:00
|
|
|
mShadowManager->Destroy();
|
2014-05-06 05:56:40 +04:00
|
|
|
}
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-04-21 18:04:57 +03:00
|
|
|
ShadowLayerForwarder::BeginTransaction(const gfx::IntRect& aTargetBounds,
|
2012-11-22 06:40:57 +04:00
|
|
|
ScreenRotation aRotation,
|
2015-08-19 00:55:09 +03:00
|
|
|
dom::ScreenOrientationInternal aOrientation)
|
2010-07-22 01:17:33 +04:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(HasShadowManager(), "no manager to forward to");
|
|
|
|
MOZ_ASSERT(mTxn->Finished(), "uncommitted txn?");
|
2014-09-10 23:59:00 +04:00
|
|
|
mTxn->Begin(aTargetBounds, aRotation, aOrientation);
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static PLayerChild*
|
|
|
|
Shadow(ShadowableLayer* aLayer)
|
|
|
|
{
|
|
|
|
return aLayer->GetShadow();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename OpCreateT>
|
|
|
|
static void
|
|
|
|
CreatedLayer(Transaction* aTxn, ShadowableLayer* aLayer)
|
|
|
|
{
|
2013-07-20 12:48:55 +04:00
|
|
|
aTxn->AddEdit(OpCreateT(nullptr, Shadow(aLayer)));
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-09-26 21:06:08 +04:00
|
|
|
ShadowLayerForwarder::CreatedPaintedLayer(ShadowableLayer* aThebes)
|
2010-07-22 01:17:33 +04:00
|
|
|
{
|
2014-09-26 21:06:08 +04:00
|
|
|
CreatedLayer<OpCreatePaintedLayer>(mTxn, aThebes);
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedContainerLayer(ShadowableLayer* aContainer)
|
|
|
|
{
|
|
|
|
CreatedLayer<OpCreateContainerLayer>(mTxn, aContainer);
|
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedImageLayer(ShadowableLayer* aImage)
|
|
|
|
{
|
|
|
|
CreatedLayer<OpCreateImageLayer>(mTxn, aImage);
|
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedColorLayer(ShadowableLayer* aColor)
|
|
|
|
{
|
|
|
|
CreatedLayer<OpCreateColorLayer>(mTxn, aColor);
|
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedCanvasLayer(ShadowableLayer* aCanvas)
|
|
|
|
{
|
|
|
|
CreatedLayer<OpCreateCanvasLayer>(mTxn, aCanvas);
|
|
|
|
}
|
2012-07-18 03:59:45 +04:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedRefLayer(ShadowableLayer* aRef)
|
|
|
|
{
|
|
|
|
CreatedLayer<OpCreateRefLayer>(mTxn, aRef);
|
|
|
|
}
|
2010-07-22 01:17:33 +04:00
|
|
|
|
2010-09-03 07:05:01 +04:00
|
|
|
void
|
2010-07-22 01:17:33 +04:00
|
|
|
ShadowLayerForwarder::Mutated(ShadowableLayer* aMutant)
|
|
|
|
{
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
mTxn->AddMutant(aMutant);
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::SetRoot(ShadowableLayer* aRoot)
|
|
|
|
{
|
2013-07-20 12:48:55 +04:00
|
|
|
mTxn->AddEdit(OpSetRoot(nullptr, Shadow(aRoot)));
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::InsertAfter(ShadowableLayer* aContainer,
|
|
|
|
ShadowableLayer* aChild,
|
|
|
|
ShadowableLayer* aAfter)
|
|
|
|
{
|
2014-07-30 17:38:47 +04:00
|
|
|
if (!aChild->HasShadow()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (aAfter && !aAfter->HasShadow()) {
|
|
|
|
aAfter = aAfter->AsLayer()->GetPrevSibling() ? aAfter->AsLayer()->GetPrevSibling()->AsShadowableLayer() : nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aAfter) {
|
2013-07-20 12:48:55 +04:00
|
|
|
mTxn->AddEdit(OpInsertAfter(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild),
|
|
|
|
nullptr, Shadow(aAfter)));
|
2014-07-30 17:38:47 +04:00
|
|
|
} else {
|
2014-02-24 18:41:55 +04:00
|
|
|
mTxn->AddEdit(OpPrependChild(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild)));
|
2014-07-30 17:38:47 +04:00
|
|
|
}
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::RemoveChild(ShadowableLayer* aContainer,
|
|
|
|
ShadowableLayer* aChild)
|
|
|
|
{
|
2013-03-22 06:17:28 +04:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] OpRemoveChild container=%p child=%p\n",
|
|
|
|
aContainer->AsLayer(), aChild->AsLayer()));
|
|
|
|
|
2014-07-30 17:38:47 +04:00
|
|
|
if (!aChild->HasShadow()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-07-20 12:48:55 +04:00
|
|
|
mTxn->AddEdit(OpRemoveChild(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild)));
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
2012-08-29 14:52:55 +04:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::RepositionChild(ShadowableLayer* aContainer,
|
|
|
|
ShadowableLayer* aChild,
|
|
|
|
ShadowableLayer* aAfter)
|
|
|
|
{
|
2014-07-30 17:38:47 +04:00
|
|
|
if (!aChild->HasShadow()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (aAfter && !aAfter->HasShadow()) {
|
|
|
|
aAfter = aAfter->AsLayer()->GetPrevSibling() ? aAfter->AsLayer()->GetPrevSibling()->AsShadowableLayer() : nullptr;
|
|
|
|
}
|
|
|
|
|
2013-03-22 06:17:28 +04:00
|
|
|
if (aAfter) {
|
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] OpRepositionChild container=%p child=%p after=%p",
|
|
|
|
aContainer->AsLayer(), aChild->AsLayer(), aAfter->AsLayer()));
|
2013-07-20 12:48:55 +04:00
|
|
|
mTxn->AddEdit(OpRepositionChild(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild),
|
|
|
|
nullptr, Shadow(aAfter)));
|
2013-03-22 06:17:28 +04:00
|
|
|
} else {
|
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] OpRaiseToTopChild container=%p child=%p",
|
|
|
|
aContainer->AsLayer(), aChild->AsLayer()));
|
2013-07-20 12:48:55 +04:00
|
|
|
mTxn->AddEdit(OpRaiseToTopChild(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild)));
|
2013-03-22 06:17:28 +04:00
|
|
|
}
|
2012-08-29 14:52:55 +04:00
|
|
|
}
|
2010-07-22 01:17:33 +04:00
|
|
|
|
2013-10-21 18:23:42 +04:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CheckSurfaceDescriptor(const SurfaceDescriptor* aDescriptor) const
|
|
|
|
{
|
|
|
|
if (!aDescriptor) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-04-07 05:32:49 +04:00
|
|
|
if (aDescriptor->type() == SurfaceDescriptor::TSurfaceDescriptorShmem) {
|
|
|
|
const SurfaceDescriptorShmem& shmem = aDescriptor->get_SurfaceDescriptorShmem();
|
|
|
|
shmem.data().AssertInvariants();
|
2013-11-01 10:36:02 +04:00
|
|
|
MOZ_ASSERT(mShadowManager &&
|
2014-04-07 05:32:49 +04:00
|
|
|
mShadowManager->IsTrackingSharedMemory(shmem.data().mSegment));
|
2013-10-21 18:23:42 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-04-13 19:17:39 +04:00
|
|
|
void
|
2014-03-08 01:34:04 +04:00
|
|
|
ShadowLayerForwarder::UseTiledLayerBuffer(CompositableClient* aCompositable,
|
|
|
|
const SurfaceDescriptorTiles& aTileLayerDescriptor)
|
2012-04-13 19:17:39 +04:00
|
|
|
{
|
2014-04-11 20:47:56 +04:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
2014-03-08 01:34:04 +04:00
|
|
|
mTxn->AddNoSwapPaint(OpUseTiledLayerBuffer(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aTileLayerDescriptor));
|
2012-04-13 19:17:39 +04:00
|
|
|
}
|
|
|
|
|
2010-07-22 01:17:33 +04:00
|
|
|
void
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
ShadowLayerForwarder::UpdateTextureRegion(CompositableClient* aCompositable,
|
|
|
|
const ThebesBufferData& aThebesBufferData,
|
|
|
|
const nsIntRegion& aUpdatedRegion)
|
2010-07-22 01:17:33 +04:00
|
|
|
{
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
|
|
|
mTxn->AddPaint(OpPaintTextureRegion(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aThebesBufferData,
|
|
|
|
aUpdatedRegion));
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
void
|
2015-07-03 13:37:03 +03:00
|
|
|
ShadowLayerForwarder::UseTextures(CompositableClient* aCompositable,
|
|
|
|
const nsTArray<TimedTextureClient>& aTextures)
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
2014-04-11 20:47:56 +04:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
2015-07-03 13:37:03 +03:00
|
|
|
|
|
|
|
nsAutoTArray<TimedTexture,4> textures;
|
|
|
|
|
|
|
|
for (auto& t : aTextures) {
|
|
|
|
MOZ_ASSERT(t.mTextureClient);
|
|
|
|
MOZ_ASSERT(t.mTextureClient->GetIPDLActor());
|
|
|
|
FenceHandle fence = t.mTextureClient->GetAcquireFenceHandle();
|
|
|
|
textures.AppendElement(TimedTexture(nullptr, t.mTextureClient->GetIPDLActor(),
|
|
|
|
fence.IsValid() ? MaybeFence(fence) : MaybeFence(null_t()),
|
2015-07-06 06:02:26 +03:00
|
|
|
t.mTimeStamp, t.mPictureRect,
|
|
|
|
t.mFrameID, t.mProducerID));
|
2015-07-03 13:37:03 +03:00
|
|
|
if ((t.mTextureClient->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD)
|
|
|
|
&& t.mTextureClient->HasInternalBuffer()) {
|
|
|
|
|
|
|
|
// We use IMMEDIATE_UPLOAD when we want to be sure that the upload cannot
|
|
|
|
// race with updates on the main thread. In this case we want the transaction
|
|
|
|
// to be synchronous.
|
|
|
|
mTxn->MarkSyncTransaction();
|
|
|
|
}
|
|
|
|
}
|
2013-07-30 13:59:51 +04:00
|
|
|
mTxn->AddEdit(OpUseTexture(nullptr, aCompositable->GetIPDLActor(),
|
2015-05-04 13:59:02 +03:00
|
|
|
textures));
|
2013-12-11 22:05:11 +04:00
|
|
|
}
|
|
|
|
|
2014-02-06 15:28:29 +04:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::UseComponentAlphaTextures(CompositableClient* aCompositable,
|
|
|
|
TextureClient* aTextureOnBlack,
|
|
|
|
TextureClient* aTextureOnWhite)
|
|
|
|
{
|
2014-04-11 20:47:56 +04:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aTextureOnWhite);
|
|
|
|
MOZ_ASSERT(aTextureOnBlack);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
|
|
|
MOZ_ASSERT(aTextureOnBlack->GetIPDLActor());
|
|
|
|
MOZ_ASSERT(aTextureOnWhite->GetIPDLActor());
|
2014-03-21 21:03:20 +04:00
|
|
|
MOZ_ASSERT(aTextureOnBlack->GetSize() == aTextureOnWhite->GetSize());
|
2014-02-06 15:28:29 +04:00
|
|
|
mTxn->AddEdit(OpUseComponentAlphaTextures(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
nullptr, aTextureOnBlack->GetIPDLActor(),
|
|
|
|
nullptr, aTextureOnWhite->GetIPDLActor()));
|
|
|
|
}
|
|
|
|
|
2014-08-19 06:14:00 +04:00
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::UseOverlaySource(CompositableClient* aCompositable,
|
2015-07-04 01:52:42 +03:00
|
|
|
const OverlaySource& aOverlay,
|
|
|
|
const nsIntRect& aPictureRect)
|
2014-08-19 06:14:00 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(aCompositable);
|
2015-07-04 01:52:42 +03:00
|
|
|
mTxn->AddEdit(OpUseOverlaySource(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aOverlay, aPictureRect));
|
2014-08-19 06:14:00 +04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-02-11 00:52:35 +04:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::RemoveTextureFromCompositable(CompositableClient* aCompositable,
|
|
|
|
TextureClient* aTexture)
|
|
|
|
{
|
2014-04-11 20:47:56 +04:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aTexture);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
|
|
|
MOZ_ASSERT(aTexture->GetIPDLActor());
|
2014-02-11 00:52:35 +04:00
|
|
|
mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
nullptr, aTexture->GetIPDLActor()));
|
2014-04-26 06:34:05 +04:00
|
|
|
if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
|
2014-02-11 00:52:35 +04:00
|
|
|
mTxn->MarkSyncTransaction();
|
|
|
|
}
|
|
|
|
// Hold texture until transaction complete.
|
|
|
|
HoldUntilTransaction(aTexture);
|
|
|
|
}
|
|
|
|
|
2014-05-24 20:14:45 +04:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::RemoveTextureFromCompositableAsync(AsyncTransactionTracker* aAsyncTransactionTracker,
|
|
|
|
CompositableClient* aCompositable,
|
|
|
|
TextureClient* aTexture)
|
|
|
|
{
|
2015-10-28 14:04:28 +03:00
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
mPendingAsyncMessages.push_back(OpRemoveTextureAsync(CompositableClient::GetTrackersHolderId(aCompositable->GetIPDLActor()),
|
|
|
|
aAsyncTransactionTracker->GetId(),
|
|
|
|
nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
nullptr, aTexture->GetIPDLActor()));
|
|
|
|
#else
|
2015-06-02 17:31:05 +03:00
|
|
|
if (mTxn->Opened() && !aCompositable->IsDestroyed()) {
|
2014-10-07 22:37:15 +04:00
|
|
|
mTxn->AddEdit(OpRemoveTextureAsync(CompositableClient::GetTrackersHolderId(aCompositable->GetIPDLActor()),
|
|
|
|
aAsyncTransactionTracker->GetId(),
|
|
|
|
nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
nullptr, aTexture->GetIPDLActor()));
|
|
|
|
} else {
|
2015-03-03 00:38:45 +03:00
|
|
|
NS_RUNTIMEABORT("not reached");
|
2014-10-07 22:37:15 +04:00
|
|
|
}
|
2015-10-28 14:04:28 +03:00
|
|
|
#endif
|
2014-05-24 20:14:45 +04:00
|
|
|
CompositableClient::HoldUntilComplete(aCompositable->GetIPDLActor(),
|
|
|
|
aAsyncTransactionTracker);
|
|
|
|
}
|
|
|
|
|
2014-07-31 10:44:31 +04:00
|
|
|
bool
|
|
|
|
ShadowLayerForwarder::InWorkerThread()
|
|
|
|
{
|
2014-10-13 03:23:20 +04:00
|
|
|
return MessageLoop::current() && (GetMessageLoop()->id() == MessageLoop::current()->id());
|
2014-07-31 10:44:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void RemoveTextureWorker(TextureClient* aTexture, ReentrantMonitor* aBarrier, bool* aDone)
|
|
|
|
{
|
|
|
|
aTexture->ForceRemove();
|
|
|
|
|
|
|
|
ReentrantMonitorAutoEnter autoMon(*aBarrier);
|
|
|
|
*aDone = true;
|
|
|
|
aBarrier->NotifyAll();
|
|
|
|
}
|
|
|
|
|
2013-12-12 05:44:45 +04:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::RemoveTexture(TextureClient* aTexture)
|
|
|
|
{
|
2014-04-11 20:47:56 +04:00
|
|
|
MOZ_ASSERT(aTexture);
|
2014-07-31 10:44:31 +04:00
|
|
|
if (InWorkerThread()) {
|
|
|
|
aTexture->ForceRemove();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReentrantMonitor barrier("ShadowLayerForwarder::RemoveTexture Lock");
|
|
|
|
ReentrantMonitorAutoEnter autoMon(barrier);
|
|
|
|
bool done = false;
|
|
|
|
|
|
|
|
GetMessageLoop()->PostTask(
|
|
|
|
FROM_HERE,
|
|
|
|
NewRunnableFunction(&RemoveTextureWorker, aTexture, &barrier, &done));
|
|
|
|
|
|
|
|
// Wait until the TextureClient has been ForceRemoved on the worker thread
|
|
|
|
while (!done) {
|
|
|
|
barrier.Wait();
|
|
|
|
}
|
2013-12-12 05:44:45 +04:00
|
|
|
}
|
|
|
|
|
2015-01-29 22:41:55 +03:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::StorePluginWidgetConfigurations(const nsTArray<nsIWidget::Configuration>&
|
|
|
|
aConfigurations)
|
|
|
|
{
|
|
|
|
// Cache new plugin widget configs here until we call update, at which
|
|
|
|
// point this data will get shipped over to chrome.
|
|
|
|
mPluginWindowData.Clear();
|
|
|
|
for (uint32_t idx = 0; idx < aConfigurations.Length(); idx++) {
|
|
|
|
const nsIWidget::Configuration& configuration = aConfigurations[idx];
|
|
|
|
mPluginWindowData.AppendElement(PluginWindowData(configuration.mWindowID,
|
|
|
|
configuration.mClipRegion,
|
|
|
|
configuration.mBounds,
|
|
|
|
configuration.mVisible));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2014-03-28 07:38:32 +04:00
|
|
|
ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
|
|
|
const nsIntRegion& aRegionToClear,
|
2014-05-29 01:42:14 +04:00
|
|
|
uint64_t aId,
|
2014-03-28 07:38:32 +04:00
|
|
|
bool aScheduleComposite,
|
2014-05-07 01:26:13 +04:00
|
|
|
uint32_t aPaintSequenceNumber,
|
2014-05-31 02:52:43 +04:00
|
|
|
bool aIsRepeatTransaction,
|
2014-08-28 23:24:26 +04:00
|
|
|
const mozilla::TimeStamp& aTransactionStart,
|
2014-03-28 07:38:32 +04:00
|
|
|
bool* aSent)
|
2010-07-22 01:17:33 +04:00
|
|
|
{
|
2013-10-22 00:14:47 +04:00
|
|
|
*aSent = false;
|
|
|
|
|
2014-05-29 01:42:14 +04:00
|
|
|
MOZ_ASSERT(aId);
|
|
|
|
|
2014-09-18 16:05:00 +04:00
|
|
|
PROFILER_LABEL("ShadowLayerForwarder", "EndTransaction",
|
2014-05-24 01:12:29 +04:00
|
|
|
js::ProfileEntry::Category::GRAPHICS);
|
|
|
|
|
2012-02-28 20:24:24 +04:00
|
|
|
RenderTraceScope rendertrace("Foward Transaction", "000091");
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(HasShadowManager(), "no manager to forward to");
|
|
|
|
MOZ_ASSERT(!mTxn->Finished(), "forgot BeginTransaction?");
|
2010-07-22 01:17:33 +04:00
|
|
|
|
2013-08-03 02:50:17 +04:00
|
|
|
DiagnosticTypes diagnostics = gfxPlatform::GetPlatform()->GetLayerDiagnosticTypes();
|
|
|
|
if (mDiagnosticTypes != diagnostics) {
|
|
|
|
mDiagnosticTypes = diagnostics;
|
|
|
|
mTxn->AddEdit(OpSetDiagnosticTypes(diagnostics));
|
2013-03-21 21:08:01 +04:00
|
|
|
}
|
|
|
|
|
2010-07-22 01:17:33 +04:00
|
|
|
AutoTxnEnd _(mTxn);
|
|
|
|
|
2013-06-20 17:01:20 +04:00
|
|
|
if (mTxn->Empty() && !mTxn->RotationChanged() && !mWindowOverlayChanged) {
|
2012-11-06 13:11:43 +04:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] 0-length cset (?) and no rotation event, skipping Update()"));
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
|
|
|
|
2015-05-04 13:35:18 +03:00
|
|
|
if (!mTxn->mPaints.empty()) {
|
|
|
|
// With some platforms, telling the drawing backend that there will be no more
|
|
|
|
// drawing for this frame helps with preventing command queues from spanning
|
|
|
|
// across multiple frames.
|
|
|
|
gfxPlatform::GetPlatform()->FlushContentDrawing();
|
|
|
|
}
|
|
|
|
|
2010-09-14 09:23:08 +04:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] destroying buffers..."));
|
|
|
|
|
2010-09-14 09:23:08 +04:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] building transaction..."));
|
2010-07-22 01:17:33 +04:00
|
|
|
|
2010-09-16 01:03:13 +04:00
|
|
|
// We purposely add attribute-change ops to the final changeset
|
|
|
|
// before we add paint ops. This allows layers to record the
|
|
|
|
// attribute changes before new pixels arrive, which can be useful
|
|
|
|
// for setting up back/front buffers.
|
2012-02-28 20:24:24 +04:00
|
|
|
RenderTraceScope rendertrace2("Foward Transaction", "000092");
|
2010-07-22 01:17:33 +04:00
|
|
|
for (ShadowableLayerSet::const_iterator it = mTxn->mMutants.begin();
|
|
|
|
it != mTxn->mMutants.end(); ++it) {
|
|
|
|
ShadowableLayer* shadow = *it;
|
2014-07-30 17:38:47 +04:00
|
|
|
|
|
|
|
if (!shadow->HasShadow()) {
|
|
|
|
continue;
|
|
|
|
}
|
2010-07-22 01:17:33 +04:00
|
|
|
Layer* mutant = shadow->AsLayer();
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(!!mutant, "unshadowable layer?");
|
2010-07-22 01:17:33 +04:00
|
|
|
|
|
|
|
LayerAttributes attrs;
|
|
|
|
CommonLayerAttributes& common = attrs.common();
|
2014-09-16 00:09:52 +04:00
|
|
|
common.layerBounds() = mutant->GetLayerBounds();
|
2010-07-22 01:17:33 +04:00
|
|
|
common.visibleRegion() = mutant->GetVisibleRegion();
|
2013-12-16 14:47:06 +04:00
|
|
|
common.eventRegions() = mutant->GetEventRegions();
|
2012-08-04 01:29:22 +04:00
|
|
|
common.postXScale() = mutant->GetPostXScale();
|
|
|
|
common.postYScale() = mutant->GetPostYScale();
|
2012-07-31 06:20:00 +04:00
|
|
|
common.transform() = mutant->GetBaseTransform();
|
2010-09-02 13:18:40 +04:00
|
|
|
common.contentFlags() = mutant->GetContentFlags();
|
2010-07-22 01:17:33 +04:00
|
|
|
common.opacity() = mutant->GetOpacity();
|
|
|
|
common.useClipRect() = !!mutant->GetClipRect();
|
|
|
|
common.clipRect() = (common.useClipRect() ?
|
2015-04-12 05:03:00 +03:00
|
|
|
*mutant->GetClipRect() : ParentLayerIntRect());
|
2011-04-06 09:00:25 +04:00
|
|
|
common.isFixedPosition() = mutant->GetIsFixedPosition();
|
2015-08-18 02:44:42 +03:00
|
|
|
if (mutant->GetIsFixedPosition()) {
|
|
|
|
common.fixedPositionScrollContainerId() = mutant->GetFixedPositionScrollContainerId();
|
|
|
|
common.fixedPositionAnchor() = mutant->GetFixedPositionAnchor();
|
2015-09-05 00:26:33 +03:00
|
|
|
common.isClipFixed() = mutant->IsClipFixed();
|
2015-08-18 02:44:42 +03:00
|
|
|
}
|
2013-09-12 08:17:58 +04:00
|
|
|
common.isStickyPosition() = mutant->GetIsStickyPosition();
|
|
|
|
if (mutant->GetIsStickyPosition()) {
|
|
|
|
common.stickyScrollContainerId() = mutant->GetStickyScrollContainerId();
|
|
|
|
common.stickyScrollRangeOuter() = mutant->GetStickyScrollRangeOuter();
|
|
|
|
common.stickyScrollRangeInner() = mutant->GetStickyScrollRangeInner();
|
2014-11-13 12:15:25 +03:00
|
|
|
} else {
|
|
|
|
#ifdef MOZ_VALGRIND
|
|
|
|
// Initialize these so that Valgrind doesn't complain when we send them
|
|
|
|
// to another process.
|
|
|
|
common.stickyScrollContainerId() = 0;
|
|
|
|
common.stickyScrollRangeOuter() = LayerRect();
|
|
|
|
common.stickyScrollRangeInner() = LayerRect();
|
|
|
|
#endif
|
2013-09-12 08:17:58 +04:00
|
|
|
}
|
2013-12-12 22:34:50 +04:00
|
|
|
common.scrollbarTargetContainerId() = mutant->GetScrollbarTargetContainerId();
|
|
|
|
common.scrollbarDirection() = mutant->GetScrollbarDirection();
|
2015-04-13 06:03:02 +03:00
|
|
|
common.scrollbarThumbRatio() = mutant->GetScrollbarThumbRatio();
|
2014-05-09 13:41:56 +04:00
|
|
|
common.mixBlendMode() = (int8_t)mutant->GetMixBlendMode();
|
|
|
|
common.forceIsolatedGroup() = mutant->GetForceIsolatedGroup();
|
2012-03-19 03:02:38 +04:00
|
|
|
if (Layer* maskLayer = mutant->GetMaskLayer()) {
|
|
|
|
common.maskLayerChild() = Shadow(maskLayer->AsShadowableLayer());
|
|
|
|
} else {
|
2013-07-20 12:48:55 +04:00
|
|
|
common.maskLayerChild() = nullptr;
|
2012-03-19 03:02:38 +04:00
|
|
|
}
|
2013-07-20 12:48:55 +04:00
|
|
|
common.maskLayerParent() = nullptr;
|
2012-07-31 21:28:20 +04:00
|
|
|
common.animations() = mutant->GetAnimations();
|
2013-11-21 23:25:16 +04:00
|
|
|
common.invalidRegion() = mutant->GetInvalidRegion();
|
2014-08-28 06:13:40 +04:00
|
|
|
common.metrics() = mutant->GetAllFrameMetrics();
|
2015-06-21 19:27:31 +03:00
|
|
|
for (size_t i = 0; i < mutant->GetAncestorMaskLayerCount(); i++) {
|
|
|
|
auto layer = Shadow(mutant->GetAncestorMaskLayerAt(i)->AsShadowableLayer());
|
|
|
|
common.ancestorMaskLayersChild().AppendElement(layer);
|
|
|
|
}
|
2015-08-03 09:11:00 +03:00
|
|
|
nsCString log;
|
|
|
|
mutant->GetDisplayListLog(log);
|
|
|
|
common.displayListLog() = log;
|
|
|
|
|
2010-07-22 01:17:33 +04:00
|
|
|
attrs.specific() = null_t();
|
|
|
|
mutant->FillSpecificAttributes(attrs.specific());
|
|
|
|
|
2013-03-22 06:17:28 +04:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] OpSetLayerAttributes(%p)\n", mutant));
|
|
|
|
|
2013-07-20 12:48:55 +04:00
|
|
|
mTxn->AddEdit(OpSetLayerAttributes(nullptr, Shadow(shadow), attrs));
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
|
|
|
|
2010-11-09 05:49:00 +03:00
|
|
|
AutoInfallibleTArray<Edit, 10> cset;
|
2010-09-16 01:03:13 +04:00
|
|
|
size_t nCsets = mTxn->mCset.size() + mTxn->mPaints.size();
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(nCsets > 0 || mWindowOverlayChanged || mTxn->RotationChanged(), "should have bailed by now");
|
2010-09-16 01:03:13 +04:00
|
|
|
|
|
|
|
cset.SetCapacity(nCsets);
|
2010-09-20 23:40:30 +04:00
|
|
|
if (!mTxn->mCset.empty()) {
|
|
|
|
cset.AppendElements(&mTxn->mCset.front(), mTxn->mCset.size());
|
|
|
|
}
|
2010-09-16 01:03:13 +04:00
|
|
|
// Paints after non-paint ops, including attribute changes. See
|
|
|
|
// above.
|
2010-09-20 23:40:30 +04:00
|
|
|
if (!mTxn->mPaints.empty()) {
|
|
|
|
cset.AppendElements(&mTxn->mPaints.front(), mTxn->mPaints.size());
|
|
|
|
}
|
2010-07-22 01:17:33 +04:00
|
|
|
|
2013-06-20 17:01:20 +04:00
|
|
|
mWindowOverlayChanged = false;
|
|
|
|
|
2014-03-28 07:38:32 +04:00
|
|
|
TargetConfig targetConfig(mTxn->mTargetBounds,
|
|
|
|
mTxn->mTargetRotation,
|
|
|
|
mTxn->mTargetOrientation,
|
|
|
|
aRegionToClear);
|
2012-07-24 23:01:09 +04:00
|
|
|
|
2014-06-11 17:52:20 +04:00
|
|
|
if (!IsSameProcess()) {
|
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send..."));
|
|
|
|
PlatformSyncBeforeUpdate();
|
|
|
|
}
|
2010-09-14 09:23:08 +04:00
|
|
|
|
2013-09-27 20:08:45 +04:00
|
|
|
profiler_tracing("Paint", "Rasterize", TRACING_INTERVAL_END);
|
2012-05-01 23:23:39 +04:00
|
|
|
if (mTxn->mSwapRequired) {
|
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction..."));
|
|
|
|
RenderTraceScope rendertrace3("Forward Transaction", "000093");
|
2013-11-01 10:36:02 +04:00
|
|
|
if (!HasShadowManager() ||
|
2014-04-16 05:59:09 +04:00
|
|
|
!mShadowManager->IPCOpen() ||
|
2015-01-29 22:41:55 +03:00
|
|
|
!mShadowManager->SendUpdate(cset, aId, targetConfig, mPluginWindowData,
|
|
|
|
mIsFirstPaint, aScheduleComposite,
|
|
|
|
aPaintSequenceNumber, aIsRepeatTransaction,
|
2015-08-18 21:27:20 +03:00
|
|
|
aTransactionStart, mPaintSyncId, aReplies)) {
|
2012-05-01 23:23:39 +04:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// If we don't require a swap we can call SendUpdateNoSwap which
|
|
|
|
// assumes that aReplies is empty (DEBUG assertion)
|
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] sending no swap transaction..."));
|
|
|
|
RenderTraceScope rendertrace3("Forward NoSwap Transaction", "000093");
|
2013-11-01 10:36:02 +04:00
|
|
|
if (!HasShadowManager() ||
|
2014-04-16 05:59:09 +04:00
|
|
|
!mShadowManager->IPCOpen() ||
|
2015-01-29 22:41:55 +03:00
|
|
|
!mShadowManager->SendUpdateNoSwap(cset, aId, targetConfig, mPluginWindowData,
|
|
|
|
mIsFirstPaint, aScheduleComposite,
|
|
|
|
aPaintSequenceNumber, aIsRepeatTransaction,
|
2015-08-18 21:27:20 +03:00
|
|
|
aTransactionStart, mPaintSyncId)) {
|
2012-05-01 23:23:39 +04:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
|
|
|
|
return false;
|
|
|
|
}
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
|
|
|
|
2013-10-22 00:14:47 +04:00
|
|
|
*aSent = true;
|
2012-03-12 19:50:15 +04:00
|
|
|
mIsFirstPaint = false;
|
2015-08-18 21:27:20 +03:00
|
|
|
mPaintSyncId = 0;
|
2010-07-22 01:17:33 +04:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] ... done"));
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
ShadowLayerForwarder::AllocShmem(size_t aSize,
|
|
|
|
ipc::SharedMemory::SharedMemoryType aType,
|
|
|
|
ipc::Shmem* aShmem)
|
2010-07-22 01:17:33 +04:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(HasShadowManager(), "no shadow manager");
|
2014-05-06 05:56:40 +04:00
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
2014-04-16 05:59:09 +04:00
|
|
|
return false;
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
return mShadowManager->AllocShmem(aSize, aType, aShmem);
|
2010-07-22 01:17:33 +04:00
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
ShadowLayerForwarder::AllocUnsafeShmem(size_t aSize,
|
|
|
|
ipc::SharedMemory::SharedMemoryType aType,
|
|
|
|
ipc::Shmem* aShmem)
|
2012-07-12 16:51:57 +04:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(HasShadowManager(), "no shadow manager");
|
2014-05-06 05:56:40 +04:00
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
2014-04-16 05:59:09 +04:00
|
|
|
return false;
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
return mShadowManager->AllocUnsafeShmem(aSize, aType, aShmem);
|
2012-07-12 16:51:57 +04:00
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::DeallocShmem(ipc::Shmem& aShmem)
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(HasShadowManager(), "no shadow manager");
|
2014-05-06 05:56:40 +04:00
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
2014-04-16 05:59:09 +04:00
|
|
|
return;
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
mShadowManager->DeallocShmem(aShmem);
|
2010-12-31 10:40:31 +03:00
|
|
|
}
|
|
|
|
|
2013-11-27 19:18:38 +04:00
|
|
|
bool
|
|
|
|
ShadowLayerForwarder::IPCOpen() const
|
|
|
|
{
|
2014-11-19 23:22:03 +03:00
|
|
|
return HasShadowManager() && mShadowManager->IPCOpen();
|
2013-11-27 19:18:38 +04:00
|
|
|
}
|
|
|
|
|
2014-02-25 17:12:49 +04:00
|
|
|
bool
|
|
|
|
ShadowLayerForwarder::IsSameProcess() const
|
|
|
|
{
|
2014-11-19 23:22:03 +03:00
|
|
|
if (!HasShadowManager() || !mShadowManager->IPCOpen()) {
|
2014-04-16 05:59:09 +04:00
|
|
|
return false;
|
|
|
|
}
|
2015-04-01 15:59:20 +03:00
|
|
|
return mShadowManager->OtherPid() == base::GetCurrentProcId();
|
2014-02-25 17:12:49 +04:00
|
|
|
}
|
|
|
|
|
2015-05-22 18:54:24 +03:00
|
|
|
base::ProcessId
|
|
|
|
ShadowLayerForwarder::ParentPid() const
|
|
|
|
{
|
|
|
|
if (!HasShadowManager() || !mShadowManager->IPCOpen()) {
|
|
|
|
return base::ProcessId();
|
|
|
|
}
|
|
|
|
|
|
|
|
return mShadowManager->OtherPid();
|
|
|
|
}
|
|
|
|
|
2013-11-01 10:36:02 +04:00
|
|
|
/**
|
|
|
|
* We bail out when we have no shadow manager. That can happen when the
|
|
|
|
* layer manager is created by the preallocated process.
|
|
|
|
* See bug 914843 for details.
|
|
|
|
*/
|
2010-07-22 01:17:33 +04:00
|
|
|
PLayerChild*
|
|
|
|
ShadowLayerForwarder::ConstructShadowFor(ShadowableLayer* aLayer)
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(HasShadowManager(), "no manager to forward to");
|
2014-05-06 05:56:40 +04:00
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
2014-04-16 05:59:09 +04:00
|
|
|
return nullptr;
|
|
|
|
}
|
2010-07-22 01:17:33 +04:00
|
|
|
return mShadowManager->SendPLayerConstructor(new ShadowLayerChild(aLayer));
|
|
|
|
}
|
|
|
|
|
2010-09-14 09:23:08 +04:00
|
|
|
#if !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
|
|
|
|
|
|
|
|
/*static*/ void
|
|
|
|
ShadowLayerForwarder::PlatformSyncBeforeUpdate()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
void
|
2015-07-06 06:02:26 +03:00
|
|
|
ShadowLayerForwarder::Connect(CompositableClient* aCompositable,
|
|
|
|
ImageContainer* aImageContainer)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
{
|
|
|
|
#ifdef GFX_COMPOSITOR_LOGGING
|
|
|
|
printf("ShadowLayerForwarder::Connect(Compositable)\n");
|
|
|
|
#endif
|
|
|
|
MOZ_ASSERT(aCompositable);
|
2013-11-01 10:36:02 +04:00
|
|
|
MOZ_ASSERT(mShadowManager);
|
2014-05-06 05:56:40 +04:00
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
2014-04-16 05:59:09 +04:00
|
|
|
return;
|
|
|
|
}
|
2014-04-24 22:13:59 +04:00
|
|
|
PCompositableChild* actor =
|
|
|
|
mShadowManager->SendPCompositableConstructor(aCompositable->GetTextureInfo());
|
|
|
|
MOZ_ASSERT(actor);
|
|
|
|
aCompositable->InitIPDLActor(actor);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ShadowLayerForwarder::Attach(CompositableClient* aCompositable,
|
|
|
|
ShadowableLayer* aLayer)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aLayer);
|
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
|
|
|
mTxn->AddEdit(OpAttachCompositable(nullptr, Shadow(aLayer),
|
|
|
|
nullptr, aCompositable->GetIPDLActor()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void ShadowLayerForwarder::AttachAsyncCompositable(uint64_t aCompositableID,
|
|
|
|
ShadowableLayer* aLayer)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aLayer);
|
|
|
|
MOZ_ASSERT(aCompositableID != 0); // zero is always an invalid compositable id.
|
|
|
|
mTxn->AddEdit(OpAttachAsyncCompositable(nullptr, Shadow(aLayer),
|
|
|
|
aCompositableID));
|
|
|
|
}
|
2012-07-12 16:51:58 +04:00
|
|
|
|
2013-12-12 05:44:44 +04:00
|
|
|
PTextureChild*
|
2014-01-22 02:06:18 +04:00
|
|
|
ShadowLayerForwarder::CreateTexture(const SurfaceDescriptor& aSharedData,
|
2015-10-06 09:39:00 +03:00
|
|
|
LayersBackend aLayersBackend,
|
2014-01-22 02:06:18 +04:00
|
|
|
TextureFlags aFlags)
|
2013-12-12 05:44:44 +04:00
|
|
|
{
|
2014-05-06 05:56:40 +04:00
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
2014-04-16 05:59:09 +04:00
|
|
|
return nullptr;
|
|
|
|
}
|
2015-10-06 09:39:00 +03:00
|
|
|
return mShadowManager->SendPTextureConstructor(aSharedData, aLayersBackend, aFlags);
|
2013-12-12 05:44:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-27 19:19:34 +04:00
|
|
|
void ShadowLayerForwarder::SetShadowManager(PLayerTransactionChild* aShadowManager)
|
|
|
|
{
|
|
|
|
mShadowManager = static_cast<LayerTransactionChild*>(aShadowManager);
|
2014-05-06 05:56:40 +04:00
|
|
|
mShadowManager->SetForwarder(this);
|
2013-11-27 19:19:34 +04:00
|
|
|
}
|
|
|
|
|
2014-05-06 05:56:40 +04:00
|
|
|
void ShadowLayerForwarder::StopReceiveAsyncParentMessge()
|
|
|
|
{
|
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
|
|
|
return;
|
|
|
|
}
|
2014-10-07 22:37:15 +04:00
|
|
|
SendPendingAsyncMessges();
|
2014-05-06 05:56:40 +04:00
|
|
|
mShadowManager->SetForwarder(nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ShadowLayerForwarder::ClearCachedResources()
|
|
|
|
{
|
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
|
|
|
return;
|
|
|
|
}
|
2014-10-07 22:37:15 +04:00
|
|
|
SendPendingAsyncMessges();
|
2014-05-06 05:56:40 +04:00
|
|
|
mShadowManager->SendClearCachedResources();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ShadowLayerForwarder::Composite()
|
|
|
|
{
|
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mShadowManager->SendForceComposite();
|
|
|
|
}
|
|
|
|
|
2014-10-07 22:37:15 +04:00
|
|
|
void ShadowLayerForwarder::SendPendingAsyncMessges()
|
2014-05-06 05:56:40 +04:00
|
|
|
{
|
|
|
|
if (!HasShadowManager() ||
|
2014-10-07 22:37:15 +04:00
|
|
|
!mShadowManager->IPCOpen()) {
|
|
|
|
mPendingAsyncMessages.clear();
|
2014-05-06 05:56:40 +04:00
|
|
|
return;
|
|
|
|
}
|
2014-10-07 22:37:15 +04:00
|
|
|
|
2015-04-10 03:19:00 +03:00
|
|
|
if (mPendingAsyncMessages.empty()) {
|
2014-10-07 22:37:15 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-05-06 05:56:40 +04:00
|
|
|
InfallibleTArray<AsyncChildMessageData> replies;
|
2014-10-07 22:37:15 +04:00
|
|
|
// Prepare pending messages.
|
|
|
|
for (size_t i = 0; i < mPendingAsyncMessages.size(); i++) {
|
|
|
|
replies.AppendElement(mPendingAsyncMessages[i]);
|
|
|
|
}
|
|
|
|
mPendingAsyncMessages.clear();
|
2014-05-06 05:56:40 +04:00
|
|
|
mShadowManager->SendChildAsyncMessages(replies);
|
|
|
|
}
|
2013-11-27 19:19:34 +04:00
|
|
|
|
2010-07-22 01:17:33 +04:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|