зеркало из https://github.com/mozilla/gecko-dev.git
Revert "Bug 1176011
- Move TextureClientPool to CompositorBridgeChild r=nical" on a CLOSED TREE
This reverts commit 5e29613bb6bc66d13bc63c4fab3a0130e801a058.
This commit is contained in:
Родитель
0fd4b861ca
Коммит
20caba9bab
|
@ -20,7 +20,7 @@ namespace layers {
|
|||
class D3D11RecycleAllocator : public TextureClientRecycleAllocator
|
||||
{
|
||||
public:
|
||||
explicit D3D11RecycleAllocator(TextureForwarder* aAllocator,
|
||||
explicit D3D11RecycleAllocator(CompositableForwarder* aAllocator,
|
||||
ID3D11Device* aDevice)
|
||||
: TextureClientRecycleAllocator(aAllocator)
|
||||
, mDevice(aDevice)
|
||||
|
|
|
@ -20,7 +20,7 @@ class TextureClient;
|
|||
class D3D9RecycleAllocator : public TextureClientRecycleAllocator
|
||||
{
|
||||
public:
|
||||
explicit D3D9RecycleAllocator(TextureForwarder* aAllocator,
|
||||
explicit D3D9RecycleAllocator(CompositableForwarder* aAllocator,
|
||||
IDirect3DDevice9* aDevice)
|
||||
: TextureClientRecycleAllocator(aAllocator)
|
||||
, mDevice(aDevice)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "mozilla/layers/PLayerChild.h" // for PLayerChild
|
||||
#include "mozilla/layers/LayerTransactionChild.h"
|
||||
#include "mozilla/layers/ShadowLayerChild.h"
|
||||
#include "mozilla/layers/TextureClientPool.h" // for TextureClientPool
|
||||
#include "mozilla/layers/PersistentBufferProvider.h"
|
||||
#include "ClientReadbackLayer.h" // for ClientReadbackLayer
|
||||
#include "nsAString.h"
|
||||
|
@ -134,6 +135,9 @@ ClientLayerManager::Destroy()
|
|||
// It's important to call ClearCachedResource before Destroy because the
|
||||
// former will early-return if the later has already run.
|
||||
ClearCachedResources();
|
||||
for (size_t i = 0; i < mTexturePools.Length(); i++) {
|
||||
mTexturePools[i]->Destroy();
|
||||
}
|
||||
LayerManager::Destroy();
|
||||
}
|
||||
|
||||
|
@ -425,6 +429,10 @@ ClientLayerManager::DidComposite(uint64_t aTransactionId,
|
|||
for (size_t i = 0; i < mDidCompositeObservers.Length(); i++) {
|
||||
mDidCompositeObservers[i]->DidComposite();
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < mTexturePools.Length(); i++) {
|
||||
mTexturePools[i]->ReturnDeferredClients();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -710,6 +718,29 @@ ClientLayerManager::SetIsFirstPaint()
|
|||
mForwarder->SetIsFirstPaint();
|
||||
}
|
||||
|
||||
TextureClientPool*
|
||||
ClientLayerManager::GetTexturePool(SurfaceFormat aFormat, TextureFlags aFlags)
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mDestroyed);
|
||||
|
||||
for (size_t i = 0; i < mTexturePools.Length(); i++) {
|
||||
if (mTexturePools[i]->GetFormat() == aFormat &&
|
||||
mTexturePools[i]->GetFlags() == aFlags) {
|
||||
return mTexturePools[i];
|
||||
}
|
||||
}
|
||||
|
||||
mTexturePools.AppendElement(
|
||||
new TextureClientPool(aFormat, aFlags,
|
||||
IntSize(gfxPlatform::GetPlatform()->GetTileWidth(),
|
||||
gfxPlatform::GetPlatform()->GetTileHeight()),
|
||||
gfxPrefs::LayersTileMaxPoolSize(),
|
||||
gfxPrefs::LayersTileShrinkPoolTimeout(),
|
||||
mForwarder));
|
||||
|
||||
return mTexturePools.LastElement();
|
||||
}
|
||||
|
||||
void
|
||||
ClientLayerManager::ClearCachedResources(Layer* aSubtree)
|
||||
{
|
||||
|
@ -724,9 +755,8 @@ ClientLayerManager::ClearCachedResources(Layer* aSubtree)
|
|||
} else if (mRoot) {
|
||||
ClearLayer(mRoot);
|
||||
}
|
||||
|
||||
if (GetCompositorBridgeChild()) {
|
||||
GetCompositorBridgeChild()->ClearTexturePool();
|
||||
for (size_t i = 0; i < mTexturePools.Length(); i++) {
|
||||
mTexturePools[i]->Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -737,8 +767,8 @@ ClientLayerManager::HandleMemoryPressure()
|
|||
HandleMemoryPressureLayer(mRoot);
|
||||
}
|
||||
|
||||
if (GetCompositorBridgeChild()) {
|
||||
GetCompositorBridgeChild()->HandleMemoryPressure();
|
||||
for (size_t i = 0; i < mTexturePools.Length(); i++) {
|
||||
mTexturePools[i]->ShrinkToMinimumSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ class CompositorBridgeChild;
|
|||
class ImageLayer;
|
||||
class PLayerChild;
|
||||
class FrameUniformityData;
|
||||
class TextureClientPool;
|
||||
|
||||
class ClientLayerManager final : public LayerManager
|
||||
{
|
||||
|
@ -115,6 +116,8 @@ public:
|
|||
|
||||
virtual void SetIsFirstPaint() override;
|
||||
|
||||
TextureClientPool* GetTexturePool(gfx::SurfaceFormat aFormat, TextureFlags aFlags);
|
||||
|
||||
/**
|
||||
* Pass through call to the forwarder for nsPresContext's
|
||||
* CollectPluginGeometryUpdates. Passes widget configuration information
|
||||
|
@ -341,6 +344,7 @@ private:
|
|||
APZTestData mApzTestData;
|
||||
|
||||
RefPtr<ShadowLayerForwarder> mForwarder;
|
||||
AutoTArray<RefPtr<TextureClientPool>,2> mTexturePools;
|
||||
AutoTArray<dom::OverfillCallback*,0> mOverfillCallbacks;
|
||||
mozilla::TimeStamp mTransactionStart;
|
||||
|
||||
|
|
|
@ -98,7 +98,6 @@ public:
|
|||
|
||||
TextureChild()
|
||||
: mForwarder(nullptr)
|
||||
, mTextureForwarder(nullptr)
|
||||
, mTextureClient(nullptr)
|
||||
, mTextureData(nullptr)
|
||||
, mDestroyed(false)
|
||||
|
@ -137,9 +136,8 @@ public:
|
|||
}
|
||||
|
||||
CompositableForwarder* GetForwarder() { return mForwarder; }
|
||||
TextureForwarder* GetTextureForwarder() { return mTextureForwarder; }
|
||||
|
||||
ClientIPCAllocator* GetAllocator() { return mTextureForwarder; }
|
||||
ClientIPCAllocator* GetAllocator() { return mForwarder; }
|
||||
|
||||
void ActorDestroy(ActorDestroyReason why) override;
|
||||
|
||||
|
@ -232,7 +230,6 @@ private:
|
|||
mutable gfx::CriticalSection mLock;
|
||||
|
||||
RefPtr<CompositableForwarder> mForwarder;
|
||||
RefPtr<TextureForwarder> mTextureForwarder;
|
||||
RefPtr<TextureClient> mWaitForRecycle;
|
||||
|
||||
TextureClient* mTextureClient;
|
||||
|
@ -837,10 +834,7 @@ bool
|
|||
TextureClient::InitIPDLActor(CompositableForwarder* aForwarder)
|
||||
{
|
||||
MOZ_ASSERT(aForwarder && aForwarder->GetMessageLoop() == mAllocator->AsClientAllocator()->GetMessageLoop());
|
||||
if (mActor && !mActor->mDestroyed) {
|
||||
if (mActor->GetForwarder() != aForwarder) {
|
||||
mActor->mForwarder = aForwarder;
|
||||
}
|
||||
if (mActor && !mActor->mDestroyed && mActor->GetForwarder() == aForwarder) {
|
||||
return true;
|
||||
}
|
||||
MOZ_ASSERT(!mActor || mActor->mDestroyed, "Cannot use a texture on several IPC channels.");
|
||||
|
@ -887,7 +881,7 @@ BackendTypeForBackendSelector(LayersBackend aLayersBackend, BackendSelector aSel
|
|||
|
||||
// static
|
||||
already_AddRefed<TextureClient>
|
||||
TextureClient::CreateForDrawing(TextureForwarder* aAllocator,
|
||||
TextureClient::CreateForDrawing(CompositableForwarder* aAllocator,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
BackendSelector aSelector,
|
||||
|
|
|
@ -64,7 +64,6 @@ class ITextureClientRecycleAllocator;
|
|||
#ifdef GFX_DEBUG_TRACK_CLIENTS_IN_POOL
|
||||
class TextureClientPool;
|
||||
#endif
|
||||
class TextureForwarder;
|
||||
class KeepAlive;
|
||||
|
||||
/**
|
||||
|
@ -337,7 +336,7 @@ public:
|
|||
|
||||
// Creates and allocates a TextureClient usable with Moz2D.
|
||||
static already_AddRefed<TextureClient>
|
||||
CreateForDrawing(TextureForwarder* aAllocator,
|
||||
CreateForDrawing(CompositableForwarder* aAllocator,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
BackendSelector aSelector,
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "TextureClientPool.h"
|
||||
#include "CompositableClient.h"
|
||||
#include "mozilla/layers/CompositableForwarder.h"
|
||||
#include "mozilla/layers/TextureForwarder.h"
|
||||
#include "mozilla/layers/TiledContentClient.h"
|
||||
|
||||
#include "gfxPrefs.h"
|
||||
|
@ -30,7 +29,7 @@ TextureClientPool::TextureClientPool(gfx::SurfaceFormat aFormat,
|
|||
gfx::IntSize aSize,
|
||||
uint32_t aMaxTextureClients,
|
||||
uint32_t aShrinkTimeoutMsec,
|
||||
TextureForwarder* aAllocator)
|
||||
CompositableForwarder* aAllocator)
|
||||
: mFormat(aFormat)
|
||||
, mFlags(aFlags)
|
||||
, mSize(aSize)
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace mozilla {
|
|||
namespace layers {
|
||||
|
||||
class ISurfaceAllocator;
|
||||
class TextureForwarder;
|
||||
class CompositableForwarder;
|
||||
class TextureReadLock;
|
||||
|
||||
class TextureClientAllocator
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
gfx::IntSize aSize,
|
||||
uint32_t aMaxTextureClients,
|
||||
uint32_t aShrinkTimeoutMsec,
|
||||
TextureForwarder* aAllocator);
|
||||
CompositableForwarder* aAllocator);
|
||||
|
||||
/**
|
||||
* Gets an allocated TextureClient of size and format that are determined
|
||||
|
@ -148,8 +148,7 @@ private:
|
|||
|
||||
std::list<RefPtr<TextureClient>> mTextureClientsDeferred;
|
||||
RefPtr<nsITimer> mTimer;
|
||||
// This mSurfaceAllocator owns us, so no need to hold a ref to it
|
||||
TextureForwarder* mSurfaceAllocator;
|
||||
RefPtr<CompositableForwarder> mSurfaceAllocator;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "gfxPlatform.h"
|
||||
#include "mozilla/layers/ISurfaceAllocator.h"
|
||||
#include "mozilla/layers/TextureForwarder.h"
|
||||
#include "mozilla/layers/CompositableForwarder.h"
|
||||
#include "TextureClientRecycleAllocator.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
already_AddRefed<TextureClient> Allocate(TextureForwarder* aAllocator) override
|
||||
already_AddRefed<TextureClient> Allocate(CompositableForwarder* aAllocator) override
|
||||
{
|
||||
return mAllocator->Allocate(mFormat,
|
||||
mSize,
|
||||
|
@ -71,7 +71,7 @@ protected:
|
|||
TextureClientRecycleAllocator* mAllocator;
|
||||
};
|
||||
|
||||
TextureClientRecycleAllocator::TextureClientRecycleAllocator(TextureForwarder* aAllocator)
|
||||
TextureClientRecycleAllocator::TextureClientRecycleAllocator(CompositableForwarder* aAllocator)
|
||||
: mSurfaceAllocator(aAllocator)
|
||||
, mMaxPooledSize(kMaxPooledSized)
|
||||
, mLock("TextureClientRecycleAllocatorImp.mLock")
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <map>
|
||||
#include <stack>
|
||||
#include "mozilla/gfx/Types.h"
|
||||
#include "mozilla/layers/TextureForwarder.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "TextureClient.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
|
@ -47,7 +46,7 @@ public:
|
|||
, mAllocationFlags(aAllocationFlags)
|
||||
{}
|
||||
|
||||
virtual already_AddRefed<TextureClient> Allocate(TextureForwarder* aAllocator) = 0;
|
||||
virtual already_AddRefed<TextureClient> Allocate(CompositableForwarder* aAllocator) = 0;
|
||||
virtual bool IsCompatible(TextureClient* aTextureClient) = 0;
|
||||
|
||||
const gfx::SurfaceFormat mFormat;
|
||||
|
@ -72,7 +71,7 @@ protected:
|
|||
virtual ~TextureClientRecycleAllocator();
|
||||
|
||||
public:
|
||||
explicit TextureClientRecycleAllocator(TextureForwarder* aAllocator);
|
||||
explicit TextureClientRecycleAllocator(CompositableForwarder* aAllocator);
|
||||
|
||||
void SetMaxPoolSize(uint32_t aMax);
|
||||
|
||||
|
@ -97,7 +96,7 @@ protected:
|
|||
TextureFlags aTextureFlags,
|
||||
TextureAllocationFlags aAllocFlags);
|
||||
|
||||
RefPtr<TextureForwarder> mSurfaceAllocator;
|
||||
RefPtr<CompositableForwarder> mSurfaceAllocator;
|
||||
|
||||
friend class DefaultTextureClientAllocationHelper;
|
||||
void RecycleTextureClient(TextureClient* aClient) override;
|
||||
|
|
|
@ -1113,7 +1113,7 @@ ClientMultiTiledLayerBuffer::ValidateTile(TileClient& aTile,
|
|||
|
||||
if (aTile.IsPlaceholderTile()) {
|
||||
aTile.SetLayerManager(mManager);
|
||||
aTile.SetTextureAllocator(mManager->GetCompositorBridgeChild()->GetTexturePool(
|
||||
aTile.SetTextureAllocator(mManager->GetTexturePool(
|
||||
gfxPlatform::GetPlatform()->Optimal2DFormatForContent(content),
|
||||
TextureFlags::DISALLOW_BIGIMAGE | TextureFlags::IMMEDIATE_UPLOAD));
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "mozilla/layers/ISurfaceAllocator.h" // for ISurfaceAllocator
|
||||
#include "mozilla/layers/LayersTypes.h" // for LayersBackend
|
||||
#include "mozilla/layers/TextureClient.h" // for TextureClient
|
||||
#include "mozilla/layers/TextureForwarder.h" // for TextureForwarder
|
||||
#include "nsRegion.h" // for nsIntRegion
|
||||
#include "mozilla/gfx/Rect.h"
|
||||
|
||||
|
@ -41,7 +40,7 @@ class PTextureChild;
|
|||
* additionally forward modifications of the Layer tree).
|
||||
* ImageBridgeChild is another CompositableForwarder.
|
||||
*/
|
||||
class CompositableForwarder : public TextureForwarder
|
||||
class CompositableForwarder : public ClientIPCAllocator
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -63,6 +62,14 @@ public:
|
|||
virtual void UseTiledLayerBuffer(CompositableClient* aCompositable,
|
||||
const SurfaceDescriptorTiles& aTiledDescriptor) = 0;
|
||||
|
||||
/**
|
||||
* Create a TextureChild/Parent pair as as well as the TextureHost on the parent side.
|
||||
*/
|
||||
virtual PTextureChild* CreateTexture(
|
||||
const SurfaceDescriptor& aSharedData,
|
||||
LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags) = 0;
|
||||
|
||||
/**
|
||||
* Communicate to the compositor that aRegion in the texture identified by
|
||||
* aCompositable and aIdentifier has been updated to aThebesBuffer.
|
||||
|
@ -129,6 +136,36 @@ public:
|
|||
|
||||
void IdentifyTextureHost(const TextureFactoryIdentifier& aIdentifier);
|
||||
|
||||
virtual int32_t GetMaxTextureSize() const override
|
||||
{
|
||||
return mTextureFactoryIdentifier.mMaxTextureSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of backend that is used off the main thread.
|
||||
* We only don't allow changing the backend type at runtime so this value can
|
||||
* be queried once and will not change until Gecko is restarted.
|
||||
*/
|
||||
LayersBackend GetCompositorBackendType() const
|
||||
{
|
||||
return mTextureFactoryIdentifier.mParentBackend;
|
||||
}
|
||||
|
||||
bool SupportsTextureBlitting() const
|
||||
{
|
||||
return mTextureFactoryIdentifier.mSupportsTextureBlitting;
|
||||
}
|
||||
|
||||
bool SupportsPartialUploads() const
|
||||
{
|
||||
return mTextureFactoryIdentifier.mSupportsPartialUploads;
|
||||
}
|
||||
|
||||
const TextureFactoryIdentifier& GetTextureFactoryIdentifier() const
|
||||
{
|
||||
return mTextureFactoryIdentifier;
|
||||
}
|
||||
|
||||
int32_t GetSerial() { return mSerial; }
|
||||
|
||||
SyncObject* GetSyncObject() { return mSyncObject; }
|
||||
|
@ -136,6 +173,7 @@ public:
|
|||
virtual CompositableForwarder* AsCompositableForwarder() override { return this; }
|
||||
|
||||
protected:
|
||||
TextureFactoryIdentifier mTextureFactoryIdentifier;
|
||||
nsTArray<RefPtr<TextureClient> > mTexturesToRemove;
|
||||
nsTArray<RefPtr<CompositableClient>> mCompositableClientsToRemove;
|
||||
RefPtr<SyncObject> mSyncObject;
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "base/task.h" // for NewRunnableMethod, etc
|
||||
#include "mozilla/layers/LayerTransactionChild.h"
|
||||
#include "mozilla/layers/PLayerTransactionChild.h"
|
||||
#include "mozilla/layers/TextureClientPool.h" // for TextureClientPool
|
||||
#include "mozilla/mozalloc.h" // for operator new, etc
|
||||
#include "nsDebug.h" // for NS_RUNTIMEABORT
|
||||
#include "nsIObserver.h" // for nsIObserver
|
||||
|
@ -42,12 +41,7 @@ Atomic<int32_t> CompositableForwarder::sSerialCounter(0);
|
|||
CompositorBridgeChild::CompositorBridgeChild(ClientLayerManager *aLayerManager)
|
||||
: mLayerManager(aLayerManager)
|
||||
, mCanSend(false)
|
||||
, mMessageLoop(MessageLoop::current())
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Ensure destruction on the main thread
|
||||
SetMessageLoopToPostDestructionTo(mMessageLoop);
|
||||
}
|
||||
|
||||
CompositorBridgeChild::~CompositorBridgeChild()
|
||||
|
@ -80,16 +74,12 @@ void
|
|||
CompositorBridgeChild::Destroy()
|
||||
{
|
||||
// This must not be called from the destructor!
|
||||
MOZ_ASSERT(!IsDead());
|
||||
MOZ_ASSERT(mRefCnt != 0);
|
||||
|
||||
if (!mCanSend) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < mTexturePools.Length(); i++) {
|
||||
mTexturePools[i]->Destroy();
|
||||
}
|
||||
|
||||
// Destroying the layer manager may cause all sorts of things to happen, so
|
||||
// let's make sure there is still a reference to keep this alive whatever
|
||||
// happens.
|
||||
|
@ -428,11 +418,6 @@ CompositorBridgeChild::RecvDidComposite(const uint64_t& aId, const uint64_t& aTr
|
|||
child->DidComposite(aTransactionId, aCompositeStart, aCompositeEnd);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < mTexturePools.Length(); i++) {
|
||||
mTexturePools[i]->ReturnDeferredClients();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -791,73 +776,6 @@ CompositorBridgeChild::DeallocPTextureChild(PTextureChild* actor)
|
|||
return TextureClient::DestroyIPDLActor(actor);
|
||||
}
|
||||
|
||||
TextureClientPool*
|
||||
CompositorBridgeChild::GetTexturePool(SurfaceFormat aFormat, TextureFlags aFlags)
|
||||
{
|
||||
for (size_t i = 0; i < mTexturePools.Length(); i++) {
|
||||
if (mTexturePools[i]->GetFormat() == aFormat &&
|
||||
mTexturePools[i]->GetFlags() == aFlags) {
|
||||
return mTexturePools[i];
|
||||
}
|
||||
}
|
||||
|
||||
mTexturePools.AppendElement(
|
||||
new TextureClientPool(aFormat, aFlags,
|
||||
IntSize(gfxPlatform::GetPlatform()->GetTileWidth(),
|
||||
gfxPlatform::GetPlatform()->GetTileHeight()),
|
||||
gfxPrefs::LayersTileMaxPoolSize(),
|
||||
gfxPrefs::LayersTileShrinkPoolTimeout(),
|
||||
this));
|
||||
|
||||
return mTexturePools.LastElement();
|
||||
}
|
||||
|
||||
void
|
||||
CompositorBridgeChild::HandleMemoryPressure()
|
||||
{
|
||||
for (size_t i = 0; i < mTexturePools.Length(); i++) {
|
||||
mTexturePools[i]->ShrinkToMinimumSize();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CompositorBridgeChild::ClearTexturePool()
|
||||
{
|
||||
for (size_t i = 0; i < mTexturePools.Length(); i++) {
|
||||
mTexturePools[i]->Clear();
|
||||
}
|
||||
}
|
||||
|
||||
PTextureChild*
|
||||
CompositorBridgeChild::CreateTexture(const SurfaceDescriptor& aSharedData,
|
||||
LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags)
|
||||
{
|
||||
return PCompositorBridgeChild::SendPTextureConstructor(aSharedData, aLayersBackend, aFlags, 0 /* FIXME: Correct ID here? */);
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorBridgeChild::AllocUnsafeShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem)
|
||||
{
|
||||
return PCompositorBridgeChild::AllocUnsafeShmem(aSize, aType, aShmem);
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorBridgeChild::AllocShmem(size_t aSize,
|
||||
ipc::SharedMemory::SharedMemoryType aType,
|
||||
ipc::Shmem* aShmem)
|
||||
{
|
||||
return PCompositorBridgeChild::AllocShmem(aSize, aType, aShmem);
|
||||
}
|
||||
|
||||
void
|
||||
CompositorBridgeChild::DeallocShmem(ipc::Shmem& aShmem)
|
||||
{
|
||||
PCompositorBridgeChild::DeallocShmem(aShmem);
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/Attributes.h" // for override
|
||||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
#include "mozilla/layers/PCompositorBridgeChild.h"
|
||||
#include "mozilla/layers/TextureForwarder.h" // for TextureForwarder
|
||||
#include "nsAutoPtr.h" // for nsRefPtr
|
||||
#include "nsClassHashtable.h" // for nsClassHashtable
|
||||
#include "nsCOMPtr.h" // for nsCOMPtr
|
||||
|
@ -33,13 +32,12 @@ using mozilla::dom::TabChild;
|
|||
|
||||
class ClientLayerManager;
|
||||
class CompositorBridgeParent;
|
||||
class TextureClientPool;
|
||||
struct FrameMetrics;
|
||||
|
||||
class CompositorBridgeChild final : public PCompositorBridgeChild,
|
||||
public TextureForwarder,
|
||||
public ShmemAllocator
|
||||
class CompositorBridgeChild final : public PCompositorBridgeChild
|
||||
{
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(CompositorBridgeChild)
|
||||
|
||||
public:
|
||||
explicit CompositorBridgeChild(ClientLayerManager *aLayerManager);
|
||||
|
||||
|
@ -105,10 +103,6 @@ public:
|
|||
|
||||
virtual bool DeallocPTextureChild(PTextureChild* actor) override;
|
||||
|
||||
virtual PTextureChild* CreateTexture(const SurfaceDescriptor& aSharedData,
|
||||
LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags) override;
|
||||
|
||||
/**
|
||||
* Request that the parent tell us when graphics are ready on GPU.
|
||||
* When we get that message, we bounce it to the TabParent via
|
||||
|
@ -143,27 +137,10 @@ public:
|
|||
bool SendUpdateVisibleRegion(VisibilityCounter aCounter,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const mozilla::CSSIntRegion& aRegion);
|
||||
bool IsSameProcess() const override;
|
||||
bool IsSameProcess() const;
|
||||
|
||||
static void ShutDown();
|
||||
|
||||
TextureClientPool* GetTexturePool(gfx::SurfaceFormat aFormat, TextureFlags aFlags);
|
||||
void ClearTexturePool();
|
||||
|
||||
void HandleMemoryPressure();
|
||||
|
||||
virtual MessageLoop* GetMessageLoop() const override { return mMessageLoop; }
|
||||
|
||||
virtual bool AllocUnsafeShmem(size_t aSize,
|
||||
mozilla::ipc::SharedMemory::SharedMemoryType aShmType,
|
||||
mozilla::ipc::Shmem* aShmem) override;
|
||||
virtual bool AllocShmem(size_t aSize,
|
||||
mozilla::ipc::SharedMemory::SharedMemoryType aShmType,
|
||||
mozilla::ipc::Shmem* aShmem) override;
|
||||
virtual void DeallocShmem(mozilla::ipc::Shmem& aShmem) override;
|
||||
|
||||
virtual ShmemAllocator* AsShmemAllocator() override { return this; }
|
||||
|
||||
private:
|
||||
// Private destructor, to discourage deletion outside of Release():
|
||||
virtual ~CompositorBridgeChild();
|
||||
|
@ -235,10 +212,6 @@ private:
|
|||
|
||||
// True until the beginning of the two-step shutdown sequence of this actor.
|
||||
bool mCanSend;
|
||||
|
||||
MessageLoop* mMessageLoop;
|
||||
|
||||
AutoTArray<RefPtr<TextureClientPool>,2> mTexturePools;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef MOZILLA_LAYERS_TEXTUREFORWARDER
|
||||
#define MOZILLA_LAYERS_TEXTUREFORWARDER
|
||||
|
||||
#include <stdint.h> // for int32_t, uint64_t
|
||||
#include "gfxTypes.h"
|
||||
#include "mozilla/Attributes.h" // for override
|
||||
#include "mozilla/layers/ISurfaceAllocator.h" // for ISurfaceAllocator
|
||||
#include "mozilla/layers/LayersTypes.h" // for LayersBackend
|
||||
#include "mozilla/layers/TextureClient.h" // for TextureClient
|
||||
#include "nsRegion.h" // for nsIntRegion
|
||||
#include "mozilla/gfx/Rect.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class TextureForwarder : public ClientIPCAllocator
|
||||
{
|
||||
public:
|
||||
|
||||
TextureForwarder()
|
||||
{}
|
||||
|
||||
/**
|
||||
* Create a TextureChild/Parent pair as as well as the TextureHost on the parent side.
|
||||
*/
|
||||
virtual PTextureChild* CreateTexture(
|
||||
const SurfaceDescriptor& aSharedData,
|
||||
LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags) = 0;
|
||||
|
||||
|
||||
virtual int32_t GetMaxTextureSize() const override
|
||||
{
|
||||
return mTextureFactoryIdentifier.mMaxTextureSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of backend that is used off the main thread.
|
||||
* We only don't allow changing the backend type at runtime so this value can
|
||||
* be queried once and will not change until Gecko is restarted.
|
||||
*/
|
||||
LayersBackend GetCompositorBackendType() const
|
||||
{
|
||||
return mTextureFactoryIdentifier.mParentBackend;
|
||||
}
|
||||
|
||||
bool SupportsTextureBlitting() const
|
||||
{
|
||||
return mTextureFactoryIdentifier.mSupportsTextureBlitting;
|
||||
}
|
||||
|
||||
bool SupportsPartialUploads() const
|
||||
{
|
||||
return mTextureFactoryIdentifier.mSupportsPartialUploads;
|
||||
}
|
||||
|
||||
const TextureFactoryIdentifier& GetTextureFactoryIdentifier() const
|
||||
{
|
||||
return mTextureFactoryIdentifier;
|
||||
}
|
||||
|
||||
protected:
|
||||
TextureFactoryIdentifier mTextureFactoryIdentifier;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
|
@ -178,7 +178,6 @@ EXPORTS.mozilla.layers += [
|
|||
'ipc/SharedBufferManagerParent.h',
|
||||
'ipc/SharedPlanarYCbCrImage.h',
|
||||
'ipc/SharedRGBImage.h',
|
||||
'ipc/TextureForwarder.h',
|
||||
'LayerMetricsWrapper.h',
|
||||
'LayersTypes.h',
|
||||
'opengl/CompositingRenderTargetOGL.h',
|
||||
|
|
Загрузка…
Ссылка в новой задаче