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
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* 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 "CompositableHost.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include <map> // for _Rb_tree_iterator, map, etc
|
|
|
|
#include <utility> // for pair
|
|
|
|
#include "ContentHost.h" // for ContentHostDoubleBuffered, etc
|
|
|
|
#include "Effects.h" // for EffectMask, Effect, etc
|
|
|
|
#include "ImageHost.h" // for DeprecatedImageHostBuffered, etc
|
|
|
|
#include "TiledContentHost.h" // for TiledContentHost
|
|
|
|
#include "gfxImageSurface.h" // for gfxImageSurface
|
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
|
|
|
|
#include "mozilla/layers/TextureHost.h" // for TextureHost, etc
|
|
|
|
#include "nsAutoPtr.h" // for nsRefPtr
|
|
|
|
#include "nsDebug.h" // for NS_WARNING
|
|
|
|
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
|
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
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
class Matrix4x4;
|
|
|
|
class Compositor;
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
CompositableHost::CompositableHost(const TextureInfo& aTextureInfo)
|
|
|
|
: mTextureInfo(aTextureInfo)
|
|
|
|
, mCompositor(nullptr)
|
|
|
|
, mLayer(nullptr)
|
2013-08-04 00:46:17 -07:00
|
|
|
, mAttached(false)
|
2013-08-20 18:28:53 -07:00
|
|
|
, mKeepAttached(false)
|
2013-07-30 02:59:51 -07:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(CompositableHost);
|
|
|
|
}
|
|
|
|
|
|
|
|
CompositableHost::~CompositableHost()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(CompositableHost);
|
|
|
|
|
|
|
|
RefPtr<TextureHost> it = mFirstTexture;
|
|
|
|
while (it) {
|
2013-10-02 13:52:04 -07:00
|
|
|
if (!(it->GetFlags() & TEXTURE_DEALLOCATE_CLIENT)) {
|
2013-07-30 02:59:51 -07:00
|
|
|
it->DeallocateSharedData();
|
|
|
|
}
|
|
|
|
it = it->GetNextSibling();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CompositableHost::AddTextureHost(TextureHost* aTexture)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aTexture);
|
|
|
|
MOZ_ASSERT(GetTextureHost(aTexture->GetID()) == nullptr,
|
|
|
|
"A texture is already present with this ID");
|
|
|
|
RefPtr<TextureHost> second = mFirstTexture;
|
|
|
|
mFirstTexture = aTexture;
|
|
|
|
aTexture->SetNextSibling(second);
|
2013-09-30 05:14:38 -07:00
|
|
|
aTexture->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
|
2013-07-30 02:59:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CompositableHost::RemoveTextureHost(uint64_t aTextureID)
|
|
|
|
{
|
2013-09-10 04:41:15 -07:00
|
|
|
if (mFirstTexture && mFirstTexture->GetID() == aTextureID) {
|
|
|
|
RefPtr<TextureHost> toRemove = mFirstTexture;
|
|
|
|
mFirstTexture = mFirstTexture->GetNextSibling();
|
|
|
|
toRemove->SetNextSibling(nullptr);
|
|
|
|
}
|
2013-07-30 02:59:51 -07:00
|
|
|
RefPtr<TextureHost> it = mFirstTexture;
|
|
|
|
while (it) {
|
|
|
|
if (it->GetNextSibling() &&
|
|
|
|
it->GetNextSibling()->GetID() == aTextureID) {
|
2013-09-10 04:41:15 -07:00
|
|
|
RefPtr<TextureHost> toRemove = it->GetNextSibling();
|
2013-07-30 02:59:51 -07:00
|
|
|
it->SetNextSibling(it->GetNextSibling()->GetNextSibling());
|
2013-09-10 04:41:15 -07:00
|
|
|
toRemove->SetNextSibling(nullptr);
|
2013-07-30 02:59:51 -07:00
|
|
|
}
|
|
|
|
it = it->GetNextSibling();
|
|
|
|
}
|
2013-10-17 08:09:15 -07:00
|
|
|
if (!mFirstTexture && mBackendData) {
|
|
|
|
mBackendData->ClearData();
|
|
|
|
}
|
2013-07-30 02:59:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
TextureHost*
|
|
|
|
CompositableHost::GetTextureHost(uint64_t aTextureID)
|
|
|
|
{
|
|
|
|
RefPtr<TextureHost> it = mFirstTexture;
|
|
|
|
while (it) {
|
|
|
|
if (it->GetID() == aTextureID) {
|
|
|
|
return it;
|
|
|
|
}
|
|
|
|
it = it->GetNextSibling();
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
CompositableHost::SetCompositor(Compositor* aCompositor)
|
|
|
|
{
|
|
|
|
mCompositor = aCompositor;
|
|
|
|
RefPtr<TextureHost> it = mFirstTexture;
|
|
|
|
while (!!it) {
|
|
|
|
it->SetCompositor(aCompositor);
|
|
|
|
it = it->GetNextSibling();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
bool
|
|
|
|
CompositableHost::Update(const SurfaceDescriptor& aImage,
|
|
|
|
SurfaceDescriptor* aResult)
|
|
|
|
{
|
2013-07-08 14:30:44 -07:00
|
|
|
if (!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 02:20:52 -07:00
|
|
|
*aResult = aImage;
|
|
|
|
return false;
|
|
|
|
}
|
2013-07-08 14:30:44 -07:00
|
|
|
MOZ_ASSERT(!GetDeprecatedTextureHost()->GetBuffer(),
|
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
|
|
|
"This path not suitable for texture-level double buffering.");
|
2013-07-08 14:30:44 -07:00
|
|
|
GetDeprecatedTextureHost()->Update(aImage);
|
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
|
|
|
*aResult = aImage;
|
2013-07-08 14:30:44 -07:00
|
|
|
return GetDeprecatedTextureHost()->IsValid();
|
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
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
CompositableHost::AddMaskEffect(EffectChain& aEffects,
|
|
|
|
const gfx::Matrix4x4& aTransform,
|
|
|
|
bool aIs3D)
|
|
|
|
{
|
2013-08-01 18:12:16 -07:00
|
|
|
RefPtr<TextureSource> source;
|
|
|
|
RefPtr<DeprecatedTextureHost> oldHost = GetDeprecatedTextureHost();
|
|
|
|
if (oldHost) {
|
|
|
|
oldHost->Lock();
|
|
|
|
source = oldHost;
|
|
|
|
} else {
|
|
|
|
RefPtr<TextureHost> host = GetTextureHost();
|
|
|
|
if (host) {
|
|
|
|
host->Lock();
|
|
|
|
source = host->GetTextureSources();
|
|
|
|
}
|
|
|
|
}
|
2013-04-16 22:10:50 -07:00
|
|
|
|
|
|
|
if (!source) {
|
|
|
|
NS_WARNING("Using compositable with no texture host as mask 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 02:20:52 -07:00
|
|
|
RefPtr<EffectMask> effect = new EffectMask(source,
|
|
|
|
source->GetSize(),
|
|
|
|
aTransform);
|
|
|
|
effect->mIs3D = aIs3D;
|
|
|
|
aEffects.mSecondaryEffects[EFFECT_MASK] = effect;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-08-01 18:12:16 -07:00
|
|
|
void
|
|
|
|
CompositableHost::RemoveMaskEffect()
|
|
|
|
{
|
|
|
|
RefPtr<DeprecatedTextureHost> oldHost = GetDeprecatedTextureHost();
|
|
|
|
if (oldHost) {
|
|
|
|
oldHost->Unlock();
|
|
|
|
} else {
|
|
|
|
RefPtr<TextureHost> host = GetTextureHost();
|
|
|
|
if (host) {
|
|
|
|
host->Unlock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-12 19:39:26 -07:00
|
|
|
// implemented in TextureHostOGL.cpp
|
2013-09-30 05:14:38 -07:00
|
|
|
TemporaryRef<CompositableBackendSpecificData> CreateCompositableBackendSpecificDataOGL();
|
2013-09-12 19:39:26 -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
|
|
|
/* static */ TemporaryRef<CompositableHost>
|
2013-04-16 14:36:06 -07:00
|
|
|
CompositableHost::Create(const TextureInfo& 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
|
|
|
{
|
|
|
|
RefPtr<CompositableHost> result;
|
2013-04-12 00:28:55 -07:00
|
|
|
switch (aTextureInfo.mCompositableType) {
|
2013-07-30 02:59:51 -07:00
|
|
|
case COMPOSITABLE_IMAGE:
|
|
|
|
result = new ImageHost(aTextureInfo);
|
2013-09-12 19:39:26 -07: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 02:20:52 -07:00
|
|
|
case BUFFER_IMAGE_BUFFERED:
|
2013-07-24 09:08:35 -07:00
|
|
|
result = new DeprecatedImageHostBuffered(aTextureInfo);
|
2013-09-12 19:39:26 -07: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 02:20:52 -07:00
|
|
|
case BUFFER_IMAGE_SINGLE:
|
2013-07-24 09:08:35 -07:00
|
|
|
result = new DeprecatedImageHostSingle(aTextureInfo);
|
2013-09-12 19:39:26 -07: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 02:20:52 -07:00
|
|
|
case BUFFER_TILED:
|
2013-04-16 14:36:06 -07:00
|
|
|
result = new TiledContentHost(aTextureInfo);
|
2013-09-12 19:39:26 -07: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 02:20:52 -07:00
|
|
|
case BUFFER_CONTENT:
|
2013-04-16 14:36:06 -07:00
|
|
|
result = new ContentHostSingleBuffered(aTextureInfo);
|
2013-09-12 19:39:26 -07: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 02:20:52 -07:00
|
|
|
case BUFFER_CONTENT_DIRECT:
|
2013-04-16 14:36:06 -07:00
|
|
|
result = new ContentHostDoubleBuffered(aTextureInfo);
|
2013-09-12 19:39:26 -07:00
|
|
|
break;
|
2013-05-15 20:45:43 -07:00
|
|
|
case BUFFER_CONTENT_INC:
|
|
|
|
result = new ContentHostIncremental(aTextureInfo);
|
2013-09-12 19:39:26 -07: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 02:20:52 -07:00
|
|
|
default:
|
2013-06-28 18:38:30 -07:00
|
|
|
MOZ_CRASH("Unknown CompositableType");
|
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-09-12 19:39:26 -07:00
|
|
|
if (result) {
|
2013-09-30 05:14:38 -07:00
|
|
|
RefPtr<CompositableBackendSpecificData> data = CreateCompositableBackendSpecificDataOGL();
|
|
|
|
result->SetCompositableBackendSpecificData(data);
|
2013-09-12 19:39:26 -07:00
|
|
|
}
|
|
|
|
return result;
|
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-08-08 05:53:12 -07:00
|
|
|
#ifdef MOZ_DUMP_PAINTING
|
2013-05-25 19:44:24 -07:00
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
CompositableHost::DumpDeprecatedTextureHost(FILE* aFile, DeprecatedTextureHost* aTexture)
|
2013-05-25 19:44:24 -07:00
|
|
|
{
|
|
|
|
if (!aTexture) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nsRefPtr<gfxImageSurface> surf = aTexture->GetAsSurface();
|
|
|
|
if (!surf) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
surf->DumpAsDataURL(aFile ? aFile : stderr);
|
|
|
|
}
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
void
|
|
|
|
CompositableHost::DumpTextureHost(FILE* aFile, TextureHost* aTexture)
|
|
|
|
{
|
|
|
|
if (!aTexture) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nsRefPtr<gfxImageSurface> surf = aTexture->GetAsSurface();
|
|
|
|
if (!surf) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
surf->DumpAsDataURL(aFile ? aFile : stderr);
|
|
|
|
}
|
2013-08-08 05:53:12 -07:00
|
|
|
#endif
|
2013-07-30 02:59:51 -07:00
|
|
|
|
2013-04-11 03:14:29 -07:00
|
|
|
void
|
|
|
|
CompositableParent::ActorDestroy(ActorDestroyReason why)
|
|
|
|
{
|
|
|
|
if (mHost) {
|
2013-09-27 02:48:42 -07:00
|
|
|
// XXX: sadness warning. We should be able to do this whenever we get ActorDestroy,
|
|
|
|
// not just for abnormal shutdowns (which is the only case we _need_ to - so that
|
|
|
|
// we don't double release our shmems). But, for some reason, that causes a
|
|
|
|
// crash, we don't know why. (Bug 925773).
|
|
|
|
if (why == AbnormalShutdown) {
|
|
|
|
mHost->OnActorDestroy();
|
|
|
|
}
|
|
|
|
mHost->Detach(nullptr, CompositableHost::FORCE_DETACH);
|
2013-04-11 03:14:29 -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
|
|
|
|
|
|
|
CompositableParent::CompositableParent(CompositableParentManager* aMgr,
|
2013-04-12 00:28:55 -07:00
|
|
|
const TextureInfo& 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
|
|
|
uint64_t aID)
|
|
|
|
: mManager(aMgr)
|
2013-04-12 00:28:55 -07:00
|
|
|
, mType(aTextureInfo.mCompositableType)
|
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
|
|
|
, mID(aID)
|
|
|
|
, mCompositorID(0)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(CompositableParent);
|
2013-04-12 00:28:55 -07:00
|
|
|
mHost = CompositableHost::Create(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
|
|
|
if (aID) {
|
|
|
|
CompositableMap::Set(aID, this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CompositableParent::~CompositableParent()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(CompositableParent);
|
|
|
|
CompositableMap::Erase(mID);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace CompositableMap {
|
|
|
|
|
|
|
|
typedef std::map<uint64_t, CompositableParent*> CompositableMap_t;
|
|
|
|
static CompositableMap_t* sCompositableMap = nullptr;
|
|
|
|
bool IsCreated() {
|
|
|
|
return sCompositableMap != nullptr;
|
|
|
|
}
|
|
|
|
CompositableParent* Get(uint64_t aID)
|
|
|
|
{
|
|
|
|
if (!IsCreated() || aID == 0) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
CompositableMap_t::iterator it = sCompositableMap->find(aID);
|
|
|
|
if (it == sCompositableMap->end()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return it->second;
|
|
|
|
}
|
|
|
|
void Set(uint64_t aID, CompositableParent* aParent)
|
|
|
|
{
|
|
|
|
if (!IsCreated() || aID == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
(*sCompositableMap)[aID] = aParent;
|
|
|
|
}
|
|
|
|
void Erase(uint64_t aID)
|
|
|
|
{
|
|
|
|
if (!IsCreated() || aID == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CompositableMap_t::iterator it = sCompositableMap->find(aID);
|
|
|
|
if (it != sCompositableMap->end()) {
|
|
|
|
sCompositableMap->erase(it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void Clear()
|
|
|
|
{
|
|
|
|
if (!IsCreated()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sCompositableMap->clear();
|
|
|
|
}
|
|
|
|
void Create()
|
|
|
|
{
|
|
|
|
if (sCompositableMap == nullptr) {
|
|
|
|
sCompositableMap = new CompositableMap_t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void Destroy()
|
|
|
|
{
|
|
|
|
Clear();
|
|
|
|
delete sCompositableMap;
|
|
|
|
sCompositableMap = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace CompositableMap
|
|
|
|
|
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|