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/TextureHost.h"
|
2013-09-13 02:39:26 +00:00
|
|
|
#include "CompositableHost.h" // for CompositableHost
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "LayersLogging.h" // for AppendToString
|
|
|
|
#include "gfx2DGlue.h" // for ToIntSize
|
|
|
|
#include "mozilla/gfx/2D.h" // for DataSourceSurface, Factory
|
|
|
|
#include "mozilla/ipc/Shmem.h" // for Shmem
|
2014-05-06 01:56:40 +00:00
|
|
|
#include "mozilla/layers/CompositableTransactionParent.h" // for CompositableParentManager
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/layers/Compositor.h" // for Compositor
|
|
|
|
#include "mozilla/layers/ISurfaceAllocator.h" // for ISurfaceAllocator
|
2013-07-30 09:59:51 +00:00
|
|
|
#include "mozilla/layers/ImageDataSerializer.h"
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
|
2014-03-27 01:01:15 +00:00
|
|
|
#include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL
|
2014-02-18 00:30:05 +00:00
|
|
|
#ifdef MOZ_X11
|
|
|
|
#include "mozilla/layers/X11TextureHost.h"
|
|
|
|
#endif
|
2013-07-30 09:59:51 +00:00
|
|
|
#include "mozilla/layers/YCbCrImageDataSerializer.h"
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "nsAString.h"
|
|
|
|
#include "nsAutoPtr.h" // for nsRefPtr
|
|
|
|
#include "nsPrintfCString.h" // for nsPrintfCString
|
2013-12-12 01:44:44 +00:00
|
|
|
#include "mozilla/layers/PTextureParent.h"
|
2014-03-10 18:34:57 +00:00
|
|
|
#include "mozilla/unused.h"
|
2014-02-20 21:04:11 +00:00
|
|
|
#include <limits>
|
2013-07-30 09:59:51 +00:00
|
|
|
|
2014-03-10 18:34:57 +00:00
|
|
|
#if 0
|
|
|
|
#define RECYCLE_LOG(...) printf_stderr(__VA_ARGS__)
|
|
|
|
#else
|
|
|
|
#define RECYCLE_LOG(...) do { } while (0)
|
|
|
|
#endif
|
|
|
|
|
2013-08-11 23:17:23 +00:00
|
|
|
struct nsIntPoint;
|
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-12-12 01:44:44 +00:00
|
|
|
/**
|
|
|
|
* TextureParent is the host-side IPDL glue between TextureClient and TextureHost.
|
|
|
|
* It is an IPDL actor just like LayerParent, CompositableParent, etc.
|
|
|
|
*/
|
|
|
|
class TextureParent : public PTextureParent
|
|
|
|
{
|
|
|
|
public:
|
2014-05-06 01:56:40 +00:00
|
|
|
TextureParent(CompositableParentManager* aManager);
|
2013-12-12 01:44:44 +00:00
|
|
|
|
|
|
|
~TextureParent();
|
|
|
|
|
2014-01-21 22:06:18 +00:00
|
|
|
bool Init(const SurfaceDescriptor& aSharedData,
|
|
|
|
const TextureFlags& aFlags);
|
2013-12-12 01:44:44 +00:00
|
|
|
|
2014-03-10 18:34:57 +00:00
|
|
|
void CompositorRecycle();
|
2014-05-12 14:39:25 +00:00
|
|
|
|
|
|
|
void SendFenceHandleIfPresent();
|
|
|
|
|
2014-03-10 18:34:57 +00:00
|
|
|
virtual bool RecvClientRecycle() MOZ_OVERRIDE;
|
|
|
|
|
2014-05-13 01:18:22 +00:00
|
|
|
virtual bool RecvClearTextureHostSync() MOZ_OVERRIDE;
|
2013-12-12 01:44:45 +00:00
|
|
|
|
2014-05-13 01:18:22 +00:00
|
|
|
virtual bool RecvRemoveTexture() MOZ_OVERRIDE;
|
2013-12-12 01:44:45 +00:00
|
|
|
|
2013-12-12 01:44:44 +00:00
|
|
|
TextureHost* GetTextureHost() { return mTextureHost; }
|
|
|
|
|
2013-12-12 01:45:07 +00:00
|
|
|
void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
2013-12-12 01:45:01 +00:00
|
|
|
|
2014-05-13 01:18:22 +00:00
|
|
|
void ClearTextureHost();
|
|
|
|
|
2014-05-06 01:56:40 +00:00
|
|
|
CompositableParentManager* mCompositableManager;
|
2014-03-10 18:34:57 +00:00
|
|
|
RefPtr<TextureHost> mWaitForClientRecycle;
|
2013-12-12 01:44:44 +00:00
|
|
|
RefPtr<TextureHost> mTextureHost;
|
|
|
|
};
|
|
|
|
|
|
|
|
// static
|
|
|
|
PTextureParent*
|
2014-05-06 01:56:40 +00:00
|
|
|
TextureHost::CreateIPDLActor(CompositableParentManager* aManager,
|
2014-01-21 22:06:18 +00:00
|
|
|
const SurfaceDescriptor& aSharedData,
|
|
|
|
TextureFlags aFlags)
|
2013-12-12 01:44:44 +00:00
|
|
|
{
|
2014-02-25 13:12:49 +00:00
|
|
|
if (aSharedData.type() == SurfaceDescriptor::TSurfaceDescriptorMemory &&
|
2014-05-06 01:56:40 +00:00
|
|
|
!aManager->IsSameProcess())
|
2014-02-25 13:12:49 +00:00
|
|
|
{
|
|
|
|
NS_ERROR("A client process is trying to peek at our address space using a MemoryTexture!");
|
|
|
|
return nullptr;
|
|
|
|
}
|
2014-05-06 01:56:40 +00:00
|
|
|
TextureParent* actor = new TextureParent(aManager);
|
2014-02-25 13:12:50 +00:00
|
|
|
if (!actor->Init(aSharedData, aFlags)) {
|
|
|
|
delete actor;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2014-01-21 22:06:18 +00:00
|
|
|
return actor;
|
2013-12-12 01:44:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
bool
|
|
|
|
TextureHost::DestroyIPDLActor(PTextureParent* actor)
|
|
|
|
{
|
|
|
|
delete actor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
bool
|
|
|
|
TextureHost::SendDeleteIPDLActor(PTextureParent* actor)
|
|
|
|
{
|
|
|
|
return PTextureParent::Send__delete__(actor);
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
TextureHost*
|
|
|
|
TextureHost::AsTextureHost(PTextureParent* actor)
|
|
|
|
{
|
|
|
|
return actor? static_cast<TextureParent*>(actor)->mTextureHost : nullptr;
|
|
|
|
}
|
|
|
|
|
2014-02-25 04:23:41 +00:00
|
|
|
PTextureParent*
|
|
|
|
TextureHost::GetIPDLActor()
|
|
|
|
{
|
|
|
|
return mActor;
|
|
|
|
}
|
|
|
|
|
2014-05-12 14:39:25 +00:00
|
|
|
// static
|
|
|
|
void
|
|
|
|
TextureHost::SendFenceHandleIfPresent(PTextureParent* actor)
|
|
|
|
{
|
|
|
|
TextureParent* parent = static_cast<TextureParent*>(actor);
|
|
|
|
parent->SendFenceHandleIfPresent();
|
|
|
|
}
|
|
|
|
|
2014-05-24 16:14:45 +00:00
|
|
|
FenceHandle
|
|
|
|
TextureHost::GetAndResetReleaseFenceHandle()
|
|
|
|
{
|
|
|
|
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
|
|
|
|
TextureHostOGL* hostOGL = this->AsHostOGL();
|
|
|
|
if (!hostOGL) {
|
|
|
|
return FenceHandle();
|
|
|
|
}
|
|
|
|
|
|
|
|
android::sp<android::Fence> fence = hostOGL->GetAndResetReleaseFence();
|
|
|
|
if (fence.get() && fence->isValid()) {
|
|
|
|
FenceHandle handle = FenceHandle(fence);
|
|
|
|
return handle;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return FenceHandle();
|
|
|
|
}
|
|
|
|
|
2013-12-04 00:20:04 +00:00
|
|
|
// implemented in TextureHostOGL.cpp
|
2013-12-12 01:44:47 +00:00
|
|
|
TemporaryRef<TextureHost> CreateTextureHostOGL(const SurfaceDescriptor& aDesc,
|
2013-07-30 09:59:51 +00:00
|
|
|
ISurfaceAllocator* aDeallocator,
|
|
|
|
TextureFlags aFlags);
|
|
|
|
|
2013-12-04 00:20:04 +00:00
|
|
|
// implemented in TextureHostBasic.cpp
|
2013-12-12 01:44:47 +00:00
|
|
|
TemporaryRef<TextureHost> CreateTextureHostBasic(const SurfaceDescriptor& aDesc,
|
|
|
|
ISurfaceAllocator* aDeallocator,
|
|
|
|
TextureFlags aFlags);
|
2013-12-04 00:20:04 +00:00
|
|
|
|
2014-01-07 16:19:52 +00:00
|
|
|
// implemented in TextureD3D11.cpp
|
|
|
|
TemporaryRef<TextureHost> CreateTextureHostD3D11(const SurfaceDescriptor& aDesc,
|
|
|
|
ISurfaceAllocator* aDeallocator,
|
|
|
|
TextureFlags aFlags);
|
|
|
|
|
2014-01-07 16:20:03 +00:00
|
|
|
// implemented in TextureD3D9.cpp
|
|
|
|
TemporaryRef<TextureHost> CreateTextureHostD3D9(const SurfaceDescriptor& aDesc,
|
|
|
|
ISurfaceAllocator* aDeallocator,
|
|
|
|
TextureFlags aFlags);
|
|
|
|
|
2013-07-30 09:59:51 +00:00
|
|
|
// static
|
|
|
|
TemporaryRef<TextureHost>
|
2013-12-12 01:44:47 +00:00
|
|
|
TextureHost::Create(const SurfaceDescriptor& aDesc,
|
2013-07-30 09:59:51 +00:00
|
|
|
ISurfaceAllocator* aDeallocator,
|
|
|
|
TextureFlags aFlags)
|
|
|
|
{
|
2014-02-05 13:34:16 +00:00
|
|
|
switch (aDesc.type()) {
|
|
|
|
case SurfaceDescriptor::TSurfaceDescriptorShmem:
|
|
|
|
case SurfaceDescriptor::TSurfaceDescriptorMemory:
|
|
|
|
return CreateBackendIndependentTextureHost(aDesc, aDeallocator, aFlags);
|
|
|
|
case SurfaceDescriptor::TSharedTextureDescriptor:
|
|
|
|
case SurfaceDescriptor::TNewSurfaceDescriptorGralloc:
|
|
|
|
case SurfaceDescriptor::TSurfaceStreamDescriptor:
|
2014-02-05 20:45:03 +00:00
|
|
|
return CreateTextureHostOGL(aDesc, aDeallocator, aFlags);
|
2014-02-05 13:34:16 +00:00
|
|
|
case SurfaceDescriptor::TSurfaceDescriptorMacIOSurface:
|
|
|
|
if (Compositor::GetBackend() == LayersBackend::LAYERS_OPENGL) {
|
|
|
|
return CreateTextureHostOGL(aDesc, aDeallocator, aFlags);
|
|
|
|
} else {
|
|
|
|
return CreateTextureHostBasic(aDesc, aDeallocator, aFlags);
|
|
|
|
}
|
2014-02-05 16:39:02 +00:00
|
|
|
#ifdef MOZ_X11
|
2014-02-18 00:30:05 +00:00
|
|
|
case SurfaceDescriptor::TSurfaceDescriptorX11: {
|
|
|
|
const SurfaceDescriptorX11& desc = aDesc.get_SurfaceDescriptorX11();
|
|
|
|
RefPtr<TextureHost> result = new X11TextureHost(aFlags, desc);
|
|
|
|
return result;
|
|
|
|
}
|
2014-02-05 16:39:02 +00:00
|
|
|
#endif
|
2013-07-30 09:59:51 +00:00
|
|
|
#ifdef XP_WIN
|
2014-02-05 13:34:16 +00:00
|
|
|
case SurfaceDescriptor::TSurfaceDescriptorD3D9:
|
|
|
|
case SurfaceDescriptor::TSurfaceDescriptorDIB:
|
2014-02-05 20:45:03 +00:00
|
|
|
return CreateTextureHostD3D9(aDesc, aDeallocator, aFlags);
|
2014-02-05 13:34:16 +00:00
|
|
|
case SurfaceDescriptor::TSurfaceDescriptorD3D10:
|
2014-04-07 03:23:06 +00:00
|
|
|
if (Compositor::GetBackend() == LayersBackend::LAYERS_D3D9) {
|
|
|
|
return CreateTextureHostD3D9(aDesc, aDeallocator, aFlags);
|
|
|
|
} else {
|
|
|
|
return CreateTextureHostD3D11(aDesc, aDeallocator, aFlags);
|
|
|
|
}
|
2013-07-30 09:59:51 +00:00
|
|
|
#endif
|
|
|
|
default:
|
2014-02-05 13:34:16 +00:00
|
|
|
MOZ_CRASH("Unsupported Surface type");
|
2013-07-30 09:59:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TemporaryRef<TextureHost>
|
2013-12-12 01:44:47 +00:00
|
|
|
CreateBackendIndependentTextureHost(const SurfaceDescriptor& aDesc,
|
2013-07-30 09:59:51 +00:00
|
|
|
ISurfaceAllocator* aDeallocator,
|
|
|
|
TextureFlags aFlags)
|
|
|
|
{
|
|
|
|
RefPtr<TextureHost> result;
|
|
|
|
switch (aDesc.type()) {
|
|
|
|
case SurfaceDescriptor::TSurfaceDescriptorShmem: {
|
|
|
|
const SurfaceDescriptorShmem& descriptor = aDesc.get_SurfaceDescriptorShmem();
|
2013-12-12 01:44:47 +00:00
|
|
|
result = new ShmemTextureHost(descriptor.data(),
|
2013-07-30 09:59:51 +00:00
|
|
|
descriptor.format(),
|
|
|
|
aDeallocator,
|
|
|
|
aFlags);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SurfaceDescriptor::TSurfaceDescriptorMemory: {
|
|
|
|
const SurfaceDescriptorMemory& descriptor = aDesc.get_SurfaceDescriptorMemory();
|
2013-12-12 01:44:47 +00:00
|
|
|
result = new MemoryTextureHost(reinterpret_cast<uint8_t*>(descriptor.data()),
|
2013-07-30 09:59:51 +00:00
|
|
|
descriptor.format(),
|
|
|
|
aFlags);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
NS_WARNING("No backend independent TextureHost for this descriptor type");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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 09:20:52 +00:00
|
|
|
|
2014-03-27 01:01:15 +00:00
|
|
|
void
|
|
|
|
TextureHost::CompositorRecycle()
|
|
|
|
{
|
|
|
|
if (!mActor) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
static_cast<TextureParent*>(mActor)->CompositorRecycle();
|
|
|
|
}
|
|
|
|
|
2013-09-30 12:14:38 +00:00
|
|
|
void
|
|
|
|
TextureHost::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
|
2013-09-13 02:39:26 +00:00
|
|
|
{
|
2013-09-30 12:14:38 +00:00
|
|
|
mCompositableBackendData = aBackendData;
|
2013-09-13 02:39:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-12 01:44:47 +00:00
|
|
|
TextureHost::TextureHost(TextureFlags aFlags)
|
2014-02-25 04:23:41 +00:00
|
|
|
: mActor(nullptr)
|
|
|
|
, mFlags(aFlags)
|
2013-09-13 02:39:26 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
TextureHost::~TextureHost()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-12-12 01:45:01 +00:00
|
|
|
void TextureHost::Finalize()
|
|
|
|
{
|
2014-04-26 02:34:05 +00:00
|
|
|
if (!(GetFlags() & TextureFlags::DEALLOCATE_CLIENT)) {
|
2013-12-12 01:45:01 +00:00
|
|
|
DeallocateSharedData();
|
|
|
|
DeallocateDeviceData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-23 11:28:40 +00:00
|
|
|
void
|
|
|
|
TextureHost::PrintInfo(nsACString& aTo, const char* aPrefix)
|
|
|
|
{
|
|
|
|
aTo += aPrefix;
|
|
|
|
aTo += nsPrintfCString("%s (0x%p)", Name(), this);
|
2014-01-21 21:27:01 +00:00
|
|
|
// Note: the TextureHost needs to be locked before it is safe to call
|
|
|
|
// GetSize() and GetFormat() on it.
|
|
|
|
if (Lock()) {
|
|
|
|
AppendToString(aTo, GetSize(), " [size=", "]");
|
|
|
|
AppendToString(aTo, GetFormat(), " [format=", "]");
|
|
|
|
Unlock();
|
|
|
|
}
|
2013-09-23 11:28:40 +00:00
|
|
|
AppendToString(aTo, mFlags, " [flags=", "]");
|
|
|
|
}
|
|
|
|
|
2013-09-30 12:14:38 +00:00
|
|
|
void
|
|
|
|
TextureSource::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
|
2013-09-13 02:39:26 +00:00
|
|
|
{
|
2013-09-30 12:14:38 +00:00
|
|
|
mCompositableBackendData = aBackendData;
|
2013-09-13 02:39:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TextureSource::TextureSource()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(TextureSource);
|
|
|
|
}
|
|
|
|
TextureSource::~TextureSource()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(TextureSource);
|
|
|
|
}
|
|
|
|
|
2013-12-12 01:44:47 +00:00
|
|
|
BufferTextureHost::BufferTextureHost(gfx::SurfaceFormat aFormat,
|
2013-07-30 09:59:51 +00:00
|
|
|
TextureFlags aFlags)
|
2013-12-12 01:44:47 +00:00
|
|
|
: TextureHost(aFlags)
|
2013-07-30 09:59:51 +00:00
|
|
|
, mCompositor(nullptr)
|
|
|
|
, mFormat(aFormat)
|
|
|
|
, mUpdateSerial(1)
|
|
|
|
, mLocked(false)
|
|
|
|
, mPartialUpdate(false)
|
|
|
|
{}
|
|
|
|
|
|
|
|
BufferTextureHost::~BufferTextureHost()
|
|
|
|
{}
|
|
|
|
|
|
|
|
void
|
|
|
|
BufferTextureHost::Updated(const nsIntRegion* aRegion)
|
|
|
|
{
|
|
|
|
++mUpdateSerial;
|
|
|
|
if (aRegion) {
|
|
|
|
mPartialUpdate = true;
|
|
|
|
mMaybeUpdatedRegion = *aRegion;
|
|
|
|
} else {
|
|
|
|
mPartialUpdate = false;
|
|
|
|
}
|
2014-04-26 02:34:05 +00:00
|
|
|
if (GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) {
|
2013-08-19 23:39:56 +00:00
|
|
|
DebugOnly<bool> result = MaybeUpload(mPartialUpdate ? &mMaybeUpdatedRegion : nullptr);
|
2014-01-07 16:20:11 +00:00
|
|
|
NS_WARN_IF_FALSE(result, "Failed to upload a texture");
|
2013-08-03 17:30:28 +00:00
|
|
|
}
|
2013-07-30 09:59:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BufferTextureHost::SetCompositor(Compositor* aCompositor)
|
|
|
|
{
|
|
|
|
if (mCompositor == aCompositor) {
|
|
|
|
return;
|
|
|
|
}
|
2014-01-07 16:20:11 +00:00
|
|
|
RefPtr<NewTextureSource> it = mFirstSource;
|
|
|
|
while (it) {
|
|
|
|
it->SetCompositor(aCompositor);
|
|
|
|
it = it->GetNextSibling();
|
|
|
|
}
|
2013-07-30 09:59:51 +00:00
|
|
|
mCompositor = aCompositor;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BufferTextureHost::DeallocateDeviceData()
|
|
|
|
{
|
|
|
|
RefPtr<NewTextureSource> it = mFirstSource;
|
|
|
|
while (it) {
|
|
|
|
it->DeallocateDeviceData();
|
|
|
|
it = it->GetNextSibling();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BufferTextureHost::Lock()
|
|
|
|
{
|
|
|
|
mLocked = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BufferTextureHost::Unlock()
|
|
|
|
{
|
|
|
|
mLocked = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
NewTextureSource*
|
|
|
|
BufferTextureHost::GetTextureSources()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mLocked, "should never be called while not locked");
|
2013-08-03 17:30:28 +00:00
|
|
|
if (!MaybeUpload(mPartialUpdate ? &mMaybeUpdatedRegion : nullptr)) {
|
2013-07-30 09:59:51 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return mFirstSource;
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::SurfaceFormat
|
|
|
|
BufferTextureHost::GetFormat() const
|
|
|
|
{
|
|
|
|
// mFormat is the format of the data that we share with the content process.
|
|
|
|
// GetFormat, on the other hand, expects the format that we present to the
|
|
|
|
// Compositor (it is used to choose the effect type).
|
|
|
|
// if the compositor does not support YCbCr effects, we give it a RGBX texture
|
|
|
|
// instead (see BufferTextureHost::Upload)
|
2014-01-10 19:06:16 +00:00
|
|
|
if (mFormat == gfx::SurfaceFormat::YUV &&
|
2013-07-30 09:59:51 +00:00
|
|
|
mCompositor &&
|
2014-04-26 02:34:06 +00:00
|
|
|
!mCompositor->SupportsEffect(EffectTypes::YCBCR)) {
|
2014-01-10 19:06:16 +00:00
|
|
|
return gfx::SurfaceFormat::R8G8B8X8;
|
2013-07-30 09:59:51 +00:00
|
|
|
}
|
|
|
|
return mFormat;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-08-03 17:30:28 +00:00
|
|
|
BufferTextureHost::MaybeUpload(nsIntRegion *aRegion)
|
|
|
|
{
|
|
|
|
if (mFirstSource && mFirstSource->GetUpdateSerial() == mUpdateSerial) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!Upload(aRegion)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
mFirstSource->SetUpdateSerial(mUpdateSerial);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-30 09:59:51 +00:00
|
|
|
BufferTextureHost::Upload(nsIntRegion *aRegion)
|
|
|
|
{
|
2013-12-12 01:44:59 +00:00
|
|
|
if (!GetBuffer()) {
|
|
|
|
// We don't have a buffer; a possible cause is that the IPDL actor
|
|
|
|
// is already dead. This inevitably happens as IPDL actors can die
|
|
|
|
// at any time, so we want to silently return in this case.
|
|
|
|
return false;
|
|
|
|
}
|
2013-12-12 01:44:41 +00:00
|
|
|
if (!mCompositor) {
|
|
|
|
NS_WARNING("Tried to upload without a compositor. Skipping texture upload...");
|
|
|
|
// If we are in this situation it means we should have called SetCompositor
|
|
|
|
// earlier. It is conceivable that on certain rare conditions with async-video
|
|
|
|
// we may end up here for the first frame, but this should not happen repeatedly.
|
|
|
|
return false;
|
|
|
|
}
|
2014-01-10 19:06:16 +00:00
|
|
|
if (mFormat == gfx::SurfaceFormat::UNKNOWN) {
|
2013-07-30 09:59:51 +00:00
|
|
|
NS_WARNING("BufferTextureHost: unsupported format!");
|
|
|
|
return false;
|
2014-01-10 19:06:16 +00:00
|
|
|
} else if (mFormat == gfx::SurfaceFormat::YUV) {
|
2014-02-20 21:04:13 +00:00
|
|
|
YCbCrImageDataDeserializer yuvDeserializer(GetBuffer(), GetBufferSize());
|
2013-07-30 09:59:51 +00:00
|
|
|
MOZ_ASSERT(yuvDeserializer.IsValid());
|
|
|
|
|
2014-04-26 02:34:06 +00:00
|
|
|
if (!mCompositor->SupportsEffect(EffectTypes::YCBCR)) {
|
2013-07-30 09:59:51 +00:00
|
|
|
RefPtr<gfx::DataSourceSurface> surf = yuvDeserializer.ToDataSourceSurface();
|
|
|
|
if (!mFirstSource) {
|
|
|
|
mFirstSource = mCompositor->CreateDataTextureSource(mFlags);
|
|
|
|
}
|
2014-01-07 16:20:11 +00:00
|
|
|
mFirstSource->Update(surf, aRegion);
|
2013-07-30 09:59:51 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
RefPtr<DataTextureSource> srcY;
|
|
|
|
RefPtr<DataTextureSource> srcU;
|
|
|
|
RefPtr<DataTextureSource> srcV;
|
|
|
|
if (!mFirstSource) {
|
2013-08-01 23:02:06 +00:00
|
|
|
// We don't support BigImages for YCbCr compositing.
|
2014-04-26 02:34:05 +00:00
|
|
|
srcY = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
|
|
|
|
srcU = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
|
|
|
|
srcV = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
|
2013-07-30 09:59:51 +00:00
|
|
|
mFirstSource = srcY;
|
|
|
|
srcY->SetNextSibling(srcU);
|
|
|
|
srcU->SetNextSibling(srcV);
|
|
|
|
} else {
|
|
|
|
// mFormat never changes so if this was created as a YCbCr host and already
|
|
|
|
// contains a source it should already have 3 sources.
|
|
|
|
// BufferTextureHost only uses DataTextureSources so it is safe to assume
|
|
|
|
// all 3 sources are DataTextureSource.
|
|
|
|
MOZ_ASSERT(mFirstSource->GetNextSibling());
|
|
|
|
MOZ_ASSERT(mFirstSource->GetNextSibling()->GetNextSibling());
|
|
|
|
srcY = mFirstSource;
|
|
|
|
srcU = mFirstSource->GetNextSibling()->AsDataTextureSource();
|
|
|
|
srcV = mFirstSource->GetNextSibling()->GetNextSibling()->AsDataTextureSource();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RefPtr<gfx::DataSourceSurface> tempY =
|
|
|
|
gfx::Factory::CreateWrappingDataSourceSurface(yuvDeserializer.GetYData(),
|
|
|
|
yuvDeserializer.GetYStride(),
|
2013-12-20 16:46:30 +00:00
|
|
|
yuvDeserializer.GetYSize(),
|
2014-01-10 19:06:16 +00:00
|
|
|
gfx::SurfaceFormat::A8);
|
2013-07-30 09:59:51 +00:00
|
|
|
RefPtr<gfx::DataSourceSurface> tempCb =
|
|
|
|
gfx::Factory::CreateWrappingDataSourceSurface(yuvDeserializer.GetCbData(),
|
|
|
|
yuvDeserializer.GetCbCrStride(),
|
2013-12-20 16:46:30 +00:00
|
|
|
yuvDeserializer.GetCbCrSize(),
|
2014-01-10 19:06:16 +00:00
|
|
|
gfx::SurfaceFormat::A8);
|
2013-07-30 09:59:51 +00:00
|
|
|
RefPtr<gfx::DataSourceSurface> tempCr =
|
|
|
|
gfx::Factory::CreateWrappingDataSourceSurface(yuvDeserializer.GetCrData(),
|
|
|
|
yuvDeserializer.GetCbCrStride(),
|
2013-12-20 16:46:30 +00:00
|
|
|
yuvDeserializer.GetCbCrSize(),
|
2014-01-10 19:06:16 +00:00
|
|
|
gfx::SurfaceFormat::A8);
|
2013-07-30 09:59:51 +00:00
|
|
|
// We don't support partial updates for Y U V textures
|
|
|
|
NS_ASSERTION(!aRegion, "Unsupported partial updates for YCbCr textures");
|
2014-01-07 16:20:11 +00:00
|
|
|
if (!srcY->Update(tempY) ||
|
|
|
|
!srcU->Update(tempCb) ||
|
|
|
|
!srcV->Update(tempCr)) {
|
2013-07-30 09:59:51 +00:00
|
|
|
NS_WARNING("failed to update the DataTextureSource");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// non-YCbCr case
|
|
|
|
if (!mFirstSource) {
|
|
|
|
mFirstSource = mCompositor->CreateDataTextureSource();
|
|
|
|
}
|
2014-02-20 21:04:11 +00:00
|
|
|
ImageDataDeserializer deserializer(GetBuffer(), GetBufferSize());
|
2013-07-30 09:59:51 +00:00
|
|
|
if (!deserializer.IsValid()) {
|
2014-02-20 21:04:11 +00:00
|
|
|
NS_ERROR("Failed to deserialize image!");
|
2013-07-30 09:59:51 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
RefPtr<gfx::DataSourceSurface> surf = deserializer.GetAsSurface();
|
2013-08-19 23:39:55 +00:00
|
|
|
if (!surf) {
|
|
|
|
return false;
|
|
|
|
}
|
2013-07-30 09:59:51 +00:00
|
|
|
|
2014-01-07 16:20:11 +00:00
|
|
|
if (!mFirstSource->Update(surf.get(), aRegion)) {
|
2013-07-30 09:59:51 +00:00
|
|
|
NS_WARNING("failed to update the DataTextureSource");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-11-27 09:59:01 +00:00
|
|
|
TemporaryRef<gfx::DataSourceSurface>
|
2013-07-30 09:59:51 +00:00
|
|
|
BufferTextureHost::GetAsSurface()
|
|
|
|
{
|
2013-11-27 09:59:01 +00:00
|
|
|
RefPtr<gfx::DataSourceSurface> result;
|
2014-01-10 19:06:16 +00:00
|
|
|
if (mFormat == gfx::SurfaceFormat::UNKNOWN) {
|
2013-07-30 09:59:51 +00:00
|
|
|
NS_WARNING("BufferTextureHost: unsupported format!");
|
|
|
|
return nullptr;
|
2014-01-10 19:06:16 +00:00
|
|
|
} else if (mFormat == gfx::SurfaceFormat::YUV) {
|
2014-02-20 21:04:13 +00:00
|
|
|
YCbCrImageDataDeserializer yuvDeserializer(GetBuffer(), GetBufferSize());
|
2013-07-30 09:59:51 +00:00
|
|
|
if (!yuvDeserializer.IsValid()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2013-11-27 09:59:01 +00:00
|
|
|
result = yuvDeserializer.ToDataSourceSurface();
|
2013-07-30 09:59:51 +00:00
|
|
|
} else {
|
2014-02-20 21:04:11 +00:00
|
|
|
ImageDataDeserializer deserializer(GetBuffer(), GetBufferSize());
|
2013-07-30 09:59:51 +00:00
|
|
|
if (!deserializer.IsValid()) {
|
2014-02-20 21:04:11 +00:00
|
|
|
NS_ERROR("Failed to deserialize image!");
|
2013-07-30 09:59:51 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
2013-11-27 09:59:01 +00:00
|
|
|
result = deserializer.GetAsSurface();
|
2013-07-30 09:59:51 +00:00
|
|
|
}
|
|
|
|
return result.forget();
|
|
|
|
}
|
|
|
|
|
2013-12-12 01:44:47 +00:00
|
|
|
ShmemTextureHost::ShmemTextureHost(const ipc::Shmem& aShmem,
|
2013-07-30 09:59:51 +00:00
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
ISurfaceAllocator* aDeallocator,
|
|
|
|
TextureFlags aFlags)
|
2013-12-12 01:44:47 +00:00
|
|
|
: BufferTextureHost(aFormat, aFlags)
|
2013-07-30 09:59:51 +00:00
|
|
|
, mShmem(new ipc::Shmem(aShmem))
|
|
|
|
, mDeallocator(aDeallocator)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(ShmemTextureHost);
|
|
|
|
}
|
|
|
|
|
|
|
|
ShmemTextureHost::~ShmemTextureHost()
|
|
|
|
{
|
|
|
|
DeallocateDeviceData();
|
|
|
|
delete mShmem;
|
|
|
|
MOZ_COUNT_DTOR(ShmemTextureHost);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShmemTextureHost::DeallocateSharedData()
|
|
|
|
{
|
|
|
|
if (mShmem) {
|
|
|
|
MOZ_ASSERT(mDeallocator,
|
|
|
|
"Shared memory would leak without a ISurfaceAllocator");
|
|
|
|
mDeallocator->DeallocShmem(*mShmem);
|
2013-12-12 01:44:45 +00:00
|
|
|
delete mShmem;
|
|
|
|
mShmem = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShmemTextureHost::ForgetSharedData()
|
|
|
|
{
|
|
|
|
if (mShmem) {
|
|
|
|
delete mShmem;
|
2013-12-11 18:05:11 +00:00
|
|
|
mShmem = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-12-12 01:45:01 +00:00
|
|
|
ShmemTextureHost::OnShutdown()
|
2013-09-27 09:48:42 +00:00
|
|
|
{
|
|
|
|
delete mShmem;
|
|
|
|
mShmem = nullptr;
|
|
|
|
}
|
|
|
|
|
2013-07-30 09:59:51 +00:00
|
|
|
uint8_t* ShmemTextureHost::GetBuffer()
|
|
|
|
{
|
|
|
|
return mShmem ? mShmem->get<uint8_t>() : nullptr;
|
|
|
|
}
|
|
|
|
|
2014-02-20 21:04:11 +00:00
|
|
|
size_t ShmemTextureHost::GetBufferSize()
|
|
|
|
{
|
|
|
|
return mShmem ? mShmem->Size<uint8_t>() : 0;
|
|
|
|
}
|
|
|
|
|
2013-12-12 01:44:47 +00:00
|
|
|
MemoryTextureHost::MemoryTextureHost(uint8_t* aBuffer,
|
2013-07-30 09:59:51 +00:00
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
TextureFlags aFlags)
|
2013-12-12 01:44:47 +00:00
|
|
|
: BufferTextureHost(aFormat, aFlags)
|
2013-07-30 09:59:51 +00:00
|
|
|
, mBuffer(aBuffer)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(MemoryTextureHost);
|
|
|
|
}
|
|
|
|
|
|
|
|
MemoryTextureHost::~MemoryTextureHost()
|
|
|
|
{
|
|
|
|
DeallocateDeviceData();
|
2014-04-26 02:34:05 +00:00
|
|
|
NS_ASSERTION(!mBuffer || (mFlags & TextureFlags::DEALLOCATE_CLIENT),
|
2013-12-05 03:03:29 +00:00
|
|
|
"Leaking our buffer");
|
2013-08-02 01:12:16 +00:00
|
|
|
MOZ_COUNT_DTOR(MemoryTextureHost);
|
2013-07-30 09:59:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MemoryTextureHost::DeallocateSharedData()
|
|
|
|
{
|
2013-11-14 21:54:25 +00:00
|
|
|
if (mBuffer) {
|
|
|
|
GfxMemoryImageReporter::WillFree(mBuffer);
|
|
|
|
}
|
2013-07-30 09:59:51 +00:00
|
|
|
delete[] mBuffer;
|
2013-12-05 18:39:22 +00:00
|
|
|
mBuffer = nullptr;
|
2013-07-30 09:59:51 +00:00
|
|
|
}
|
|
|
|
|
2013-12-12 01:44:45 +00:00
|
|
|
void
|
|
|
|
MemoryTextureHost::ForgetSharedData()
|
|
|
|
{
|
|
|
|
mBuffer = nullptr;
|
|
|
|
}
|
|
|
|
|
2013-07-30 09:59:51 +00:00
|
|
|
uint8_t* MemoryTextureHost::GetBuffer()
|
|
|
|
{
|
|
|
|
return mBuffer;
|
|
|
|
}
|
|
|
|
|
2014-02-20 21:04:11 +00:00
|
|
|
size_t MemoryTextureHost::GetBufferSize()
|
|
|
|
{
|
|
|
|
// MemoryTextureHost just trusts that the buffer size is large enough to read
|
|
|
|
// anything we need to. That's because MemoryTextureHost has to trust the buffer
|
|
|
|
// pointer anyway, so the security model here is just that MemoryTexture's
|
|
|
|
// are restricted to same-process clients.
|
|
|
|
return std::numeric_limits<size_t>::max();
|
|
|
|
}
|
|
|
|
|
2014-05-06 01:56:40 +00:00
|
|
|
TextureParent::TextureParent(CompositableParentManager* aCompositableManager)
|
|
|
|
: mCompositableManager(aCompositableManager)
|
2013-12-12 01:44:44 +00:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(TextureParent);
|
|
|
|
}
|
|
|
|
|
|
|
|
TextureParent::~TextureParent()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(TextureParent);
|
2014-03-10 18:34:57 +00:00
|
|
|
if (mTextureHost) {
|
|
|
|
mTextureHost->ClearRecycleCallback();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void RecycleCallback(TextureHost* textureHost, void* aClosure) {
|
|
|
|
TextureParent* tp = reinterpret_cast<TextureParent*>(aClosure);
|
|
|
|
tp->CompositorRecycle();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TextureParent::CompositorRecycle()
|
|
|
|
{
|
|
|
|
mTextureHost->ClearRecycleCallback();
|
2014-05-12 14:39:25 +00:00
|
|
|
SendFenceHandleIfPresent();
|
|
|
|
|
|
|
|
if (mTextureHost->GetFlags() & TextureFlags::RECYCLE) {
|
|
|
|
mozilla::unused << SendCompositorRecycle();
|
|
|
|
// Don't forget to prepare for the next reycle
|
|
|
|
// if TextureClient request it.
|
|
|
|
mWaitForClientRecycle = mTextureHost;
|
|
|
|
}
|
|
|
|
}
|
2014-03-27 01:01:15 +00:00
|
|
|
|
2014-05-12 14:39:25 +00:00
|
|
|
void
|
|
|
|
TextureParent::SendFenceHandleIfPresent()
|
|
|
|
{
|
2014-03-27 01:01:15 +00:00
|
|
|
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
|
|
|
|
if (mTextureHost) {
|
|
|
|
TextureHostOGL* hostOGL = mTextureHost->AsHostOGL();
|
|
|
|
android::sp<android::Fence> fence = hostOGL->GetAndResetReleaseFence();
|
|
|
|
if (fence.get() && fence->isValid()) {
|
|
|
|
// HWC might not provide Fence.
|
|
|
|
// In this case, HWC implicitly handles buffer's fence.
|
2014-05-06 01:56:40 +00:00
|
|
|
|
|
|
|
FenceHandle handle = FenceHandle(fence);
|
2014-05-24 16:14:45 +00:00
|
|
|
RefPtr<FenceDeliveryTracker> tracker = new FenceDeliveryTracker(handle);
|
2014-05-06 01:56:40 +00:00
|
|
|
mCompositableManager->SendFenceHandle(tracker, this, handle);
|
2014-03-27 01:01:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2014-03-10 18:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TextureParent::RecvClientRecycle()
|
|
|
|
{
|
|
|
|
// This will allow the RecycleCallback to be called once the compositor
|
|
|
|
// releases any external references to TextureHost.
|
|
|
|
mTextureHost->SetRecycleCallback(RecycleCallback, this);
|
|
|
|
if (!mWaitForClientRecycle) {
|
|
|
|
RECYCLE_LOG("Not a recycable tile");
|
|
|
|
}
|
|
|
|
mWaitForClientRecycle = nullptr;
|
|
|
|
return true;
|
2013-12-12 01:44:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2014-01-21 22:06:18 +00:00
|
|
|
TextureParent::Init(const SurfaceDescriptor& aSharedData,
|
|
|
|
const TextureFlags& aFlags)
|
2013-12-12 01:44:44 +00:00
|
|
|
{
|
2013-12-12 01:44:47 +00:00
|
|
|
mTextureHost = TextureHost::Create(aSharedData,
|
2014-05-06 01:56:40 +00:00
|
|
|
mCompositableManager,
|
2013-12-12 01:44:44 +00:00
|
|
|
aFlags);
|
2014-03-10 18:34:57 +00:00
|
|
|
if (mTextureHost) {
|
|
|
|
mTextureHost->mActor = this;
|
2014-04-26 02:34:05 +00:00
|
|
|
if (aFlags & TextureFlags::RECYCLE) {
|
2014-03-10 18:34:57 +00:00
|
|
|
mWaitForClientRecycle = mTextureHost;
|
|
|
|
RECYCLE_LOG("Setup recycling for tile %p\n", this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-12 01:44:44 +00:00
|
|
|
return !!mTextureHost;
|
|
|
|
}
|
|
|
|
|
2013-12-12 01:44:45 +00:00
|
|
|
bool
|
|
|
|
TextureParent::RecvRemoveTexture()
|
|
|
|
{
|
|
|
|
return PTextureParent::Send__delete__(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2014-05-13 01:18:22 +00:00
|
|
|
TextureParent::RecvClearTextureHostSync()
|
2013-12-12 01:44:45 +00:00
|
|
|
{
|
2014-05-13 01:18:22 +00:00
|
|
|
ClearTextureHost();
|
|
|
|
return true;
|
2013-12-12 01:44:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TextureParent::ActorDestroy(ActorDestroyReason why)
|
|
|
|
{
|
|
|
|
switch (why) {
|
|
|
|
case AncestorDeletion:
|
|
|
|
case Deletion:
|
|
|
|
case NormalShutdown:
|
|
|
|
case AbnormalShutdown:
|
|
|
|
break;
|
|
|
|
case FailedConstructor:
|
|
|
|
NS_RUNTIMEABORT("FailedConstructor isn't possible in PTexture");
|
|
|
|
}
|
2014-01-23 15:26:59 +00:00
|
|
|
|
2014-05-13 01:18:22 +00:00
|
|
|
ClearTextureHost();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TextureParent::ClearTextureHost()
|
|
|
|
{
|
|
|
|
if (!mTextureHost) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-04-26 02:34:05 +00:00
|
|
|
if (mTextureHost->GetFlags() & TextureFlags::RECYCLE) {
|
2014-03-10 18:34:57 +00:00
|
|
|
RECYCLE_LOG("clear recycling for tile %p\n", this);
|
|
|
|
mTextureHost->ClearRecycleCallback();
|
|
|
|
}
|
2014-04-26 02:34:05 +00:00
|
|
|
if (mTextureHost->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
|
2014-01-23 15:26:59 +00:00
|
|
|
mTextureHost->ForgetSharedData();
|
|
|
|
}
|
2014-02-25 04:23:41 +00:00
|
|
|
|
2014-04-01 03:24:55 +00:00
|
|
|
// Clear recycle callback.
|
|
|
|
mTextureHost->ClearRecycleCallback();
|
|
|
|
mWaitForClientRecycle = nullptr;
|
|
|
|
|
2014-02-25 04:23:41 +00:00
|
|
|
mTextureHost->mActor = nullptr;
|
2013-12-12 01:44:45 +00:00
|
|
|
mTextureHost = 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
|
|
|
} // namespace
|
|
|
|
} // namespace
|