Remove Composer2D remnants. (bug 1339353, r=kats)

This commit is contained in:
David Anderson 2017-02-14 12:29:39 -08:00
Родитель 617a860f57
Коммит d2703c8176
28 изменённых файлов: 13 добавлений и 308 удалений

Просмотреть файл

@ -77,7 +77,6 @@ struct TexturedEffect : public Effect
TextureSource* mTexture;
bool mPremultiplied;
gfx::SamplingFilter mSamplingFilter;
LayerRenderState mState;
};
// Support an alpha mask.
@ -233,8 +232,7 @@ inline already_AddRefed<TexturedEffect>
CreateTexturedEffect(gfx::SurfaceFormat aFormat,
TextureSource* aSource,
const gfx::SamplingFilter aSamplingFilter,
bool isAlphaPremultiplied,
const LayerRenderState &state = LayerRenderState())
bool isAlphaPremultiplied)
{
MOZ_ASSERT(aSource);
RefPtr<TexturedEffect> result;
@ -257,8 +255,6 @@ CreateTexturedEffect(gfx::SurfaceFormat aFormat,
break;
}
result->mState = state;
return result.forget();
}
@ -266,8 +262,7 @@ inline already_AddRefed<TexturedEffect>
CreateTexturedEffect(TextureHost* aHost,
TextureSource* aSource,
const gfx::SamplingFilter aSamplingFilter,
bool isAlphaPremultiplied,
const LayerRenderState &state = LayerRenderState())
bool isAlphaPremultiplied)
{
MOZ_ASSERT(aHost);
MOZ_ASSERT(aSource);
@ -280,8 +275,7 @@ CreateTexturedEffect(TextureHost* aHost,
result = CreateTexturedEffect(aHost->GetReadFormat(),
aSource,
aSamplingFilter,
isAlphaPremultiplied,
state);
isAlphaPremultiplied);
}
return result.forget();
}
@ -296,8 +290,7 @@ inline already_AddRefed<TexturedEffect>
CreateTexturedEffect(TextureSource* aSource,
TextureSource* aSourceOnWhite,
const gfx::SamplingFilter aSamplingFilter,
bool isAlphaPremultiplied,
const LayerRenderState &state = LayerRenderState())
bool isAlphaPremultiplied)
{
MOZ_ASSERT(aSource);
if (aSourceOnWhite) {
@ -311,8 +304,7 @@ CreateTexturedEffect(TextureSource* aSource,
return CreateTexturedEffect(aSource->GetFormat(),
aSource,
aSamplingFilter,
isAlphaPremultiplied,
state);
isAlphaPremultiplied);
}
/**
@ -322,10 +314,9 @@ CreateTexturedEffect(TextureSource* aSource,
*/
inline already_AddRefed<TexturedEffect>
CreateTexturedEffect(TextureSource *aTexture,
const gfx::SamplingFilter aSamplingFilter,
const LayerRenderState &state = LayerRenderState())
const gfx::SamplingFilter aSamplingFilter)
{
return CreateTexturedEffect(aTexture, nullptr, aSamplingFilter, true, state);
return CreateTexturedEffect(aTexture, nullptr, aSamplingFilter, true);
}

Просмотреть файл

@ -8,7 +8,6 @@
#include "LayerScope.h"
#include "nsAppRunner.h"
#include "Composer2D.h"
#include "Effects.h"
#include "mozilla/EndianUtils.h"
#include "mozilla/MathAlgorithms.h"

Просмотреть файл

@ -1792,8 +1792,6 @@ public:
uint32_t GetDebugColorIndex() { return mDebugColorIndex; }
#endif
virtual LayerRenderState GetRenderState() { return LayerRenderState(); }
void Mutated() {
mManager->Mutated(this);
}

Просмотреть файл

@ -1,29 +0,0 @@
/* -*- Mode: C++; tab-width: 2; 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 "LayersTypes.h"
namespace mozilla {
namespace layers {
LayerRenderState::LayerRenderState()
: mFlags(LayerRenderStateFlags::LAYER_RENDER_STATE_DEFAULT)
, mHasOwnOffset(false)
{
}
LayerRenderState::LayerRenderState(const LayerRenderState& aOther)
: mFlags(aOther.mFlags)
, mHasOwnOffset(aOther.mHasOwnOffset)
, mOffset(aOther.mOffset)
{
}
LayerRenderState::~LayerRenderState()
{
}
} // namespace layers
} // namespace mozilla

Просмотреть файл

@ -70,43 +70,6 @@ enum class SurfaceMode : int8_t {
SURFACE_COMPONENT_ALPHA
};
// LayerRenderState for Composer2D
enum class LayerRenderStateFlags : int8_t {
LAYER_RENDER_STATE_DEFAULT = 0,
ORIGIN_BOTTOM_LEFT = 1 << 0,
BUFFER_ROTATION = 1 << 1,
// Notify Composer2D to swap the RB pixels of gralloc buffer
FORMAT_RB_SWAP = 1 << 2,
// We record opaqueness here alongside the actual surface we're going to
// render. This avoids confusion when a layer might return different kinds
// of surfaces over time (e.g. video frames).
OPAQUE = 1 << 3
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(LayerRenderStateFlags)
struct LayerRenderState {
// Constructors and destructor are defined in LayersTypes.cpp so we don't
// have to pull in a definition for GraphicBuffer.h here. In KK at least,
// that results in nasty pollution such as libui's hardware.h #defining
// 'version_major' and 'version_minor' which conflict with Theora's codec.c...
LayerRenderState();
LayerRenderState(const LayerRenderState& aOther);
~LayerRenderState();
void SetOffset(const nsIntPoint& aOffset)
{
mOffset = aOffset;
mHasOwnOffset = true;
}
// see LayerRenderStateFlags
LayerRenderStateFlags mFlags;
// true if mOffset is applicable
bool mHasOwnOffset;
// the location of the layer's origin on mSurface
nsIntPoint mOffset;
};
enum class ScaleMode : int8_t {
SCALE_NONE,
STRETCH,

Просмотреть файл

@ -68,15 +68,6 @@ CanvasLayerComposite::SetLayerManager(HostLayerManager* aManager)
}
}
LayerRenderState
CanvasLayerComposite::GetRenderState()
{
if (mDestroyed || !mCompositableHost || !mCompositableHost->IsAttached()) {
return LayerRenderState();
}
return mCompositableHost->GetRenderState();
}
void
CanvasLayerComposite::RenderLayer(const IntRect& aClipRect,
const Maybe<gfx::Polygon>& aGeometry)

Просмотреть файл

@ -39,8 +39,6 @@ public:
MOZ_CRASH("Incompatibe surface type");
}
virtual LayerRenderState GetRenderState() override;
virtual bool SetCompositableHost(CompositableHost* aHost) override;
virtual void Disconnect() override

Просмотреть файл

@ -124,8 +124,6 @@ public:
return nullptr;
}
virtual LayerRenderState GetRenderState() = 0;
virtual gfx::IntSize GetImageSize() const
{
MOZ_ASSERT(false, "Should have been overridden");

Просмотреть файл

@ -62,8 +62,7 @@ ContentHostTexture::Composite(LayerComposite* aLayer,
RefPtr<TexturedEffect> effect = CreateTexturedEffect(mTextureSource.get(),
mTextureSourceOnWhite.get(),
aSamplingFilter, true,
GetRenderState());
aSamplingFilter, true);
if (!effect) {
return;
}
@ -435,22 +434,6 @@ ContentHostTexture::PrintInfo(std::stringstream& aStream, const char* aPrefix)
}
LayerRenderState
ContentHostTexture::GetRenderState()
{
if (!mTextureHost) {
return LayerRenderState();
}
LayerRenderState result = mTextureHost->GetRenderState();
if (mBufferRotation != nsIntPoint()) {
result.mFlags |= LayerRenderStateFlags::BUFFER_ROTATION;
}
result.SetOffset(GetOriginOffset());
return result;
}
already_AddRefed<TexturedEffect>
ContentHostTexture::GenEffect(const gfx::SamplingFilter aSamplingFilter)
{
@ -468,8 +451,7 @@ ContentHostTexture::GenEffect(const gfx::SamplingFilter aSamplingFilter)
}
return CreateTexturedEffect(mTextureSource.get(),
mTextureSourceOnWhite.get(),
aSamplingFilter, true,
GetRenderState());
aSamplingFilter, true);
}
already_AddRefed<gfx::DataSourceSurface>

Просмотреть файл

@ -165,8 +165,6 @@ public:
mLocked = false;
}
LayerRenderState GetRenderState() override;
virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::SamplingFilter aSamplingFilter) override;
protected:

Просмотреть файл

@ -238,8 +238,7 @@ ImageHost::Composite(LayerComposite* aLayer,
!(mCurrentTextureHost->GetFlags() & TextureFlags::NON_PREMULTIPLIED);
RefPtr<TexturedEffect> effect =
CreateTexturedEffect(mCurrentTextureHost,
mCurrentTextureSource.get(), aSamplingFilter, isAlphaPremultiplied,
GetRenderState());
mCurrentTextureSource.get(), aSamplingFilter, isAlphaPremultiplied);
if (!effect) {
return;
}
@ -384,17 +383,6 @@ ImageHost::Dump(std::stringstream& aStream,
}
}
LayerRenderState
ImageHost::GetRenderState()
{
TimedImage* img = ChooseImage();
if (img) {
SetCurrentTextureHost(img->mTextureHost);
return img->mTextureHost->GetRenderState();
}
return LayerRenderState();
}
already_AddRefed<gfx::DataSourceSurface>
ImageHost::GetAsSurface()
{
@ -484,8 +472,7 @@ ImageHost::GenEffect(const gfx::SamplingFilter aSamplingFilter)
return CreateTexturedEffect(mCurrentTextureHost,
mCurrentTextureSource,
aSamplingFilter,
isAlphaPremultiplied,
GetRenderState());
isAlphaPremultiplied);
}
} // namespace layers

Просмотреть файл

@ -67,8 +67,6 @@ public:
gfx::IntSize GetImageSize() const override;
virtual LayerRenderState GetRenderState() override;
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
virtual void Dump(std::stringstream& aStream,

Просмотреть файл

@ -64,15 +64,6 @@ ImageLayerComposite::Disconnect()
Destroy();
}
LayerRenderState
ImageLayerComposite::GetRenderState()
{
if (mImageHost && mImageHost->IsAttached()) {
return mImageHost->GetRenderState();
}
return LayerRenderState();
}
Layer*
ImageLayerComposite::GetLayer()
{

Просмотреть файл

@ -35,8 +35,6 @@ protected:
virtual ~ImageLayerComposite();
public:
virtual LayerRenderState GetRenderState() override;
virtual void Disconnect() override;
virtual bool SetCompositableHost(CompositableHost* aHost) override;

Просмотреть файл

@ -89,15 +89,6 @@ PaintedLayerComposite::SetLayerManager(HostLayerManager* aManager)
}
}
LayerRenderState
PaintedLayerComposite::GetRenderState()
{
if (!mBuffer || !mBuffer->IsAttached() || mDestroyed) {
return LayerRenderState();
}
return mBuffer->GetRenderState();
}
void
PaintedLayerComposite::RenderLayer(const gfx::IntRect& aClipRect,
const Maybe<gfx::Polygon>& aGeometry)

Просмотреть файл

@ -41,8 +41,6 @@ protected:
public:
virtual void Disconnect() override;
virtual LayerRenderState GetRenderState() override;
CompositableHost* GetCompositableHost() override;
virtual void Destroy() override;

Просмотреть файл

@ -542,17 +542,6 @@ public:
*/
PTextureParent* GetIPDLActor();
/**
* Specific to B2G's Composer2D
* XXX - more doc here
*/
virtual LayerRenderState GetRenderState()
{
// By default we return an empty render state, this should be overridden
// by the TextureHost implementations that are used on B2G with Composer2D
return LayerRenderState();
}
// If a texture host holds a reference to shmem, it should override this method
// to forget about the shmem _without_ releasing it.
virtual void OnShutdown() {}

Просмотреть файл

@ -100,9 +100,6 @@ TiledContentHost::~TiledContentHost()
already_AddRefed<TexturedEffect>
TiledContentHost::GenEffect(const gfx::SamplingFilter aSamplingFilter)
{
// If we can use hwc for this TiledContentHost, it implies that we have exactly
// one high precision tile. Please check TiledContentHost::GetRenderState() for
// all condition.
MOZ_ASSERT(mTiledBuffer.GetTileCount() == 1 && mLowPrecisionTiledBuffer.GetTileCount() == 0);
MOZ_ASSERT(mTiledBuffer.GetTile(0).mTextureHost);
@ -114,8 +111,7 @@ TiledContentHost::GenEffect(const gfx::SamplingFilter aSamplingFilter)
return CreateTexturedEffect(tile.mTextureSource,
nullptr,
aSamplingFilter,
true,
tile.mTextureHost->GetRenderState());
true);
}
void
@ -482,8 +478,7 @@ TiledContentHost::RenderTile(TileHost& aTile,
CreateTexturedEffect(aTile.mTextureSource,
aTile.mTextureSourceOnWhite,
aSamplingFilter,
true,
aTile.mTextureHost->GetRenderState());
true);
if (!effect) {
return;
}

Просмотреть файл

@ -173,30 +173,6 @@ protected:
~TiledContentHost();
public:
virtual LayerRenderState GetRenderState() override
{
// If we have exactly one high precision tile, then we can support hwc.
if (mTiledBuffer.GetTileCount() == 1 &&
mLowPrecisionTiledBuffer.GetTileCount() == 0) {
TextureHost* host = mTiledBuffer.GetTile(0).mTextureHost;
if (host) {
MOZ_ASSERT(!mTiledBuffer.GetTile(0).mTextureHostOnWhite, "Component alpha not supported!");
gfx::IntPoint offset = mTiledBuffer.GetTileOffset(mTiledBuffer.GetPlacement().TilePosition(0));
// Don't try to use HWC if the content doesn't start at the top-left of the tile.
if (offset != GetValidRegion().GetBounds().TopLeft()) {
return LayerRenderState();
}
LayerRenderState state = host->GetRenderState();
state.SetOffset(offset);
return state;
}
}
return LayerRenderState();
}
// Generate effect for layerscope when using hwc.
virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::SamplingFilter aSamplingFilter) override;

Просмотреть файл

@ -40,7 +40,6 @@ EXPORTS += [
'LayersTypes.h',
'LayerTreeInvalidation.h',
'LayerUserData.h',
'opengl/Composer2D.h',
'opengl/OGLShaderProgram.h',
'opengl/TexturePoolOGL.h',
'protobuf/LayerScopePacket.pb.h',
@ -374,7 +373,6 @@ UNIFIED_SOURCES += [
'LayerScope.cpp',
'LayersLogging.cpp',
'LayerSorter.cpp',
'LayersTypes.cpp',
'opengl/CompositingRenderTargetOGL.cpp',
'opengl/CompositorOGL.cpp',
'opengl/GLBlitTextureImageHelper.cpp',

Просмотреть файл

@ -1,73 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=8 et :
*/
/* 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_Composer2D_h
#define mozilla_layers_Composer2D_h
#include "gfxTypes.h"
#include "nsISupportsImpl.h"
/**
* Many platforms have dedicated hardware for simple composition.
* This hardware is usually faster or more power efficient than the
* GPU. However, in exchange for this better performance, generality
* has to be sacrificed: no 3d transforms, no intermediate surfaces,
* no special shader effects, loss of other goodies depending on the
* platform.
*
* Composer2D is a very simple interface to this class of hardware
* that allows an implementation to "try rendering" with the fast
* path. If the given layer tree requires more generality than the
* hardware provides, the implementation should bail and have the
* layer manager fall back on full GPU composition.
*/
class nsIWidget;
namespace mozilla {
namespace layers {
class Layer;
class Composer2D {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Composer2D)
protected:
// Protected destructor, to discourage deletion outside of Release():
virtual ~Composer2D() {}
public:
/**
* Return true if |aRoot| met the implementation's criteria for fast
* composition and the render was successful. Return false to fall
* back on the GPU.
*
* Currently, when TryRender() returns true, the entire framebuffer
* must have been rendered.
*/
virtual bool TryRenderWithHwc(Layer* aRoot,
nsIWidget* aWidget,
bool aGeometryChanged,
bool aHasImageHostOverlays) = 0;
/**
* Return true if Composer2D does composition. Return false if Composer2D
* failed the composition.
*/
virtual bool Render(nsIWidget* aWidget) = 0;
/**
* Return true if Composer2D has a fast composition hardware.
* Return false if Composer2D does not have a fast composition hardware.
*/
virtual bool HasHwc() = 0;
};
} // namespace layers
} // namespace mozilla
#endif // mozilla_layers_Composer2D_h

Просмотреть файл

@ -157,12 +157,6 @@ WebRenderImageHost::Dump(std::stringstream& aStream,
}
}
LayerRenderState
WebRenderImageHost::GetRenderState()
{
return LayerRenderState();
}
already_AddRefed<gfx::DataSourceSurface>
WebRenderImageHost::GetAsSurface()
{

Просмотреть файл

@ -47,8 +47,6 @@ public:
gfx::IntSize GetImageSize() const override;
virtual LayerRenderState GetRenderState() override;
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
virtual void Dump(std::stringstream& aStream,

Просмотреть файл

@ -25,7 +25,6 @@ class Compositor;
class LayerManager;
class LayerManagerComposite;
class Compositor;
class Composer2D;
} // namespace layers
namespace gfx {
class DrawTarget;
@ -202,17 +201,6 @@ public:
*/
virtual uint32_t GetGLFrameBufferFormat();
/**
* If this widget has a more efficient composer available for its
* native framebuffer, return it.
*
* This can be called from a non-main thread, but that thread must
* hold a strong reference to this.
*/
virtual layers::Composer2D* GetComposer2D() {
return nullptr;
}
/*
* Access the underlying nsIWidget. This method will be removed when the compositor no longer
* depends on nsIWidget on any platform.

Просмотреть файл

@ -118,12 +118,6 @@ InProcessCompositorWidget::GetGLFrameBufferFormat()
return mWidget->GetGLFrameBufferFormat();
}
layers::Composer2D*
InProcessCompositorWidget::GetComposer2D()
{
return mWidget->GetComposer2D();
}
uintptr_t
InProcessCompositorWidget::GetWidgetKey()
{

Просмотреть файл

@ -36,7 +36,6 @@ public:
virtual bool InitCompositor(layers::Compositor* aCompositor) override;
virtual LayoutDeviceIntSize GetClientSize() override;
virtual uint32_t GetGLFrameBufferFormat() override;
virtual layers::Composer2D* GetComposer2D() override;
virtual void ObserveVsync(VsyncObserver* aObserver) override;
virtual uintptr_t GetWidgetKey() override;

Просмотреть файл

@ -443,9 +443,6 @@ protected:
return true;
}
virtual uint32_t GetGLFrameBufferFormat();
virtual mozilla::layers::Composer2D* GetComposer2D() {
return nullptr;
}
protected:
void ResolveIconName(const nsAString &aIconName,

Просмотреть файл

@ -50,7 +50,6 @@ class PluginWidgetChild;
} // namespace plugins
namespace layers {
class AsyncDragMetrics;
class Composer2D;
class Compositor;
class CompositorBridgeChild;
class LayerManager;
@ -334,7 +333,6 @@ class nsIWidget : public nsISupports
typedef mozilla::dom::TabChild TabChild;
public:
typedef mozilla::layers::Composer2D Composer2D;
typedef mozilla::layers::CompositorBridgeChild CompositorBridgeChild;
typedef mozilla::layers::AsyncDragMetrics AsyncDragMetrics;
typedef mozilla::layers::FrameMetrics FrameMetrics;