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/. */
|
|
|
|
|
|
|
|
#ifndef GFX_CONTENTHOST_H
|
|
|
|
#define GFX_CONTENTHOST_H
|
|
|
|
|
2013-08-11 23:17:23 +00:00
|
|
|
#include <stdint.h> // for uint32_t
|
|
|
|
#include <stdio.h> // for FILE
|
|
|
|
#include "mozilla-config.h" // for MOZ_DUMP_PAINTING
|
|
|
|
#include "CompositableHost.h" // for CompositableHost, etc
|
2013-11-27 00:29:46 +00:00
|
|
|
#include "RotatedBuffer.h" // for RotatedContentBuffer, etc
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/Attributes.h" // for MOZ_OVERRIDE
|
|
|
|
#include "mozilla/RefPtr.h" // for RefPtr
|
|
|
|
#include "mozilla/gfx/BasePoint.h" // for BasePoint
|
|
|
|
#include "mozilla/gfx/Point.h" // for Point
|
|
|
|
#include "mozilla/gfx/Rect.h" // for Rect
|
|
|
|
#include "mozilla/gfx/Types.h" // for Filter
|
|
|
|
#include "mozilla/layers/CompositorTypes.h" // for TextureInfo, etc
|
|
|
|
#include "mozilla/layers/ISurfaceAllocator.h" // for ISurfaceAllocator
|
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
|
2013-11-17 21:47:40 +00:00
|
|
|
#include "mozilla/layers/LayersTypes.h" // for etc
|
2014-04-03 06:04:04 +00:00
|
|
|
#include "mozilla/layers/TextureHost.h" // for TextureHost
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/mozalloc.h" // for operator delete
|
2014-08-25 15:09:39 +00:00
|
|
|
#include "mozilla/UniquePtr.h" // for UniquePtr
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "nsCOMPtr.h" // for already_AddRefed
|
|
|
|
#include "nsDebug.h" // for NS_RUNTIMEABORT
|
2014-02-26 21:36:35 +00:00
|
|
|
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "nsPoint.h" // for nsIntPoint
|
|
|
|
#include "nsRect.h" // for nsIntRect
|
|
|
|
#include "nsRegion.h" // for nsIntRegion
|
|
|
|
#include "nsTArray.h" // for nsTArray
|
|
|
|
#include "nscore.h" // for nsACString
|
|
|
|
|
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 {
|
2013-08-11 23:17:23 +00:00
|
|
|
namespace gfx {
|
|
|
|
class Matrix4x4;
|
|
|
|
}
|
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 layers {
|
2013-08-11 23:17:23 +00:00
|
|
|
class Compositor;
|
|
|
|
class ThebesBufferData;
|
|
|
|
class TiledLayerComposer;
|
|
|
|
struct EffectChain;
|
2014-04-02 06:45:02 +00:00
|
|
|
class TextureImageTextureSourceOGL;
|
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
|
|
|
|
|
|
|
struct TexturedEffect;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ContentHosts are used for compositing Thebes layers, always matched by a
|
|
|
|
* ContentClient of the same type.
|
|
|
|
*
|
|
|
|
* ContentHosts support only UpdateThebes(), not Update().
|
|
|
|
*/
|
|
|
|
class ContentHost : public CompositableHost
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Subclasses should implement this method if they support being used as a
|
|
|
|
// tiling.
|
|
|
|
virtual TiledLayerComposer* AsTiledLayerComposer() { return nullptr; }
|
|
|
|
|
2014-02-20 13:05:32 +00:00
|
|
|
virtual bool UpdateThebes(const ThebesBufferData& aData,
|
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
|
|
|
const nsIntRegion& aUpdated,
|
|
|
|
const nsIntRegion& aOldValidRegionBack,
|
|
|
|
nsIntRegion* aUpdatedRegionBack) = 0;
|
|
|
|
|
2014-08-04 03:29:55 +00:00
|
|
|
virtual void SetPaintWillResample(bool aResample) { mPaintWillResample = aResample; }
|
|
|
|
bool PaintWillResample() { return mPaintWillResample; }
|
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
|
|
|
|
|
|
|
protected:
|
2014-08-20 04:55:14 +00:00
|
|
|
explicit ContentHost(const TextureInfo& aTextureInfo)
|
2013-04-16 21:36:06 +00:00
|
|
|
: CompositableHost(aTextureInfo)
|
2014-08-04 03:29:55 +00:00
|
|
|
, mPaintWillResample(false)
|
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-08-04 03:29:55 +00:00
|
|
|
|
|
|
|
bool mPaintWillResample;
|
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
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base class for non-tiled ContentHosts.
|
|
|
|
*
|
|
|
|
* Ownership of the SurfaceDescriptor and the resources it represents is passed
|
2014-04-03 06:04:04 +00:00
|
|
|
* from the ContentClient to the ContentHost when the TextureClient/Hosts are
|
|
|
|
* created, that is recevied here by SetTextureHosts which assigns one or two
|
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
|
|
|
* texture hosts (for single and double buffering) to the ContentHost.
|
|
|
|
*
|
|
|
|
* It is the responsibility of the ContentHost to destroy its resources when
|
|
|
|
* they are recreated or the ContentHost dies.
|
|
|
|
*/
|
2013-11-27 21:16:35 +00:00
|
|
|
class ContentHostBase : public ContentHost
|
2013-11-27 21:16:34 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef RotatedContentBuffer::ContentType ContentType;
|
|
|
|
typedef RotatedContentBuffer::PaintState PaintState;
|
|
|
|
|
2014-08-20 04:55:14 +00:00
|
|
|
explicit ContentHostBase(const TextureInfo& aTextureInfo);
|
2013-12-05 18:39:22 +00:00
|
|
|
virtual ~ContentHostBase();
|
|
|
|
|
|
|
|
virtual void Composite(EffectChain& aEffectChain,
|
|
|
|
float aOpacity,
|
|
|
|
const gfx::Matrix4x4& aTransform,
|
|
|
|
const gfx::Filter& aFilter,
|
|
|
|
const gfx::Rect& aClipRect,
|
2014-08-04 03:29:55 +00:00
|
|
|
const nsIntRegion* aVisibleRegion = nullptr);
|
2014-04-02 06:45:02 +00:00
|
|
|
|
|
|
|
virtual NewTextureSource* GetTextureSource() = 0;
|
|
|
|
virtual NewTextureSource* GetTextureSourceOnWhite() = 0;
|
|
|
|
|
2014-06-22 17:06:00 +00:00
|
|
|
virtual TemporaryRef<TexturedEffect> GenEffect(const gfx::Filter& aFilter) MOZ_OVERRIDE;
|
|
|
|
|
2014-04-02 06:45:02 +00:00
|
|
|
protected:
|
|
|
|
virtual nsIntPoint GetOriginOffset()
|
|
|
|
{
|
|
|
|
return mBufferRect.TopLeft() - mBufferRotation;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsIntRect mBufferRect;
|
|
|
|
nsIntPoint mBufferRotation;
|
|
|
|
bool mInitialised;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shared ContentHostBase implementation for content hosts that
|
|
|
|
* use up to two TextureHosts.
|
|
|
|
*/
|
|
|
|
class ContentHostTexture : public ContentHostBase
|
|
|
|
{
|
|
|
|
public:
|
2014-08-20 04:55:14 +00:00
|
|
|
explicit ContentHostTexture(const TextureInfo& aTextureInfo)
|
2014-04-02 06:45:02 +00:00
|
|
|
: ContentHostBase(aTextureInfo)
|
|
|
|
, mLocked(false)
|
|
|
|
{ }
|
2013-12-05 18:39:22 +00:00
|
|
|
|
|
|
|
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
#ifdef MOZ_DUMP_PAINTING
|
|
|
|
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
|
|
|
|
|
2014-06-19 22:36:25 +00:00
|
|
|
virtual void Dump(std::stringstream& aStream,
|
2013-12-05 18:39:22 +00:00
|
|
|
const char* aPrefix="",
|
|
|
|
bool aDumpHtml=false) MOZ_OVERRIDE;
|
|
|
|
#endif
|
|
|
|
|
2014-06-19 22:36:25 +00:00
|
|
|
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
|
2013-12-05 18:39:22 +00:00
|
|
|
|
|
|
|
virtual void UseTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
|
2014-02-06 11:28:29 +00:00
|
|
|
virtual void UseComponentAlphaTextures(TextureHost* aTextureOnBlack,
|
|
|
|
TextureHost* aTextureOnWhite) MOZ_OVERRIDE;
|
2013-12-05 18:39:22 +00:00
|
|
|
|
2014-06-22 17:06:00 +00:00
|
|
|
virtual bool Lock() MOZ_OVERRIDE {
|
2014-04-02 06:45:02 +00:00
|
|
|
MOZ_ASSERT(!mLocked);
|
2014-04-23 12:19:29 +00:00
|
|
|
if (!mTextureHost) {
|
|
|
|
return false;
|
|
|
|
}
|
2014-04-02 06:45:02 +00:00
|
|
|
if (!mTextureHost->Lock()) {
|
|
|
|
return false;
|
|
|
|
}
|
2013-12-05 18:39:22 +00:00
|
|
|
|
2014-04-02 06:45:02 +00:00
|
|
|
if (mTextureHostOnWhite && !mTextureHostOnWhite->Lock()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
mLocked = true;
|
|
|
|
return true;
|
|
|
|
}
|
2014-06-22 17:06:00 +00:00
|
|
|
virtual void Unlock() MOZ_OVERRIDE {
|
2014-04-02 06:45:02 +00:00
|
|
|
MOZ_ASSERT(mLocked);
|
|
|
|
mTextureHost->Unlock();
|
|
|
|
if (mTextureHostOnWhite) {
|
|
|
|
mTextureHostOnWhite->Unlock();
|
|
|
|
}
|
|
|
|
mLocked = false;
|
2013-12-05 18:39:22 +00:00
|
|
|
}
|
|
|
|
|
2014-06-22 17:06:00 +00:00
|
|
|
virtual NewTextureSource* GetTextureSource() MOZ_OVERRIDE {
|
2014-04-02 06:45:02 +00:00
|
|
|
MOZ_ASSERT(mLocked);
|
|
|
|
return mTextureHost->GetTextureSources();
|
|
|
|
}
|
2014-06-22 17:06:00 +00:00
|
|
|
virtual NewTextureSource* GetTextureSourceOnWhite() MOZ_OVERRIDE {
|
2014-04-02 06:45:02 +00:00
|
|
|
MOZ_ASSERT(mLocked);
|
|
|
|
if (mTextureHostOnWhite) {
|
|
|
|
return mTextureHostOnWhite->GetTextureSources();
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
2013-12-05 18:39:22 +00:00
|
|
|
|
2014-04-02 06:45:02 +00:00
|
|
|
LayerRenderState GetRenderState();
|
|
|
|
|
|
|
|
protected:
|
2013-12-05 18:39:22 +00:00
|
|
|
RefPtr<TextureHost> mTextureHost;
|
|
|
|
RefPtr<TextureHost> mTextureHostOnWhite;
|
2014-04-02 06:45:02 +00:00
|
|
|
bool mLocked;
|
2013-12-05 18:39:22 +00:00
|
|
|
};
|
2014-04-01 06:28:05 +00: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 09:20:52 +00:00
|
|
|
/**
|
2013-12-05 18:39:22 +00:00
|
|
|
* Double buffering is implemented by swapping the front and back TextureHosts.
|
|
|
|
* We assume that whenever we use double buffering, then we have
|
|
|
|
* render-to-texture and thus no texture upload to do.
|
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-04-02 06:45:02 +00:00
|
|
|
class ContentHostDoubleBuffered : public ContentHostTexture
|
2013-11-27 21:16:34 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-08-20 04:55:14 +00:00
|
|
|
explicit ContentHostDoubleBuffered(const TextureInfo& aTextureInfo)
|
2014-04-02 06:45:02 +00:00
|
|
|
: ContentHostTexture(aTextureInfo)
|
2013-11-27 21:16:34 +00:00
|
|
|
{}
|
|
|
|
|
2013-12-05 18:39:22 +00:00
|
|
|
virtual ~ContentHostDoubleBuffered() {}
|
|
|
|
|
2014-04-26 02:34:06 +00:00
|
|
|
virtual CompositableType GetType() { return CompositableType::CONTENT_DOUBLE; }
|
2013-12-05 18:39:22 +00:00
|
|
|
|
2014-02-20 13:05:32 +00:00
|
|
|
virtual bool UpdateThebes(const ThebesBufferData& aData,
|
2013-12-05 18:39:22 +00:00
|
|
|
const nsIntRegion& aUpdated,
|
|
|
|
const nsIntRegion& aOldValidRegionBack,
|
|
|
|
nsIntRegion* aUpdatedRegionBack);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsIntRegion mValidRegionForNextBackBuffer;
|
|
|
|
};
|
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Single buffered, therefore we must synchronously upload the image from the
|
2014-04-03 06:04:04 +00:00
|
|
|
* TextureHost in the layers transaction (i.e., in UpdateThebes).
|
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-04-02 06:45:02 +00:00
|
|
|
class ContentHostSingleBuffered : public ContentHostTexture
|
2013-11-27 21:16:34 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-08-20 04:55:14 +00:00
|
|
|
explicit ContentHostSingleBuffered(const TextureInfo& aTextureInfo)
|
2014-04-02 06:45:02 +00:00
|
|
|
: ContentHostTexture(aTextureInfo)
|
2013-11-27 21:16:34 +00:00
|
|
|
{}
|
2013-12-05 18:39:22 +00:00
|
|
|
virtual ~ContentHostSingleBuffered() {}
|
|
|
|
|
2014-04-26 02:34:06 +00:00
|
|
|
virtual CompositableType GetType() { return CompositableType::CONTENT_SINGLE; }
|
2013-12-05 18:39:22 +00:00
|
|
|
|
2014-02-20 13:05:32 +00:00
|
|
|
virtual bool UpdateThebes(const ThebesBufferData& aData,
|
2013-12-05 18:39:22 +00:00
|
|
|
const nsIntRegion& aUpdated,
|
|
|
|
const nsIntRegion& aOldValidRegionBack,
|
|
|
|
nsIntRegion* aUpdatedRegionBack);
|
|
|
|
};
|
|
|
|
|
2013-05-16 03:45:43 +00:00
|
|
|
/**
|
|
|
|
* Maintains a host-side only texture, and gets provided with
|
|
|
|
* surfaces that only cover the changed pixels during an update.
|
|
|
|
*
|
|
|
|
* Takes ownership of the passed in update surfaces, and must
|
|
|
|
* free them once texture upload is complete.
|
|
|
|
*
|
|
|
|
* Delays texture uploads until the next composite to
|
|
|
|
* avoid blocking the main thread.
|
|
|
|
*/
|
2014-04-02 06:45:02 +00:00
|
|
|
class ContentHostIncremental : public ContentHostBase
|
2013-05-16 03:45:43 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-08-20 04:55:14 +00:00
|
|
|
explicit ContentHostIncremental(const TextureInfo& aTextureInfo);
|
2014-04-02 07:08:31 +00:00
|
|
|
~ContentHostIncremental();
|
2013-05-16 03:45:43 +00:00
|
|
|
|
2014-04-26 02:34:06 +00:00
|
|
|
virtual CompositableType GetType() { return CompositableType::BUFFER_CONTENT_INC; }
|
2013-05-16 03:45:43 +00:00
|
|
|
|
2014-04-02 06:45:02 +00:00
|
|
|
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE { return LayerRenderState(); }
|
|
|
|
|
2014-04-23 14:46:02 +00:00
|
|
|
virtual bool CreatedIncrementalTexture(ISurfaceAllocator* aAllocator,
|
2014-04-02 06:45:01 +00:00
|
|
|
const TextureInfo& aTextureInfo,
|
|
|
|
const nsIntRect& aBufferRect) MOZ_OVERRIDE;
|
2013-05-16 03:45:43 +00:00
|
|
|
|
|
|
|
virtual void UpdateIncremental(TextureIdentifier aTextureId,
|
|
|
|
SurfaceDescriptor& aSurface,
|
|
|
|
const nsIntRegion& aUpdated,
|
|
|
|
const nsIntRect& aBufferRect,
|
|
|
|
const nsIntPoint& aBufferRotation) MOZ_OVERRIDE;
|
|
|
|
|
2014-02-20 13:05:32 +00:00
|
|
|
virtual bool UpdateThebes(const ThebesBufferData& aData,
|
2013-05-16 03:45:43 +00:00
|
|
|
const nsIntRegion& aUpdated,
|
|
|
|
const nsIntRegion& aOldValidRegionBack,
|
|
|
|
nsIntRegion* aUpdatedRegionBack)
|
|
|
|
{
|
2014-02-20 13:05:32 +00:00
|
|
|
NS_ERROR("Shouldn't call this");
|
|
|
|
return false;
|
2013-05-16 03:45:43 +00:00
|
|
|
}
|
|
|
|
|
2014-06-19 22:36:25 +00:00
|
|
|
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
|
2014-05-02 21:29:29 +00:00
|
|
|
|
2014-06-22 17:06:00 +00:00
|
|
|
virtual bool Lock() MOZ_OVERRIDE {
|
2014-04-02 06:45:02 +00:00
|
|
|
MOZ_ASSERT(!mLocked);
|
|
|
|
ProcessTextureUpdates();
|
|
|
|
mLocked = true;
|
|
|
|
return true;
|
2013-05-16 03:45:43 +00:00
|
|
|
}
|
|
|
|
|
2014-06-22 17:06:00 +00:00
|
|
|
virtual void Unlock() MOZ_OVERRIDE {
|
2014-04-02 06:45:02 +00:00
|
|
|
MOZ_ASSERT(mLocked);
|
|
|
|
mLocked = false;
|
2013-05-16 03:45:43 +00:00
|
|
|
}
|
|
|
|
|
2014-06-22 17:06:00 +00:00
|
|
|
virtual NewTextureSource* GetTextureSource() MOZ_OVERRIDE;
|
|
|
|
virtual NewTextureSource* GetTextureSourceOnWhite() MOZ_OVERRIDE;
|
2014-04-02 06:45:02 +00:00
|
|
|
|
2013-05-16 03:45:43 +00:00
|
|
|
private:
|
|
|
|
|
2013-11-14 23:56:42 +00:00
|
|
|
void FlushUpdateQueue();
|
2013-05-16 03:45:43 +00:00
|
|
|
void ProcessTextureUpdates();
|
|
|
|
|
|
|
|
class Request
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Request()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(ContentHostIncremental::Request);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~Request()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(ContentHostIncremental::Request);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Execute(ContentHostIncremental *aHost) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class TextureCreationRequest : public Request
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TextureCreationRequest(const TextureInfo& aTextureInfo,
|
|
|
|
const nsIntRect& aBufferRect)
|
|
|
|
: mTextureInfo(aTextureInfo)
|
|
|
|
, mBufferRect(aBufferRect)
|
|
|
|
{}
|
|
|
|
|
|
|
|
virtual void Execute(ContentHostIncremental *aHost);
|
|
|
|
|
|
|
|
private:
|
|
|
|
TextureInfo mTextureInfo;
|
|
|
|
nsIntRect mBufferRect;
|
|
|
|
};
|
|
|
|
|
|
|
|
class TextureUpdateRequest : public Request
|
|
|
|
{
|
|
|
|
public:
|
2013-05-22 03:36:38 +00:00
|
|
|
TextureUpdateRequest(ISurfaceAllocator* aDeAllocator,
|
|
|
|
TextureIdentifier aTextureId,
|
2013-05-16 03:45:43 +00:00
|
|
|
SurfaceDescriptor& aDescriptor,
|
|
|
|
const nsIntRegion& aUpdated,
|
|
|
|
const nsIntRect& aBufferRect,
|
|
|
|
const nsIntPoint& aBufferRotation)
|
2013-05-22 03:36:38 +00:00
|
|
|
: mDeAllocator(aDeAllocator)
|
|
|
|
, mTextureId(aTextureId)
|
2013-05-16 03:45:43 +00:00
|
|
|
, mDescriptor(aDescriptor)
|
|
|
|
, mUpdated(aUpdated)
|
|
|
|
, mBufferRect(aBufferRect)
|
|
|
|
, mBufferRotation(aBufferRotation)
|
|
|
|
{}
|
|
|
|
|
2013-05-22 03:36:38 +00:00
|
|
|
~TextureUpdateRequest()
|
|
|
|
{
|
|
|
|
//TODO: Recycle these?
|
|
|
|
mDeAllocator->DestroySharedSurface(&mDescriptor);
|
|
|
|
}
|
|
|
|
|
2013-05-16 03:45:43 +00:00
|
|
|
virtual void Execute(ContentHostIncremental *aHost);
|
|
|
|
|
|
|
|
private:
|
|
|
|
enum XSide {
|
|
|
|
LEFT, RIGHT
|
|
|
|
};
|
|
|
|
enum YSide {
|
|
|
|
TOP, BOTTOM
|
|
|
|
};
|
|
|
|
|
|
|
|
nsIntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide) const;
|
|
|
|
|
2013-12-03 18:44:38 +00:00
|
|
|
RefPtr<ISurfaceAllocator> mDeAllocator;
|
2013-05-16 03:45:43 +00:00
|
|
|
TextureIdentifier mTextureId;
|
|
|
|
SurfaceDescriptor mDescriptor;
|
|
|
|
nsIntRegion mUpdated;
|
|
|
|
nsIntRect mBufferRect;
|
|
|
|
nsIntPoint mBufferRotation;
|
|
|
|
};
|
|
|
|
|
2014-08-25 15:09:39 +00:00
|
|
|
nsTArray<UniquePtr<Request> > mUpdateList;
|
2013-05-16 03:45:43 +00:00
|
|
|
|
2014-04-02 06:45:02 +00:00
|
|
|
// Specific to OGL to avoid exposing methods on TextureSource that only
|
|
|
|
// have one implementation.
|
|
|
|
RefPtr<TextureImageTextureSourceOGL> mSource;
|
|
|
|
RefPtr<TextureImageTextureSourceOGL> mSourceOnWhite;
|
|
|
|
|
2013-12-03 18:44:38 +00:00
|
|
|
RefPtr<ISurfaceAllocator> mDeAllocator;
|
2014-04-02 06:45:02 +00:00
|
|
|
bool mLocked;
|
2013-05-16 03:45:43 +00: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 09:20:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|