2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2013-07-04 21:25:50 +04:00
|
|
|
* 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
|
2015-03-21 19:28:04 +03:00
|
|
|
#include "mozilla/Attributes.h" // for override
|
2015-10-18 08:24:48 +03:00
|
|
|
#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
|
2014-10-16 17:48:29 +04:00
|
|
|
#include "mozilla/layers/CompositorOGL.h" // for CompositorOGL
|
2013-08-12 03:17:23 +04:00
|
|
|
#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 "nsCOMPtr.h" // for already_AddRefed
|
|
|
|
#include "nsDebug.h" // for NS_WARNING
|
|
|
|
#include "nsISupportsImpl.h" // for TextureImage::Release, etc
|
2015-11-04 19:49:49 +03:00
|
|
|
#include "nsRegionFwd.h" // for nsIntRegion
|
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
|
|
|
|
2017-03-04 00:14:27 +03:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
|
|
|
#include "GeneratedJNIWrappers.h"
|
|
|
|
#include "AndroidSurfaceTexture.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
|
|
|
namespace mozilla {
|
2013-08-12 03:17:23 +04:00
|
|
|
namespace gfx {
|
|
|
|
class DataSourceSurface;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace gfx
|
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-10-16 21:08:32 +04:00
|
|
|
class GLTextureSource;
|
2013-09-13 06:39:26 +04:00
|
|
|
|
2016-05-25 19:01:18 +03:00
|
|
|
inline void ApplySamplingFilterToBoundTexture(gl::GLContext* aGL,
|
|
|
|
gfx::SamplingFilter aSamplingFilter,
|
|
|
|
GLuint aTarget = LOCAL_GL_TEXTURE_2D)
|
2014-03-13 04:37:17 +04:00
|
|
|
{
|
|
|
|
GLenum filter =
|
2016-05-25 19:01:18 +03:00
|
|
|
(aSamplingFilter == gfx::SamplingFilter::POINT ? LOCAL_GL_NEAREST : LOCAL_GL_LINEAR);
|
2014-03-13 04:37:17 +04:00
|
|
|
|
|
|
|
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()
|
2018-06-16 17:42:33 +03:00
|
|
|
: mCachedSamplingFilter(gfx::SamplingFilter::GOOD)
|
|
|
|
, mHasCachedSamplingFilter(false)
|
2014-03-13 04:37:17 +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 bool IsValid() const = 0;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2016-05-25 19:01:18 +03:00
|
|
|
virtual void BindTexture(GLenum aTextureUnit,
|
|
|
|
gfx::SamplingFilter aSamplingFilter) = 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
|
|
|
|
2014-10-16 21:08:32 +04:00
|
|
|
virtual GLTextureSource* AsGLTextureSource() { return nullptr; }
|
|
|
|
|
2016-05-25 19:01:18 +03:00
|
|
|
void SetSamplingFilter(gl::GLContext* aGL, gfx::SamplingFilter aSamplingFilter)
|
2014-03-13 04:37:17 +04:00
|
|
|
{
|
2016-05-25 19:01:18 +03:00
|
|
|
if (mHasCachedSamplingFilter &&
|
|
|
|
mCachedSamplingFilter == aSamplingFilter) {
|
2014-03-13 04:37:17 +04:00
|
|
|
return;
|
|
|
|
}
|
2016-05-25 19:01:18 +03:00
|
|
|
mHasCachedSamplingFilter = true;
|
|
|
|
mCachedSamplingFilter = aSamplingFilter;
|
|
|
|
ApplySamplingFilterToBoundTexture(aGL, aSamplingFilter, GetTextureTarget());
|
2014-03-13 04:37:17 +04:00
|
|
|
}
|
|
|
|
|
2016-05-25 19:01:18 +03:00
|
|
|
void ClearCachedFilter() { mHasCachedSamplingFilter = false; }
|
2014-03-13 04:37:17 +04:00
|
|
|
|
|
|
|
private:
|
2016-05-25 19:01:18 +03:00
|
|
|
gfx::SamplingFilter mCachedSamplingFilter;
|
|
|
|
bool mHasCachedSamplingFilter;
|
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
|
|
|
/**
|
|
|
|
* 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).
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
class TextureImageTextureSourceOGL final : public DataTextureSource
|
2015-03-27 21:52:19 +03:00
|
|
|
, 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-11-10 22:49:05 +03:00
|
|
|
explicit TextureImageTextureSourceOGL(CompositorOGL *aCompositor,
|
2014-08-20 08:55:14 +04:00
|
|
|
TextureFlags aFlags = TextureFlags::DEFAULT)
|
2017-03-22 06:32:53 +03:00
|
|
|
: mGL(aCompositor->gl())
|
2014-01-07 20:20:11 +04:00
|
|
|
, mFlags(aFlags)
|
2013-07-30 13:59:51 +04:00
|
|
|
, mIterating(false)
|
|
|
|
{}
|
|
|
|
|
2016-02-08 13:57:00 +03:00
|
|
|
virtual const char* Name() const override { return "TextureImageTextureSourceOGL"; }
|
2013-07-30 13:59:51 +04:00
|
|
|
// DataTextureSource
|
|
|
|
|
|
|
|
virtual bool Update(gfx::DataSourceSurface* aSurface,
|
|
|
|
nsIntRegion* aDestRegion = nullptr,
|
2015-03-21 19:28:04 +03:00
|
|
|
gfx::IntPoint* aSrcOffset = nullptr) override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2015-03-29 17:59:08 +03:00
|
|
|
void EnsureBuffer(const gfx::IntSize& aSize,
|
|
|
|
gfxContentType aContentType);
|
2014-04-02 10:45:02 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual TextureImageTextureSourceOGL* AsTextureImageTextureSource() override { return this; }
|
2014-04-02 10:45:02 +04:00
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
// TextureSource
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DeallocateDeviceData() override
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
|
|
|
mTexImage = nullptr;
|
|
|
|
SetUpdateSerial(0);
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual TextureSourceOGL* AsSourceOGL() override { return this; }
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2016-05-25 19:01:18 +03:00
|
|
|
virtual void BindTexture(GLenum aTextureUnit,
|
|
|
|
gfx::SamplingFilter aSamplingFilter) override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::IntSize GetSize() const override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::SurfaceFormat GetFormat() const override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsValid() const override { return !!mTexImage; }
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2017-03-22 06:32:53 +03:00
|
|
|
virtual void SetTextureSourceProvider(TextureSourceProvider* aProvider) override;
|
2014-01-07 20:20:11 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual GLenum GetWrapMode() const override
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
|
|
|
return mTexImage->GetWrapMode();
|
|
|
|
}
|
|
|
|
|
2014-04-28 15:27:25 +04:00
|
|
|
// BigImageIterator
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual BigImageIterator* AsBigImageIterator() override { return this; }
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void BeginBigImageIteration() 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
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void EndBigImageIteration() override
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
|
|
|
mIterating = false;
|
|
|
|
}
|
|
|
|
|
2015-04-21 18:04:57 +03:00
|
|
|
virtual gfx::IntRect GetTileRect() override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual size_t GetTileCount() override
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
|
|
|
return mTexImage->GetTileCount();
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool NextTile() override
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
|
|
|
return mTexImage->NextTile();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<gl::TextureImage> mTexImage;
|
2017-03-22 06:32:53 +03:00
|
|
|
RefPtr<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.
|
|
|
|
*/
|
2018-05-03 04:20:10 +03:00
|
|
|
class GLTextureSource : public DataTextureSource
|
2014-09-17 17:13:29 +04:00
|
|
|
, public TextureSourceOGL
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
|
|
|
public:
|
2017-03-22 06:32:54 +03:00
|
|
|
GLTextureSource(TextureSourceProvider* aProvider,
|
2014-10-16 21:08:32 +04:00
|
|
|
GLuint aTextureHandle,
|
2014-10-24 22:25:25 +04:00
|
|
|
GLenum aTarget,
|
2014-10-16 21:08:32 +04:00
|
|
|
gfx::IntSize aSize,
|
2018-05-03 04:19:54 +03:00
|
|
|
gfx::SurfaceFormat aFormat);
|
2014-10-16 21:08:32 +04:00
|
|
|
|
2018-05-03 04:20:10 +03:00
|
|
|
virtual ~GLTextureSource();
|
2014-10-16 21:08:32 +04:00
|
|
|
|
2016-02-08 13:57:00 +03:00
|
|
|
virtual const char* Name() const override { return "GLTextureSource"; }
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual GLTextureSource* AsGLTextureSource() override { return this; }
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual TextureSourceOGL* AsSourceOGL() override { return this; }
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2016-05-25 19:01:18 +03:00
|
|
|
virtual void BindTexture(GLenum activetex,
|
|
|
|
gfx::SamplingFilter aSamplingFilter) override;
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsValid() const override;
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::IntSize GetSize() const override { return mSize; }
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; }
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual GLenum GetTextureTarget() const override { return mTextureTarget; }
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual GLenum GetWrapMode() const override { return LOCAL_GL_CLAMP_TO_EDGE; }
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DeallocateDeviceData() override;
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2017-03-22 06:32:53 +03:00
|
|
|
virtual void SetTextureSourceProvider(TextureSourceProvider* aProvider) override;
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2014-10-16 21:08:32 +04:00
|
|
|
void SetSize(gfx::IntSize aSize) { mSize = aSize; }
|
|
|
|
|
|
|
|
void SetFormat(gfx::SurfaceFormat aFormat) { mFormat = aFormat; }
|
|
|
|
|
|
|
|
GLuint GetTextureHandle() const { return mTextureHandle; }
|
|
|
|
|
2017-03-22 06:32:53 +03:00
|
|
|
gl::GLContext* gl() const {
|
|
|
|
return mGL;
|
|
|
|
}
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2018-05-03 04:20:10 +03:00
|
|
|
virtual bool Update(gfx::DataSourceSurface* aSurface,
|
|
|
|
nsIntRegion* aDestRegion = nullptr,
|
|
|
|
gfx::IntPoint* aSrcOffset = nullptr) override
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
protected:
|
2014-10-16 21:08:32 +04:00
|
|
|
void DeleteTextureHandle();
|
|
|
|
|
2017-03-22 06:32:53 +03:00
|
|
|
RefPtr<gl::GLContext> mGL;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CompositorOGL> mCompositor;
|
2014-10-16 21:08:32 +04:00
|
|
|
GLuint mTextureHandle;
|
|
|
|
GLenum mTextureTarget;
|
|
|
|
gfx::IntSize mSize;
|
|
|
|
gfx::SurfaceFormat mFormat;
|
2018-05-03 04:20:10 +03:00
|
|
|
};
|
|
|
|
|
2018-05-03 04:20:10 +03:00
|
|
|
// This texture source try to wrap "aSurface" in ctor for compositor direct
|
|
|
|
// access. Since we can't know the timing for gpu buffer access, the surface
|
|
|
|
// should be alive until the ~ClientStorageTextureSource(). And if we try to
|
|
|
|
// update the surface we mapped before, we need to call Sync() to make sure
|
|
|
|
// the surface is not used by compositor.
|
|
|
|
class DirectMapTextureSource : public GLTextureSource
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DirectMapTextureSource(TextureSourceProvider* aProvider,
|
|
|
|
gfx::DataSourceSurface* aSurface);
|
|
|
|
|
|
|
|
virtual bool Update(gfx::DataSourceSurface* aSurface,
|
|
|
|
nsIntRegion* aDestRegion = nullptr,
|
|
|
|
gfx::IntPoint* aSrcOffset = nullptr) override;
|
|
|
|
|
|
|
|
virtual bool IsDirectMap() override { return true; }
|
|
|
|
|
Bug 1265824 - Wait on texture handles with IPC r=jld,mattwoodrow
There's a lot going on here, but it all fits under the idea of
being able to communicate about texture locking statuses
without spinning on IsReadLocked. This is a bit of a trade -
we could just always allocate/grab a texture from the pool,
which would put a smaller cap on the amount of time we can
possibly spend when a texture is locked. However, this eats
up more CPU and memory than waiting on the textures to unlock,
and could take longer, especially if there were a large number
of textures which we just need to wait for for a short amount
of time. In any case, we very rarely hit the case where we
actually need to wait on the sync IPC to the compositor - most
of the time the textures are already unlocked.
There is also an async IPC call in here, which we make before
flushing async paints. This just causes the compositor to
check whether the GPU is done with its textures or not and
unlock them if it is. This helps us avoid the case where we
take a long time painting asynchronously, turn IPC back on at
the end of that, and then have to wait for the compositor
to to get into TiledLayerBufferComposite::UseTiles before
getting a response. Specifically this eliminates several talos
regressions which use ASAP mode.
Lastly, there seem to be no other cases of static Monitors
being used. This seems like it falls under similar use cases
as StaticMutexes, so I added it in. I can move it into its own
file if we think it might be generally useful in the future.
MozReview-Commit-ID: IYQLwUqMxg2
--HG--
extra : rebase_source : 4f05832f51dae6db98773dcad03cb008a80eca6c
2018-05-06 01:46:26 +03:00
|
|
|
// If aBlocking is false, check if this texture is no longer being used
|
|
|
|
// by the GPU - if aBlocking is true, this will block until the GPU is
|
|
|
|
// done with it.
|
|
|
|
virtual bool Sync(bool aBlocking) override;
|
2018-05-03 04:20:10 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool UpdateInternal(gfx::DataSourceSurface* aSurface,
|
|
|
|
nsIntRegion* aDestRegion,
|
|
|
|
gfx::IntPoint* aSrcOffset,
|
|
|
|
bool aInit);
|
|
|
|
};
|
|
|
|
|
2015-09-24 17:11:53 +03:00
|
|
|
class GLTextureHost : public TextureHost
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GLTextureHost(TextureFlags aFlags,
|
|
|
|
GLuint aTextureHandle,
|
|
|
|
GLenum aTarget,
|
|
|
|
GLsync aSync,
|
|
|
|
gfx::IntSize aSize,
|
|
|
|
bool aHasAlpha);
|
|
|
|
|
|
|
|
virtual ~GLTextureHost();
|
|
|
|
|
|
|
|
// We don't own anything.
|
|
|
|
virtual void DeallocateDeviceData() override {}
|
|
|
|
|
2017-03-22 06:32:54 +03:00
|
|
|
virtual void SetTextureSourceProvider(TextureSourceProvider* aProvider) override;
|
2016-06-02 12:00:21 +03:00
|
|
|
|
2015-09-24 17:11:53 +03:00
|
|
|
virtual bool Lock() override;
|
|
|
|
|
|
|
|
virtual void Unlock() override {}
|
|
|
|
|
|
|
|
virtual gfx::SurfaceFormat GetFormat() const override;
|
|
|
|
|
|
|
|
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override
|
|
|
|
{
|
|
|
|
aTexture = mTextureSource;
|
|
|
|
return !!aTexture;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override
|
|
|
|
{
|
|
|
|
return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
|
|
|
|
}
|
|
|
|
|
|
|
|
gl::GLContext* gl() const;
|
|
|
|
|
|
|
|
virtual gfx::IntSize GetSize() const override { return mSize; }
|
|
|
|
|
|
|
|
virtual const char* Name() override { return "GLTextureHost"; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
const GLuint mTexture;
|
|
|
|
const GLenum mTarget;
|
|
|
|
GLsync mSync;
|
|
|
|
const gfx::IntSize mSize;
|
|
|
|
const bool mHasAlpha;
|
|
|
|
RefPtr<GLTextureSource> mTextureSource;
|
|
|
|
};
|
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// 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:
|
2017-03-22 06:32:53 +03:00
|
|
|
SurfaceTextureSource(TextureSourceProvider* aProvider,
|
2017-03-04 00:14:27 +03:00
|
|
|
java::GeckoSurfaceTexture::Ref& aSurfTex,
|
2014-09-17 17:13:29 +04:00
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
GLenum aTarget,
|
|
|
|
GLenum aWrapMode,
|
2017-10-28 13:59:58 +03:00
|
|
|
gfx::IntSize aSize,
|
|
|
|
bool aIgnoreTransform);
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2016-02-08 13:57:00 +03:00
|
|
|
virtual const char* Name() const override { return "SurfaceTextureSource"; }
|
|
|
|
|
2016-06-04 01:31:05 +03:00
|
|
|
virtual TextureSourceOGL* AsSourceOGL() override { return this; }
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2016-05-25 19:01:18 +03:00
|
|
|
virtual void BindTexture(GLenum activetex,
|
|
|
|
gfx::SamplingFilter aSamplingFilter) override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsValid() const override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::IntSize GetSize() const override { return mSize; }
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; }
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::Matrix4x4 GetTextureTransform() override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2016-06-04 01:31:05 +03:00
|
|
|
virtual GLenum GetTextureTarget() const override { return mTextureTarget; }
|
2013-08-28 00:16:54 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual GLenum GetWrapMode() const override { return mWrapMode; }
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2016-02-25 11:48:55 +03:00
|
|
|
virtual void DeallocateDeviceData() override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2017-03-22 06:32:53 +03:00
|
|
|
virtual void SetTextureSourceProvider(TextureSourceProvider* aProvider) override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2017-03-22 06:32:53 +03:00
|
|
|
gl::GLContext* gl() const {
|
|
|
|
return mGL;
|
|
|
|
}
|
2013-07-30 13:59:51 +04:00
|
|
|
|
|
|
|
protected:
|
2017-03-22 06:32:53 +03:00
|
|
|
RefPtr<gl::GLContext> mGL;
|
2017-03-04 00:14:27 +03:00
|
|
|
mozilla::java::GeckoSurfaceTexture::GlobalRef mSurfTex;
|
2014-09-17 17:13:29 +04:00
|
|
|
const gfx::SurfaceFormat mFormat;
|
|
|
|
const GLenum mTextureTarget;
|
|
|
|
const GLenum mWrapMode;
|
|
|
|
const gfx::IntSize mSize;
|
2017-10-28 13:59:58 +03:00
|
|
|
const bool mIgnoreTransform;
|
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,
|
2017-03-04 00:14:27 +03:00
|
|
|
mozilla::java::GeckoSurfaceTexture::Ref& aSurfTex,
|
2017-03-10 02:50:21 +03:00
|
|
|
gfx::IntSize aSize,
|
2017-10-28 13:59:58 +03:00
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
bool aContinuousUpdate,
|
|
|
|
bool aIgnoreTransform);
|
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
|
|
|
|
2017-03-04 00:14:27 +03:00
|
|
|
virtual void PrepareTextureSource(CompositableTextureSourceRef& aTexture) override;
|
|
|
|
|
2016-02-25 11:48:55 +03:00
|
|
|
virtual void DeallocateDeviceData() override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2017-03-22 06:32:54 +03:00
|
|
|
virtual void SetTextureSourceProvider(TextureSourceProvider* aProvider) override;
|
2016-06-02 12:00:21 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool Lock() override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2017-05-12 05:21:14 +03:00
|
|
|
virtual gfx::SurfaceFormat GetFormat() const override;
|
2017-03-04 00:14:27 +03:00
|
|
|
|
2017-03-04 00:14:27 +03:00
|
|
|
virtual void NotifyNotUsed() override;
|
|
|
|
|
2015-03-27 13:16:34 +03:00
|
|
|
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
2015-03-27 13:16:34 +03:00
|
|
|
aTexture = mTextureSource;
|
|
|
|
return !!aTexture;
|
2013-07-30 13:59:51 +04:00
|
|
|
}
|
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
|
|
|
return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
|
|
|
|
}
|
|
|
|
|
|
|
|
gl::GLContext* gl() const;
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::IntSize GetSize() const override { return mSize; }
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2016-06-04 01:31:05 +03:00
|
|
|
virtual const char* Name() override { return "SurfaceTextureHost"; }
|
2013-07-30 13:59:51 +04:00
|
|
|
|
|
|
|
protected:
|
2017-10-31 19:07:53 +03:00
|
|
|
bool EnsureAttached();
|
|
|
|
|
2017-03-04 00:14:27 +03:00
|
|
|
mozilla::java::GeckoSurfaceTexture::GlobalRef mSurfTex;
|
2014-09-17 17:13:29 +04:00
|
|
|
const gfx::IntSize mSize;
|
2017-10-28 13:59:58 +03:00
|
|
|
const gfx::SurfaceFormat mFormat;
|
2017-03-10 02:50:21 +03:00
|
|
|
bool mContinuousUpdate;
|
2017-10-28 13:59:58 +03:00
|
|
|
const bool mIgnoreTransform;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CompositorOGL> mCompositor;
|
|
|
|
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:
|
2017-03-22 06:32:54 +03:00
|
|
|
EGLImageTextureSource(TextureSourceProvider* aProvider,
|
2014-09-17 17:13:29 +04:00
|
|
|
EGLImage aImage,
|
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
GLenum aTarget,
|
|
|
|
GLenum aWrapMode,
|
|
|
|
gfx::IntSize aSize);
|
2014-09-12 23:01:26 +04:00
|
|
|
|
2016-02-08 13:57:00 +03:00
|
|
|
virtual const char* Name() const override { return "EGLImageTextureSource"; }
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual TextureSourceOGL* AsSourceOGL() override { return this; }
|
2014-01-10 17:06:06 +04:00
|
|
|
|
2016-05-25 19:01:18 +03:00
|
|
|
virtual void BindTexture(GLenum activetex,
|
|
|
|
gfx::SamplingFilter aSamplingFilter) override;
|
2014-01-10 17:06:06 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsValid() const override;
|
2014-01-10 17:06:06 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::IntSize GetSize() const override { return mSize; }
|
2014-01-10 17:06:06 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; }
|
2014-01-10 17:06:06 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::Matrix4x4 GetTextureTransform() override;
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual GLenum GetTextureTarget() const override { return mTextureTarget; }
|
2014-01-10 17:06:06 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual GLenum GetWrapMode() const override { return mWrapMode; }
|
2014-01-10 17:06:06 +04:00
|
|
|
|
2014-09-17 17:13:29 +04:00
|
|
|
// We don't own anything.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DeallocateDeviceData() override {}
|
2014-06-05 05:27:22 +04:00
|
|
|
|
2017-03-22 06:32:53 +03:00
|
|
|
virtual void SetTextureSourceProvider(TextureSourceProvider* aProvider) override;
|
2014-06-05 05:27:22 +04:00
|
|
|
|
2017-03-22 06:32:53 +03:00
|
|
|
gl::GLContext* gl() const {
|
|
|
|
return mGL;
|
|
|
|
}
|
2014-06-05 05:27:22 +04:00
|
|
|
|
2014-01-10 17:06:06 +04:00
|
|
|
protected:
|
2017-03-22 06:32:53 +03:00
|
|
|
RefPtr<gl::GLContext> mGL;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<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;
|
|
|
|
};
|
|
|
|
|
2017-03-22 06:32:54 +03:00
|
|
|
class EGLImageTextureHost final : public TextureHost
|
2014-09-17 17:13:29 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
EGLImageTextureHost(TextureFlags aFlags,
|
|
|
|
EGLImage aImage,
|
2014-11-27 00:16:07 +03:00
|
|
|
EGLSync aSync,
|
2015-06-05 03:15:38 +03:00
|
|
|
gfx::IntSize aSize,
|
|
|
|
bool hasAlpha);
|
2014-09-17 17:13:29 +04:00
|
|
|
|
|
|
|
virtual ~EGLImageTextureHost();
|
|
|
|
|
|
|
|
// We don't own anything.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DeallocateDeviceData() override {}
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2017-03-22 06:32:54 +03:00
|
|
|
void SetTextureSourceProvider(TextureSourceProvider* aProvider) override;
|
2016-06-02 12:00:21 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool Lock() override;
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void Unlock() override;
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::SurfaceFormat GetFormat() const override;
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2015-03-27 13:16:34 +03:00
|
|
|
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override
|
2014-09-17 17:13:29 +04:00
|
|
|
{
|
2015-03-27 13:16:34 +03:00
|
|
|
aTexture = mTextureSource;
|
|
|
|
return !!aTexture;
|
2014-09-17 17:13:29 +04:00
|
|
|
}
|
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override
|
2014-09-17 17:13:29 +04:00
|
|
|
{
|
|
|
|
return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
|
|
|
|
}
|
|
|
|
|
|
|
|
gl::GLContext* gl() const;
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfx::IntSize GetSize() const override { return mSize; }
|
2014-09-17 17:13:29 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual const char* Name() override { return "EGLImageTextureHost"; }
|
2014-09-17 17:13:29 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
const EGLImage mImage;
|
2014-11-27 00:16:07 +03:00
|
|
|
const EGLSync mSync;
|
2014-09-17 17:13:29 +04:00
|
|
|
const gfx::IntSize mSize;
|
2015-06-05 03:15:38 +03:00
|
|
|
const bool mHasAlpha;
|
2015-10-18 08:24:48 +03:00
|
|
|
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
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
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 /* MOZILLA_GFX_TEXTUREOGL_H */
|