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 13:20:52 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2013-07-04 21:25:50 +04:00
|
|
|
* 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/. */
|
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 13:20:52 +04:00
|
|
|
|
|
|
|
#ifndef MOZILLA_GFX_TEXTUREOGL_H
|
|
|
|
#define MOZILLA_GFX_TEXTUREOGL_H
|
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
#include <stddef.h> // for size_t
|
|
|
|
#include <stdint.h> // for uint64_t
|
2013-09-13 06:39:26 +04:00
|
|
|
#include "CompositableHost.h"
|
2013-09-04 16:14:52 +04:00
|
|
|
#include "GLContextTypes.h" // for GLContext
|
|
|
|
#include "GLDefs.h" // for GLenum, LOCAL_GL_CLAMP_TO_EDGE, etc
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "GLTextureImage.h" // for TextureImage
|
2013-09-25 00:45:14 +04:00
|
|
|
#include "gfxTypes.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/GfxMessageUtils.h" // for gfxContentType
|
|
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
|
|
|
#include "mozilla/Attributes.h" // for MOZ_OVERRIDE
|
|
|
|
#include "mozilla/RefPtr.h" // for RefPtr
|
2014-01-25 05:49:02 +04:00
|
|
|
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/gfx/Point.h" // for IntSize, IntPoint
|
|
|
|
#include "mozilla/gfx/Types.h" // for SurfaceFormat, etc
|
|
|
|
#include "mozilla/layers/CompositorTypes.h" // for TextureFlags
|
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
|
2014-04-03 10:04:04 +04:00
|
|
|
#include "mozilla/layers/TextureHost.h" // for TextureHost, etc
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/mozalloc.h" // for operator delete, etc
|
|
|
|
#include "nsAutoPtr.h" // for nsRefPtr
|
|
|
|
#include "nsCOMPtr.h" // for already_AddRefed
|
|
|
|
#include "nsDebug.h" // for NS_WARNING
|
|
|
|
#include "nsISupportsImpl.h" // for TextureImage::Release, etc
|
2013-11-27 02:15:17 +04:00
|
|
|
#include "OGLShaderProgram.h" // for ShaderProgramType, etc
|
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 13:20:52 +04:00
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
#include <ui/GraphicBuffer.h>
|
2014-02-28 01:26:22 +04:00
|
|
|
#if ANDROID_VERSION >= 17
|
2014-02-25 08:23:41 +04:00
|
|
|
#include <ui/Fence.h>
|
|
|
|
#endif
|
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 13:20:52 +04:00
|
|
|
#endif
|
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
class gfxReusableSurfaceWrapper;
|
|
|
|
class nsIntRegion;
|
2014-09-17 17:13:29 +04:00
|
|
|
class nsSurfaceTexture;
|
2013-08-12 03:17:23 +04:00
|
|
|
struct nsIntPoint;
|
2013-09-07 06:15:49 +04:00
|
|
|
struct nsIntRect;
|
|
|
|
struct nsIntSize;
|
2013-08-12 03:17:23 +04: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 13:20:52 +04:00
|
|
|
namespace mozilla {
|
2013-08-12 03:17:23 +04:00
|
|
|
namespace gfx {
|
|
|
|
class DataSourceSurface;
|
2014-07-12 02:10:49 +04: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 13:20:52 +04:00
|
|
|
namespace layers {
|
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
class Compositor;
|
2013-08-12 06:21:17 +04:00
|
|
|
class CompositorOGL;
|
2014-04-02 10:45:02 +04:00
|
|
|
class TextureImageTextureSourceOGL;
|
2014-09-26 15:30:11 +04:00
|
|
|
class TextureSharedDataGonkOGL;
|
2013-05-16 07:45:43 +04:00
|
|
|
|
2013-09-13 06:39:26 +04:00
|
|
|
/**
|
2013-09-30 16:14:38 +04:00
|
|
|
* CompositableBackendSpecificData implementation for the Gonk OpenGL backend.
|
2013-09-13 06:39:26 +04:00
|
|
|
* Share a same texture between TextureHosts in the same CompositableHost.
|
|
|
|
* By shareing the texture among the TextureHosts, number of texture allocations
|
|
|
|
* can be reduced than texture allocation in every TextureHosts.
|
|
|
|
* From Bug 912134, use only one texture among all TextureHosts degrade
|
|
|
|
* the rendering performance.
|
2013-09-30 16:14:38 +04:00
|
|
|
* CompositableDataGonkOGL chooses in a middile of them.
|
2013-09-13 06:39:26 +04:00
|
|
|
*/
|
2013-09-30 16:14:38 +04:00
|
|
|
class CompositableDataGonkOGL : public CompositableBackendSpecificData
|
2013-09-13 06:39:26 +04:00
|
|
|
{
|
2014-09-26 15:30:11 +04:00
|
|
|
protected:
|
2013-09-30 16:14:38 +04:00
|
|
|
virtual ~CompositableDataGonkOGL();
|
2013-09-13 06:39:26 +04:00
|
|
|
|
2014-09-26 15:30:11 +04:00
|
|
|
public:
|
|
|
|
CompositableDataGonkOGL();
|
2013-10-17 19:09:15 +04:00
|
|
|
virtual void ClearData() MOZ_OVERRIDE;
|
2014-09-26 15:30:11 +04:00
|
|
|
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
TextureSharedDataGonkOGL* GetTextureBackendSpecificData();
|
|
|
|
protected:
|
|
|
|
nsRefPtr<TextureSharedDataGonkOGL> mTextureBackendSpecificData;
|
|
|
|
RefPtr<CompositorOGL> mCompositor;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Manage actual shared resources of CompositableDataGonkOGL.
|
|
|
|
* The resources are split from CompositableDataGonkOGL to handle two use cases.
|
|
|
|
* Normally TextureHost is used from one CompositableHost at the same time.
|
|
|
|
* In this case, performance is good if the resources are owned by CompositableDataGonkOGL.
|
|
|
|
* But TextureHost could be shared among multiple ImageHosts.
|
|
|
|
* If it happens, performance is good if the resource is owned by TextureHost.
|
|
|
|
* The resources ownership is carryed over from CompositableDataGonkOGL to TextureHost.
|
|
|
|
* See Bug 1017351.
|
|
|
|
*/
|
|
|
|
class TextureSharedDataGonkOGL
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
virtual ~TextureSharedDataGonkOGL();
|
|
|
|
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_REFCOUNTING(TextureSharedDataGonkOGL)
|
|
|
|
|
|
|
|
TextureSharedDataGonkOGL();
|
|
|
|
TextureSharedDataGonkOGL(GLuint aTexture, EGLImage aImage, CompositorOGL* aCompositor);
|
|
|
|
|
|
|
|
void SetCompositor(Compositor* aCompositor);
|
|
|
|
void ClearData();
|
|
|
|
|
|
|
|
// Mark TextureSharedDataGonkOGL as owned by TextureHost.
|
|
|
|
void SetOwnedByTextureHost()
|
|
|
|
{
|
|
|
|
mOwnedByCompositableHost = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check if this is owned by CompositableHost or TextureHost.
|
|
|
|
bool IsOwnedByCompositableHost()
|
|
|
|
{
|
|
|
|
return mOwnedByCompositableHost;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsAllowingSharingTextureHost()
|
|
|
|
{
|
|
|
|
return mAllowSharingTextureHost;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetAllowSharingTextureHost(bool aAllow)
|
|
|
|
{
|
|
|
|
mAllowSharingTextureHost = aAllow;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create new TextureSharedDataGonkOGL.
|
|
|
|
// If aImage is already bound to OpenGL texture, the OpenGL textre is carried over
|
|
|
|
// to a new object. It could reduce calling fEGLImageTargetTexture2D()
|
|
|
|
// during resources ownership carry over from CompositableHost to TextureHost.
|
|
|
|
TemporaryRef<TextureSharedDataGonkOGL> GetNewTextureBackendSpecificData(EGLImage aImage);
|
|
|
|
|
2014-04-07 16:09:44 +04:00
|
|
|
GLuint GetTexture();
|
|
|
|
void DeleteTextureIfPresent();
|
2013-09-13 06:39:26 +04:00
|
|
|
gl::GLContext* gl() const;
|
2014-05-14 20:59:25 +04:00
|
|
|
void BindEGLImage(GLuint aTarget, EGLImage aImage);
|
|
|
|
void ClearBoundEGLImage(EGLImage aImage);
|
2014-09-26 15:30:11 +04:00
|
|
|
bool IsEGLImageBound(EGLImage aImage);
|
2013-09-13 06:39:26 +04:00
|
|
|
protected:
|
2014-09-26 15:30:11 +04:00
|
|
|
GLuint GetAndResetGLTextureOwnership();
|
|
|
|
|
|
|
|
bool mOwnedByCompositableHost;
|
|
|
|
bool mAllowSharingTextureHost;
|
2013-09-13 06:39:26 +04:00
|
|
|
RefPtr<CompositorOGL> mCompositor;
|
2014-04-07 16:09:44 +04:00
|
|
|
GLuint mTexture;
|
2014-05-14 20:59:25 +04:00
|
|
|
EGLImage mBoundEGLImage;
|
2013-09-13 06:39:26 +04:00
|
|
|
};
|
|
|
|
|
2014-03-13 04:37:17 +04:00
|
|
|
inline void ApplyFilterToBoundTexture(gl::GLContext* aGL,
|
|
|
|
gfx::Filter aFilter,
|
|
|
|
GLuint aTarget = LOCAL_GL_TEXTURE_2D)
|
|
|
|
{
|
|
|
|
GLenum filter =
|
|
|
|
(aFilter == gfx::Filter::POINT ? LOCAL_GL_NEAREST : LOCAL_GL_LINEAR);
|
|
|
|
|
|
|
|
aGL->fTexParameteri(aTarget, LOCAL_GL_TEXTURE_MIN_FILTER, filter);
|
|
|
|
aGL->fTexParameteri(aTarget, LOCAL_GL_TEXTURE_MAG_FILTER, filter);
|
|
|
|
}
|
|
|
|
|
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 13:20:52 +04:00
|
|
|
/*
|
|
|
|
* TextureHost implementations for the OpenGL backend.
|
|
|
|
*
|
2013-07-09 08:21:06 +04:00
|
|
|
* Note that it is important to be careful about the ownership model with
|
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 13:20:52 +04:00
|
|
|
* the OpenGL backend, due to some widget limitation on Linux: before
|
|
|
|
* the nsBaseWidget associated with our OpenGL context has been completely
|
|
|
|
* deleted, every resource belonging to the OpenGL context MUST have been
|
|
|
|
* released. At the moment the teardown sequence happens in the middle of
|
|
|
|
* the nsBaseWidget's destructor, meaning that at a given moment we must be
|
|
|
|
* able to easily find and release all the GL resources.
|
|
|
|
* The point is: be careful about the ownership model and limit the number
|
|
|
|
* of objects sharing references to GL resources to make the tear down
|
|
|
|
* sequence as simple as possible.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TextureSourceOGL provides the necessary API for CompositorOGL to composite
|
|
|
|
* a TextureSource.
|
|
|
|
*/
|
|
|
|
class TextureSourceOGL
|
|
|
|
{
|
|
|
|
public:
|
2014-03-13 04:37:17 +04:00
|
|
|
TextureSourceOGL()
|
|
|
|
: mHasCachedFilter(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 13:20:52 +04:00
|
|
|
virtual bool IsValid() const = 0;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2014-03-13 04:37:17 +04:00
|
|
|
virtual void BindTexture(GLenum aTextureUnit, gfx::Filter aFilter) = 0;
|
2013-07-30 13:59:51 +04: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 13:20:52 +04:00
|
|
|
virtual gfx::IntSize GetSize() const = 0;
|
2013-07-30 13:59:51 +04: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 13:20:52 +04:00
|
|
|
virtual GLenum GetTextureTarget() const { return LOCAL_GL_TEXTURE_2D; }
|
2013-07-30 13:59:51 +04:00
|
|
|
|
|
|
|
virtual gfx::SurfaceFormat GetFormat() const = 0;
|
|
|
|
|
|
|
|
virtual GLenum GetWrapMode() const = 0;
|
|
|
|
|
2014-01-25 05:49:02 +04:00
|
|
|
virtual gfx::Matrix4x4 GetTextureTransform() { return gfx::Matrix4x4(); }
|
2013-05-16 07:45:43 +04:00
|
|
|
|
2014-04-02 10:45:02 +04:00
|
|
|
virtual TextureImageTextureSourceOGL* AsTextureImageTextureSource() { return nullptr; }
|
2014-03-13 04:37:17 +04:00
|
|
|
|
|
|
|
void SetFilter(gl::GLContext* aGL, gfx::Filter aFilter)
|
|
|
|
{
|
|
|
|
if (mHasCachedFilter &&
|
|
|
|
mCachedFilter == aFilter) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mHasCachedFilter = true;
|
|
|
|
mCachedFilter = aFilter;
|
|
|
|
ApplyFilterToBoundTexture(aGL, aFilter, GetTextureTarget());
|
|
|
|
}
|
|
|
|
|
|
|
|
void ClearCachedFilter() { mHasCachedFilter = false; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
gfx::Filter mCachedFilter;
|
|
|
|
bool mHasCachedFilter;
|
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 13:20:52 +04:00
|
|
|
};
|
|
|
|
|
2014-02-25 08:23:41 +04:00
|
|
|
/**
|
|
|
|
* TextureHostOGL provides the necessary API for platform specific composition.
|
|
|
|
*/
|
|
|
|
class TextureHostOGL
|
|
|
|
{
|
|
|
|
public:
|
2014-03-27 05:01:15 +04:00
|
|
|
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
|
2014-02-25 08:23:41 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Store a fence that will signal when the current buffer is no longer being read.
|
|
|
|
* Similar to android's GLConsumer::setReleaseFence()
|
|
|
|
*/
|
|
|
|
virtual bool SetReleaseFence(const android::sp<android::Fence>& aReleaseFence);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a releaseFence's Fence and clear a reference to the Fence.
|
|
|
|
*/
|
|
|
|
virtual android::sp<android::Fence> GetAndResetReleaseFence();
|
2014-03-27 05:01:15 +04:00
|
|
|
|
2014-06-08 17:18:53 +04:00
|
|
|
virtual void SetAcquireFence(const android::sp<android::Fence>& aAcquireFence);
|
|
|
|
|
2014-06-13 05:46:25 +04:00
|
|
|
/**
|
|
|
|
* Return a acquireFence's Fence and clear a reference to the Fence.
|
|
|
|
*/
|
|
|
|
virtual android::sp<android::Fence> GetAndResetAcquireFence();
|
2014-06-08 17:18:53 +04:00
|
|
|
|
|
|
|
virtual void WaitAcquireFenceSyncComplete();
|
|
|
|
|
2014-02-25 08:23:41 +04:00
|
|
|
protected:
|
|
|
|
android::sp<android::Fence> mReleaseFence;
|
2014-03-27 05:01:15 +04:00
|
|
|
|
2014-06-08 17:18:53 +04:00
|
|
|
android::sp<android::Fence> mAcquireFence;
|
|
|
|
|
2014-03-27 05:01:15 +04:00
|
|
|
/**
|
|
|
|
* Hold previous ReleaseFence to prevent Fence delivery failure via gecko IPC.
|
|
|
|
* Fence is a kernel object and its lifetime is managed by a reference count.
|
|
|
|
* Until the Fence is delivered to client side, need to hold Fence on host side.
|
|
|
|
*/
|
|
|
|
android::sp<android::Fence> mPrevReleaseFence;
|
2014-02-25 08:23:41 +04:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
/**
|
|
|
|
* A TextureSource backed by a TextureImage.
|
|
|
|
*
|
|
|
|
* Depending on the underlying TextureImage, may support texture tiling, so
|
2014-04-28 15:27:25 +04:00
|
|
|
* make sure to check AsBigImageIterator() and use the texture accordingly.
|
2013-07-30 13:59:51 +04:00
|
|
|
*
|
|
|
|
* This TextureSource can be used without a TextureHost and manage it's own
|
|
|
|
* GL texture(s).
|
|
|
|
*/
|
2014-08-05 21:33:55 +04:00
|
|
|
class TextureImageTextureSourceOGL MOZ_FINAL : public DataTextureSource
|
|
|
|
, public TextureSourceOGL
|
|
|
|
, public 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 13:20:52 +04:00
|
|
|
{
|
2013-07-30 13:59:51 +04:00
|
|
|
public:
|
2014-08-20 08:55:14 +04:00
|
|
|
explicit TextureImageTextureSourceOGL(gl::GLContext* aGL,
|
|
|
|
TextureFlags aFlags = TextureFlags::DEFAULT)
|
2013-07-30 13:59:51 +04:00
|
|
|
: mGL(aGL)
|
2014-01-07 20:20:11 +04:00
|
|
|
, mFlags(aFlags)
|
2013-07-30 13:59:51 +04:00
|
|
|
, mIterating(false)
|
|
|
|
{}
|
|
|
|
|
|
|
|
// DataTextureSource
|
|
|
|
|
|
|
|
virtual bool Update(gfx::DataSourceSurface* aSurface,
|
|
|
|
nsIntRegion* aDestRegion = nullptr,
|
|
|
|
gfx::IntPoint* aSrcOffset = nullptr) MOZ_OVERRIDE;
|
|
|
|
|
2014-04-02 10:45:02 +04:00
|
|
|
void EnsureBuffer(const nsIntSize& aSize,
|
|
|
|
gfxContentType aContentType);
|
|
|
|
|
|
|
|
void CopyTo(const nsIntRect& aSourceRect,
|
|
|
|
DataTextureSource* aDest,
|
|
|
|
const nsIntRect& aDestRect);
|
|
|
|
|
|
|
|
virtual TextureImageTextureSourceOGL* AsTextureImageTextureSource() { return this; }
|
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
// TextureSource
|
|
|
|
|
|
|
|
virtual void DeallocateDeviceData() MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
mTexImage = nullptr;
|
|
|
|
SetUpdateSerial(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; }
|
|
|
|
|
2014-03-13 04:37:17 +04:00
|
|
|
virtual void BindTexture(GLenum aTextureUnit, gfx::Filter aFilter) MOZ_OVERRIDE;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
|
|
|
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual bool IsValid() const MOZ_OVERRIDE { return !!mTexImage; }
|
|
|
|
|
2014-01-07 20:20:11 +04:00
|
|
|
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
virtual GLenum GetWrapMode() const MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
return mTexImage->GetWrapMode();
|
|
|
|
}
|
|
|
|
|
2014-04-28 15:27:25 +04:00
|
|
|
// BigImageIterator
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2014-04-28 15:27:25 +04:00
|
|
|
virtual BigImageIterator* AsBigImageIterator() MOZ_OVERRIDE { return this; }
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2014-04-28 15:27:25 +04:00
|
|
|
virtual void BeginBigImageIteration() MOZ_OVERRIDE
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
2014-04-28 15:27:25 +04:00
|
|
|
mTexImage->BeginBigImageIteration();
|
2013-07-30 13:59:51 +04:00
|
|
|
mIterating = true;
|
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 13:20:52 +04:00
|
|
|
}
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2014-04-28 15:27:25 +04:00
|
|
|
virtual void EndBigImageIteration() MOZ_OVERRIDE
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
|
|
|
mIterating = false;
|
|
|
|
}
|
|
|
|
|
2013-08-13 17:44:53 +04:00
|
|
|
virtual nsIntRect GetTileRect() MOZ_OVERRIDE;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
|
|
|
virtual size_t GetTileCount() MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
return mTexImage->GetTileCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool NextTile() MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
return mTexImage->NextTile();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsRefPtr<gl::TextureImage> mTexImage;
|
|
|
|
gl::GLContext* mGL;
|
2014-01-07 20:20:11 +04:00
|
|
|
TextureFlags mFlags;
|
2013-07-30 13:59:51 +04:00
|
|
|
bool mIterating;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2014-09-17 17:13:29 +04:00
|
|
|
* A texture source for GL textures.
|
2013-07-30 13:59:51 +04:00
|
|
|
*
|
|
|
|
* It does not own any GL texture, and attaches its shared handle to one of
|
|
|
|
* the compositor's temporary textures when binding.
|
|
|
|
*
|
|
|
|
* The shared texture handle is owned by the TextureHost.
|
|
|
|
*/
|
2014-10-07 17:58:59 +04:00
|
|
|
class GLTextureSource : public TextureSource
|
2014-09-17 17:13:29 +04:00
|
|
|
, public TextureSourceOGL
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-17 17:13:29 +04:00
|
|
|
GLTextureSource(CompositorOGL* aCompositor,
|
|
|
|
GLuint aTex,
|
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
GLenum aTarget,
|
|
|
|
gfx::IntSize aSize);
|
|
|
|
|
|
|
|
virtual TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; }
|
|
|
|
|
|
|
|
virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual bool IsValid() const MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
|
|
|
|
|
|
|
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
|
|
|
|
|
|
|
virtual GLenum GetTextureTarget() const { return mTextureTarget; }
|
|
|
|
|
|
|
|
virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return LOCAL_GL_CLAMP_TO_EDGE; }
|
|
|
|
|
|
|
|
virtual void DeallocateDeviceData() MOZ_OVERRIDE {}
|
|
|
|
|
|
|
|
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
gl::GLContext* gl() const;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
protected:
|
|
|
|
const gfx::IntSize mSize;
|
|
|
|
CompositorOGL* mCompositor;
|
|
|
|
const GLuint mTex;
|
|
|
|
const gfx::SurfaceFormat mFormat;
|
|
|
|
const GLenum mTextureTarget;
|
|
|
|
};
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// SurfaceTexture
|
|
|
|
|
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
|
|
|
|
2014-10-07 17:58:59 +04:00
|
|
|
class SurfaceTextureSource : public TextureSource
|
2014-09-17 17:13:29 +04:00
|
|
|
, public TextureSourceOGL
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SurfaceTextureSource(CompositorOGL* aCompositor,
|
|
|
|
nsSurfaceTexture* aSurfTex,
|
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
GLenum aTarget,
|
|
|
|
GLenum aWrapMode,
|
|
|
|
gfx::IntSize aSize);
|
2013-07-30 13:59:51 +04:00
|
|
|
|
|
|
|
virtual TextureSourceOGL* AsSourceOGL() { return this; }
|
|
|
|
|
2014-03-13 04:37:17 +04:00
|
|
|
virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) MOZ_OVERRIDE;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
|
|
|
virtual bool IsValid() const MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
|
|
|
|
|
|
|
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
|
|
|
|
2014-01-25 05:49:02 +04:00
|
|
|
virtual gfx::Matrix4x4 GetTextureTransform() MOZ_OVERRIDE;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2013-08-28 00:16:54 +04:00
|
|
|
virtual GLenum GetTextureTarget() const { return mTextureTarget; }
|
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return mWrapMode; }
|
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
// We don't own anything.
|
2014-06-19 04:04:06 +04:00
|
|
|
virtual void DeallocateDeviceData() MOZ_OVERRIDE {}
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2014-01-08 23:25:52 +04:00
|
|
|
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
|
|
|
gl::GLContext* gl() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CompositorOGL* mCompositor;
|
2014-09-17 17:13:29 +04:00
|
|
|
nsSurfaceTexture* const mSurfTex;
|
|
|
|
const gfx::SurfaceFormat mFormat;
|
|
|
|
const GLenum mTextureTarget;
|
|
|
|
const GLenum mWrapMode;
|
|
|
|
const gfx::IntSize mSize;
|
2013-07-30 13:59:51 +04:00
|
|
|
};
|
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
class SurfaceTextureHost : public TextureHost
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-17 17:13:29 +04:00
|
|
|
SurfaceTextureHost(TextureFlags aFlags,
|
|
|
|
nsSurfaceTexture* aSurfTex,
|
|
|
|
gfx::IntSize aSize);
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
virtual ~SurfaceTextureHost();
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
// We don't own anything.
|
2013-07-30 13:59:51 +04:00
|
|
|
virtual void DeallocateDeviceData() MOZ_OVERRIDE {}
|
|
|
|
|
|
|
|
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual bool Lock() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual void Unlock() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
|
|
|
|
|
2014-10-07 17:58:59 +04:00
|
|
|
virtual TextureSource* GetTextureSources() MOZ_OVERRIDE
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
|
|
|
return mTextureSource;
|
|
|
|
}
|
|
|
|
|
2013-11-27 13:59:01 +04:00
|
|
|
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
|
|
|
return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
|
|
|
|
}
|
|
|
|
|
|
|
|
gl::GLContext* gl() const;
|
|
|
|
|
|
|
|
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
virtual const char* Name() { return "SurfaceTextureHost"; }
|
2013-07-30 13:59:51 +04:00
|
|
|
|
|
|
|
protected:
|
2014-09-17 17:13:29 +04:00
|
|
|
nsSurfaceTexture* const mSurfTex;
|
|
|
|
const gfx::IntSize mSize;
|
2013-07-30 13:59:51 +04:00
|
|
|
CompositorOGL* mCompositor;
|
2014-09-17 17:13:29 +04:00
|
|
|
RefPtr<SurfaceTextureSource> mTextureSource;
|
2014-09-12 23:01:26 +04:00
|
|
|
};
|
2014-09-12 22:39:20 +04:00
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
#endif // MOZ_WIDGET_ANDROID
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// EGLImage
|
|
|
|
|
2014-10-07 17:58:59 +04:00
|
|
|
class EGLImageTextureSource : public TextureSource
|
2014-09-17 17:13:29 +04:00
|
|
|
, public TextureSourceOGL
|
2014-01-10 17:06:06 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-17 17:13:29 +04:00
|
|
|
EGLImageTextureSource(CompositorOGL* aCompositor,
|
|
|
|
EGLImage aImage,
|
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
GLenum aTarget,
|
|
|
|
GLenum aWrapMode,
|
|
|
|
gfx::IntSize aSize);
|
2014-09-12 23:01:26 +04:00
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
virtual TextureSourceOGL* AsSourceOGL() { return this; }
|
2014-01-10 17:06:06 +04:00
|
|
|
|
2014-03-13 04:37:17 +04:00
|
|
|
virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) MOZ_OVERRIDE;
|
2014-01-10 17:06:06 +04:00
|
|
|
|
2014-06-19 04:04:06 +04:00
|
|
|
virtual bool IsValid() const MOZ_OVERRIDE;
|
2014-01-10 17:06:06 +04:00
|
|
|
|
|
|
|
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
|
|
|
|
|
|
|
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
virtual gfx::Matrix4x4 GetTextureTransform() MOZ_OVERRIDE;
|
|
|
|
|
2014-01-10 17:06:06 +04:00
|
|
|
virtual GLenum GetTextureTarget() const { return mTextureTarget; }
|
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return mWrapMode; }
|
2014-01-10 17:06:06 +04:00
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
// We don't own anything.
|
2014-06-05 05:27:22 +04:00
|
|
|
virtual void DeallocateDeviceData() MOZ_OVERRIDE {}
|
|
|
|
|
|
|
|
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
|
|
|
|
2014-06-19 04:04:06 +04:00
|
|
|
gl::GLContext* gl() const;
|
2014-06-05 05:27:22 +04:00
|
|
|
|
2014-01-10 17:06:06 +04:00
|
|
|
protected:
|
|
|
|
CompositorOGL* mCompositor;
|
2014-09-17 17:13:29 +04:00
|
|
|
const EGLImage mImage;
|
2014-06-19 04:04:06 +04:00
|
|
|
const gfx::SurfaceFormat mFormat;
|
|
|
|
const GLenum mTextureTarget;
|
2014-09-17 17:13:29 +04:00
|
|
|
const GLenum mWrapMode;
|
|
|
|
const gfx::IntSize mSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
class EGLImageTextureHost : public TextureHost
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EGLImageTextureHost(TextureFlags aFlags,
|
|
|
|
EGLImage aImage,
|
|
|
|
gfx::IntSize aSize);
|
|
|
|
|
|
|
|
virtual ~EGLImageTextureHost();
|
|
|
|
|
|
|
|
// We don't own anything.
|
|
|
|
virtual void DeallocateDeviceData() MOZ_OVERRIDE {}
|
|
|
|
|
|
|
|
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual bool Lock() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual void Unlock() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
|
|
|
|
|
2014-10-07 17:58:59 +04:00
|
|
|
virtual TextureSource* GetTextureSources() MOZ_OVERRIDE
|
2014-09-17 17:13:29 +04:00
|
|
|
{
|
|
|
|
return mTextureSource;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
|
|
|
|
}
|
|
|
|
|
|
|
|
gl::GLContext* gl() const;
|
|
|
|
|
|
|
|
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
|
|
|
|
|
|
|
virtual const char* Name() { return "EGLImageTextureHost"; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
const EGLImage mImage;
|
|
|
|
const gfx::IntSize mSize;
|
|
|
|
CompositorOGL* mCompositor;
|
|
|
|
RefPtr<EGLImageTextureSource> mTextureSource;
|
2013-07-30 13:59:51 +04: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 13:20:52 +04:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif /* MOZILLA_GFX_TEXTUREOGL_H */
|