Files
palemoon27/gfx/layers/client/TextureClientRecycleAllocator.h
T
roytam1 7f6fda62d8 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1208661 - Make ContentClient dumping play nicely with HTML dumping. r=BenWa (18b2c4a11b)
- Bug 1204895 - Add fence handling to AutoRemoveTexture on gonk r=nical (d1f21e0210)
- Bug 1208661 - Support dumping client-side layer textures without compression. r=BenWa (22ee0a45b5)
- Bug 1206915 - Avoid reordering of different parts of paint dump output. r=mattwoodrow (0c7d46bca1)
- Bug 1208661 - Do not assume that PaintRoot()'s contributions to the HTML paint dump will all be inside a <script> tag. r=BenWa (5917d13001)
- Bug 1203992 - Distinguish between SingleTiledContentClient and MultiTiledContentClient in the layer tree dump. r=nical (70955c53cc)
- Bug 1207590 - Don't use SingleTiledContentClient for layers that are larger than the maximum texture size. r=mattwoodrow (dd2a094297)
- Bug 1201541 - Use SingleTiledContentClient for non-scrollable layers on Android r=mattwoodrow (6010b5080d)
- missing of Bug 1161662 - Exclude post scale from layer.GetTransform(). r=roc (a3c92f89ae)
- Bug 1172537 - Make the warning: "Tiled PaintedLayer with no scrollable container ancestor" occur only on actual b2g phones. r=nical (d604c9e9da)
- Bug 1204597 - Use Move constructor for opaque region in FrameLayerBuilder instead of copying. r=jrmuizel (26bf99c0fb)
- Bug 1201541 - Add a pref for disabling single tile layers r=mattwoodrow (e3170f8f4c)
- Bug 1172719 - Fix SharedSurface fence handling on gonk r=jgilbert,nical (9fdf5fef4f)
- Support all blend modes in the basic compositor. (bug 1203829 part 1, r=mattwoodrow) (ac9eeca118)
- Compile shaders with newer fxc. (bug 1203829 part 2, r=mattwoodrow) (3fd4acc1ec)
- Refactor shader initialization in CompositorD3D11. (bug 1203829 part 3, r=mattwoodrow) (a5e79828ad)
- Handle screen and multiply blend modes in the D3D11 compositor. (bug 1203829 part 4, r=mattwoodrow) (b20c4af7fc)
- Bug 1173107: Add hexa() around various hr logging. r=jrmuizel a=KWierso (76d6d27ff9)
- Get the sync texture's sync handle during compositor initialization, where it can be made to fail gracefully. (bug 1207665 part 3, r=bas) (98d15069a0)
- Log initialization failures in CompositorD3D11.cpp. (bug 1211109 part 1, r=mattwoodrow) (211725e4ce)
- Don't use Direct2D if CompositorD3D11::Initialize fails. (bug 1208638, r=jrmuizel) (17a119bc1a)
- Bug 1143653 - Typo fix in a variable name. r=me (469e89d0b6)
- Remove the static compositor backend variable. (bug 1211109 part 2, r=mattwoodrow) (3b7dcb9a7c)
- Allow top-level window changes to the remembered compositor type. (bug 1211109 part 3, r=mattwoodrow) (9309cdfd0f)
- Remove ISurfaceAllocator::GetCompositorBackend. (bug 1211109 part 4, r=mattwoodrow) (2928f757c8)
- Bug 1143653 - Backout part of the initial patch because of crashes. (33637851d4)
- missing bit of 687388 (19770529ef)
- Bug 1208071 - Ensure that only valid texture actors are added to ImageBridge tarnsactions. r=sotaro (23bef4f601)
- Bug 1197534 - Send RecycleTexture messages from the ImageBridge thread. r=sotaro (7249beb404)
2022-09-23 09:35:49 +08:00

83 lines
2.5 KiB
C++

/* -*- 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/. */
#ifndef MOZILLA_GFX_TEXTURECLIENT_RECYCLE_ALLOCATOR_H
#define MOZILLA_GFX_TEXTURECLIENT_RECYCLE_ALLOCATOR_H
#include <map>
#include <stack>
#include "mozilla/gfx/Types.h"
#include "mozilla/RefPtr.h"
#include "TextureClient.h"
#include "mozilla/Mutex.h"
namespace mozilla {
namespace layers {
class ISurfaceAllocator;
class TextureClientHolder;
/**
* TextureClientRecycleAllocator provides TextureClients allocation and
* recycling capabilities. It expects allocations of same sizes and
* attributres. If a recycled TextureClient is different from
* requested one, the recycled one is dropped and new TextureClient is allocated.
*
* By default this uses TextureClient::CreateForDrawing to allocate new texture
* clients.
*/
class TextureClientRecycleAllocator
{
protected:
virtual ~TextureClientRecycleAllocator();
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TextureClientRecycleAllocator)
explicit TextureClientRecycleAllocator(CompositableForwarder* aAllocator);
void SetMaxPoolSize(uint32_t aMax);
// Creates and allocates a TextureClient.
already_AddRefed<TextureClient>
CreateOrRecycle(gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
BackendSelector aSelector,
TextureFlags aTextureFlags,
TextureAllocationFlags flags = ALLOC_DEFAULT);
protected:
virtual already_AddRefed<TextureClient>
Allocate(gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
BackendSelector aSelector,
TextureFlags aTextureFlags,
TextureAllocationFlags aAllocFlags);
RefPtr<CompositableForwarder> mSurfaceAllocator;
private:
friend class TextureClient;
void RecycleTextureClient(TextureClient* aClient);
static const uint32_t kMaxPooledSized = 2;
uint32_t mMaxPooledSize;
std::map<TextureClient*, RefPtr<TextureClientHolder> > mInUseClients;
// On b2g gonk, std::queue might be a better choice.
// On ICS, fence wait happens implicitly before drawing.
// Since JB, fence wait happens explicitly when fetching a client from the pool.
// stack is good from Graphics cache usage point of view.
std::stack<RefPtr<TextureClientHolder> > mPooledClients;
Mutex mLock;
};
} // namespace layers
} // namespace mozilla
#endif /* MOZILLA_GFX_TEXTURECLIENT_RECYCLE_ALLOCATOR_H */