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 02:20:52 -07: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 MOZILLA_GFX_TEXTUREHOST_H
|
|
|
|
#define MOZILLA_GFX_TEXTUREHOST_H
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
#include <stddef.h> // for size_t
|
|
|
|
#include <stdint.h> // for uint64_t, uint32_t, uint8_t
|
2013-09-24 13:45:14 -07:00
|
|
|
#include "gfxTypes.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
|
|
|
#include "mozilla/Attributes.h" // for MOZ_OVERRIDE
|
|
|
|
#include "mozilla/RefPtr.h" // for RefPtr, TemporaryRef, etc
|
|
|
|
#include "mozilla/gfx/2D.h" // for DataSourceSurface
|
|
|
|
#include "mozilla/gfx/Point.h" // for IntSize, IntPoint
|
|
|
|
#include "mozilla/gfx/Types.h" // for SurfaceFormat, etc
|
|
|
|
#include "mozilla/layers/CompositorTypes.h" // for TextureFlags, etc
|
2014-05-24 09:14:45 -07:00
|
|
|
#include "mozilla/layers/FenceUtils.h" // for FenceHandle
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
|
|
|
|
#include "mozilla/mozalloc.h" // for operator delete
|
|
|
|
#include "nsCOMPtr.h" // for already_AddRefed
|
|
|
|
#include "nsDebug.h" // for NS_RUNTIMEABORT
|
2014-02-26 13:36:35 -08:00
|
|
|
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "nsRegion.h" // for nsIntRegion
|
2014-03-07 13:34:04 -08:00
|
|
|
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "nscore.h" // for nsACString
|
2013-12-11 17:45:11 -08:00
|
|
|
#include "mozilla/layers/AtomicRefCountedWithFinalize.h"
|
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 02:20:52 -07:00
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
class gfxReusableSurfaceWrapper;
|
|
|
|
struct nsIntPoint;
|
|
|
|
struct nsIntSize;
|
2013-09-06 19:15:49 -07:00
|
|
|
struct nsIntRect;
|
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 02:20:52 -07:00
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
namespace mozilla {
|
2013-08-11 16:17:23 -07:00
|
|
|
namespace ipc {
|
|
|
|
class Shmem;
|
2013-07-30 02:59:51 -07: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 02:20:52 -07:00
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
class Compositor;
|
2013-09-12 19:39:26 -07:00
|
|
|
class CompositableHost;
|
2013-09-30 05:14:38 -07:00
|
|
|
class CompositableBackendSpecificData;
|
2014-05-05 18:56:40 -07:00
|
|
|
class CompositableParentManager;
|
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 02:20:52 -07:00
|
|
|
class SurfaceDescriptor;
|
|
|
|
class ISurfaceAllocator;
|
2014-02-24 20:23:41 -08:00
|
|
|
class TextureHostOGL;
|
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 02:20:52 -07:00
|
|
|
class TextureSourceOGL;
|
2013-08-04 00:46:17 -07:00
|
|
|
class TextureSourceD3D9;
|
2013-05-03 10:34:29 -07:00
|
|
|
class TextureSourceD3D11;
|
2013-04-30 17:42:05 -07:00
|
|
|
class TextureSourceBasic;
|
2013-12-11 11:52:50 -08:00
|
|
|
class DataTextureSource;
|
2013-12-11 17:44:44 -08:00
|
|
|
class PTextureParent;
|
|
|
|
class TextureParent;
|
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 02:20:52 -07:00
|
|
|
|
|
|
|
/**
|
2013-07-30 02:59:51 -07:00
|
|
|
* A view on a TextureHost where the texture is internally represented as tiles
|
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 02:20:52 -07:00
|
|
|
* (contrast with a tiled buffer, where each texture is a tile). For iteration by
|
|
|
|
* the texture's buffer host.
|
|
|
|
* This is only useful when the underlying surface is too big to fit in one
|
|
|
|
* device texture, which forces us to split it in smaller parts.
|
|
|
|
* Tiled Compositable is a different thing.
|
|
|
|
*/
|
2014-04-28 04:27:25 -07:00
|
|
|
class BigImageIterator
|
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 02:20:52 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-04-28 04:27:25 -07:00
|
|
|
virtual void BeginBigImageIteration() = 0;
|
|
|
|
virtual void EndBigImageIteration() {};
|
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 02:20:52 -07:00
|
|
|
virtual nsIntRect GetTileRect() = 0;
|
|
|
|
virtual size_t GetTileCount() = 0;
|
|
|
|
virtual bool NextTile() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TextureSource is the interface for texture objects that can be composited
|
|
|
|
* by a given compositor backend. Since the drawing APIs are different
|
|
|
|
* between backends, the TextureSource interface is split into different
|
|
|
|
* interfaces (TextureSourceOGL, etc.), and TextureSource mostly provide
|
|
|
|
* access to these interfaces.
|
|
|
|
*
|
|
|
|
* This class is used on the compositor side.
|
|
|
|
*/
|
2014-04-14 12:04:24 -07:00
|
|
|
class TextureSource
|
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 02:20:52 -07:00
|
|
|
{
|
2014-04-14 12:04:24 -07:00
|
|
|
protected:
|
|
|
|
virtual ~TextureSource();
|
|
|
|
|
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 02:20:52 -07:00
|
|
|
public:
|
2014-04-14 12:04:24 -07:00
|
|
|
NS_INLINE_DECL_REFCOUNTING(TextureSource)
|
|
|
|
|
2013-09-12 19:39:26 -07:00
|
|
|
TextureSource();
|
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 02:20:52 -07:00
|
|
|
|
|
|
|
/**
|
2013-07-30 02:59:51 -07:00
|
|
|
* Return the size of the texture in texels.
|
|
|
|
* If this is a tile iterator, GetSize must return the size of the current tile.
|
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 02:20:52 -07:00
|
|
|
*/
|
|
|
|
virtual gfx::IntSize GetSize() const = 0;
|
2013-07-24 08:34:09 -07:00
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
/**
|
|
|
|
* Return the pixel format of this texture
|
|
|
|
*/
|
2014-01-10 11:06:16 -08:00
|
|
|
virtual gfx::SurfaceFormat GetFormat() const { return gfx::SurfaceFormat::UNKNOWN; }
|
2013-07-24 08:34:09 -07: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 02:20:52 -07:00
|
|
|
/**
|
2013-08-04 00:46:17 -07:00
|
|
|
* Cast to a TextureSource for for each backend..
|
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 02:20:52 -07:00
|
|
|
*/
|
|
|
|
virtual TextureSourceOGL* AsSourceOGL() { return nullptr; }
|
2013-08-04 00:46:17 -07:00
|
|
|
virtual TextureSourceD3D9* AsSourceD3D9() { return nullptr; }
|
2013-05-03 10:34:29 -07:00
|
|
|
virtual TextureSourceD3D11* AsSourceD3D11() { return nullptr; }
|
2013-04-30 17:42:05 -07:00
|
|
|
virtual TextureSourceBasic* AsSourceBasic() { return nullptr; }
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
/**
|
|
|
|
* Cast to a DataTextureSurce.
|
|
|
|
*/
|
|
|
|
virtual DataTextureSource* AsDataTextureSource() { return 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 02:20:52 -07:00
|
|
|
/**
|
|
|
|
* In some rare cases we currently need to consider a group of textures as one
|
|
|
|
* TextureSource, that can be split in sub-TextureSources.
|
|
|
|
*/
|
|
|
|
virtual TextureSource* GetSubSource(int index) { return nullptr; }
|
2013-07-30 02:59:51 -07: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 02:20:52 -07:00
|
|
|
/**
|
|
|
|
* Overload this if the TextureSource supports big textures that don't fit in
|
|
|
|
* one device texture and must be tiled internally.
|
|
|
|
*/
|
2014-04-28 04:27:25 -07:00
|
|
|
virtual BigImageIterator* AsBigImageIterator() { return 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 02:20:52 -07:00
|
|
|
|
2013-09-30 05:14:38 -07:00
|
|
|
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData);
|
2013-09-12 19:39:26 -07:00
|
|
|
|
|
|
|
protected:
|
2013-09-30 05:14:38 -07:00
|
|
|
RefPtr<CompositableBackendSpecificData> mCompositableBackendData;
|
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 02:20:52 -07:00
|
|
|
};
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
/**
|
|
|
|
* XXX - merge this class with TextureSource when deprecated texture classes
|
|
|
|
* are completely removed.
|
|
|
|
*/
|
|
|
|
class NewTextureSource : public TextureSource
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NewTextureSource()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(NewTextureSource);
|
|
|
|
}
|
|
|
|
virtual ~NewTextureSource()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(NewTextureSource);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-08-08 05:53:12 -07:00
|
|
|
* Should be overridden in order to deallocate the data that is associated
|
2013-07-30 02:59:51 -07:00
|
|
|
* with the rendering backend, such as GL textures.
|
|
|
|
*/
|
|
|
|
virtual void DeallocateDeviceData() = 0;
|
|
|
|
|
2014-01-07 08:20:11 -08:00
|
|
|
virtual void SetCompositor(Compositor* aCompositor) {}
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
void SetNextSibling(NewTextureSource* aTexture)
|
|
|
|
{
|
|
|
|
mNextSibling = aTexture;
|
|
|
|
}
|
|
|
|
|
|
|
|
NewTextureSource* GetNextSibling() const
|
|
|
|
{
|
|
|
|
return mNextSibling;
|
|
|
|
}
|
|
|
|
|
|
|
|
// temporary adapter to use the same SubSource API as the old TextureSource
|
|
|
|
virtual TextureSource* GetSubSource(int index) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
switch (index) {
|
|
|
|
case 0: return this;
|
|
|
|
case 1: return GetNextSibling();
|
|
|
|
case 2: return GetNextSibling() ? GetNextSibling()->GetNextSibling() : nullptr;
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
RefPtr<NewTextureSource> mNextSibling;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface for TextureSources that can be updated from a DataSourceSurface.
|
|
|
|
*
|
|
|
|
* All backend should implement at least one DataTextureSource.
|
|
|
|
*/
|
|
|
|
class DataTextureSource : public NewTextureSource
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DataTextureSource()
|
|
|
|
: mUpdateSerial(0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
virtual DataTextureSource* AsDataTextureSource() MOZ_OVERRIDE { return this; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Upload a (portion of) surface to the TextureSource.
|
|
|
|
*
|
|
|
|
* The DataTextureSource doesn't own aSurface, although it owns and manage
|
|
|
|
* the device texture it uploads to internally.
|
|
|
|
*/
|
|
|
|
virtual bool Update(gfx::DataSourceSurface* aSurface,
|
|
|
|
nsIntRegion* aDestRegion = nullptr,
|
|
|
|
gfx::IntPoint* aSrcOffset = nullptr) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A facility to avoid reuploading when it is not necessary.
|
|
|
|
* The caller of Update can use GetUpdateSerial to see if the number has changed
|
|
|
|
* since last update, and call SetUpdateSerial after each successful update.
|
|
|
|
* The caller is responsible for managing the update serial except when the
|
|
|
|
* texture data is deallocated in which case the TextureSource should always
|
|
|
|
* reset the update serial to zero.
|
|
|
|
*/
|
|
|
|
uint32_t GetUpdateSerial() const { return mUpdateSerial; }
|
|
|
|
void SetUpdateSerial(uint32_t aValue) { mUpdateSerial = aValue; }
|
|
|
|
|
|
|
|
// By default at least set the update serial to zero.
|
|
|
|
// overloaded versions should do that too.
|
|
|
|
virtual void DeallocateDeviceData() MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
SetUpdateSerial(0);
|
|
|
|
}
|
|
|
|
|
2013-08-08 05:53:12 -07:00
|
|
|
#ifdef DEBUG
|
2013-07-30 02:59:51 -07:00
|
|
|
/**
|
|
|
|
* Provide read access to the data as a DataSourceSurface.
|
|
|
|
*
|
|
|
|
* This is expected to be very slow and should be used for mostly debugging.
|
|
|
|
* XXX - implement everywhere and make it pure virtual.
|
|
|
|
*/
|
|
|
|
virtual TemporaryRef<gfx::DataSourceSurface> ReadBack() { return nullptr; };
|
2013-08-08 05:53:12 -07:00
|
|
|
#endif
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
private:
|
|
|
|
uint32_t mUpdateSerial;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TextureHost is a thin abstraction over texture data that need to be shared
|
|
|
|
* between the content process and the compositor process. It is the
|
|
|
|
* compositor-side half of a TextureClient/TextureHost pair. A corresponding
|
|
|
|
* TextureClient lives on the content-side.
|
|
|
|
*
|
|
|
|
* TextureHost only knows how to deserialize or synchronize generic image data
|
|
|
|
* (SurfaceDescriptor) and provide access to one or more TextureSource objects
|
|
|
|
* (these provide the necessary APIs for compositor backends to composite the
|
|
|
|
* image).
|
|
|
|
*
|
|
|
|
* A TextureHost implementation corresponds to one SurfaceDescriptor type, as
|
|
|
|
* opposed to TextureSource that corresponds to device textures.
|
|
|
|
* This means that for YCbCr planes, even though they are represented as
|
|
|
|
* 3 textures internally (3 TextureSources), we use 1 TextureHost and not 3,
|
|
|
|
* because the 3 planes are stored in the same buffer of shared memory, before
|
|
|
|
* they are uploaded separately.
|
|
|
|
*
|
|
|
|
* There is always one and only one TextureHost per TextureClient, and the
|
|
|
|
* TextureClient/Host pair only owns one buffer of image data through its
|
|
|
|
* lifetime. This means that the lifetime of the underlying shared data
|
|
|
|
* matches the lifetime of the TextureClient/Host pair. It also means
|
|
|
|
* TextureClient/Host do not implement double buffering, which is the
|
|
|
|
* reponsibility of the compositable (which would use two Texture pairs).
|
|
|
|
*
|
|
|
|
* The Lock/Unlock mecanism here mirrors Lock/Unlock in TextureClient.
|
|
|
|
*
|
|
|
|
*/
|
2013-12-11 17:45:01 -08:00
|
|
|
class TextureHost
|
2013-12-11 17:45:11 -08:00
|
|
|
: public AtomicRefCountedWithFinalize<TextureHost>
|
2013-07-30 02:59:51 -07:00
|
|
|
{
|
2013-12-11 17:45:01 -08:00
|
|
|
/**
|
|
|
|
* Called once, just before the destructor.
|
|
|
|
*
|
|
|
|
* Here goes the shut-down code that uses virtual methods.
|
|
|
|
* Must only be called by Release().
|
|
|
|
*/
|
|
|
|
void Finalize();
|
|
|
|
|
2013-12-11 17:45:11 -08:00
|
|
|
friend class AtomicRefCountedWithFinalize<TextureHost>;
|
2013-07-30 02:59:51 -07:00
|
|
|
public:
|
2013-12-11 17:44:47 -08:00
|
|
|
TextureHost(TextureFlags aFlags);
|
2013-07-30 02:59:51 -07:00
|
|
|
|
2013-09-12 19:39:26 -07:00
|
|
|
virtual ~TextureHost();
|
2013-07-30 02:59:51 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Factory method.
|
|
|
|
*/
|
2013-12-11 17:44:47 -08:00
|
|
|
static TemporaryRef<TextureHost> Create(const SurfaceDescriptor& aDesc,
|
2013-07-30 02:59:51 -07:00
|
|
|
ISurfaceAllocator* aDeallocator,
|
|
|
|
TextureFlags aFlags);
|
|
|
|
|
2014-03-26 18:01:15 -07:00
|
|
|
/**
|
|
|
|
* Tell to TextureChild that TextureHost is recycled.
|
|
|
|
* This function should be called from TextureHost's RecycleCallback.
|
|
|
|
* If SetRecycleCallback is set to TextureHost.
|
|
|
|
* TextureHost can be recycled by calling RecycleCallback
|
|
|
|
* when reference count becomes one.
|
|
|
|
* One reference count is always added by TextureChild.
|
|
|
|
*/
|
|
|
|
void CompositorRecycle();
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
/**
|
|
|
|
* Lock the texture host for compositing.
|
|
|
|
*/
|
|
|
|
virtual bool Lock() { return true; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unlock the texture host after compositing.
|
|
|
|
*/
|
|
|
|
virtual void Unlock() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Note that the texture host format can be different from its corresponding
|
|
|
|
* texture source's. For example a ShmemTextureHost can have the ycbcr
|
|
|
|
* format and produce 3 "alpha" textures sources.
|
|
|
|
*/
|
|
|
|
virtual gfx::SurfaceFormat GetFormat() const = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a list of TextureSources for use with a Compositor.
|
|
|
|
*
|
|
|
|
* This can trigger texture uploads, so do not call it inside transactions
|
|
|
|
* so as to not upload textures while the main thread is blocked.
|
|
|
|
* Must not be called while this TextureHost is not sucessfully Locked.
|
|
|
|
*/
|
|
|
|
virtual NewTextureSource* GetTextureSources() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is called before compositing if the shared data has changed since last
|
|
|
|
* composition.
|
|
|
|
* This method should be overload in cases like when we need to do a texture
|
|
|
|
* upload for example.
|
|
|
|
*
|
|
|
|
* @param aRegion The region that has been changed, if nil, it means that the
|
|
|
|
* entire surface should be updated.
|
|
|
|
*/
|
2013-12-05 10:39:22 -08:00
|
|
|
virtual void Updated(const nsIntRegion* aRegion = nullptr) {}
|
2013-07-30 02:59:51 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets this TextureHost's compositor.
|
|
|
|
* A TextureHost can change compositor on certain occasions, in particular if
|
|
|
|
* it belongs to an async Compositable.
|
|
|
|
* aCompositor can be null, in which case the TextureHost must cleanup all
|
|
|
|
* of it's device textures.
|
|
|
|
*/
|
|
|
|
virtual void SetCompositor(Compositor* aCompositor) {}
|
|
|
|
|
|
|
|
/**
|
2013-08-08 05:53:12 -07:00
|
|
|
* Should be overridden in order to deallocate the data that is associated
|
2013-07-30 02:59:51 -07:00
|
|
|
* with the rendering backend, such as GL textures.
|
|
|
|
*/
|
|
|
|
virtual void DeallocateDeviceData() {}
|
|
|
|
|
|
|
|
/**
|
2013-08-08 05:53:12 -07:00
|
|
|
* Should be overridden in order to deallocate the data that is shared with
|
2013-07-30 02:59:51 -07:00
|
|
|
* the content side, such as shared memory.
|
|
|
|
*/
|
|
|
|
virtual void DeallocateSharedData() {}
|
|
|
|
|
2013-12-11 17:44:45 -08:00
|
|
|
/**
|
|
|
|
* Should be overridden in order to force the TextureHost to drop all references
|
|
|
|
* to it's shared data.
|
|
|
|
*
|
|
|
|
* This is important to ensure the correctness of the deallocation protocol.
|
|
|
|
*/
|
|
|
|
virtual void ForgetSharedData() {}
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
virtual gfx::IntSize GetSize() const = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Debug facility.
|
2013-08-08 05:53:12 -07:00
|
|
|
* XXX - cool kids use Moz2D. See bug 882113.
|
2013-07-30 02:59:51 -07:00
|
|
|
*/
|
2013-11-27 01:59:01 -08:00
|
|
|
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() = 0;
|
2013-07-30 02:59:51 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* XXX - Flags should only be set at creation time, this will be removed.
|
|
|
|
*/
|
|
|
|
void SetFlags(TextureFlags aFlags) { mFlags = aFlags; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* XXX - Flags should only be set at creation time, this will be removed.
|
|
|
|
*/
|
|
|
|
void AddFlag(TextureFlags aFlag) { mFlags |= aFlag; }
|
|
|
|
|
|
|
|
TextureFlags GetFlags() { return mFlags; }
|
|
|
|
|
2013-12-11 17:44:44 -08:00
|
|
|
/**
|
|
|
|
* Allocate and deallocate a TextureParent actor.
|
|
|
|
*
|
|
|
|
* TextureParent< is an implementation detail of TextureHost that is not
|
|
|
|
* exposed to the rest of the code base. CreateIPDLActor and DestroyIPDLActor
|
|
|
|
* are for use with the managing IPDL protocols only (so that they can
|
|
|
|
* implement AllocPTextureParent and DeallocPTextureParent).
|
|
|
|
*/
|
2014-05-05 18:56:40 -07:00
|
|
|
static PTextureParent* CreateIPDLActor(CompositableParentManager* aManager,
|
2014-01-21 14:06:18 -08:00
|
|
|
const SurfaceDescriptor& aSharedData,
|
|
|
|
TextureFlags aFlags);
|
2013-12-11 17:44:44 -08:00
|
|
|
static bool DestroyIPDLActor(PTextureParent* actor);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroy the TextureChild/Parent pair.
|
|
|
|
*/
|
|
|
|
static bool SendDeleteIPDLActor(PTextureParent* actor);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the TextureHost corresponding to the actor passed in parameter.
|
|
|
|
*/
|
|
|
|
static TextureHost* AsTextureHost(PTextureParent* actor);
|
|
|
|
|
2014-02-24 20:23:41 -08:00
|
|
|
/**
|
|
|
|
* Return a pointer to the IPDLActor.
|
|
|
|
*
|
|
|
|
* This is to be used with IPDL messages only. Do not store the returned
|
|
|
|
* pointer.
|
|
|
|
*/
|
|
|
|
PTextureParent* GetIPDLActor();
|
|
|
|
|
2014-05-12 07:39:25 -07:00
|
|
|
static void SendFenceHandleIfPresent(PTextureParent* actor);
|
|
|
|
|
2014-05-24 09:14:45 -07:00
|
|
|
FenceHandle GetAndResetReleaseFenceHandle();
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
/**
|
|
|
|
* Specific to B2G's Composer2D
|
|
|
|
* XXX - more doc here
|
|
|
|
*/
|
|
|
|
virtual LayerRenderState GetRenderState()
|
|
|
|
{
|
2013-08-08 05:53:12 -07:00
|
|
|
// By default we return an empty render state, this should be overridden
|
2013-07-30 02:59:51 -07:00
|
|
|
// by the TextureHost implementations that are used on B2G with Composer2D
|
|
|
|
return LayerRenderState();
|
|
|
|
}
|
|
|
|
|
2013-09-30 05:14:38 -07:00
|
|
|
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData);
|
2013-09-12 19:39:26 -07:00
|
|
|
|
2013-09-27 02:48:42 -07:00
|
|
|
// If a texture host holds a reference to shmem, it should override this method
|
|
|
|
// to forget about the shmem _without_ releasing it.
|
2013-12-11 17:45:01 -08:00
|
|
|
virtual void OnShutdown() {}
|
2013-09-27 02:48:42 -07:00
|
|
|
|
2014-06-04 18:27:41 -07:00
|
|
|
// Forget buffer actor. Used only for hacky fix for bug 966446.
|
2014-02-06 17:32:29 -08:00
|
|
|
virtual void ForgetBufferActor() {}
|
|
|
|
|
2013-09-23 04:28:40 -07:00
|
|
|
virtual const char *Name() { return "TextureHost"; }
|
|
|
|
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
|
2013-07-30 02:59:51 -07:00
|
|
|
|
2014-03-07 13:34:04 -08:00
|
|
|
/**
|
|
|
|
* Indicates whether the TextureHost implementation is backed by an
|
|
|
|
* in-memory buffer. The consequence of this is that locking the
|
|
|
|
* TextureHost does not contend with locking the texture on the client side.
|
|
|
|
*/
|
|
|
|
virtual bool HasInternalBuffer() const { return false; }
|
|
|
|
|
2014-02-24 20:23:41 -08:00
|
|
|
/**
|
|
|
|
* Cast to a TextureHost for each backend.
|
|
|
|
*/
|
|
|
|
virtual TextureHostOGL* AsHostOGL() { return nullptr; }
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
protected:
|
2014-02-24 20:23:41 -08:00
|
|
|
PTextureParent* mActor;
|
2013-07-30 02:59:51 -07:00
|
|
|
TextureFlags mFlags;
|
2013-09-30 05:14:38 -07:00
|
|
|
RefPtr<CompositableBackendSpecificData> mCompositableBackendData;
|
2014-02-24 20:23:41 -08:00
|
|
|
|
|
|
|
friend class TextureParent;
|
2013-07-30 02:59:51 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TextureHost that wraps a random access buffer such as a Shmem or some raw
|
|
|
|
* memory.
|
|
|
|
*
|
|
|
|
* This TextureHost is backend-independent and the backend-specific bits are
|
|
|
|
* in the TextureSource.
|
|
|
|
* This class must be inherited to implement GetBuffer and DeallocSharedData
|
|
|
|
* (see ShmemTextureHost and MemoryTextureHost)
|
|
|
|
*
|
|
|
|
* Uploads happen when Lock is called.
|
|
|
|
*
|
|
|
|
* BufferTextureHost supports YCbCr and flavours of RGBA images (RGBX, A, etc.).
|
|
|
|
*/
|
|
|
|
class BufferTextureHost : public TextureHost
|
|
|
|
{
|
|
|
|
public:
|
2013-12-11 17:44:47 -08:00
|
|
|
BufferTextureHost(gfx::SurfaceFormat aFormat,
|
2013-07-30 02:59:51 -07:00
|
|
|
TextureFlags aFlags);
|
|
|
|
|
|
|
|
~BufferTextureHost();
|
|
|
|
|
|
|
|
virtual uint8_t* GetBuffer() = 0;
|
2014-03-07 13:34:04 -08:00
|
|
|
|
2014-02-20 13:04:11 -08:00
|
|
|
virtual size_t GetBufferSize() = 0;
|
2013-07-30 02:59:51 -07:00
|
|
|
|
2013-12-05 10:39:22 -08:00
|
|
|
virtual void Updated(const nsIntRegion* aRegion = nullptr) MOZ_OVERRIDE;
|
2013-07-30 02:59:51 -07:00
|
|
|
|
|
|
|
virtual bool Lock() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual void Unlock() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual NewTextureSource* GetTextureSources() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual void DeallocateDeviceData() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the format that is exposed to the compositor when calling
|
|
|
|
* GetTextureSources.
|
|
|
|
*
|
|
|
|
* If the shared format is YCbCr and the compositor does not support it,
|
2014-01-10 11:06:16 -08:00
|
|
|
* GetFormat will be RGB32 (even though mFormat is SurfaceFormat::YUV).
|
2013-07-30 02:59:51 -07:00
|
|
|
*/
|
|
|
|
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
|
|
|
|
2013-11-27 01:59:01 -08:00
|
|
|
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
|
2013-08-08 05:53:12 -07:00
|
|
|
|
2014-03-07 13:34:04 -08:00
|
|
|
virtual bool HasInternalBuffer() const MOZ_OVERRIDE { return true; }
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
protected:
|
|
|
|
bool Upload(nsIntRegion *aRegion = nullptr);
|
2013-08-03 10:30:28 -07:00
|
|
|
bool MaybeUpload(nsIntRegion *aRegion = nullptr);
|
2013-07-30 02:59:51 -07:00
|
|
|
|
|
|
|
Compositor* mCompositor;
|
|
|
|
RefPtr<DataTextureSource> mFirstSource;
|
|
|
|
nsIntRegion mMaybeUpdatedRegion;
|
|
|
|
gfx::IntSize mSize;
|
|
|
|
// format of the data that is shared with the content process.
|
|
|
|
gfx::SurfaceFormat mFormat;
|
|
|
|
uint32_t mUpdateSerial;
|
|
|
|
bool mLocked;
|
|
|
|
bool mPartialUpdate;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TextureHost that wraps shared memory.
|
|
|
|
* the corresponding texture on the client side is ShmemTextureClient.
|
|
|
|
* This TextureHost is backend-independent.
|
|
|
|
*/
|
|
|
|
class ShmemTextureHost : public BufferTextureHost
|
|
|
|
{
|
|
|
|
public:
|
2013-12-11 17:44:47 -08:00
|
|
|
ShmemTextureHost(const mozilla::ipc::Shmem& aShmem,
|
2013-07-30 02:59:51 -07:00
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
ISurfaceAllocator* aDeallocator,
|
|
|
|
TextureFlags aFlags);
|
|
|
|
|
|
|
|
~ShmemTextureHost();
|
|
|
|
|
|
|
|
virtual void DeallocateSharedData() MOZ_OVERRIDE;
|
|
|
|
|
2013-12-11 17:44:45 -08:00
|
|
|
virtual void ForgetSharedData() MOZ_OVERRIDE;
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
virtual uint8_t* GetBuffer() MOZ_OVERRIDE;
|
|
|
|
|
2014-02-20 13:04:11 -08:00
|
|
|
virtual size_t GetBufferSize() MOZ_OVERRIDE;
|
|
|
|
|
2013-09-23 04:28:40 -07:00
|
|
|
virtual const char *Name() MOZ_OVERRIDE { return "ShmemTextureHost"; }
|
|
|
|
|
2013-12-11 17:45:01 -08:00
|
|
|
virtual void OnShutdown() MOZ_OVERRIDE;
|
2013-09-27 02:48:42 -07:00
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
protected:
|
2013-11-17 11:03:55 -08:00
|
|
|
mozilla::ipc::Shmem* mShmem;
|
2013-12-03 10:44:38 -08:00
|
|
|
RefPtr<ISurfaceAllocator> mDeallocator;
|
2013-07-30 02:59:51 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TextureHost that wraps raw memory.
|
|
|
|
* The corresponding texture on the client side is MemoryTextureClient.
|
|
|
|
* Can obviously not be used in a cross process setup.
|
|
|
|
* This TextureHost is backend-independent.
|
|
|
|
*/
|
|
|
|
class MemoryTextureHost : public BufferTextureHost
|
|
|
|
{
|
|
|
|
public:
|
2013-12-11 17:44:47 -08:00
|
|
|
MemoryTextureHost(uint8_t* aBuffer,
|
2013-07-30 02:59:51 -07:00
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
TextureFlags aFlags);
|
|
|
|
|
|
|
|
~MemoryTextureHost();
|
|
|
|
|
|
|
|
virtual void DeallocateSharedData() MOZ_OVERRIDE;
|
|
|
|
|
2013-12-11 17:44:45 -08:00
|
|
|
virtual void ForgetSharedData() MOZ_OVERRIDE;
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
virtual uint8_t* GetBuffer() MOZ_OVERRIDE;
|
|
|
|
|
2014-02-20 13:04:11 -08:00
|
|
|
virtual size_t GetBufferSize() MOZ_OVERRIDE;
|
|
|
|
|
2013-09-23 04:28:40 -07:00
|
|
|
virtual const char *Name() MOZ_OVERRIDE { return "MemoryTextureHost"; }
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
protected:
|
|
|
|
uint8_t* mBuffer;
|
|
|
|
};
|
|
|
|
|
2013-12-19 08:20:51 -08:00
|
|
|
class MOZ_STACK_CLASS AutoLockTextureHost
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AutoLockTextureHost(TextureHost* aTexture)
|
|
|
|
: mTexture(aTexture)
|
|
|
|
{
|
2013-12-20 14:30:52 -08:00
|
|
|
mLocked = mTexture ? mTexture->Lock() : false;
|
2013-12-19 08:20:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
~AutoLockTextureHost()
|
|
|
|
{
|
2013-12-20 14:30:52 -08:00
|
|
|
if (mTexture && mLocked) {
|
2013-12-19 08:20:51 -08:00
|
|
|
mTexture->Unlock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-20 14:30:52 -08:00
|
|
|
bool Failed() { return mTexture && !mLocked; }
|
2013-12-19 08:20:51 -08:00
|
|
|
|
|
|
|
private:
|
|
|
|
RefPtr<TextureHost> mTexture;
|
|
|
|
bool mLocked;
|
|
|
|
};
|
|
|
|
|
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 02:20:52 -07:00
|
|
|
/**
|
|
|
|
* This can be used as an offscreen rendering target by the compositor, and
|
|
|
|
* subsequently can be used as a source by the compositor.
|
|
|
|
*/
|
|
|
|
class CompositingRenderTarget : public TextureSource
|
|
|
|
{
|
|
|
|
public:
|
2013-11-07 01:53:08 -08:00
|
|
|
CompositingRenderTarget(const gfx::IntPoint& aOrigin)
|
|
|
|
: mOrigin(aOrigin)
|
|
|
|
{}
|
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 02:20:52 -07:00
|
|
|
virtual ~CompositingRenderTarget() {}
|
|
|
|
|
|
|
|
#ifdef MOZ_DUMP_PAINTING
|
2014-01-08 00:37:58 -08:00
|
|
|
virtual TemporaryRef<gfx::DataSourceSurface> Dump(Compositor* aCompositor) { return 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 02:20:52 -07:00
|
|
|
#endif
|
2013-11-07 01:53:08 -08:00
|
|
|
|
|
|
|
const gfx::IntPoint& GetOrigin() { return mOrigin; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
gfx::IntPoint mOrigin;
|
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 02:20:52 -07:00
|
|
|
};
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
/**
|
|
|
|
* Creates a TextureHost that can be used with any of the existing backends
|
|
|
|
* Not all SurfaceDescriptor types are supported
|
|
|
|
*/
|
|
|
|
TemporaryRef<TextureHost>
|
2013-12-11 17:44:47 -08:00
|
|
|
CreateBackendIndependentTextureHost(const SurfaceDescriptor& aDesc,
|
2013-07-30 02:59:51 -07:00
|
|
|
ISurfaceAllocator* aDeallocator,
|
|
|
|
TextureFlags aFlags);
|
|
|
|
|
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 02:20:52 -07:00
|
|
|
}
|
|
|
|
}
|
2013-07-30 02:59:51 -07: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 02:20:52 -07:00
|
|
|
#endif
|