2010-07-21 21:17:33 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 11:12:37 +00: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 21:17:33 +00:00
|
|
|
|
2013-04-24 18:42:40 +00:00
|
|
|
#include "LayerTransactionParent.h"
|
2013-08-11 23:17:23 +00:00
|
|
|
#include <vector> // for vector
|
2014-10-16 13:23:52 +00:00
|
|
|
#include "apz/src/AsyncPanZoomController.h"
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "CompositableHost.h" // for CompositableParent, Get, etc
|
|
|
|
#include "ImageLayers.h" // for ImageLayer
|
|
|
|
#include "Layers.h" // for Layer, ContainerLayer, etc
|
|
|
|
#include "ShadowLayerParent.h" // for ShadowLayerParent
|
|
|
|
#include "CompositableTransactionParent.h" // for EditReplyVector
|
|
|
|
#include "mozilla/gfx/BasePoint3D.h" // for BasePoint3D
|
|
|
|
#include "mozilla/layers/CanvasLayerComposite.h"
|
2013-04-25 22:25:33 +00:00
|
|
|
#include "mozilla/layers/ColorLayerComposite.h"
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/layers/Compositor.h" // for Compositor
|
2013-04-25 22:25:33 +00:00
|
|
|
#include "mozilla/layers/ContainerLayerComposite.h"
|
2014-10-06 22:45:03 +00:00
|
|
|
#include "mozilla/layers/ImageBridgeParent.h" // for ImageBridgeParent
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/layers/ImageLayerComposite.h"
|
|
|
|
#include "mozilla/layers/LayerManagerComposite.h"
|
2013-09-06 15:41:00 +00:00
|
|
|
#include "mozilla/layers/LayersMessages.h" // for EditReply, etc
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for PGrallocBufferParent
|
|
|
|
#include "mozilla/layers/LayersTypes.h" // for MOZ_LAYERS_LOG
|
|
|
|
#include "mozilla/layers/PCompositableParent.h"
|
|
|
|
#include "mozilla/layers/PLayerParent.h" // for PLayerParent
|
2014-06-08 13:18:53 +00:00
|
|
|
#include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL
|
2014-09-26 17:06:08 +00:00
|
|
|
#include "mozilla/layers/PaintedLayerComposite.h"
|
2014-10-27 12:57:36 +00:00
|
|
|
#include "mozilla/layers/ShadowLayersManager.h" // for ShadowLayersManager
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/mozalloc.h" // for operator delete, etc
|
2014-05-06 01:56:40 +00:00
|
|
|
#include "mozilla/unused.h"
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "nsCoord.h" // for NSAppUnitsToFloatPixels
|
|
|
|
#include "nsDebug.h" // for NS_RUNTIMEABORT
|
2014-03-10 04:47:12 +00:00
|
|
|
#include "nsDeviceContext.h" // for AppUnitsPerCSSPixel
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "nsISupportsImpl.h" // for Layer::Release, etc
|
|
|
|
#include "nsLayoutUtils.h" // for nsLayoutUtils
|
|
|
|
#include "nsMathUtils.h" // for NS_round
|
|
|
|
#include "nsPoint.h" // for nsPoint
|
|
|
|
#include "nsTArray.h" // for nsTArray, nsTArray_Impl, etc
|
2013-09-10 19:56:49 +00:00
|
|
|
#include "GeckoProfiler.h"
|
2013-12-12 01:44:44 +00:00
|
|
|
#include "mozilla/layers/TextureHost.h"
|
2014-02-11 04:01:20 +00:00
|
|
|
#include "mozilla/layers/AsyncCompositionManager.h"
|
2010-07-21 21:17:33 +00:00
|
|
|
|
|
|
|
typedef std::vector<mozilla::layers::EditReply> EditReplyVector;
|
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
using mozilla::layout::RenderFrameParent;
|
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
namespace mozilla {
|
2014-07-09 19:26:18 +00:00
|
|
|
namespace gfx {
|
|
|
|
class VRHMDInfo;
|
|
|
|
}
|
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 23:17:23 +00:00
|
|
|
class PGrallocBufferParent;
|
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
//--------------------------------------------------
|
|
|
|
// Convenience accessors
|
|
|
|
static ShadowLayerParent*
|
|
|
|
cast(const PLayerParent* in)
|
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 09:20:52 +00:00
|
|
|
{
|
2010-07-21 21:17:33 +00:00
|
|
|
return const_cast<ShadowLayerParent*>(
|
|
|
|
static_cast<const ShadowLayerParent*>(in));
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class OpCreateT>
|
|
|
|
static ShadowLayerParent*
|
2013-04-25 22:25:33 +00:00
|
|
|
AsLayerComposite(const OpCreateT& op)
|
2010-07-21 21:17:33 +00:00
|
|
|
{
|
|
|
|
return cast(op.layerParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
2013-04-25 22:25:33 +00:00
|
|
|
AsLayerComposite(const OpSetRoot& op)
|
2010-07-21 21:17:33 +00:00
|
|
|
{
|
|
|
|
return cast(op.rootParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowContainer(const OpInsertAfter& op)
|
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowChild(const OpInsertAfter& op)
|
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowAfter(const OpInsertAfter& op)
|
|
|
|
{
|
|
|
|
return cast(op.afterParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
2014-02-24 14:41:55 +00:00
|
|
|
ShadowContainer(const OpPrependChild& op)
|
2010-07-21 21:17:33 +00:00
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
2014-02-24 14:41:55 +00:00
|
|
|
ShadowChild(const OpPrependChild& op)
|
2010-07-21 21:17:33 +00:00
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowContainer(const OpRemoveChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowChild(const OpRemoveChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
|
2012-08-29 10:52:55 +00:00
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowContainer(const OpRepositionChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowChild(const OpRepositionChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowAfter(const OpRepositionChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.afterParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowContainer(const OpRaiseToTopChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowChild(const OpRaiseToTopChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
//--------------------------------------------------
|
2013-04-24 18:42:40 +00:00
|
|
|
// LayerTransactionParent
|
2013-04-25 22:25:33 +00:00
|
|
|
LayerTransactionParent::LayerTransactionParent(LayerManagerComposite* aManager,
|
2013-04-24 18:42:40 +00:00
|
|
|
ShadowLayersManager* aLayersManager,
|
2015-04-01 08:40:35 +00:00
|
|
|
uint64_t aId)
|
2012-07-17 23:59:45 +00:00
|
|
|
: mLayerManager(aManager)
|
|
|
|
, mShadowLayersManager(aLayersManager)
|
|
|
|
, mId(aId)
|
2014-05-28 21:42:14 +00:00
|
|
|
, mPendingTransaction(0)
|
2012-07-17 23:59:45 +00:00
|
|
|
, mDestroyed(false)
|
2013-11-27 15:18:38 +00:00
|
|
|
, mIPCOpen(false)
|
2010-07-21 21:17:33 +00:00
|
|
|
{
|
2013-04-24 18:42:40 +00:00
|
|
|
MOZ_COUNT_CTOR(LayerTransactionParent);
|
2010-07-21 21:17:33 +00:00
|
|
|
}
|
|
|
|
|
2013-04-24 18:42:40 +00:00
|
|
|
LayerTransactionParent::~LayerTransactionParent()
|
2010-07-21 21:17:33 +00:00
|
|
|
{
|
2013-04-24 18:42:40 +00:00
|
|
|
MOZ_COUNT_DTOR(LayerTransactionParent);
|
2010-07-21 21:17:33 +00:00
|
|
|
}
|
|
|
|
|
2014-10-13 08:43:59 +00:00
|
|
|
bool
|
|
|
|
LayerTransactionParent::RecvShutdown()
|
|
|
|
{
|
|
|
|
Destroy();
|
|
|
|
return Send__delete__(this);
|
|
|
|
}
|
|
|
|
|
2011-01-06 04:54:47 +00:00
|
|
|
void
|
2013-04-24 18:42:40 +00:00
|
|
|
LayerTransactionParent::Destroy()
|
2011-01-06 04:54:47 +00:00
|
|
|
{
|
2011-01-12 20:13:41 +00:00
|
|
|
mDestroyed = true;
|
2011-01-06 04:54:47 +00:00
|
|
|
for (size_t i = 0; i < ManagedPLayerParent().Length(); ++i) {
|
|
|
|
ShadowLayerParent* slp =
|
|
|
|
static_cast<ShadowLayerParent*>(ManagedPLayerParent()[i]);
|
|
|
|
slp->Destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-07 21:34:04 +00:00
|
|
|
LayersBackend
|
|
|
|
LayerTransactionParent::GetCompositorBackendType() const
|
|
|
|
{
|
|
|
|
return mLayerManager->GetBackendType();
|
|
|
|
}
|
|
|
|
|
2012-05-01 19:23:39 +00:00
|
|
|
bool
|
2015-01-16 19:58:52 +00:00
|
|
|
LayerTransactionParent::RecvUpdateNoSwap(InfallibleTArray<Edit>&& cset,
|
2014-05-28 21:42:14 +00:00
|
|
|
const uint64_t& aTransactionId,
|
2013-04-24 18:42:40 +00:00
|
|
|
const TargetConfig& targetConfig,
|
2015-01-29 19:41:55 +00:00
|
|
|
PluginsArray&& aPlugins,
|
2013-12-16 05:38:42 +00:00
|
|
|
const bool& isFirstPaint,
|
2014-05-06 21:26:13 +00:00
|
|
|
const bool& scheduleComposite,
|
2014-05-30 22:52:43 +00:00
|
|
|
const uint32_t& paintSequenceNumber,
|
2014-08-28 19:24:26 +00:00
|
|
|
const bool& isRepeatTransaction,
|
|
|
|
const mozilla::TimeStamp& aTransactionStart)
|
2012-05-01 19:23:39 +00:00
|
|
|
{
|
2015-01-29 19:41:55 +00:00
|
|
|
return RecvUpdate(Move(cset), aTransactionId, targetConfig, Move(aPlugins), isFirstPaint,
|
2014-08-28 19:24:26 +00:00
|
|
|
scheduleComposite, paintSequenceNumber, isRepeatTransaction,
|
|
|
|
aTransactionStart, nullptr);
|
2012-05-01 19:23:39 +00:00
|
|
|
}
|
|
|
|
|
2014-10-06 22:45:03 +00:00
|
|
|
class MOZ_STACK_CLASS AutoLayerTransactionParentAsyncMessageSender
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit AutoLayerTransactionParentAsyncMessageSender(LayerTransactionParent* aLayerTransaction)
|
|
|
|
: mLayerTransaction(aLayerTransaction) {}
|
|
|
|
|
|
|
|
~AutoLayerTransactionParentAsyncMessageSender()
|
|
|
|
{
|
2015-04-10 00:21:00 +00:00
|
|
|
mLayerTransaction->SendPendingAsyncMessages();
|
|
|
|
ImageBridgeParent::SendPendingAsyncMessages(mLayerTransaction->GetChildProcessId());
|
2014-10-06 22:45:03 +00:00
|
|
|
}
|
|
|
|
private:
|
|
|
|
LayerTransactionParent* mLayerTransaction;
|
|
|
|
};
|
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
bool
|
2015-01-16 19:58:52 +00:00
|
|
|
LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
|
2014-05-28 21:42:14 +00:00
|
|
|
const uint64_t& aTransactionId,
|
2013-04-24 18:42:40 +00:00
|
|
|
const TargetConfig& targetConfig,
|
2015-01-29 19:41:55 +00:00
|
|
|
PluginsArray&& aPlugins,
|
2013-04-24 18:42:40 +00:00
|
|
|
const bool& isFirstPaint,
|
2013-12-16 05:38:42 +00:00
|
|
|
const bool& scheduleComposite,
|
2014-05-06 21:26:13 +00:00
|
|
|
const uint32_t& paintSequenceNumber,
|
2014-05-30 22:52:43 +00:00
|
|
|
const bool& isRepeatTransaction,
|
2014-08-28 19:24:26 +00:00
|
|
|
const mozilla::TimeStamp& aTransactionStart,
|
2013-04-24 18:42:40 +00:00
|
|
|
InfallibleTArray<EditReply>* reply)
|
2010-07-21 21:17:33 +00:00
|
|
|
{
|
2014-10-01 09:38:00 +00:00
|
|
|
profiler_tracing("Paint", "LayerTransaction", TRACING_INTERVAL_START);
|
2014-05-23 21:12:29 +00:00
|
|
|
PROFILER_LABEL("LayerTransactionParent", "RecvUpdate",
|
|
|
|
js::ProfileEntry::Category::GRAPHICS);
|
|
|
|
|
2012-02-10 23:06:17 +00:00
|
|
|
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
|
|
|
TimeStamp updateStart = TimeStamp::Now();
|
|
|
|
#endif
|
|
|
|
|
2011-05-31 16:14:54 +00:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] received txn with %d edits", cset.Length()));
|
2010-07-21 21:17:33 +00: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 09:20:52 +00:00
|
|
|
if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
|
2010-12-27 14:48:00 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-11 22:19:01 +00:00
|
|
|
if (mLayerManager && mLayerManager->GetCompositor() &&
|
|
|
|
!targetConfig.naturalBounds().IsEmpty()) {
|
|
|
|
mLayerManager->GetCompositor()->SetScreenRotation(targetConfig.rotation());
|
|
|
|
}
|
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
EditReplyVector replyv;
|
2014-10-06 22:45:03 +00:00
|
|
|
AutoLayerTransactionParentAsyncMessageSender autoAsyncMessageSender(this);
|
2010-07-21 21:17:33 +00:00
|
|
|
|
2014-02-11 04:01:20 +00:00
|
|
|
{
|
2014-02-24 22:45:40 +00:00
|
|
|
AutoResolveRefLayers resolve(mShadowLayersManager->GetCompositionManager(this));
|
2014-02-11 04:01:20 +00:00
|
|
|
layer_manager()->BeginTransaction();
|
|
|
|
}
|
2010-07-21 21:17:33 +00:00
|
|
|
|
|
|
|
for (EditArray::index_type i = 0; i < cset.Length(); ++i) {
|
|
|
|
const Edit& edit = cset[i];
|
|
|
|
|
|
|
|
switch (edit.type()) {
|
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 09:20:52 +00:00
|
|
|
// Create* ops
|
2014-09-26 17:06:08 +00:00
|
|
|
case Edit::TOpCreatePaintedLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreatePaintedLayer"));
|
2010-07-21 21:17:33 +00:00
|
|
|
|
2014-09-26 17:06:08 +00:00
|
|
|
nsRefPtr<PaintedLayerComposite> layer =
|
|
|
|
layer_manager()->CreatePaintedLayerComposite();
|
|
|
|
AsLayerComposite(edit.get_OpCreatePaintedLayer())->Bind(layer);
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateContainerLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateContainerLayer"));
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
nsRefPtr<ContainerLayer> layer = layer_manager()->CreateContainerLayerComposite();
|
|
|
|
AsLayerComposite(edit.get_OpCreateContainerLayer())->Bind(layer);
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateImageLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateImageLayer"));
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
nsRefPtr<ImageLayerComposite> layer =
|
|
|
|
layer_manager()->CreateImageLayerComposite();
|
|
|
|
AsLayerComposite(edit.get_OpCreateImageLayer())->Bind(layer);
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateColorLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateColorLayer"));
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
nsRefPtr<ColorLayerComposite> layer = layer_manager()->CreateColorLayerComposite();
|
|
|
|
AsLayerComposite(edit.get_OpCreateColorLayer())->Bind(layer);
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateCanvasLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateCanvasLayer"));
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
nsRefPtr<CanvasLayerComposite> layer =
|
|
|
|
layer_manager()->CreateCanvasLayerComposite();
|
|
|
|
AsLayerComposite(edit.get_OpCreateCanvasLayer())->Bind(layer);
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-07-17 23:59:45 +00:00
|
|
|
case Edit::TOpCreateRefLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateRefLayer"));
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
nsRefPtr<RefLayerComposite> layer =
|
|
|
|
layer_manager()->CreateRefLayerComposite();
|
|
|
|
AsLayerComposite(edit.get_OpCreateRefLayer())->Bind(layer);
|
2012-07-17 23:59:45 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-07-21 21:17:33 +00:00
|
|
|
|
2013-03-21 17:08:01 +00:00
|
|
|
// Attributes
|
2010-07-21 21:17:33 +00:00
|
|
|
case Edit::TOpSetLayerAttributes: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] SetLayerAttributes"));
|
|
|
|
|
|
|
|
const OpSetLayerAttributes& osla = edit.get_OpSetLayerAttributes();
|
2014-02-20 16:40:55 +00:00
|
|
|
ShadowLayerParent* layerParent = AsLayerComposite(osla);
|
|
|
|
Layer* layer = layerParent->AsLayer();
|
2014-02-21 21:50:25 +00:00
|
|
|
if (!layer) {
|
|
|
|
return false;
|
|
|
|
}
|
2010-07-21 21:17:33 +00:00
|
|
|
const LayerAttributes& attrs = osla.attrs();
|
|
|
|
|
|
|
|
const CommonLayerAttributes& common = attrs.common();
|
2014-09-15 20:09:52 +00:00
|
|
|
layer->SetLayerBounds(common.layerBounds());
|
2010-07-21 21:17:33 +00:00
|
|
|
layer->SetVisibleRegion(common.visibleRegion());
|
2013-12-16 10:47:06 +00:00
|
|
|
layer->SetEventRegions(common.eventRegions());
|
2010-09-02 09:18:40 +00:00
|
|
|
layer->SetContentFlags(common.contentFlags());
|
2012-08-20 13:35:41 +00:00
|
|
|
layer->SetOpacity(common.opacity());
|
2015-04-12 02:03:00 +00:00
|
|
|
layer->SetClipRect(common.useClipRect() ? Some(common.clipRect()) : Nothing());
|
2012-07-31 17:28:20 +00:00
|
|
|
layer->SetBaseTransform(common.transform().value());
|
2012-08-03 21:29:22 +00:00
|
|
|
layer->SetPostScale(common.postXScale(), common.postYScale());
|
2012-12-23 15:47:16 +00:00
|
|
|
layer->SetIsFixedPosition(common.isFixedPosition());
|
|
|
|
layer->SetFixedPositionAnchor(common.fixedPositionAnchor());
|
2013-03-07 10:17:33 +00:00
|
|
|
layer->SetFixedPositionMargins(common.fixedPositionMargin());
|
2013-09-12 04:17:58 +00:00
|
|
|
if (common.isStickyPosition()) {
|
|
|
|
layer->SetStickyPositionData(common.stickyScrollContainerId(),
|
|
|
|
common.stickyScrollRangeOuter(),
|
|
|
|
common.stickyScrollRangeInner());
|
|
|
|
}
|
2013-12-12 18:34:50 +00:00
|
|
|
layer->SetScrollbarData(common.scrollbarTargetContainerId(),
|
2015-04-13 03:03:02 +00:00
|
|
|
static_cast<Layer::ScrollDirection>(common.scrollbarDirection()),
|
|
|
|
common.scrollbarThumbRatio());
|
2014-05-09 09:41:56 +00:00
|
|
|
layer->SetMixBlendMode((gfx::CompositionOp)common.mixBlendMode());
|
|
|
|
layer->SetForceIsolatedGroup(common.forceIsolatedGroup());
|
2012-03-18 23:02:38 +00:00
|
|
|
if (PLayerParent* maskLayer = common.maskLayerParent()) {
|
|
|
|
layer->SetMaskLayer(cast(maskLayer)->AsLayer());
|
|
|
|
} else {
|
2013-07-20 08:48:55 +00:00
|
|
|
layer->SetMaskLayer(nullptr);
|
2012-03-18 23:02:38 +00:00
|
|
|
}
|
2012-07-31 17:28:20 +00:00
|
|
|
layer->SetAnimations(common.animations());
|
2013-11-21 19:25:16 +00:00
|
|
|
layer->SetInvalidRegion(common.invalidRegion());
|
2014-08-12 00:00:36 +00:00
|
|
|
layer->SetFrameMetrics(common.metrics());
|
2010-07-21 21:17:33 +00:00
|
|
|
|
|
|
|
typedef SpecificLayerAttributes Specific;
|
|
|
|
const SpecificLayerAttributes& specific = attrs.specific();
|
|
|
|
switch (specific.type()) {
|
|
|
|
case Specific::Tnull_t:
|
|
|
|
break;
|
|
|
|
|
2014-09-26 17:06:08 +00:00
|
|
|
case Specific::TPaintedLayerAttributes: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] painted layer"));
|
2010-07-21 21:17:33 +00:00
|
|
|
|
2014-09-26 17:06:08 +00:00
|
|
|
PaintedLayerComposite* paintedLayer = layerParent->AsPaintedLayerComposite();
|
|
|
|
if (!paintedLayer) {
|
2014-02-20 16:40:55 +00:00
|
|
|
return false;
|
|
|
|
}
|
2014-09-26 17:06:08 +00:00
|
|
|
const PaintedLayerAttributes& attrs =
|
|
|
|
specific.get_PaintedLayerAttributes();
|
2010-09-03 20:10:46 +00:00
|
|
|
|
2014-09-26 17:06:08 +00:00
|
|
|
paintedLayer->SetValidRegion(attrs.validRegion());
|
2010-07-21 21:17:33 +00:00
|
|
|
|
2010-09-03 20:10:46 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-08-03 21:29:22 +00:00
|
|
|
case Specific::TContainerLayerAttributes: {
|
2010-09-03 20:10:45 +00:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] container layer"));
|
|
|
|
|
2014-02-20 16:40:55 +00:00
|
|
|
ContainerLayerComposite* containerLayer = layerParent->AsContainerLayerComposite();
|
|
|
|
if (!containerLayer) {
|
|
|
|
return false;
|
|
|
|
}
|
2012-08-03 21:29:22 +00:00
|
|
|
const ContainerLayerAttributes& attrs =
|
|
|
|
specific.get_ContainerLayerAttributes();
|
|
|
|
containerLayer->SetPreScale(attrs.preXScale(), attrs.preYScale());
|
2013-01-08 09:39:12 +00:00
|
|
|
containerLayer->SetInheritedScale(attrs.inheritedXScale(), attrs.inheritedYScale());
|
2015-01-03 01:06:14 +00:00
|
|
|
containerLayer->SetScaleToResolution(attrs.scaleToResolution(),
|
|
|
|
attrs.presShellResolution());
|
2015-02-17 02:30:02 +00:00
|
|
|
containerLayer->SetEventRegionsOverride(attrs.eventRegionsOverride());
|
2014-07-09 19:26:18 +00:00
|
|
|
|
|
|
|
if (attrs.hmdInfo()) {
|
|
|
|
if (!IsSameProcess()) {
|
|
|
|
NS_WARNING("VR layers currently not supported with cross-process compositing");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
containerLayer->SetVRHMDInfo(reinterpret_cast<mozilla::gfx::VRHMDInfo*>(attrs.hmdInfo()));
|
|
|
|
}
|
|
|
|
|
2010-09-03 20:10:45 +00:00
|
|
|
break;
|
2012-08-03 21:29:22 +00:00
|
|
|
}
|
2014-02-20 16:40:55 +00:00
|
|
|
case Specific::TColorLayerAttributes: {
|
2010-07-21 21:17:33 +00:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] color layer"));
|
|
|
|
|
2014-02-20 16:40:55 +00:00
|
|
|
ColorLayerComposite* colorLayer = layerParent->AsColorLayerComposite();
|
|
|
|
if (!colorLayer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
colorLayer->SetColor(specific.get_ColorLayerAttributes().color().value());
|
|
|
|
colorLayer->SetBounds(specific.get_ColorLayerAttributes().bounds());
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
2014-02-20 16:40:55 +00:00
|
|
|
}
|
|
|
|
case Specific::TCanvasLayerAttributes: {
|
2010-07-21 21:17:33 +00:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] canvas layer"));
|
|
|
|
|
2014-02-20 16:40:55 +00:00
|
|
|
CanvasLayerComposite* canvasLayer = layerParent->AsCanvasLayerComposite();
|
|
|
|
if (!canvasLayer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
canvasLayer->SetFilter(specific.get_CanvasLayerAttributes().filter());
|
|
|
|
canvasLayer->SetBounds(specific.get_CanvasLayerAttributes().bounds());
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
2014-02-20 16:40:55 +00:00
|
|
|
}
|
|
|
|
case Specific::TRefLayerAttributes: {
|
2012-07-17 23:59:45 +00:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] ref layer"));
|
|
|
|
|
2014-02-20 16:40:55 +00:00
|
|
|
RefLayerComposite* refLayer = layerParent->AsRefLayerComposite();
|
|
|
|
if (!refLayer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
refLayer->SetReferentId(specific.get_RefLayerAttributes().id());
|
2015-02-17 02:30:02 +00:00
|
|
|
refLayer->SetEventRegionsOverride(specific.get_RefLayerAttributes().eventRegionsOverride());
|
2012-07-17 23:59:45 +00:00
|
|
|
break;
|
2014-02-20 16:40:55 +00:00
|
|
|
}
|
2012-05-22 23:14:03 +00:00
|
|
|
case Specific::TImageLayerAttributes: {
|
2010-07-21 21:17:33 +00:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] image layer"));
|
|
|
|
|
2014-02-20 16:40:55 +00:00
|
|
|
ImageLayerComposite* imageLayer = layerParent->AsImageLayerComposite();
|
|
|
|
if (!imageLayer) {
|
|
|
|
return false;
|
|
|
|
}
|
2012-05-22 23:14:03 +00:00
|
|
|
const ImageLayerAttributes& attrs = specific.get_ImageLayerAttributes();
|
|
|
|
imageLayer->SetFilter(attrs.filter());
|
2013-05-09 21:02:50 +00:00
|
|
|
imageLayer->SetScaleToSize(attrs.scaleToSize(), attrs.scaleMode());
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
2012-05-22 23:14:03 +00:00
|
|
|
}
|
2010-07-21 21:17:33 +00:00
|
|
|
default:
|
|
|
|
NS_RUNTIMEABORT("not reached");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2013-08-02 22:50:17 +00:00
|
|
|
case Edit::TOpSetDiagnosticTypes: {
|
|
|
|
mLayerManager->GetCompositor()->SetDiagnosticTypes(
|
|
|
|
edit.get_OpSetDiagnosticTypes().diagnostics());
|
2013-03-21 17:08:01 +00:00
|
|
|
break;
|
|
|
|
}
|
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 09:20:52 +00:00
|
|
|
// Tree ops
|
2010-07-21 21:17:33 +00:00
|
|
|
case Edit::TOpSetRoot: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] SetRoot"));
|
|
|
|
|
2014-02-20 20:05:08 +00:00
|
|
|
Layer* newRoot = AsLayerComposite(edit.get_OpSetRoot())->AsLayer();
|
2014-02-26 21:23:51 +00:00
|
|
|
if (!newRoot) {
|
|
|
|
return false;
|
|
|
|
}
|
2014-02-20 20:05:08 +00:00
|
|
|
if (newRoot->GetParent()) {
|
2014-02-26 21:23:51 +00:00
|
|
|
// newRoot is not a root!
|
2014-02-20 20:05:08 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
mRoot = newRoot;
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpInsertAfter: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] InsertAfter"));
|
|
|
|
|
|
|
|
const OpInsertAfter& oia = edit.get_OpInsertAfter();
|
2014-02-21 21:50:25 +00:00
|
|
|
Layer* child = ShadowChild(oia)->AsLayer();
|
|
|
|
if (!child) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ContainerLayerComposite* container = ShadowContainer(oia)->AsContainerLayerComposite();
|
2014-02-21 21:50:25 +00:00
|
|
|
if (!container ||
|
|
|
|
!container->InsertAfter(child, ShadowAfter(oia)->AsLayer()))
|
|
|
|
{
|
2014-02-21 21:50:25 +00:00
|
|
|
return false;
|
|
|
|
}
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-02-24 14:41:55 +00:00
|
|
|
case Edit::TOpPrependChild: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] PrependChild"));
|
2010-07-21 21:17:33 +00:00
|
|
|
|
2014-02-24 14:41:55 +00:00
|
|
|
const OpPrependChild& oac = edit.get_OpPrependChild();
|
2014-02-21 21:50:25 +00:00
|
|
|
Layer* child = ShadowChild(oac)->AsLayer();
|
|
|
|
if (!child) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ContainerLayerComposite* container = ShadowContainer(oac)->AsContainerLayerComposite();
|
2014-02-21 21:50:25 +00:00
|
|
|
if (!container ||
|
|
|
|
!container->InsertAfter(child, nullptr))
|
|
|
|
{
|
2014-02-21 21:50:25 +00:00
|
|
|
return false;
|
|
|
|
}
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpRemoveChild: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] RemoveChild"));
|
|
|
|
|
|
|
|
const OpRemoveChild& orc = edit.get_OpRemoveChild();
|
|
|
|
Layer* childLayer = ShadowChild(orc)->AsLayer();
|
2014-02-21 21:50:25 +00:00
|
|
|
if (!childLayer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ContainerLayerComposite* container = ShadowContainer(orc)->AsContainerLayerComposite();
|
2014-02-21 21:50:25 +00:00
|
|
|
if (!container ||
|
|
|
|
!container->RemoveChild(childLayer))
|
|
|
|
{
|
2014-02-21 21:50:25 +00:00
|
|
|
return false;
|
|
|
|
}
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-08-29 10:52:55 +00:00
|
|
|
case Edit::TOpRepositionChild: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] RepositionChild"));
|
|
|
|
|
|
|
|
const OpRepositionChild& orc = edit.get_OpRepositionChild();
|
2014-02-21 21:50:25 +00:00
|
|
|
Layer* child = ShadowChild(orc)->AsLayer();
|
|
|
|
if (!child) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ContainerLayerComposite* container = ShadowContainer(orc)->AsContainerLayerComposite();
|
2014-02-21 21:50:25 +00:00
|
|
|
if (!container ||
|
|
|
|
!container->RepositionChild(child, ShadowAfter(orc)->AsLayer()))
|
|
|
|
{
|
2014-02-21 21:50:25 +00:00
|
|
|
return false;
|
|
|
|
}
|
2012-08-29 10:52:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpRaiseToTopChild: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] RaiseToTopChild"));
|
|
|
|
|
|
|
|
const OpRaiseToTopChild& rtc = edit.get_OpRaiseToTopChild();
|
2014-02-21 21:50:25 +00:00
|
|
|
Layer* child = ShadowChild(rtc)->AsLayer();
|
|
|
|
if (!child) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ContainerLayerComposite* container = ShadowContainer(rtc)->AsContainerLayerComposite();
|
2014-02-21 21:50:25 +00:00
|
|
|
if (!container ||
|
|
|
|
!container->RepositionChild(child, nullptr))
|
|
|
|
{
|
2014-02-21 21:50:25 +00:00
|
|
|
return false;
|
|
|
|
}
|
2012-08-29 10:52:55 +00:00
|
|
|
break;
|
|
|
|
}
|
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 09:20:52 +00:00
|
|
|
case Edit::TCompositableOperation: {
|
2014-03-10 22:12:49 +00:00
|
|
|
if (!ReceiveCompositableUpdate(edit.get_CompositableOperation(),
|
|
|
|
replyv)) {
|
|
|
|
return false;
|
|
|
|
}
|
2012-04-13 15:17:39 +00:00
|
|
|
break;
|
|
|
|
}
|
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 09:20:52 +00:00
|
|
|
case Edit::TOpAttachCompositable: {
|
|
|
|
const OpAttachCompositable& op = edit.get_OpAttachCompositable();
|
2014-04-25 15:15:58 +00:00
|
|
|
CompositableHost* host = CompositableHost::FromIPDLActor(op.compositableParent());
|
|
|
|
if (!Attach(cast(op.layerParent()), host, false)) {
|
2014-02-21 21:50:25 +00:00
|
|
|
return false;
|
|
|
|
}
|
2014-04-25 15:15:58 +00:00
|
|
|
host->SetCompositorID(mLayerManager->GetCompositor()->GetCompositorID());
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
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 09:20:52 +00:00
|
|
|
case Edit::TOpAttachAsyncCompositable: {
|
|
|
|
const OpAttachAsyncCompositable& op = edit.get_OpAttachAsyncCompositable();
|
2014-04-25 15:15:58 +00:00
|
|
|
PCompositableParent* compositableParent = CompositableMap::Get(op.containerID());
|
2014-04-23 14:46:50 +00:00
|
|
|
if (!compositableParent) {
|
|
|
|
NS_ERROR("CompositableParent not found in the map");
|
|
|
|
return false;
|
|
|
|
}
|
2014-04-25 15:15:58 +00:00
|
|
|
CompositableHost* host = CompositableHost::FromIPDLActor(compositableParent);
|
|
|
|
if (!Attach(cast(op.layerParent()), host, true)) {
|
2014-02-21 21:50:25 +00:00
|
|
|
return false;
|
|
|
|
}
|
2014-04-25 15:15:58 +00:00
|
|
|
|
|
|
|
host->SetCompositorID(mLayerManager->GetCompositor()->GetCompositorID());
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
NS_RUNTIMEABORT("not reached");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-26 12:40:10 +00:00
|
|
|
mShadowLayersManager->ShadowLayersUpdated(this, aTransactionId, targetConfig,
|
2015-01-29 19:41:55 +00:00
|
|
|
aPlugins, isFirstPaint, scheduleComposite,
|
|
|
|
paintSequenceNumber, isRepeatTransaction);
|
2014-06-26 12:40:10 +00:00
|
|
|
|
2014-02-11 04:01:20 +00:00
|
|
|
{
|
2014-02-24 22:45:40 +00:00
|
|
|
AutoResolveRefLayers resolve(mShadowLayersManager->GetCompositionManager(this));
|
2014-02-11 04:01:20 +00:00
|
|
|
layer_manager()->EndTransaction(nullptr, nullptr, LayerManager::END_NO_IMMEDIATE_REDRAW);
|
|
|
|
}
|
2010-07-21 21:17:33 +00:00
|
|
|
|
2013-03-22 19:22:20 +00:00
|
|
|
if (reply) {
|
|
|
|
reply->SetCapacity(replyv.size());
|
|
|
|
if (replyv.size() > 0) {
|
|
|
|
reply->AppendElements(&replyv.front(), replyv.size());
|
|
|
|
}
|
2010-07-21 23:13:24 +00:00
|
|
|
}
|
2010-07-21 21:17:33 +00:00
|
|
|
|
2014-06-11 13:52:20 +00:00
|
|
|
if (!IsSameProcess()) {
|
|
|
|
// Ensure that any pending operations involving back and front
|
|
|
|
// buffers have completed, so that neither process stomps on the
|
|
|
|
// other's buffer contents.
|
|
|
|
LayerManagerComposite::PlatformSyncBeforeReplyUpdate();
|
|
|
|
}
|
2010-09-14 05:23:08 +00:00
|
|
|
|
2012-02-10 23:06:17 +00:00
|
|
|
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
2012-03-19 11:55:37 +00:00
|
|
|
int compositeTime = (int)(mozilla::TimeStamp::Now() - updateStart).ToMilliseconds();
|
|
|
|
if (compositeTime > 15) {
|
|
|
|
printf_stderr("Compositor: Layers update took %i ms (blocking gecko).\n", compositeTime);
|
|
|
|
}
|
2012-02-10 23:06:17 +00:00
|
|
|
#endif
|
|
|
|
|
2015-02-06 03:56:08 +00:00
|
|
|
// Enable visual warning for long transaction when draw FPS option is enabled
|
|
|
|
bool drawFps = gfxPrefs::LayersDrawFPS();
|
|
|
|
if (drawFps) {
|
|
|
|
uint32_t visualWarningTrigger = gfxPrefs::LayerTransactionWarning();
|
|
|
|
// The default theshold is 200ms to trigger, hit red when it take 4 times longer
|
|
|
|
TimeDuration latency = TimeStamp::Now() - aTransactionStart;
|
|
|
|
if (latency > TimeDuration::FromMilliseconds(visualWarningTrigger)) {
|
|
|
|
float severity = (latency - TimeDuration::FromMilliseconds(visualWarningTrigger)).ToMilliseconds() /
|
|
|
|
(4 * visualWarningTrigger);
|
|
|
|
if (severity > 1.f) {
|
|
|
|
severity = 1.f;
|
|
|
|
}
|
|
|
|
mLayerManager->VisualFrameWarning(severity);
|
|
|
|
PR_LogPrint("LayerTransactionParent::RecvUpdate transaction from process %d took %f ms",
|
2015-04-01 08:40:35 +00:00
|
|
|
OtherPid(),
|
2015-02-06 03:56:08 +00:00
|
|
|
latency.ToMilliseconds());
|
2014-08-28 19:24:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-01 09:38:00 +00:00
|
|
|
profiler_tracing("Paint", "LayerTransaction", TRACING_INTERVAL_END);
|
2010-07-21 21:17:33 +00:00
|
|
|
return true;
|
2014-03-21 21:59:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
LayerTransactionParent::RecvSetTestSampleTime(const TimeStamp& aTime)
|
|
|
|
{
|
|
|
|
return mShadowLayersManager->SetTestSampleTime(this, aTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
LayerTransactionParent::RecvLeaveTestMode()
|
|
|
|
{
|
|
|
|
mShadowLayersManager->LeaveTestMode(this);
|
|
|
|
return true;
|
2010-07-21 21:17:33 +00:00
|
|
|
}
|
|
|
|
|
2013-05-30 00:38:27 +00:00
|
|
|
bool
|
|
|
|
LayerTransactionParent::RecvGetOpacity(PLayerParent* aParent,
|
|
|
|
float* aOpacity)
|
|
|
|
{
|
|
|
|
if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-02-21 21:50:25 +00:00
|
|
|
Layer* layer = cast(aParent)->AsLayer();
|
|
|
|
if (!layer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-25 00:05:52 +00:00
|
|
|
mShadowLayersManager->ApplyAsyncProperties(this);
|
|
|
|
|
2014-02-21 21:50:25 +00:00
|
|
|
*aOpacity = layer->GetLocalOpacity();
|
2013-05-30 00:38:27 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2014-03-10 04:47:12 +00:00
|
|
|
LayerTransactionParent::RecvGetAnimationTransform(PLayerParent* aParent,
|
|
|
|
MaybeTransform* aTransform)
|
2013-05-30 00:38:27 +00:00
|
|
|
{
|
|
|
|
if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-05-31 00:45:17 +00:00
|
|
|
Layer* layer = cast(aParent)->AsLayer();
|
2014-02-21 21:50:25 +00:00
|
|
|
if (!layer) {
|
|
|
|
return false;
|
|
|
|
}
|
2014-03-10 04:47:12 +00:00
|
|
|
|
Bug 1113425 part 2 - Apply async properties when querying the animated transform; r=mattwoodrow
In order to test off-main thread animations, we have a method that will return
the animated transform value set on a shadow layer. This method will return null
if the transform was not set by animation.
However, in some situations we temporarily clear the animation transform. For
example, when we synchronize a composite layer with its content layer, we reset
the animation transform. Then, on the next composite, we will recalculate the
animated value.
If we try to query the animated transform value in between resetting it and the
next composite we will get back null. To avoid a race condition, in
ShadowLayersUpdated after potentially clearing the animated transform, we
synchronously update the async properties on the layer transform in order
to reinstate the animated transform (so it is there when we go to query it).
However we *only* do this when the mIsTesting flag is set which is true
whenever we have the refresh driver under test control. Furthermore, we only
do it when we already have a pending composite task to better match conditions
under regular operation.
In test_deferred_start.html, however, we specifically need to test without
putting the refresh driver under test control. As a result mIsTesting will be
false and we can encounter a race condition when querying the animated
transform.
To work around this, this patch makes us *also* update async properties
when fetching the animated transform value. The method for getting the
animated transform value is only used for testing so it should have no effect
on the regular compositing behavior.
It would seem that we could then remove the call from ShadowLayersUpdated but
doing this caused a small number of test cases to fail. In particular one test
for *opacity* in test_animations_omta.html was failing at the end of the
animation because we ended up with a stale opacity animation value on the
compositor which the synchronous update was previously removing. The test,
in this case, should be ignoring the value on the compositor but, unlike
transform, there is no flag for indicating whether or not the opacity on shadow
layers has been set by animations. As a result, this patch leaves the call that
triggers a synchronous update in test mode when updating shadow layers.
2015-03-17 09:38:12 +00:00
|
|
|
// Make sure we apply the latest animation style or else we can end up with
|
|
|
|
// a race between when we temporarily clear the animation transform (in
|
|
|
|
// CompositorParent::SetShadowProperties) and when animation recalculates
|
|
|
|
// the value.
|
|
|
|
mShadowLayersManager->ApplyAsyncProperties(this);
|
|
|
|
|
2014-03-10 04:47:12 +00:00
|
|
|
// This method is specific to transforms applied by animation.
|
|
|
|
// This is because this method uses the information stored with an animation
|
|
|
|
// such as the origin of the reference frame corresponding to the layer, to
|
|
|
|
// recover the untranslated transform from the shadow transform. For
|
|
|
|
// transforms that are not set by animation we don't have this information
|
|
|
|
// available.
|
|
|
|
if (!layer->AsLayerComposite()->GetShadowTransformSetByAnimation()) {
|
|
|
|
*aTransform = mozilla::void_t();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The following code recovers the untranslated transform
|
|
|
|
// from the shadow transform by undoing the translations in
|
|
|
|
// AsyncCompositionManager::SampleValue.
|
|
|
|
|
2014-08-01 12:31:49 +00:00
|
|
|
Matrix4x4 transform = layer->AsLayerComposite()->GetShadowTransform();
|
2013-05-31 18:06:57 +00:00
|
|
|
if (ContainerLayer* c = layer->AsContainerLayer()) {
|
2014-03-10 04:47:12 +00:00
|
|
|
// Undo the scale transform applied by AsyncCompositionManager::SampleValue
|
2014-10-16 09:51:12 +00:00
|
|
|
transform.PostScale(1.0f/c->GetInheritedXScale(),
|
2014-03-10 04:47:12 +00:00
|
|
|
1.0f/c->GetInheritedYScale(),
|
|
|
|
1.0f);
|
2013-05-31 18:06:57 +00:00
|
|
|
}
|
2013-05-31 00:45:17 +00:00
|
|
|
float scale = 1;
|
2014-08-29 18:47:30 +00:00
|
|
|
Point3D scaledOrigin;
|
|
|
|
Point3D transformOrigin;
|
2013-05-31 00:45:17 +00:00
|
|
|
for (uint32_t i=0; i < layer->GetAnimations().Length(); i++) {
|
|
|
|
if (layer->GetAnimations()[i].data().type() == AnimationData::TTransformData) {
|
|
|
|
const TransformData& data = layer->GetAnimations()[i].data().get_TransformData();
|
|
|
|
scale = data.appUnitsPerDevPixel();
|
|
|
|
scaledOrigin =
|
2014-08-29 18:47:30 +00:00
|
|
|
Point3D(NS_round(NSAppUnitsToFloatPixels(data.origin().x, scale)),
|
|
|
|
NS_round(NSAppUnitsToFloatPixels(data.origin().y, scale)),
|
|
|
|
0.0f);
|
2015-04-23 02:37:04 +00:00
|
|
|
transformOrigin = data.transformOrigin();
|
2013-05-31 00:45:17 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-10 04:47:12 +00:00
|
|
|
// Undo the translation to the origin of the reference frame applied by
|
|
|
|
// AsyncCompositionManager::SampleValue
|
2014-10-16 09:51:12 +00:00
|
|
|
transform.PreTranslate(-scaledOrigin.x, -scaledOrigin.y, -scaledOrigin.z);
|
2014-03-10 04:47:12 +00:00
|
|
|
|
|
|
|
// Undo the rebasing applied by
|
|
|
|
// nsDisplayTransform::GetResultingTransformMatrixInternal
|
2014-08-29 18:47:30 +00:00
|
|
|
Point3D basis = -scaledOrigin - transformOrigin;
|
2014-08-01 12:31:49 +00:00
|
|
|
transform.ChangeBasis(basis.x, basis.y, basis.z);
|
2014-03-10 04:47:12 +00:00
|
|
|
|
|
|
|
// Convert to CSS pixels (this undoes the operations performed by
|
|
|
|
// nsStyleTransformMatrix::ProcessTranslatePart which is called from
|
|
|
|
// nsDisplayTransform::GetResultingTransformMatrix)
|
|
|
|
double devPerCss =
|
|
|
|
double(scale) / double(nsDeviceContext::AppUnitsPerCSSPixel());
|
2014-03-10 04:47:12 +00:00
|
|
|
transform._41 *= devPerCss;
|
|
|
|
transform._42 *= devPerCss;
|
|
|
|
transform._43 *= devPerCss;
|
2014-03-10 04:47:12 +00:00
|
|
|
|
2014-03-10 04:47:12 +00:00
|
|
|
*aTransform = transform;
|
2013-05-30 00:38:27 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-08-31 03:29:24 +00:00
|
|
|
static AsyncPanZoomController*
|
|
|
|
GetAPZCForViewID(Layer* aLayer, FrameMetrics::ViewID aScrollID)
|
|
|
|
{
|
|
|
|
for (uint32_t i = 0; i < aLayer->GetFrameMetricsCount(); i++) {
|
|
|
|
if (aLayer->GetFrameMetrics(i).GetScrollId() == aScrollID) {
|
|
|
|
return aLayer->GetAsyncPanZoomController(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ContainerLayer* container = aLayer->AsContainerLayer();
|
|
|
|
if (container) {
|
|
|
|
for (Layer* l = container->GetFirstChild(); l; l = l->GetNextSibling()) {
|
|
|
|
AsyncPanZoomController* c = GetAPZCForViewID(l, aScrollID);
|
|
|
|
if (c) {
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2014-02-14 08:59:23 +00:00
|
|
|
bool
|
2014-08-31 03:29:24 +00:00
|
|
|
LayerTransactionParent::RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aScrollID,
|
2014-02-14 08:59:23 +00:00
|
|
|
const int32_t& aX, const int32_t& aY)
|
|
|
|
{
|
|
|
|
if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-08-31 03:29:24 +00:00
|
|
|
AsyncPanZoomController* controller = GetAPZCForViewID(mRoot, aScrollID);
|
2014-02-14 08:59:23 +00:00
|
|
|
if (!controller) {
|
2014-04-23 14:42:40 +00:00
|
|
|
return false;
|
2014-02-14 08:59:23 +00:00
|
|
|
}
|
|
|
|
controller->SetTestAsyncScrollOffset(CSSPoint(aX, aY));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-05-07 23:56:48 +00:00
|
|
|
bool
|
|
|
|
LayerTransactionParent::RecvGetAPZTestData(APZTestData* aOutData)
|
|
|
|
{
|
|
|
|
mShadowLayersManager->GetAPZTestData(this, aOutData);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-02 19:23:34 +00:00
|
|
|
bool
|
|
|
|
LayerTransactionParent::RecvRequestProperty(const nsString& aProperty, float* aValue)
|
|
|
|
{
|
|
|
|
if (aProperty.Equals(NS_LITERAL_STRING("overdraw"))) {
|
|
|
|
*aValue = layer_manager()->GetCompositor()->GetFillRatio();
|
|
|
|
} else if (aProperty.Equals(NS_LITERAL_STRING("missed_hwc"))) {
|
|
|
|
*aValue = layer_manager()->LastFrameMissedHWC() ? 1 : 0;
|
|
|
|
} else {
|
|
|
|
*aValue = -1;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-04-14 16:24:32 +00:00
|
|
|
bool
|
|
|
|
LayerTransactionParent::RecvSetConfirmedTargetAPZC(const uint64_t& aBlockId,
|
|
|
|
nsTArray<ScrollableLayerGuid>&& aTargets)
|
|
|
|
{
|
|
|
|
mShadowLayersManager->SetConfirmedTargetAPZC(this, aBlockId, aTargets);
|
|
|
|
return true;
|
|
|
|
}
|
2014-09-02 19:23:34 +00:00
|
|
|
|
2014-02-21 21:50:25 +00:00
|
|
|
bool
|
2013-08-21 01:28:53 +00:00
|
|
|
LayerTransactionParent::Attach(ShadowLayerParent* aLayerParent,
|
2014-04-25 15:15:58 +00:00
|
|
|
CompositableHost* aCompositable,
|
|
|
|
bool aIsAsync)
|
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 09:20:52 +00:00
|
|
|
{
|
2014-04-25 15:15:58 +00:00
|
|
|
if (!aCompositable) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-02-21 21:50:25 +00:00
|
|
|
Layer* baselayer = aLayerParent->AsLayer();
|
|
|
|
if (!baselayer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
LayerComposite* layer = baselayer->AsLayerComposite();
|
|
|
|
if (!layer) {
|
|
|
|
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 09:20:52 +00:00
|
|
|
|
|
|
|
Compositor* compositor
|
|
|
|
= static_cast<LayerManagerComposite*>(aLayerParent->AsLayer()->Manager())->GetCompositor();
|
|
|
|
|
2014-04-25 15:15:58 +00:00
|
|
|
if (!layer->SetCompositableHost(aCompositable)) {
|
2014-02-20 13:05:30 +00:00
|
|
|
// not all layer types accept a compositable, see bug 967824
|
2014-02-21 21:50:25 +00:00
|
|
|
return false;
|
2014-02-20 13:05:30 +00:00
|
|
|
}
|
2014-04-25 15:15:58 +00:00
|
|
|
aCompositable->Attach(aLayerParent->AsLayer(),
|
|
|
|
compositor,
|
|
|
|
aIsAsync
|
|
|
|
? CompositableHost::ALLOW_REATTACH
|
|
|
|
| CompositableHost::KEEP_ATTACHED
|
|
|
|
: CompositableHost::NO_FLAGS);
|
2014-02-21 21:50:25 +00:00
|
|
|
return 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 09:20:52 +00:00
|
|
|
}
|
|
|
|
|
2012-11-08 03:51:55 +00:00
|
|
|
bool
|
2013-04-24 18:42:40 +00:00
|
|
|
LayerTransactionParent::RecvClearCachedResources()
|
2012-11-08 03:51:55 +00:00
|
|
|
{
|
|
|
|
if (mRoot) {
|
|
|
|
// NB: |mRoot| here is the *child* context's root. In this parent
|
|
|
|
// context, it's just a subtree root. We need to scope the clear
|
|
|
|
// of resources to exactly that subtree, so we specify it here.
|
|
|
|
mLayerManager->ClearCachedResources(mRoot);
|
|
|
|
}
|
2015-03-12 18:33:43 +00:00
|
|
|
mShadowLayersManager->NotifyClearCachedResources(this);
|
2012-11-08 03:51:55 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-03 00:59:58 +00:00
|
|
|
bool
|
|
|
|
LayerTransactionParent::RecvForceComposite()
|
|
|
|
{
|
|
|
|
mShadowLayersManager->ForceComposite(this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
PLayerParent*
|
2013-07-08 15:48:39 +00:00
|
|
|
LayerTransactionParent::AllocPLayerParent()
|
2010-08-20 23:24:41 +00:00
|
|
|
{
|
|
|
|
return new ShadowLayerParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 15:48:39 +00:00
|
|
|
LayerTransactionParent::DeallocPLayerParent(PLayerParent* actor)
|
2010-08-20 23:24:41 +00:00
|
|
|
{
|
|
|
|
delete actor;
|
|
|
|
return 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 09:20:52 +00:00
|
|
|
PCompositableParent*
|
2013-07-08 15:48:39 +00:00
|
|
|
LayerTransactionParent::AllocPCompositableParent(const TextureInfo& aInfo)
|
2011-09-27 22:19:26 +00:00
|
|
|
{
|
2014-04-25 15:15:58 +00:00
|
|
|
return CompositableHost::CreateIPDLActor(this, aInfo, 0);
|
2011-09-27 22:19:26 +00: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 09:20:52 +00:00
|
|
|
bool
|
2014-04-25 15:15:58 +00:00
|
|
|
LayerTransactionParent::DeallocPCompositableParent(PCompositableParent* aActor)
|
2011-09-27 22:19:26 +00:00
|
|
|
{
|
2014-04-25 15:15:58 +00:00
|
|
|
return CompositableHost::DestroyIPDLActor(aActor);
|
2011-09-27 22:19:26 +00:00
|
|
|
}
|
|
|
|
|
2013-12-12 01:44:44 +00:00
|
|
|
PTextureParent*
|
2014-01-21 22:06:18 +00:00
|
|
|
LayerTransactionParent::AllocPTextureParent(const SurfaceDescriptor& aSharedData,
|
|
|
|
const TextureFlags& aFlags)
|
2013-12-12 01:44:44 +00:00
|
|
|
{
|
2014-01-21 22:06:18 +00:00
|
|
|
return TextureHost::CreateIPDLActor(this, aSharedData, aFlags);
|
2013-12-12 01:44:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
LayerTransactionParent::DeallocPTextureParent(PTextureParent* actor)
|
|
|
|
{
|
|
|
|
return TextureHost::DestroyIPDLActor(actor);
|
|
|
|
}
|
|
|
|
|
2014-05-06 01:56:40 +00:00
|
|
|
bool
|
2015-01-16 19:58:52 +00:00
|
|
|
LayerTransactionParent::RecvChildAsyncMessages(InfallibleTArray<AsyncChildMessageData>&& aMessages)
|
2014-05-06 01:56:40 +00:00
|
|
|
{
|
2014-10-07 18:37:15 +00:00
|
|
|
AutoLayerTransactionParentAsyncMessageSender autoAsyncMessageSender(this);
|
|
|
|
|
2014-05-06 01:56:40 +00:00
|
|
|
for (AsyncChildMessageArray::index_type i = 0; i < aMessages.Length(); ++i) {
|
|
|
|
const AsyncChildMessageData& message = aMessages[i];
|
|
|
|
|
|
|
|
switch (message.type()) {
|
2014-10-07 18:37:15 +00:00
|
|
|
case AsyncChildMessageData::TOpRemoveTextureAsync: {
|
|
|
|
const OpRemoveTextureAsync& op = message.get_OpRemoveTextureAsync();
|
|
|
|
CompositableHost* compositable = CompositableHost::FromIPDLActor(op.compositableParent());
|
|
|
|
RefPtr<TextureHost> tex = TextureHost::AsTextureHost(op.textureParent());
|
|
|
|
|
|
|
|
MOZ_ASSERT(tex.get());
|
|
|
|
compositable->RemoveTextureHost(tex);
|
|
|
|
|
2015-03-11 13:53:43 +00:00
|
|
|
MOZ_ASSERT(ImageBridgeParent::GetInstance(GetChildProcessId()));
|
2015-03-02 21:38:45 +00:00
|
|
|
if (ImageBridgeParent::GetInstance(GetChildProcessId())) {
|
|
|
|
// send FenceHandle if present via ImageBridge.
|
2015-04-10 00:21:00 +00:00
|
|
|
ImageBridgeParent::AppendDeliverFenceMessage(
|
2015-03-02 21:38:45 +00:00
|
|
|
GetChildProcessId(),
|
|
|
|
op.holderId(),
|
|
|
|
op.transactionId(),
|
|
|
|
op.textureParent(),
|
|
|
|
compositable);
|
|
|
|
// Send message back via PImageBridge.
|
|
|
|
ImageBridgeParent::ReplyRemoveTexture(
|
|
|
|
GetChildProcessId(),
|
2015-04-10 00:19:00 +00:00
|
|
|
OpReplyRemoveTexture(op.holderId(),
|
|
|
|
op.transactionId()));
|
2015-03-02 21:38:45 +00:00
|
|
|
} else {
|
|
|
|
NS_ERROR("ImageBridgeParent should exist");
|
|
|
|
}
|
2014-10-07 18:37:15 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-05-06 01:56:40 +00:00
|
|
|
default:
|
|
|
|
NS_ERROR("unknown AsyncChildMessageData type");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LayerTransactionParent::ActorDestroy(ActorDestroyReason why)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-02-25 13:12:49 +00:00
|
|
|
bool LayerTransactionParent::IsSameProcess() const
|
|
|
|
{
|
2015-04-01 12:59:20 +00:00
|
|
|
return OtherPid() == base::GetCurrentProcId();
|
2014-02-25 13:12:49 +00:00
|
|
|
}
|
|
|
|
|
2014-10-06 22:45:03 +00:00
|
|
|
void
|
|
|
|
LayerTransactionParent::SendFenceHandleIfPresent(PTextureParent* aTexture,
|
|
|
|
CompositableHost* aCompositableHost)
|
|
|
|
{
|
|
|
|
RefPtr<TextureHost> texture = TextureHost::AsTextureHost(aTexture);
|
|
|
|
if (!texture) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Send a ReleaseFence of CompositorOGL.
|
|
|
|
if (aCompositableHost && aCompositableHost->GetCompositor()) {
|
|
|
|
FenceHandle fence = aCompositableHost->GetCompositor()->GetReleaseFence();
|
|
|
|
if (fence.IsValid()) {
|
2015-04-10 00:19:00 +00:00
|
|
|
mPendingAsyncMessage.push_back(OpDeliverFence(aTexture, nullptr,
|
2014-10-06 22:45:03 +00:00
|
|
|
fence));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Send a ReleaseFence that is set by HwcComposer2D.
|
|
|
|
FenceHandle fence = texture->GetAndResetReleaseFenceHandle();
|
|
|
|
if (fence.IsValid()) {
|
2015-04-10 00:19:00 +00:00
|
|
|
mPendingAsyncMessage.push_back(OpDeliverFence(aTexture, nullptr,
|
2014-10-06 22:45:03 +00:00
|
|
|
fence));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-14 22:40:15 +00:00
|
|
|
void
|
|
|
|
LayerTransactionParent::SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage)
|
|
|
|
{
|
2014-06-08 13:18:53 +00:00
|
|
|
mozilla::unused << SendParentAsyncMessages(aMessage);
|
2014-05-06 01:56:40 +00:00
|
|
|
}
|
|
|
|
|
2015-03-11 13:53:43 +00:00
|
|
|
void
|
|
|
|
LayerTransactionParent::ReplyRemoveTexture(const OpReplyRemoveTexture& aReply)
|
|
|
|
{
|
|
|
|
InfallibleTArray<AsyncParentMessageData> messages;
|
|
|
|
messages.AppendElement(aReply);
|
|
|
|
mozilla::unused << SendParentAsyncMessages(messages);
|
|
|
|
}
|
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|