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
|
|
|
/* -*- 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 "mozilla/layers/CompositableClient.h"
|
2013-08-11 23:17:23 +00:00
|
|
|
#include <stdint.h> // for uint64_t, uint32_t
|
|
|
|
#include "gfxPlatform.h" // for gfxPlatform
|
2013-08-12 02:21:17 +00:00
|
|
|
#include "mozilla/layers/CompositableForwarder.h"
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/layers/TextureClient.h" // for DeprecatedTextureClient, etc
|
|
|
|
#include "mozilla/layers/TextureClientOGL.h"
|
|
|
|
#include "mozilla/mozalloc.h" // for operator delete, etc
|
2013-09-24 01:14:12 +00:00
|
|
|
#include "gfxASurface.h" // for gfxContentType
|
2013-05-03 17:34:29 +00:00
|
|
|
#ifdef XP_WIN
|
2013-08-04 07:46:17 +00:00
|
|
|
#include "mozilla/layers/TextureD3D9.h"
|
2013-05-03 17:34:29 +00:00
|
|
|
#include "mozilla/layers/TextureD3D11.h"
|
|
|
|
#include "gfxWindowsPlatform.h"
|
|
|
|
#endif
|
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
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-07-30 09:59:51 +00:00
|
|
|
CompositableClient::CompositableClient(CompositableForwarder* aForwarder)
|
|
|
|
: mNextTextureID(1)
|
|
|
|
, mCompositableChild(nullptr)
|
|
|
|
, mForwarder(aForwarder)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(CompositableClient);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
CompositableClient::~CompositableClient()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(CompositableClient);
|
|
|
|
Destroy();
|
2013-09-12 14:50:35 +00:00
|
|
|
|
|
|
|
FlushTexturesToRemoveCallbacks();
|
2013-08-08 12:53:12 +00:00
|
|
|
MOZ_ASSERT(mTexturesToRemove.Length() == 0, "would leak textures pending for deletion");
|
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
|
|
|
}
|
|
|
|
|
2013-09-12 14:50:35 +00:00
|
|
|
void
|
|
|
|
CompositableClient::FlushTexturesToRemoveCallbacks()
|
|
|
|
{
|
|
|
|
std::map<uint64_t,TextureClientData*>::iterator it
|
|
|
|
= mTexturesToRemoveCallbacks.begin();
|
|
|
|
std::map<uint64_t,TextureClientData*>::iterator stop
|
|
|
|
= mTexturesToRemoveCallbacks.end();
|
|
|
|
for (; it != stop; ++it) {
|
|
|
|
it->second->DeallocateSharedData(GetForwarder());
|
|
|
|
delete it->second;
|
|
|
|
}
|
|
|
|
mTexturesToRemoveCallbacks.clear();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
LayersBackend
|
|
|
|
CompositableClient::GetCompositorBackendType() const
|
|
|
|
{
|
|
|
|
return mForwarder->GetCompositorBackendType();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CompositableClient::SetIPDLActor(CompositableChild* aChild)
|
|
|
|
{
|
|
|
|
mCompositableChild = aChild;
|
|
|
|
}
|
|
|
|
|
|
|
|
CompositableChild*
|
|
|
|
CompositableClient::GetIPDLActor() const
|
|
|
|
{
|
|
|
|
return mCompositableChild;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
CompositableClient::Connect()
|
|
|
|
{
|
|
|
|
if (!GetForwarder() || GetIPDLActor()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
GetForwarder()->Connect(this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CompositableClient::Destroy()
|
|
|
|
{
|
|
|
|
if (!mCompositableChild) {
|
|
|
|
return;
|
|
|
|
}
|
2013-09-27 09:48:42 +00:00
|
|
|
mCompositableChild->SetClient(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 09:20:52 +00:00
|
|
|
mCompositableChild->Destroy();
|
|
|
|
mCompositableChild = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t
|
|
|
|
CompositableClient::GetAsyncID() const
|
|
|
|
{
|
|
|
|
if (mCompositableChild) {
|
|
|
|
return mCompositableChild->GetAsyncID();
|
|
|
|
}
|
|
|
|
return 0; // zero is always an invalid async ID
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
CompositableChild::Destroy()
|
|
|
|
{
|
|
|
|
Send__delete__(this);
|
|
|
|
}
|
|
|
|
|
2013-07-08 21:30:44 +00:00
|
|
|
TemporaryRef<DeprecatedTextureClient>
|
2013-09-24 01:14:12 +00:00
|
|
|
CompositableClient::CreateDeprecatedTextureClient(DeprecatedTextureClientType aDeprecatedTextureClientType,
|
2013-09-24 20:45:13 +00:00
|
|
|
gfxContentType aContentType)
|
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
|
|
|
{
|
|
|
|
MOZ_ASSERT(GetForwarder(), "Can't create a texture client if the compositable is not connected to the compositor.");
|
|
|
|
LayersBackend parentBackend = GetForwarder()->GetCompositorBackendType();
|
2013-07-08 21:30:44 +00:00
|
|
|
RefPtr<DeprecatedTextureClient> 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 09:20:52 +00:00
|
|
|
|
2013-07-08 21:30:44 +00:00
|
|
|
switch (aDeprecatedTextureClientType) {
|
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 TEXTURE_SHARED_GL:
|
|
|
|
if (parentBackend == LAYERS_OPENGL) {
|
2013-07-08 21:30:44 +00:00
|
|
|
result = new DeprecatedTextureClientSharedOGL(GetForwarder(), GetTextureInfo());
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TEXTURE_SHARED_GL_EXTERNAL:
|
|
|
|
if (parentBackend == LAYERS_OPENGL) {
|
2013-07-08 21:30:44 +00:00
|
|
|
result = new DeprecatedTextureClientSharedOGLExternal(GetForwarder(), GetTextureInfo());
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TEXTURE_STREAM_GL:
|
|
|
|
if (parentBackend == LAYERS_OPENGL) {
|
2013-07-08 21:30:44 +00:00
|
|
|
result = new DeprecatedTextureClientStreamOGL(GetForwarder(), GetTextureInfo());
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TEXTURE_YCBCR:
|
2013-07-03 20:35:51 +00:00
|
|
|
if (parentBackend == LAYERS_OPENGL ||
|
2013-08-04 07:46:17 +00:00
|
|
|
parentBackend == LAYERS_D3D9 ||
|
2013-07-03 20:35:51 +00:00
|
|
|
parentBackend == LAYERS_D3D11 ||
|
|
|
|
parentBackend == LAYERS_BASIC) {
|
2013-07-08 21:30:44 +00:00
|
|
|
result = new DeprecatedTextureClientShmemYCbCr(GetForwarder(), GetTextureInfo());
|
2013-05-01 00:42:05 +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
|
|
|
break;
|
|
|
|
case TEXTURE_CONTENT:
|
2013-05-03 17:34:29 +00:00
|
|
|
#ifdef XP_WIN
|
|
|
|
if (parentBackend == LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice()) {
|
2013-07-08 21:30:44 +00:00
|
|
|
result = new DeprecatedTextureClientD3D11(GetForwarder(), GetTextureInfo());
|
2013-05-03 17:34:29 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-08-04 07:46:17 +00:00
|
|
|
if (parentBackend == LAYERS_D3D9 &&
|
|
|
|
!GetForwarder()->ForwardsToDifferentProcess()) {
|
2013-11-21 22:07:57 +00:00
|
|
|
// We can't use a d3d9 texture for an RGBA surface because we cannot get a DC for
|
|
|
|
// for a gfxWindowsSurface.
|
|
|
|
// We have to wait for the compositor thread to create a d3d9 device before we
|
|
|
|
// can create d3d9 textures on the main thread (because we need to reset on the
|
|
|
|
// compositor thread, and the d3d9 device must be reset on the same thread it was
|
|
|
|
// created on).
|
|
|
|
if (aContentType == GFX_CONTENT_COLOR_ALPHA ||
|
|
|
|
!gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
|
2013-09-24 01:14:12 +00:00
|
|
|
result = new DeprecatedTextureClientDIB(GetForwarder(), GetTextureInfo());
|
|
|
|
} else {
|
|
|
|
result = new DeprecatedTextureClientD3D9(GetForwarder(), GetTextureInfo());
|
|
|
|
}
|
2013-08-04 07:46:17 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-05-03 17:34:29 +00:00
|
|
|
#endif
|
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
|
|
|
// fall through to TEXTURE_SHMEM
|
|
|
|
case TEXTURE_SHMEM:
|
2013-07-08 21:30:44 +00:00
|
|
|
result = new DeprecatedTextureClientShmem(GetForwarder(), GetTextureInfo());
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
break;
|
2013-08-04 07:46:17 +00:00
|
|
|
case TEXTURE_FALLBACK:
|
|
|
|
#ifdef XP_WIN
|
2013-08-21 01:13:57 +00:00
|
|
|
if (parentBackend == LAYERS_D3D11 ||
|
|
|
|
parentBackend == LAYERS_D3D9) {
|
2013-08-04 07:46:17 +00:00
|
|
|
result = new DeprecatedTextureClientShmem(GetForwarder(), GetTextureInfo());
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
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
|
|
|
default:
|
|
|
|
MOZ_ASSERT(false, "Unhandled texture client type");
|
|
|
|
}
|
|
|
|
|
2013-05-01 00:42:05 +00:00
|
|
|
// If we couldn't create an appropriate texture client,
|
|
|
|
// then return nullptr so the caller can chose another
|
|
|
|
// type.
|
|
|
|
if (!result) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2013-07-08 21:30:44 +00:00
|
|
|
MOZ_ASSERT(result->SupportsType(aDeprecatedTextureClientType),
|
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
|
|
|
"Created the wrong texture client?");
|
2013-04-12 07:28:55 +00:00
|
|
|
result->SetFlags(GetTextureInfo().mTextureFlags);
|
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
|
|
|
|
|
|
|
return result.forget();
|
|
|
|
}
|
|
|
|
|
2013-07-30 09:59:51 +00:00
|
|
|
TemporaryRef<BufferTextureClient>
|
2013-12-04 17:19:50 +00:00
|
|
|
CompositableClient::CreateBufferTextureClient(gfx::SurfaceFormat aFormat,
|
|
|
|
uint32_t aTextureFlags)
|
2013-07-30 09:59:51 +00:00
|
|
|
{
|
2013-08-28 13:21:13 +00:00
|
|
|
// XXX - Once bug 908196 is fixed, we can use gralloc textures here which will
|
|
|
|
// improve performances of videos using SharedPlanarYCbCrImage on b2g.
|
|
|
|
//#ifdef MOZ_WIDGET_GONK
|
|
|
|
// {
|
|
|
|
// RefPtr<BufferTextureClient> result = new GrallocTextureClientOGL(this,
|
|
|
|
// aFormat,
|
|
|
|
// aTextureFlags);
|
|
|
|
// return result.forget();
|
|
|
|
// }
|
|
|
|
//#endif
|
2013-07-30 09:59:51 +00:00
|
|
|
if (gfxPlatform::GetPlatform()->PreferMemoryOverShmem()) {
|
2013-08-03 17:30:28 +00:00
|
|
|
RefPtr<BufferTextureClient> result = new MemoryTextureClient(this, aFormat, aTextureFlags);
|
2013-07-30 09:59:51 +00:00
|
|
|
return result.forget();
|
|
|
|
}
|
2013-08-03 17:30:28 +00:00
|
|
|
RefPtr<BufferTextureClient> result = new ShmemTextureClient(this, aFormat, aTextureFlags);
|
2013-07-30 09:59:51 +00:00
|
|
|
return result.forget();
|
|
|
|
}
|
|
|
|
|
2013-12-04 17:19:50 +00:00
|
|
|
bool
|
|
|
|
CompositableClient::AddTextureClient(TextureClient* aClient)
|
2013-07-30 09:59:51 +00:00
|
|
|
{
|
|
|
|
++mNextTextureID;
|
|
|
|
// 0 is always an invalid ID
|
|
|
|
if (mNextTextureID == 0) {
|
|
|
|
++mNextTextureID;
|
|
|
|
}
|
2013-12-04 17:19:50 +00:00
|
|
|
aClient->SetID(mNextTextureID);
|
2013-10-09 23:18:29 +00:00
|
|
|
return mForwarder->AddTexture(this, aClient);
|
2013-07-30 09:59:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CompositableClient::RemoveTextureClient(TextureClient* aClient)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aClient);
|
2013-09-12 14:50:28 +00:00
|
|
|
mTexturesToRemove.AppendElement(TextureIDAndFlags(aClient->GetID(),
|
|
|
|
aClient->GetFlags()));
|
2013-10-02 20:52:04 +00:00
|
|
|
if (aClient->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
|
2013-09-27 20:12:28 +00:00
|
|
|
TextureClientData* data = aClient->DropTextureData();
|
|
|
|
if (data) {
|
2013-09-12 14:50:28 +00:00
|
|
|
mTexturesToRemoveCallbacks[aClient->GetID()] = data;
|
|
|
|
}
|
|
|
|
}
|
2013-08-27 20:16:03 +00:00
|
|
|
aClient->ClearID();
|
2013-09-27 20:12:28 +00:00
|
|
|
aClient->MarkInvalid();
|
2013-07-30 09:59:51 +00:00
|
|
|
}
|
|
|
|
|
2013-09-12 14:50:28 +00:00
|
|
|
void
|
|
|
|
CompositableClient::OnReplyTextureRemoved(uint64_t aTextureID)
|
|
|
|
{
|
|
|
|
std::map<uint64_t,TextureClientData*>::iterator it
|
|
|
|
= mTexturesToRemoveCallbacks.find(aTextureID);
|
|
|
|
if (it != mTexturesToRemoveCallbacks.end()) {
|
|
|
|
it->second->DeallocateSharedData(GetForwarder());
|
|
|
|
delete it->second;
|
|
|
|
mTexturesToRemoveCallbacks.erase(it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-30 09:59:51 +00:00
|
|
|
void
|
|
|
|
CompositableClient::OnTransaction()
|
|
|
|
{
|
2013-08-08 12:53:12 +00:00
|
|
|
for (unsigned i = 0; i < mTexturesToRemove.Length(); ++i) {
|
2013-09-12 14:50:28 +00:00
|
|
|
const TextureIDAndFlags& texture = mTexturesToRemove[i];
|
|
|
|
mForwarder->RemoveTexture(this, texture.mID, texture.mFlags);
|
2013-07-30 09:59:51 +00:00
|
|
|
}
|
2013-08-08 12:53:12 +00:00
|
|
|
mTexturesToRemove.Clear();
|
2013-07-30 09:59:51 +00:00
|
|
|
}
|
|
|
|
|
2013-09-27 09:48:42 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
CompositableChild::ActorDestroy(ActorDestroyReason why)
|
|
|
|
{
|
|
|
|
if (mCompositableClient && why == AbnormalShutdown) {
|
|
|
|
mCompositableClient->OnActorDestroy();
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|