2010-07-21 14:17:33 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 04:12:37 -07: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-21 14:17:33 -07:00
|
|
|
|
|
|
|
#include "ShadowLayers.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include <set> // for _Rb_tree_const_iterator, etc
|
|
|
|
#include <vector> // for vector
|
|
|
|
#include "AutoOpenSurface.h" // for AutoOpenSurface, etc
|
2013-08-22 00:11:51 -07:00
|
|
|
#include "GeckoProfiler.h" // for PROFILER_LABEL
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "ISurfaceAllocator.h" // for IsSurfaceDescriptorValid
|
|
|
|
#include "Layers.h" // for Layer
|
|
|
|
#include "RenderTrace.h" // for RenderTraceScope
|
|
|
|
#include "ShadowLayerChild.h" // for ShadowLayerChild
|
|
|
|
#include "gfxImageSurface.h" // for gfxImageSurface
|
|
|
|
#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
|
|
|
|
#include "mozilla/layers/CompositableClient.h" // for CompositableClient, etc
|
2013-09-06 08:41:00 -07:00
|
|
|
#include "mozilla/layers/LayersMessages.h" // for Edit, etc
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
|
|
|
|
#include "mozilla/layers/LayersTypes.h" // for MOZ_LAYERS_LOG
|
|
|
|
#include "mozilla/layers/PLayerTransactionChild.h"
|
|
|
|
#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 "nsDebug.h" // for NS_ABORT_IF_FALSE, etc
|
|
|
|
#include "nsRect.h" // for nsIntRect
|
|
|
|
#include "nsSize.h" // for nsIntSize
|
|
|
|
#include "nsTArray.h" // for nsAutoTArray, nsTArray, etc
|
|
|
|
#include "nsXULAppAPI.h" // for XRE_GetProcessType, etc
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
struct nsIntPoint;
|
2013-05-27 07:12:13 -07:00
|
|
|
|
2010-09-27 17:59:43 -07:00
|
|
|
using namespace mozilla::ipc;
|
2012-10-25 13:12:59 -07:00
|
|
|
using namespace mozilla::gl;
|
2012-11-21 18:40:57 -08:00
|
|
|
using namespace mozilla::dom;
|
2010-09-27 17:59:43 -07:00
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
namespace mozilla {
|
2013-08-11 16:17:23 -07:00
|
|
|
namespace ipc {
|
|
|
|
class Shmem;
|
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
class BasicTiledLayerBuffer;
|
|
|
|
|
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 02:20:52 -07:00
|
|
|
typedef nsTArray<SurfaceDescriptor> BufferArray;
|
2010-07-21 14:17:33 -07:00
|
|
|
typedef std::vector<Edit> EditVector;
|
|
|
|
typedef std::set<ShadowableLayer*> ShadowableLayerSet;
|
|
|
|
|
|
|
|
class Transaction
|
|
|
|
{
|
|
|
|
public:
|
2012-05-01 12:23:39 -07:00
|
|
|
Transaction()
|
2013-02-25 21:18:20 -08:00
|
|
|
: mTargetRotation(ROTATION_0)
|
|
|
|
, mSwapRequired(false)
|
2012-05-18 01:29:38 -07:00
|
|
|
, mOpen(false)
|
2012-11-06 01:11:43 -08:00
|
|
|
, mRotationChanged(false)
|
2012-05-01 12:23:39 -07:00
|
|
|
{}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2012-11-21 18:40:57 -08:00
|
|
|
void Begin(const nsIntRect& aTargetBounds, ScreenRotation aRotation,
|
|
|
|
const nsIntRect& aClientBounds, ScreenOrientation aOrientation)
|
2012-07-24 12:01:09 -07:00
|
|
|
{
|
|
|
|
mOpen = true;
|
|
|
|
mTargetBounds = aTargetBounds;
|
2012-11-06 01:11:43 -08:00
|
|
|
if (aRotation != mTargetRotation) {
|
2013-02-25 21:18:20 -08: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 01:11:43 -08:00
|
|
|
}
|
2012-07-24 12:01:09 -07:00
|
|
|
mTargetRotation = aRotation;
|
2012-11-21 18:40:57 -08:00
|
|
|
mClientBounds = aClientBounds;
|
|
|
|
mTargetOrientation = aOrientation;
|
2012-07-24 12:01:09 -07:00
|
|
|
}
|
2013-09-12 07:50:28 -07:00
|
|
|
void MarkSyncTransaction()
|
|
|
|
{
|
|
|
|
mSwapRequired = true;
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
void AddEdit(const Edit& aEdit)
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
|
|
|
|
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 02:20:52 -07:00
|
|
|
void AddEdit(const CompositableOperation& aEdit)
|
|
|
|
{
|
|
|
|
AddEdit(Edit(aEdit));
|
|
|
|
}
|
2010-09-15 14:03:13 -07:00
|
|
|
void AddPaint(const Edit& aPaint)
|
2012-05-01 12:23:39 -07: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 02:20:52 -07:00
|
|
|
void AddPaint(const CompositableOperation& aPaint)
|
|
|
|
{
|
|
|
|
AddNoSwapPaint(Edit(aPaint));
|
|
|
|
mSwapRequired = true;
|
|
|
|
}
|
|
|
|
|
2012-05-01 12:23:39 -07:00
|
|
|
void AddNoSwapPaint(const Edit& aPaint)
|
2010-09-15 14:03:13 -07:00
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
|
|
|
|
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 02:20:52 -07:00
|
|
|
void AddNoSwapPaint(const CompositableOperation& aPaint)
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
|
|
|
|
mPaints.push_back(Edit(aPaint));
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
void AddMutant(ShadowableLayer* aLayer)
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
|
|
|
|
mMutants.insert(aLayer);
|
|
|
|
}
|
2010-09-13 22:23:08 -07:00
|
|
|
void AddBufferToDestroy(gfxSharedImageSurface* aBuffer)
|
2010-09-13 22:23:08 -07:00
|
|
|
{
|
|
|
|
return AddBufferToDestroy(aBuffer->GetShmem());
|
|
|
|
}
|
|
|
|
void AddBufferToDestroy(const SurfaceDescriptor& aBuffer)
|
2010-09-13 22:23:08 -07:00
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
|
|
|
|
mDyingBuffers.AppendElement(aBuffer);
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
void End()
|
|
|
|
{
|
|
|
|
mCset.clear();
|
2010-09-15 14:03:13 -07:00
|
|
|
mPaints.clear();
|
2010-09-13 22:23:08 -07:00
|
|
|
mDyingBuffers.Clear();
|
2010-07-21 14:17:33 -07:00
|
|
|
mMutants.clear();
|
2011-10-17 07:59:28 -07:00
|
|
|
mOpen = false;
|
2012-05-01 12:23:39 -07:00
|
|
|
mSwapRequired = false;
|
2012-11-06 01:11:43 -08:00
|
|
|
mRotationChanged = false;
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool Empty() const {
|
2010-09-15 14:03:13 -07:00
|
|
|
return mCset.empty() && mPaints.empty() && mMutants.empty();
|
|
|
|
}
|
2012-11-06 01:11:43 -08:00
|
|
|
bool RotationChanged() const {
|
|
|
|
return mRotationChanged;
|
|
|
|
}
|
2011-09-28 23:19:26 -07:00
|
|
|
bool Finished() const { return !mOpen && Empty(); }
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
EditVector mCset;
|
2010-09-15 14:03:13 -07:00
|
|
|
EditVector mPaints;
|
2010-09-13 22:23:08 -07:00
|
|
|
BufferArray mDyingBuffers;
|
2010-07-21 14:17:33 -07:00
|
|
|
ShadowableLayerSet mMutants;
|
2012-07-24 12:01:09 -07:00
|
|
|
nsIntRect mTargetBounds;
|
|
|
|
ScreenRotation mTargetRotation;
|
2012-11-21 18:40:57 -08:00
|
|
|
nsIntRect mClientBounds;
|
|
|
|
ScreenOrientation mTargetOrientation;
|
2012-05-01 12:23:39 -07:00
|
|
|
bool mSwapRequired;
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
private:
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mOpen;
|
2012-11-06 01:11:43 -08:00
|
|
|
bool mRotationChanged;
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
// disabled
|
|
|
|
Transaction(const Transaction&);
|
|
|
|
Transaction& operator=(const Transaction&);
|
|
|
|
};
|
|
|
|
struct AutoTxnEnd {
|
|
|
|
AutoTxnEnd(Transaction* aTxn) : mTxn(aTxn) {}
|
|
|
|
~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 02:20:52 -07:00
|
|
|
void
|
|
|
|
CompositableForwarder::IdentifyTextureHost(const TextureFactoryIdentifier& aIdentifier)
|
|
|
|
{
|
2013-07-11 19:32:09 -07:00
|
|
|
mTextureFactoryIdentifier = aIdentifier;
|
2013-08-04 00:46:17 -07:00
|
|
|
mMultiProcess = aIdentifier.mParentProcessId != XRE_GetProcessType();
|
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 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
2010-12-30 23:40:19 -08:00
|
|
|
ShadowLayerForwarder::ShadowLayerForwarder()
|
2013-07-20 01:48:55 -07:00
|
|
|
: mShadowManager(nullptr)
|
2013-08-02 15:50:17 -07:00
|
|
|
, mDiagnosticTypes(DIAGNOSTIC_NONE)
|
2012-03-12 08:50:15 -07:00
|
|
|
, mIsFirstPaint(false)
|
2013-06-20 06:01:20 -07:00
|
|
|
, mWindowOverlayChanged(false)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
|
|
|
mTxn = new Transaction();
|
|
|
|
}
|
|
|
|
|
|
|
|
ShadowLayerForwarder::~ShadowLayerForwarder()
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(mTxn->Finished(), "unfinished transaction?");
|
|
|
|
delete mTxn;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-07-24 12:01:09 -07:00
|
|
|
ShadowLayerForwarder::BeginTransaction(const nsIntRect& aTargetBounds,
|
2012-11-21 18:40:57 -08:00
|
|
|
ScreenRotation aRotation,
|
|
|
|
const nsIntRect& aClientBounds,
|
|
|
|
ScreenOrientation aOrientation)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
|
|
|
|
NS_ABORT_IF_FALSE(mTxn->Finished(), "uncommitted txn?");
|
2012-11-21 18:40:57 -08:00
|
|
|
mTxn->Begin(aTargetBounds, aRotation, aClientBounds, aOrientation);
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static PLayerChild*
|
|
|
|
Shadow(ShadowableLayer* aLayer)
|
|
|
|
{
|
|
|
|
return aLayer->GetShadow();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename OpCreateT>
|
|
|
|
static void
|
|
|
|
CreatedLayer(Transaction* aTxn, ShadowableLayer* aLayer)
|
|
|
|
{
|
2013-07-20 01:48:55 -07:00
|
|
|
aTxn->AddEdit(OpCreateT(nullptr, Shadow(aLayer)));
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedThebesLayer(ShadowableLayer* aThebes)
|
|
|
|
{
|
|
|
|
CreatedLayer<OpCreateThebesLayer>(mTxn, aThebes);
|
|
|
|
}
|
|
|
|
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-17 16:59:45 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedRefLayer(ShadowableLayer* aRef)
|
|
|
|
{
|
|
|
|
CreatedLayer<OpCreateRefLayer>(mTxn, aRef);
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2011-10-10 16:43:56 -07: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 02:20:52 -07:00
|
|
|
ShadowLayerForwarder::DestroyedThebesBuffer(const SurfaceDescriptor& aBackBufferToDestroy)
|
2011-10-10 16:43:56 -07:00
|
|
|
{
|
|
|
|
mTxn->AddBufferToDestroy(aBackBufferToDestroy);
|
|
|
|
}
|
|
|
|
|
2010-09-02 20:05:01 -07:00
|
|
|
void
|
2010-07-21 14:17:33 -07: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 02:20:52 -07:00
|
|
|
mTxn->AddMutant(aMutant);
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::SetRoot(ShadowableLayer* aRoot)
|
|
|
|
{
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddEdit(OpSetRoot(nullptr, Shadow(aRoot)));
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::InsertAfter(ShadowableLayer* aContainer,
|
|
|
|
ShadowableLayer* aChild,
|
|
|
|
ShadowableLayer* aAfter)
|
|
|
|
{
|
|
|
|
if (aAfter)
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddEdit(OpInsertAfter(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild),
|
|
|
|
nullptr, Shadow(aAfter)));
|
2010-07-21 14:17:33 -07:00
|
|
|
else
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddEdit(OpAppendChild(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild)));
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::RemoveChild(ShadowableLayer* aContainer,
|
|
|
|
ShadowableLayer* aChild)
|
|
|
|
{
|
2013-03-21 19:17:28 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] OpRemoveChild container=%p child=%p\n",
|
|
|
|
aContainer->AsLayer(), aChild->AsLayer()));
|
|
|
|
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddEdit(OpRemoveChild(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild)));
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
2012-08-29 03:52:55 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::RepositionChild(ShadowableLayer* aContainer,
|
|
|
|
ShadowableLayer* aChild,
|
|
|
|
ShadowableLayer* aAfter)
|
|
|
|
{
|
2013-03-21 19:17:28 -07:00
|
|
|
if (aAfter) {
|
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] OpRepositionChild container=%p child=%p after=%p",
|
|
|
|
aContainer->AsLayer(), aChild->AsLayer(), aAfter->AsLayer()));
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddEdit(OpRepositionChild(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild),
|
|
|
|
nullptr, Shadow(aAfter)));
|
2013-03-21 19:17:28 -07:00
|
|
|
} else {
|
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] OpRaiseToTopChild container=%p child=%p",
|
|
|
|
aContainer->AsLayer(), aChild->AsLayer()));
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddEdit(OpRaiseToTopChild(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild)));
|
2013-03-21 19:17:28 -07:00
|
|
|
}
|
2012-08-29 03:52:55 -07:00
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2012-04-13 08:17:39 -07:00
|
|
|
void
|
2013-04-16 14:36:06 -07:00
|
|
|
ShadowLayerForwarder::PaintedTiledLayerBuffer(CompositableClient* aCompositable,
|
2013-08-19 06:59:22 -07:00
|
|
|
const SurfaceDescriptorTiles& aTileLayerDescriptor)
|
2012-04-13 08:17:39 -07:00
|
|
|
{
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddNoSwapPaint(OpPaintTiledLayerBuffer(nullptr, aCompositable->GetIPDLActor(),
|
2013-08-19 06:59:22 -07:00
|
|
|
aTileLayerDescriptor));
|
2012-04-13 08:17:39 -07:00
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
void
|
2013-04-12 00:28:55 -07:00
|
|
|
ShadowLayerForwarder::UpdateTexture(CompositableClient* aCompositable,
|
|
|
|
TextureIdentifier aTextureId,
|
|
|
|
SurfaceDescriptor* aDescriptor)
|
|
|
|
{
|
|
|
|
if (aDescriptor->type() != SurfaceDescriptor::T__None &&
|
|
|
|
aDescriptor->type() != SurfaceDescriptor::Tnull_t) {
|
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
|
|
|
mTxn->AddPaint(OpPaintTexture(nullptr, aCompositable->GetIPDLActor(), 1,
|
|
|
|
SurfaceDescriptor(*aDescriptor)));
|
|
|
|
*aDescriptor = SurfaceDescriptor();
|
|
|
|
} else {
|
|
|
|
NS_WARNING("Trying to send a null SurfaceDescriptor.");
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
2013-04-12 00:28:55 -07:00
|
|
|
|
2013-05-01 16:24:27 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::UpdateTextureNoSwap(CompositableClient* aCompositable,
|
|
|
|
TextureIdentifier aTextureId,
|
|
|
|
SurfaceDescriptor* aDescriptor)
|
|
|
|
{
|
|
|
|
if (aDescriptor->type() != SurfaceDescriptor::T__None &&
|
|
|
|
aDescriptor->type() != SurfaceDescriptor::Tnull_t) {
|
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
|
|
|
mTxn->AddNoSwapPaint(OpPaintTexture(nullptr, aCompositable->GetIPDLActor(), 1,
|
|
|
|
SurfaceDescriptor(*aDescriptor)));
|
|
|
|
*aDescriptor = SurfaceDescriptor();
|
|
|
|
} else {
|
|
|
|
NS_WARNING("Trying to send a null SurfaceDescriptor.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07: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 02:20:52 -07:00
|
|
|
ShadowLayerForwarder::UpdateTextureRegion(CompositableClient* aCompositable,
|
|
|
|
const ThebesBufferData& aThebesBufferData,
|
|
|
|
const nsIntRegion& aUpdatedRegion)
|
2010-07-21 14:17:33 -07: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 02:20:52 -07:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
|
|
|
mTxn->AddPaint(OpPaintTextureRegion(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aThebesBufferData,
|
|
|
|
aUpdatedRegion));
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2013-05-15 20:45:43 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::UpdateTextureIncremental(CompositableClient* aCompositable,
|
|
|
|
TextureIdentifier aTextureId,
|
|
|
|
SurfaceDescriptor& aDescriptor,
|
|
|
|
const nsIntRegion& aUpdatedRegion,
|
|
|
|
const nsIntRect& aBufferRect,
|
|
|
|
const nsIntPoint& aBufferRotation)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
2013-05-21 20:36:38 -07:00
|
|
|
mTxn->AddNoSwapPaint(OpPaintTextureIncremental(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aTextureId,
|
|
|
|
aDescriptor,
|
|
|
|
aUpdatedRegion,
|
|
|
|
aBufferRect,
|
|
|
|
aBufferRotation));
|
2013-05-15 20:45:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-22 12:22:20 -07: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 02:20:52 -07:00
|
|
|
ShadowLayerForwarder::UpdatePictureRect(CompositableClient* aCompositable,
|
|
|
|
const nsIntRect& aRect)
|
2013-03-22 12:22:20 -07: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 02:20:52 -07:00
|
|
|
mTxn->AddNoSwapPaint(OpUpdatePictureRect(nullptr, aCompositable->GetIPDLActor(), aRect));
|
2013-03-22 12:22:20 -07:00
|
|
|
}
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::AddTexture(CompositableClient* aCompositable,
|
|
|
|
TextureClient* aTexture)
|
|
|
|
{
|
|
|
|
SurfaceDescriptor descriptor;
|
|
|
|
if (!aTexture->ToSurfaceDescriptor(descriptor)) {
|
|
|
|
NS_WARNING("Failed to serialize a TextureClient");
|
|
|
|
return;
|
|
|
|
}
|
2013-08-19 16:39:56 -07:00
|
|
|
MOZ_ASSERT(aTexture->GetFlags() != 0);
|
2013-07-30 02:59:51 -07:00
|
|
|
mTxn->AddEdit(OpAddTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aTexture->GetID(),
|
|
|
|
descriptor,
|
|
|
|
aTexture->GetFlags()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::RemoveTexture(CompositableClient* aCompositable,
|
|
|
|
uint64_t aTexture,
|
|
|
|
TextureFlags aFlags)
|
|
|
|
{
|
2013-09-12 07:50:28 -07:00
|
|
|
mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aTexture,
|
|
|
|
aFlags));
|
2013-09-26 09:00:23 -07:00
|
|
|
if (aFlags & TEXTURE_DEALLOCATE_CLIENT) {
|
2013-09-12 07:50:28 -07:00
|
|
|
mTxn->MarkSyncTransaction();
|
|
|
|
}
|
2013-07-30 02:59:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::UpdatedTexture(CompositableClient* aCompositable,
|
|
|
|
TextureClient* aTexture,
|
|
|
|
nsIntRegion* aRegion)
|
|
|
|
{
|
|
|
|
MaybeRegion region = aRegion ? MaybeRegion(*aRegion)
|
|
|
|
: MaybeRegion(null_t());
|
2013-08-03 10:30:28 -07:00
|
|
|
if (aTexture->GetFlags() & TEXTURE_IMMEDIATE_UPLOAD) {
|
|
|
|
mTxn->AddPaint(OpUpdateTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aTexture->GetID(),
|
|
|
|
region));
|
|
|
|
} else {
|
|
|
|
mTxn->AddNoSwapPaint(OpUpdateTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aTexture->GetID(),
|
|
|
|
region));
|
|
|
|
}
|
2013-07-30 02:59:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::UseTexture(CompositableClient* aCompositable,
|
|
|
|
TextureClient* aTexture)
|
|
|
|
{
|
|
|
|
mTxn->AddEdit(OpUseTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aTexture->GetID()));
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2010-11-08 18:49:00 -08:00
|
|
|
ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
2013-03-15 21:47:02 -07:00
|
|
|
PROFILER_LABEL("ShadowLayerForwarder", "EndTranscation");
|
2012-02-28 08:24:24 -08:00
|
|
|
RenderTraceScope rendertrace("Foward Transaction", "000091");
|
2010-07-21 14:17:33 -07:00
|
|
|
NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
|
|
|
|
NS_ABORT_IF_FALSE(!mTxn->Finished(), "forgot BeginTransaction?");
|
|
|
|
|
2013-08-02 15:50:17 -07:00
|
|
|
DiagnosticTypes diagnostics = gfxPlatform::GetPlatform()->GetLayerDiagnosticTypes();
|
|
|
|
if (mDiagnosticTypes != diagnostics) {
|
|
|
|
mDiagnosticTypes = diagnostics;
|
|
|
|
mTxn->AddEdit(OpSetDiagnosticTypes(diagnostics));
|
2013-03-21 10:08:01 -07:00
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
AutoTxnEnd _(mTxn);
|
|
|
|
|
2013-06-20 06:01:20 -07:00
|
|
|
if (mTxn->Empty() && !mTxn->RotationChanged() && !mWindowOverlayChanged) {
|
2012-11-06 01:11:43 -08:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] 0-length cset (?) and no rotation event, skipping Update()"));
|
2011-10-17 07:59:28 -07:00
|
|
|
return true;
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] destroying buffers..."));
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
for (uint32_t i = 0; i < mTxn->mDyingBuffers.Length(); ++i) {
|
2010-09-13 22:23:08 -07:00
|
|
|
DestroySharedSurface(&mTxn->mDyingBuffers[i]);
|
2010-09-13 22:23:08 -07:00
|
|
|
}
|
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] building transaction..."));
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2010-09-15 14:03:13 -07: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 08:24:24 -08:00
|
|
|
RenderTraceScope rendertrace2("Foward Transaction", "000092");
|
2010-07-21 14:17:33 -07:00
|
|
|
for (ShadowableLayerSet::const_iterator it = mTxn->mMutants.begin();
|
|
|
|
it != mTxn->mMutants.end(); ++it) {
|
|
|
|
ShadowableLayer* shadow = *it;
|
|
|
|
Layer* mutant = shadow->AsLayer();
|
|
|
|
NS_ABORT_IF_FALSE(!!mutant, "unshadowable layer?");
|
|
|
|
|
|
|
|
LayerAttributes attrs;
|
|
|
|
CommonLayerAttributes& common = attrs.common();
|
|
|
|
common.visibleRegion() = mutant->GetVisibleRegion();
|
2012-08-03 14:29:22 -07:00
|
|
|
common.postXScale() = mutant->GetPostXScale();
|
|
|
|
common.postYScale() = mutant->GetPostYScale();
|
2012-07-30 19:20:00 -07:00
|
|
|
common.transform() = mutant->GetBaseTransform();
|
2010-09-02 02:18:40 -07:00
|
|
|
common.contentFlags() = mutant->GetContentFlags();
|
2010-07-21 14:17:33 -07:00
|
|
|
common.opacity() = mutant->GetOpacity();
|
|
|
|
common.useClipRect() = !!mutant->GetClipRect();
|
|
|
|
common.clipRect() = (common.useClipRect() ?
|
|
|
|
*mutant->GetClipRect() : nsIntRect());
|
2011-04-05 22:00:25 -07:00
|
|
|
common.isFixedPosition() = mutant->GetIsFixedPosition();
|
2012-06-27 08:43:57 -07:00
|
|
|
common.fixedPositionAnchor() = mutant->GetFixedPositionAnchor();
|
2013-04-12 15:41:18 -07:00
|
|
|
common.fixedPositionMargin() = mutant->GetFixedPositionMargins();
|
2013-09-11 21:17:58 -07:00
|
|
|
common.isStickyPosition() = mutant->GetIsStickyPosition();
|
|
|
|
if (mutant->GetIsStickyPosition()) {
|
|
|
|
common.stickyScrollContainerId() = mutant->GetStickyScrollContainerId();
|
|
|
|
common.stickyScrollRangeOuter() = mutant->GetStickyScrollRangeOuter();
|
|
|
|
common.stickyScrollRangeInner() = mutant->GetStickyScrollRangeInner();
|
|
|
|
}
|
2012-03-18 16:02:38 -07:00
|
|
|
if (Layer* maskLayer = mutant->GetMaskLayer()) {
|
|
|
|
common.maskLayerChild() = Shadow(maskLayer->AsShadowableLayer());
|
|
|
|
} else {
|
2013-07-20 01:48:55 -07:00
|
|
|
common.maskLayerChild() = nullptr;
|
2012-03-18 16:02:38 -07:00
|
|
|
}
|
2013-07-20 01:48:55 -07:00
|
|
|
common.maskLayerParent() = nullptr;
|
2012-07-31 10:28:20 -07:00
|
|
|
common.animations() = mutant->GetAnimations();
|
2010-07-21 14:17:33 -07:00
|
|
|
attrs.specific() = null_t();
|
|
|
|
mutant->FillSpecificAttributes(attrs.specific());
|
|
|
|
|
2013-03-21 19:17:28 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] OpSetLayerAttributes(%p)\n", mutant));
|
|
|
|
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddEdit(OpSetLayerAttributes(nullptr, Shadow(shadow), attrs));
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2010-11-08 18:49:00 -08:00
|
|
|
AutoInfallibleTArray<Edit, 10> cset;
|
2010-09-15 14:03:13 -07:00
|
|
|
size_t nCsets = mTxn->mCset.size() + mTxn->mPaints.size();
|
2013-06-20 06:01:20 -07:00
|
|
|
NS_ABORT_IF_FALSE(nCsets > 0 || mWindowOverlayChanged, "should have bailed by now");
|
2010-09-15 14:03:13 -07:00
|
|
|
|
|
|
|
cset.SetCapacity(nCsets);
|
2010-09-20 12:40:30 -07:00
|
|
|
if (!mTxn->mCset.empty()) {
|
|
|
|
cset.AppendElements(&mTxn->mCset.front(), mTxn->mCset.size());
|
|
|
|
}
|
2010-09-15 14:03:13 -07:00
|
|
|
// Paints after non-paint ops, including attribute changes. See
|
|
|
|
// above.
|
2010-09-20 12:40:30 -07:00
|
|
|
if (!mTxn->mPaints.empty()) {
|
|
|
|
cset.AppendElements(&mTxn->mPaints.front(), mTxn->mPaints.size());
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2013-06-20 06:01:20 -07:00
|
|
|
mWindowOverlayChanged = false;
|
|
|
|
|
2012-11-21 18:40:57 -08:00
|
|
|
TargetConfig targetConfig(mTxn->mTargetBounds, mTxn->mTargetRotation, mTxn->mClientBounds, mTxn->mTargetOrientation);
|
2012-07-24 12:01:09 -07:00
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send..."));
|
|
|
|
PlatformSyncBeforeUpdate();
|
|
|
|
|
2012-05-01 12:23:39 -07:00
|
|
|
if (mTxn->mSwapRequired) {
|
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction..."));
|
|
|
|
RenderTraceScope rendertrace3("Forward Transaction", "000093");
|
2012-07-24 12:01:09 -07:00
|
|
|
if (!mShadowManager->SendUpdate(cset, targetConfig, mIsFirstPaint,
|
|
|
|
aReplies)) {
|
2012-05-01 12:23:39 -07: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");
|
2012-07-24 12:01:09 -07:00
|
|
|
if (!mShadowManager->SendUpdateNoSwap(cset, targetConfig, mIsFirstPaint)) {
|
2012-05-01 12:23:39 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
|
|
|
|
return false;
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2012-03-12 08:50:15 -07:00
|
|
|
mIsFirstPaint = false;
|
2010-07-21 14:17:33 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] ... done"));
|
2011-10-17 07:59:28 -07:00
|
|
|
return true;
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07: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 02:20:52 -07:00
|
|
|
ShadowLayerForwarder::AllocShmem(size_t aSize,
|
|
|
|
ipc::SharedMemory::SharedMemoryType aType,
|
|
|
|
ipc::Shmem* aShmem)
|
2010-07-21 14:17:33 -07: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 02:20:52 -07:00
|
|
|
return mShadowManager->AllocShmem(aSize, aType, aShmem);
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
2011-09-28 23:19:26 -07: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 02:20:52 -07:00
|
|
|
ShadowLayerForwarder::AllocUnsafeShmem(size_t aSize,
|
|
|
|
ipc::SharedMemory::SharedMemoryType aType,
|
|
|
|
ipc::Shmem* aShmem)
|
2012-07-12 05:51:57 -07: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 02:20:52 -07:00
|
|
|
return mShadowManager->AllocUnsafeShmem(aSize, aType, aShmem);
|
2012-07-12 05:51:57 -07: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 02:20:52 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::DeallocShmem(ipc::Shmem& aShmem)
|
|
|
|
{
|
|
|
|
mShadowManager->DeallocShmem(aShmem);
|
2010-12-30 23:40:31 -08:00
|
|
|
}
|
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
/*static*/ already_AddRefed<gfxASurface>
|
2012-07-12 05:51:58 -07:00
|
|
|
ShadowLayerForwarder::OpenDescriptor(OpenMode aMode,
|
|
|
|
const SurfaceDescriptor& aSurface)
|
2010-09-13 22:23:08 -07:00
|
|
|
{
|
2012-07-12 05:51:58 -07:00
|
|
|
nsRefPtr<gfxASurface> surf = PlatformOpenDescriptor(aMode, aSurface);
|
2010-09-13 22:23:08 -07:00
|
|
|
if (surf) {
|
|
|
|
return surf.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (aSurface.type()) {
|
|
|
|
case SurfaceDescriptor::TShmem: {
|
2011-01-04 08:40:54 -08:00
|
|
|
surf = gfxSharedImageSurface::Open(aSurface.get_Shmem());
|
2010-09-13 22:23:08 -07:00
|
|
|
return surf.forget();
|
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 02:20:52 -07:00
|
|
|
} case SurfaceDescriptor::TRGBImage: {
|
|
|
|
const RGBImage& rgb = aSurface.get_RGBImage();
|
2013-09-24 13:45:13 -07:00
|
|
|
gfxImageFormat rgbFormat
|
|
|
|
= static_cast<gfxImageFormat>(rgb.rgbFormat());
|
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 02:20:52 -07:00
|
|
|
uint32_t stride = gfxASurface::BytesPerPixel(rgbFormat) * rgb.picture().width;
|
|
|
|
nsIntSize size(rgb.picture().width, rgb.picture().height);
|
|
|
|
surf = new gfxImageSurface(rgb.data().get<uint8_t>(),
|
|
|
|
size,
|
|
|
|
stride,
|
|
|
|
rgbFormat);
|
|
|
|
return surf.forget();
|
2013-05-22 00:04:12 -07:00
|
|
|
}
|
|
|
|
case SurfaceDescriptor::TMemoryImage: {
|
|
|
|
const MemoryImage& image = aSurface.get_MemoryImage();
|
2013-09-24 13:45:13 -07:00
|
|
|
gfxImageFormat format
|
|
|
|
= static_cast<gfxImageFormat>(image.format());
|
2013-05-22 00:04:12 -07:00
|
|
|
surf = new gfxImageSurface((unsigned char *)image.data(),
|
|
|
|
image.size(),
|
|
|
|
image.stride(),
|
|
|
|
format);
|
|
|
|
return surf.forget();
|
2010-09-13 22:23:08 -07:00
|
|
|
}
|
|
|
|
default:
|
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 02:20:52 -07:00
|
|
|
NS_ERROR("unexpected SurfaceDescriptor type!");
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2010-09-13 22:23:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-12 05:51:58 -07:00
|
|
|
/*static*/ gfxContentType
|
|
|
|
ShadowLayerForwarder::GetDescriptorSurfaceContentType(
|
|
|
|
const SurfaceDescriptor& aDescriptor, OpenMode aMode,
|
|
|
|
gfxASurface** aSurface)
|
|
|
|
{
|
|
|
|
gfxContentType content;
|
|
|
|
if (PlatformGetDescriptorSurfaceContentType(aDescriptor, aMode,
|
|
|
|
&content, aSurface)) {
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsRefPtr<gfxASurface> surface = OpenDescriptor(aMode, aDescriptor);
|
|
|
|
content = surface->GetContentType();
|
|
|
|
*aSurface = surface.forget().get();
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*static*/ gfxIntSize
|
|
|
|
ShadowLayerForwarder::GetDescriptorSurfaceSize(
|
|
|
|
const SurfaceDescriptor& aDescriptor, OpenMode aMode,
|
|
|
|
gfxASurface** aSurface)
|
|
|
|
{
|
|
|
|
gfxIntSize size;
|
|
|
|
if (PlatformGetDescriptorSurfaceSize(aDescriptor, aMode, &size, aSurface)) {
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsRefPtr<gfxASurface> surface = OpenDescriptor(aMode, aDescriptor);
|
|
|
|
size = surface->GetSize();
|
|
|
|
*aSurface = surface.forget().get();
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2013-08-07 15:38:21 -07:00
|
|
|
/*static*/ gfxImageFormat
|
|
|
|
ShadowLayerForwarder::GetDescriptorSurfaceImageFormat(
|
|
|
|
const SurfaceDescriptor& aDescriptor, OpenMode aMode,
|
|
|
|
gfxASurface** aSurface)
|
|
|
|
{
|
|
|
|
gfxImageFormat format;
|
|
|
|
if (PlatformGetDescriptorSurfaceImageFormat(aDescriptor, aMode, &format, aSurface)) {
|
|
|
|
return format;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsRefPtr<gfxASurface> surface = OpenDescriptor(aMode, aDescriptor);
|
2013-09-24 13:45:13 -07:00
|
|
|
NS_ENSURE_TRUE(surface, gfxImageFormatUnknown);
|
2013-08-07 15:38:21 -07:00
|
|
|
|
|
|
|
nsRefPtr<gfxImageSurface> img = surface->GetAsImageSurface();
|
2013-09-24 13:45:13 -07:00
|
|
|
NS_ENSURE_TRUE(img, gfxImageFormatUnknown);
|
2013-08-07 15:38:21 -07:00
|
|
|
|
|
|
|
format = img->Format();
|
2013-09-24 13:45:13 -07:00
|
|
|
NS_ASSERTION(format != gfxImageFormatUnknown,
|
2013-08-07 15:38:21 -07:00
|
|
|
"ImageSurface RGB format should be known");
|
|
|
|
|
|
|
|
*aSurface = surface.forget().get();
|
|
|
|
return format;
|
|
|
|
}
|
|
|
|
|
2012-07-12 05:51:58 -07:00
|
|
|
/*static*/ void
|
|
|
|
ShadowLayerForwarder::CloseDescriptor(const SurfaceDescriptor& aDescriptor)
|
|
|
|
{
|
|
|
|
PlatformCloseDescriptor(aDescriptor);
|
|
|
|
// There's no "close" needed for Shmem surfaces.
|
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
PLayerChild*
|
|
|
|
ShadowLayerForwarder::ConstructShadowFor(ShadowableLayer* aLayer)
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
|
|
|
|
return mShadowManager->SendPLayerConstructor(new ShadowLayerChild(aLayer));
|
|
|
|
}
|
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
#if !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
|
|
|
|
|
|
|
|
/*static*/ already_AddRefed<gfxASurface>
|
2012-07-12 05:51:58 -07:00
|
|
|
ShadowLayerForwarder::PlatformOpenDescriptor(OpenMode,
|
|
|
|
const SurfaceDescriptor&)
|
2010-09-13 22:23:08 -07:00
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2010-09-13 22:23:08 -07:00
|
|
|
}
|
|
|
|
|
2012-07-12 05:51:58 -07:00
|
|
|
/*static*/ bool
|
|
|
|
ShadowLayerForwarder::PlatformCloseDescriptor(const SurfaceDescriptor&)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*static*/ bool
|
|
|
|
ShadowLayerForwarder::PlatformGetDescriptorSurfaceContentType(
|
|
|
|
const SurfaceDescriptor&,
|
|
|
|
OpenMode,
|
|
|
|
gfxContentType*,
|
|
|
|
gfxASurface**)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*static*/ bool
|
|
|
|
ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize(
|
|
|
|
const SurfaceDescriptor&,
|
|
|
|
OpenMode,
|
|
|
|
gfxIntSize*,
|
|
|
|
gfxASurface**)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-08-07 15:38:21 -07:00
|
|
|
/*static*/ bool
|
|
|
|
ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat(
|
|
|
|
const SurfaceDescriptor&,
|
|
|
|
OpenMode,
|
|
|
|
gfxImageFormat*,
|
|
|
|
gfxASurface**)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2010-09-13 22:23:08 -07:00
|
|
|
ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor*)
|
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2010-09-13 22:23:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*static*/ void
|
|
|
|
ShadowLayerForwarder::PlatformSyncBeforeUpdate()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07: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 02:20:52 -07:00
|
|
|
ISurfaceAllocator::PlatformDestroySharedSurface(SurfaceDescriptor*)
|
2010-09-13 22:23:08 -07:00
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2010-09-13 22:23:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
|
|
|
|
|
2012-07-12 05:51:58 -07:00
|
|
|
AutoOpenSurface::AutoOpenSurface(OpenMode aMode,
|
|
|
|
const SurfaceDescriptor& aDescriptor)
|
|
|
|
: mDescriptor(aDescriptor)
|
|
|
|
, mMode(aMode)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsSurfaceDescriptorValid(mDescriptor));
|
|
|
|
}
|
|
|
|
|
|
|
|
AutoOpenSurface::~AutoOpenSurface()
|
|
|
|
{
|
|
|
|
if (mSurface) {
|
2012-07-30 07:20:58 -07:00
|
|
|
mSurface = nullptr;
|
2012-07-12 05:51:58 -07:00
|
|
|
ShadowLayerForwarder::CloseDescriptor(mDescriptor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gfxContentType
|
|
|
|
AutoOpenSurface::ContentType()
|
|
|
|
{
|
|
|
|
if (mSurface) {
|
|
|
|
return mSurface->GetContentType();
|
|
|
|
}
|
|
|
|
return ShadowLayerForwarder::GetDescriptorSurfaceContentType(
|
|
|
|
mDescriptor, mMode, getter_AddRefs(mSurface));
|
2013-08-07 15:38:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
gfxImageFormat
|
|
|
|
AutoOpenSurface::ImageFormat()
|
|
|
|
{
|
|
|
|
if (mSurface) {
|
|
|
|
nsRefPtr<gfxImageSurface> img = mSurface->GetAsImageSurface();
|
|
|
|
if (img) {
|
|
|
|
gfxImageFormat format = img->Format();
|
2013-09-24 13:45:13 -07:00
|
|
|
NS_ASSERTION(format != gfxImageFormatUnknown,
|
2013-08-07 15:38:21 -07:00
|
|
|
"ImageSurface RGB format should be known");
|
|
|
|
|
|
|
|
return format;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ShadowLayerForwarder::GetDescriptorSurfaceImageFormat(
|
|
|
|
mDescriptor, mMode, getter_AddRefs(mSurface));
|
2012-07-12 05:51:58 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
gfxIntSize
|
|
|
|
AutoOpenSurface::Size()
|
|
|
|
{
|
|
|
|
if (mSurface) {
|
|
|
|
return mSurface->GetSize();
|
|
|
|
}
|
|
|
|
return ShadowLayerForwarder::GetDescriptorSurfaceSize(
|
|
|
|
mDescriptor, mMode, getter_AddRefs(mSurface));
|
|
|
|
}
|
|
|
|
|
|
|
|
gfxASurface*
|
|
|
|
AutoOpenSurface::Get()
|
|
|
|
{
|
|
|
|
if (!mSurface) {
|
|
|
|
mSurface = ShadowLayerForwarder::OpenDescriptor(mMode, mDescriptor);
|
|
|
|
}
|
|
|
|
return mSurface.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
gfxImageSurface*
|
|
|
|
AutoOpenSurface::GetAsImage()
|
|
|
|
{
|
|
|
|
if (!mSurfaceAsImage) {
|
|
|
|
mSurfaceAsImage = Get()->GetAsImageSurface();
|
|
|
|
}
|
|
|
|
return mSurfaceAsImage.get();
|
|
|
|
}
|
|
|
|
|
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 02:20:52 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::Connect(CompositableClient* aCompositable)
|
|
|
|
{
|
|
|
|
#ifdef GFX_COMPOSITOR_LOGGING
|
|
|
|
printf("ShadowLayerForwarder::Connect(Compositable)\n");
|
|
|
|
#endif
|
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
CompositableChild* child = static_cast<CompositableChild*>(
|
2013-04-12 00:28:55 -07:00
|
|
|
mShadowManager->SendPCompositableConstructor(aCompositable->GetTextureInfo()));
|
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 02:20:52 -07:00
|
|
|
MOZ_ASSERT(child);
|
|
|
|
aCompositable->SetIPDLActor(child);
|
|
|
|
child->SetClient(aCompositable);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedSingleBuffer(CompositableClient* aCompositable,
|
2013-04-12 00:28:55 -07:00
|
|
|
const SurfaceDescriptor& aDescriptor,
|
2013-04-21 19:40:52 -07:00
|
|
|
const TextureInfo& aTextureInfo,
|
|
|
|
const SurfaceDescriptor* aDescriptorOnWhite)
|
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 02:20:52 -07:00
|
|
|
{
|
2013-04-12 00:28:55 -07:00
|
|
|
MOZ_ASSERT(aDescriptor.type() != SurfaceDescriptor::T__None &&
|
|
|
|
aDescriptor.type() != SurfaceDescriptor::Tnull_t);
|
2013-04-12 00:29:08 -07:00
|
|
|
mTxn->AddEdit(OpCreatedTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
TextureFront,
|
|
|
|
aDescriptor,
|
|
|
|
aTextureInfo));
|
2013-04-21 19:40:52 -07:00
|
|
|
if (aDescriptorOnWhite) {
|
|
|
|
mTxn->AddEdit(OpCreatedTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
TextureOnWhiteFront,
|
|
|
|
*aDescriptorOnWhite,
|
|
|
|
aTextureInfo));
|
|
|
|
}
|
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 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
2013-05-15 20:45:43 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedIncrementalBuffer(CompositableClient* aCompositable,
|
|
|
|
const TextureInfo& aTextureInfo,
|
|
|
|
const nsIntRect& aBufferRect)
|
|
|
|
{
|
2013-05-21 20:36:38 -07:00
|
|
|
mTxn->AddNoSwapPaint(OpCreatedIncrementalTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aTextureInfo, aBufferRect));
|
2013-05-15 20:45:43 -07: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 02:20:52 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedDoubleBuffer(CompositableClient* aCompositable,
|
2013-04-12 00:28:55 -07:00
|
|
|
const SurfaceDescriptor& aFrontDescriptor,
|
|
|
|
const SurfaceDescriptor& aBackDescriptor,
|
2013-04-21 19:40:52 -07:00
|
|
|
const TextureInfo& aTextureInfo,
|
|
|
|
const SurfaceDescriptor* aFrontDescriptorOnWhite,
|
|
|
|
const SurfaceDescriptor* aBackDescriptorOnWhite)
|
2013-04-12 00:28:55 -07:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(aFrontDescriptor.type() != SurfaceDescriptor::T__None &&
|
|
|
|
aBackDescriptor.type() != SurfaceDescriptor::T__None &&
|
|
|
|
aFrontDescriptor.type() != SurfaceDescriptor::Tnull_t &&
|
|
|
|
aBackDescriptor.type() != SurfaceDescriptor::Tnull_t);
|
2013-04-12 00:29:08 -07:00
|
|
|
mTxn->AddEdit(OpCreatedTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
TextureFront,
|
|
|
|
aFrontDescriptor,
|
|
|
|
aTextureInfo));
|
|
|
|
mTxn->AddEdit(OpCreatedTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
TextureBack,
|
|
|
|
aBackDescriptor,
|
|
|
|
aTextureInfo));
|
2013-04-21 19:40:52 -07:00
|
|
|
if (aFrontDescriptorOnWhite) {
|
|
|
|
MOZ_ASSERT(aBackDescriptorOnWhite);
|
|
|
|
mTxn->AddEdit(OpCreatedTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
TextureOnWhiteFront,
|
|
|
|
*aFrontDescriptorOnWhite,
|
|
|
|
aTextureInfo));
|
|
|
|
mTxn->AddEdit(OpCreatedTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
TextureOnWhiteBack,
|
|
|
|
*aBackDescriptorOnWhite,
|
|
|
|
aTextureInfo));
|
|
|
|
}
|
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 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::DestroyThebesBuffer(CompositableClient* aCompositable)
|
|
|
|
{
|
|
|
|
mTxn->AddEdit(OpDestroyThebesBuffer(nullptr, aCompositable->GetIPDLActor()));
|
|
|
|
}
|
|
|
|
|
|
|
|
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 05:51:58 -07:00
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|