Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "CompositableTransactionParent.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "CompositableHost.h" // for CompositableParent, etc
|
|
|
|
#include "CompositorParent.h" // for CompositorParent
|
|
|
|
#include "Layers.h" // for Layer
|
|
|
|
#include "RenderTrace.h" // for RenderTraceInvalidateEnd, etc
|
|
|
|
#include "TiledLayerBuffer.h" // for TiledLayerComposer
|
|
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
|
|
|
#include "mozilla/RefPtr.h" // for RefPtr
|
|
|
|
#include "mozilla/layers/CompositorTypes.h"
|
|
|
|
#include "mozilla/layers/ContentHost.h" // for ContentHostBase
|
2013-04-26 02:25:33 +04:00
|
|
|
#include "mozilla/layers/LayerManagerComposite.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
|
|
|
|
#include "mozilla/layers/LayersTypes.h" // for MOZ_LAYERS_LOG
|
|
|
|
#include "mozilla/layers/TextureHost.h" // for TextureHost
|
2013-04-26 02:25:33 +04:00
|
|
|
#include "mozilla/layers/ThebesLayerComposite.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/mozalloc.h" // for operator delete
|
|
|
|
#include "nsDebug.h" // for NS_WARNING, NS_ASSERTION
|
|
|
|
#include "nsRegion.h" // for nsIntRegion
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
class BasicTiledLayerBuffer;
|
|
|
|
class Compositor;
|
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
template<typename T>
|
|
|
|
CompositableHost* AsCompositable(const T& op)
|
|
|
|
{
|
|
|
|
return static_cast<CompositableParent*>(op.compositableParent())->GetCompositableHost();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
bool ScheduleComposition(const T& op)
|
|
|
|
{
|
|
|
|
CompositableParent* comp = static_cast<CompositableParent*>(op.compositableParent());
|
|
|
|
if (!comp || !comp->GetCompositorID()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
CompositorParent* cp
|
|
|
|
= CompositorParent::GetCompositor(comp->GetCompositorID());
|
|
|
|
if (!cp) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
cp->ScheduleComposition();
|
|
|
|
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 13:20:52 +04:00
|
|
|
bool
|
|
|
|
CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation& aEdit,
|
|
|
|
EditReplyVector& replyv)
|
|
|
|
{
|
|
|
|
switch (aEdit.type()) {
|
2013-04-12 11:29:08 +04:00
|
|
|
case CompositableOperation::TOpCreatedTexture: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Created texture"));
|
|
|
|
const OpCreatedTexture& op = aEdit.get_OpCreatedTexture();
|
|
|
|
CompositableParent* compositableParent =
|
|
|
|
static_cast<CompositableParent*>(op.compositableParent());
|
|
|
|
CompositableHost* compositable = compositableParent->GetCompositableHost();
|
2013-04-12 11:28:55 +04:00
|
|
|
|
2013-07-09 01:30:44 +04:00
|
|
|
compositable->EnsureDeprecatedTextureHost(op.textureId(), op.descriptor(),
|
2013-04-12 11:29:08 +04:00
|
|
|
compositableParent->GetCompositableManager(),
|
|
|
|
op.textureInfo());
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2013-05-16 07:45:43 +04:00
|
|
|
case CompositableOperation::TOpCreatedIncrementalTexture: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Created texture"));
|
|
|
|
const OpCreatedIncrementalTexture& op = aEdit.get_OpCreatedIncrementalTexture();
|
|
|
|
|
|
|
|
CompositableParent* compositableParent =
|
|
|
|
static_cast<CompositableParent*>(op.compositableParent());
|
|
|
|
CompositableHost* compositable = compositableParent->GetCompositableHost();
|
|
|
|
|
2013-07-09 01:30:44 +04:00
|
|
|
compositable->EnsureDeprecatedTextureHostIncremental(compositableParent->GetCompositableManager(),
|
2013-05-31 08:36:19 +04:00
|
|
|
op.textureInfo(),
|
|
|
|
op.bufferRect());
|
2013-05-16 07:45:43 +04: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 13:20:52 +04:00
|
|
|
case CompositableOperation::TOpDestroyThebesBuffer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Created double buffer"));
|
|
|
|
const OpDestroyThebesBuffer& op = aEdit.get_OpDestroyThebesBuffer();
|
|
|
|
CompositableParent* compositableParent = static_cast<CompositableParent*>(op.compositableParent());
|
|
|
|
ContentHostBase* content = static_cast<ContentHostBase*>(compositableParent->GetCompositableHost());
|
|
|
|
content->DestroyTextures();
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CompositableOperation::TOpPaintTexture: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Paint Texture X"));
|
|
|
|
const OpPaintTexture& op = aEdit.get_OpPaintTexture();
|
|
|
|
|
2013-04-12 11:28:55 +04:00
|
|
|
CompositableParent* compositableParent =
|
|
|
|
static_cast<CompositableParent*>(op.compositableParent());
|
|
|
|
CompositableHost* compositable =
|
|
|
|
compositableParent->GetCompositableHost();
|
|
|
|
|
|
|
|
Layer* layer = compositable ? compositable->GetLayer() : nullptr;
|
2013-04-26 02:25:33 +04:00
|
|
|
LayerComposite* shadowLayer = layer ? layer->AsLayerComposite() : nullptr;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
if (shadowLayer) {
|
|
|
|
Compositor* compositor = static_cast<LayerManagerComposite*>(layer->Manager())->GetCompositor();
|
|
|
|
compositable->SetCompositor(compositor);
|
|
|
|
compositable->SetLayer(layer);
|
|
|
|
} else {
|
|
|
|
// if we reach this branch, it most likely means that async textures
|
2013-07-09 08:21:06 +04:00
|
|
|
// are coming in before we had time to attach the compositable to a
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
// layer. Don't panic, it is okay in this case. it should not be
|
|
|
|
// happening continuously, though.
|
|
|
|
}
|
|
|
|
|
|
|
|
if (layer) {
|
|
|
|
RenderTraceInvalidateStart(layer, "FF00FF", layer->GetVisibleRegion().GetBounds());
|
|
|
|
}
|
|
|
|
|
2013-04-24 18:32:43 +04:00
|
|
|
if (compositable) {
|
|
|
|
const SurfaceDescriptor& descriptor = op.image();
|
2013-07-09 01:30:44 +04:00
|
|
|
compositable->EnsureDeprecatedTextureHost(op.textureId(),
|
2013-04-24 18:32:43 +04:00
|
|
|
descriptor,
|
|
|
|
compositableParent->GetCompositableManager(),
|
|
|
|
TextureInfo());
|
2013-07-09 01:30:44 +04:00
|
|
|
MOZ_ASSERT(compositable->GetDeprecatedTextureHost());
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
2013-04-24 18:32:43 +04:00
|
|
|
SurfaceDescriptor newBack;
|
|
|
|
bool shouldRecomposite = compositable->Update(descriptor, &newBack);
|
|
|
|
if (IsSurfaceDescriptorValid(newBack)) {
|
|
|
|
replyv.push_back(OpTextureSwap(compositableParent, nullptr,
|
|
|
|
op.textureId(), newBack));
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
if (shouldRecomposite) {
|
|
|
|
ScheduleComposition(op);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (layer) {
|
|
|
|
RenderTraceInvalidateEnd(layer, "FF00FF");
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CompositableOperation::TOpPaintTextureRegion: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Paint ThebesLayer"));
|
|
|
|
|
|
|
|
const OpPaintTextureRegion& op = aEdit.get_OpPaintTextureRegion();
|
|
|
|
CompositableParent* compositableParent = static_cast<CompositableParent*>(op.compositableParent());
|
|
|
|
CompositableHost* compositable =
|
|
|
|
compositableParent->GetCompositableHost();
|
2013-04-26 02:25:33 +04:00
|
|
|
ThebesLayerComposite* thebes =
|
|
|
|
static_cast<ThebesLayerComposite*>(compositable->GetLayer());
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
|
|
|
const ThebesBufferData& bufferData = op.bufferData();
|
|
|
|
|
|
|
|
RenderTraceInvalidateStart(thebes, "FF00FF", op.updatedRegion().GetBounds());
|
|
|
|
|
|
|
|
nsIntRegion frontUpdatedRegion;
|
|
|
|
compositable->UpdateThebes(bufferData,
|
|
|
|
op.updatedRegion(),
|
|
|
|
thebes->GetValidRegion(),
|
|
|
|
&frontUpdatedRegion);
|
|
|
|
replyv.push_back(
|
|
|
|
OpContentBufferSwap(compositableParent, nullptr, frontUpdatedRegion));
|
|
|
|
|
|
|
|
RenderTraceInvalidateEnd(thebes, "FF00FF");
|
|
|
|
break;
|
|
|
|
}
|
2013-05-16 07:45:43 +04:00
|
|
|
case CompositableOperation::TOpPaintTextureIncremental: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Paint ThebesLayer"));
|
|
|
|
|
|
|
|
const OpPaintTextureIncremental& op = aEdit.get_OpPaintTextureIncremental();
|
|
|
|
|
|
|
|
CompositableParent* compositableParent = static_cast<CompositableParent*>(op.compositableParent());
|
|
|
|
CompositableHost* compositable =
|
|
|
|
compositableParent->GetCompositableHost();
|
|
|
|
|
|
|
|
SurfaceDescriptor desc = op.image();
|
|
|
|
|
|
|
|
compositable->UpdateIncremental(op.textureId(),
|
|
|
|
desc,
|
|
|
|
op.updatedRegion(),
|
|
|
|
op.bufferRect(),
|
|
|
|
op.bufferRotation());
|
|
|
|
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 13:20:52 +04:00
|
|
|
case CompositableOperation::TOpUpdatePictureRect: {
|
|
|
|
const OpUpdatePictureRect& op = aEdit.get_OpUpdatePictureRect();
|
|
|
|
CompositableHost* compositable
|
|
|
|
= static_cast<CompositableParent*>(op.compositableParent())->GetCompositableHost();
|
|
|
|
MOZ_ASSERT(compositable);
|
|
|
|
compositable->SetPictureRect(op.picture());
|
|
|
|
break;
|
|
|
|
}
|
2013-04-17 01:36:06 +04:00
|
|
|
case CompositableOperation::TOpPaintTiledLayerBuffer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Paint TiledLayerBuffer"));
|
|
|
|
const OpPaintTiledLayerBuffer& op = aEdit.get_OpPaintTiledLayerBuffer();
|
|
|
|
CompositableParent* compositableParent = static_cast<CompositableParent*>(op.compositableParent());
|
|
|
|
CompositableHost* compositable =
|
|
|
|
compositableParent->GetCompositableHost();
|
|
|
|
|
|
|
|
TiledLayerComposer* tileComposer = compositable->AsTiledLayerComposer();
|
|
|
|
NS_ASSERTION(tileComposer, "compositable is not a tile composer");
|
|
|
|
|
2013-08-19 17:59:22 +04:00
|
|
|
const SurfaceDescriptorTiles& tileDesc = op.tileLayerDescriptor();
|
|
|
|
tileComposer->PaintedTiledLayerBuffer(this, tileDesc);
|
2013-04-17 01:36:06 +04:00
|
|
|
break;
|
|
|
|
}
|
2013-07-30 13:59:51 +04:00
|
|
|
case CompositableOperation::TOpUseTexture: {
|
|
|
|
const OpUseTexture& op = aEdit.get_OpUseTexture();
|
|
|
|
if (op.textureID() == 0) {
|
|
|
|
NS_WARNING("Invalid texture ID");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CompositableHost* compositable = AsCompositable(op);
|
|
|
|
RefPtr<TextureHost> tex = compositable->GetTextureHost(op.textureID());
|
|
|
|
|
|
|
|
MOZ_ASSERT(tex.get());
|
|
|
|
compositable->UseTextureHost(tex);
|
|
|
|
|
|
|
|
if (!ScheduleComposition(op)) {
|
|
|
|
NS_WARNING("could not find a compositor to schedule composition");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CompositableOperation::TOpAddTexture: {
|
|
|
|
const OpAddTexture& op = aEdit.get_OpAddTexture();
|
|
|
|
if (op.textureID() == 0) {
|
|
|
|
NS_WARNING("Invalid texture ID");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CompositableHost* compositable = AsCompositable(op);
|
|
|
|
RefPtr<TextureHost> tex = TextureHost::Create(op.textureID(),
|
|
|
|
op.data(),
|
|
|
|
this,
|
|
|
|
op.textureFlags());
|
|
|
|
MOZ_ASSERT(tex.get());
|
|
|
|
tex->SetCompositor(compositable->GetCompositor());
|
2013-09-30 16:14:38 +04:00
|
|
|
// set CompositableBackendSpecificData
|
2013-09-13 06:39:26 +04:00
|
|
|
// on gonk, create EGLImage if possible.
|
|
|
|
// create EGLImage during buffer swap could reduce the graphic driver's task
|
|
|
|
// during rendering.
|
2013-07-30 13:59:51 +04:00
|
|
|
compositable->AddTextureHost(tex);
|
|
|
|
MOZ_ASSERT(compositable->GetTextureHost(op.textureID()) == tex.get());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CompositableOperation::TOpRemoveTexture: {
|
|
|
|
const OpRemoveTexture& op = aEdit.get_OpRemoveTexture();
|
|
|
|
if (op.textureID() == 0) {
|
|
|
|
NS_WARNING("Invalid texture ID");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CompositableHost* compositable = AsCompositable(op);
|
|
|
|
|
|
|
|
RefPtr<TextureHost> texture = compositable->GetTextureHost(op.textureID());
|
|
|
|
MOZ_ASSERT(texture);
|
|
|
|
|
|
|
|
TextureFlags flags = texture->GetFlags();
|
|
|
|
|
2013-10-03 00:52:04 +04:00
|
|
|
if (!(flags & TEXTURE_DEALLOCATE_CLIENT)) {
|
2013-07-30 13:59:51 +04:00
|
|
|
texture->DeallocateSharedData();
|
|
|
|
}
|
|
|
|
|
|
|
|
compositable->RemoveTextureHost(op.textureID());
|
|
|
|
|
|
|
|
// if it is not the host that deallocates the shared data, then we need
|
|
|
|
// to notfy the client side to tell when it is safe to deallocate or
|
|
|
|
// reuse it.
|
2013-10-03 00:52:04 +04:00
|
|
|
if (flags & TEXTURE_DEALLOCATE_CLIENT) {
|
2013-07-30 13:59:51 +04:00
|
|
|
replyv.push_back(ReplyTextureRemoved(op.compositableParent(), nullptr,
|
|
|
|
op.textureID()));
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CompositableOperation::TOpUpdateTexture: {
|
|
|
|
const OpUpdateTexture& op = aEdit.get_OpUpdateTexture();
|
|
|
|
if (op.textureID() == 0) {
|
|
|
|
NS_WARNING("Invalid texture ID");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CompositableHost* compositable = AsCompositable(op);
|
|
|
|
MOZ_ASSERT(compositable);
|
|
|
|
RefPtr<TextureHost> texture = compositable->GetTextureHost(op.textureID());
|
|
|
|
MOZ_ASSERT(texture);
|
2013-08-08 16:53:12 +04:00
|
|
|
|
|
|
|
texture->Updated(op.region().type() == MaybeRegion::TnsIntRegion
|
|
|
|
? &op.region().get_nsIntRegion()
|
|
|
|
: nullptr); // no region means invalidate the entire surface
|
|
|
|
|
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
compositable->UseTextureHost(texture);
|
|
|
|
|
|
|
|
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 13:20:52 +04:00
|
|
|
default: {
|
|
|
|
MOZ_ASSERT(false, "bad type");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
} // namespace
|
|
|
|
|