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: 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-12 03:17:23 +04:00
|
|
|
#include <stdint.h> // for uint64_t, uint32_t
|
|
|
|
#include "gfxPlatform.h" // for gfxPlatform
|
2013-08-12 06:21:17 +04:00
|
|
|
#include "mozilla/layers/CompositableForwarder.h"
|
2013-08-12 03:17:23 +04: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 05:14:12 +04:00
|
|
|
#include "gfxASurface.h" // for gfxContentType
|
2013-05-03 21:34:29 +04:00
|
|
|
#ifdef XP_WIN
|
2013-08-04 11:46:17 +04:00
|
|
|
#include "mozilla/layers/TextureD3D9.h"
|
2013-05-03 21:34:29 +04:00
|
|
|
#include "mozilla/layers/TextureD3D11.h"
|
|
|
|
#include "gfxWindowsPlatform.h"
|
2013-12-05 22:39:22 +04:00
|
|
|
#include "gfx2DGlue.h"
|
2013-05-03 21:34:29 +04: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 13:20:52 +04:00
|
|
|
|
2013-12-05 22:39:22 +04:00
|
|
|
using namespace mozilla::gfx;
|
|
|
|
|
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-07-30 13:59:51 +04:00
|
|
|
CompositableClient::CompositableClient(CompositableForwarder* aForwarder)
|
2013-12-12 05:44:47 +04:00
|
|
|
: mCompositableChild(nullptr)
|
2013-07-30 13:59:51 +04:00
|
|
|
, 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 13:20:52 +04:00
|
|
|
CompositableClient::~CompositableClient()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(CompositableClient);
|
|
|
|
Destroy();
|
2013-09-12 18:50:35 +04: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 13:20:52 +04: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 13:48:42 +04: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 13:20:52 +04: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-09 01:30:44 +04:00
|
|
|
TemporaryRef<DeprecatedTextureClient>
|
2013-09-24 05:14:12 +04:00
|
|
|
CompositableClient::CreateDeprecatedTextureClient(DeprecatedTextureClientType aDeprecatedTextureClientType,
|
2013-09-25 00:45:13 +04: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 13:20:52 +04: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-09 01:30:44 +04: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 13:20:52 +04:00
|
|
|
|
2013-07-09 01:30:44 +04: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 13:20:52 +04:00
|
|
|
case TEXTURE_SHARED_GL:
|
|
|
|
if (parentBackend == LAYERS_OPENGL) {
|
2013-07-09 01:30:44 +04: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 13:20:52 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TEXTURE_SHARED_GL_EXTERNAL:
|
|
|
|
if (parentBackend == LAYERS_OPENGL) {
|
2013-07-09 01:30:44 +04: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 13:20:52 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TEXTURE_STREAM_GL:
|
|
|
|
if (parentBackend == LAYERS_OPENGL) {
|
2013-07-09 01:30:44 +04: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 13:20:52 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TEXTURE_YCBCR:
|
2013-07-04 00:35:51 +04:00
|
|
|
if (parentBackend == LAYERS_OPENGL ||
|
2013-08-04 11:46:17 +04:00
|
|
|
parentBackend == LAYERS_D3D9 ||
|
2013-07-04 00:35:51 +04:00
|
|
|
parentBackend == LAYERS_D3D11 ||
|
|
|
|
parentBackend == LAYERS_BASIC) {
|
2013-07-09 01:30:44 +04:00
|
|
|
result = new DeprecatedTextureClientShmemYCbCr(GetForwarder(), GetTextureInfo());
|
2013-05-01 04:42:05 +04: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 13:20:52 +04:00
|
|
|
break;
|
|
|
|
case TEXTURE_CONTENT:
|
2013-05-03 21:34:29 +04:00
|
|
|
#ifdef XP_WIN
|
|
|
|
if (parentBackend == LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice()) {
|
2013-07-09 01:30:44 +04:00
|
|
|
result = new DeprecatedTextureClientD3D11(GetForwarder(), GetTextureInfo());
|
2013-05-03 21:34:29 +04:00
|
|
|
break;
|
|
|
|
}
|
2013-08-04 11:46:17 +04:00
|
|
|
if (parentBackend == LAYERS_D3D9 &&
|
|
|
|
!GetForwarder()->ForwardsToDifferentProcess()) {
|
2013-11-22 02:07:57 +04: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 05:14:12 +04:00
|
|
|
result = new DeprecatedTextureClientDIB(GetForwarder(), GetTextureInfo());
|
|
|
|
} else {
|
|
|
|
result = new DeprecatedTextureClientD3D9(GetForwarder(), GetTextureInfo());
|
|
|
|
}
|
2013-08-04 11:46:17 +04:00
|
|
|
break;
|
|
|
|
}
|
2013-05-03 21:34:29 +04: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 13:20:52 +04:00
|
|
|
// fall through to TEXTURE_SHMEM
|
|
|
|
case TEXTURE_SHMEM:
|
2013-07-09 01:30:44 +04: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 13:20:52 +04:00
|
|
|
break;
|
2013-08-04 11:46:17 +04:00
|
|
|
case TEXTURE_FALLBACK:
|
|
|
|
#ifdef XP_WIN
|
2013-08-21 05:13:57 +04:00
|
|
|
if (parentBackend == LAYERS_D3D11 ||
|
|
|
|
parentBackend == LAYERS_D3D9) {
|
2013-08-04 11:46:17 +04: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 13:20:52 +04:00
|
|
|
default:
|
|
|
|
MOZ_ASSERT(false, "Unhandled texture client type");
|
|
|
|
}
|
|
|
|
|
2013-05-01 04:42:05 +04: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-09 01:30:44 +04: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 13:20:52 +04:00
|
|
|
"Created the wrong texture client?");
|
2013-04-12 11:28:55 +04: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 13:20:52 +04:00
|
|
|
|
|
|
|
return result.forget();
|
|
|
|
}
|
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
TemporaryRef<BufferTextureClient>
|
2013-12-05 22:39:22 +04:00
|
|
|
CompositableClient::CreateBufferTextureClient(SurfaceFormat aFormat,
|
|
|
|
TextureFlags aTextureFlags)
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
2013-08-28 17:21:13 +04: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 13:59:51 +04:00
|
|
|
if (gfxPlatform::GetPlatform()->PreferMemoryOverShmem()) {
|
2013-08-03 21:30:28 +04:00
|
|
|
RefPtr<BufferTextureClient> result = new MemoryTextureClient(this, aFormat, aTextureFlags);
|
2013-07-30 13:59:51 +04:00
|
|
|
return result.forget();
|
|
|
|
}
|
2013-08-03 21:30:28 +04:00
|
|
|
RefPtr<BufferTextureClient> result = new ShmemTextureClient(this, aFormat, aTextureFlags);
|
2013-07-30 13:59:51 +04:00
|
|
|
return result.forget();
|
|
|
|
}
|
|
|
|
|
2013-12-05 22:39:22 +04:00
|
|
|
TemporaryRef<TextureClient>
|
|
|
|
CompositableClient::CreateTextureClientForDrawing(SurfaceFormat aFormat,
|
|
|
|
TextureFlags aTextureFlags)
|
|
|
|
{
|
|
|
|
RefPtr<TextureClient> result;
|
|
|
|
|
|
|
|
#ifdef XP_WIN
|
|
|
|
LayersBackend parentBackend = GetForwarder()->GetCompositorBackendType();
|
|
|
|
if (parentBackend == LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice() &&
|
|
|
|
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
|
2014-01-07 20:20:11 +04:00
|
|
|
result = new TextureClientD3D11(aFormat, aTextureFlags);
|
2013-12-05 22:39:22 +04:00
|
|
|
}
|
|
|
|
if (parentBackend == LAYERS_D3D9 &&
|
|
|
|
!GetForwarder()->ForwardsToDifferentProcess() &&
|
|
|
|
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
|
|
|
|
// non-DIB textures don't work with alpha, see notes in TextureD3D9.
|
2014-01-07 20:20:40 +04:00
|
|
|
if (ContentForFormat(aFormat) != GFX_CONTENT_COLOR) {
|
|
|
|
result = new DIBTextureClientD3D9(aFormat, aTextureFlags);
|
2013-12-05 22:39:22 +04:00
|
|
|
} else {
|
2014-01-07 20:20:40 +04:00
|
|
|
result = new CairoTextureClientD3D9(aFormat, aTextureFlags);
|
2013-12-05 22:39:22 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
// Can't do any better than a buffer texture client.
|
|
|
|
if (!result) {
|
|
|
|
result = CreateBufferTextureClient(aFormat, aTextureFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ASSERT(!result || result->AsTextureClientDrawTarget(),
|
|
|
|
"Not a TextureClientDrawTarget?");
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
CompositableClient::AddTextureClient(TextureClient* aClient)
|
|
|
|
{
|
2013-12-12 05:44:44 +04:00
|
|
|
return aClient->InitIPDLActor(mForwarder);
|
2013-12-11 23:52:50 +04:00
|
|
|
}
|
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
void
|
|
|
|
CompositableClient::OnTransaction()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
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 layers
|
|
|
|
} // namespace mozilla
|