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/. */
|
|
|
|
|
|
|
|
#include "TextureHostOGL.h"
|
|
|
|
#include "ipc/AutoOpenSurface.h"
|
|
|
|
#include "gfx2DGlue.h"
|
2013-05-23 00:17:10 -07:00
|
|
|
#include "mozilla/layers/YCbCrImageDataSerializer.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
|
|
|
#include "GLContext.h"
|
|
|
|
#include "gfxImageSurface.h"
|
|
|
|
#include "SurfaceStream.h"
|
|
|
|
#include "SharedSurface.h"
|
|
|
|
#include "SharedSurfaceGL.h"
|
|
|
|
#include "SharedSurfaceEGL.h"
|
2013-07-17 20:24:15 -07:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
#include "SharedSurfaceIO.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 02:20:52 -07:00
|
|
|
#include "mozilla/layers/CompositorOGL.h"
|
|
|
|
|
|
|
|
using namespace mozilla::gl;
|
|
|
|
using namespace mozilla::gfx;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
TemporaryRef<DeprecatedTextureHost>
|
|
|
|
CreateDeprecatedTextureHostOGL(SurfaceDescriptorType aDescriptorType,
|
|
|
|
uint32_t aDeprecatedTextureHostFlags,
|
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
|
|
|
uint32_t aTextureFlags)
|
|
|
|
{
|
2013-07-08 14:30:44 -07:00
|
|
|
RefPtr<DeprecatedTextureHost> result = 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
|
|
|
|
|
|
|
if (aDescriptorType == SurfaceDescriptor::TYCbCrImage) {
|
2013-07-08 14:30:44 -07:00
|
|
|
result = new YCbCrDeprecatedTextureHostOGL();
|
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
|
|
|
} else if (aDescriptorType == SurfaceDescriptor::TSurfaceStreamDescriptor) {
|
|
|
|
result = new SurfaceStreamHostOGL();
|
|
|
|
} else if (aDescriptorType == SurfaceDescriptor::TSharedTextureDescriptor) {
|
2013-07-08 14:30:44 -07:00
|
|
|
result = new SharedDeprecatedTextureHostOGL();
|
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
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
} else if (aDescriptorType == SurfaceDescriptor::TSurfaceDescriptorGralloc) {
|
2013-07-08 14:30:44 -07:00
|
|
|
result = new GrallocDeprecatedTextureHostOGL();
|
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-07-08 14:30:44 -07:00
|
|
|
} else if (aDeprecatedTextureHostFlags & TEXTURE_HOST_TILED) {
|
|
|
|
result = new TiledDeprecatedTextureHostOGL();
|
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
|
|
|
} else {
|
2013-07-08 14:30:44 -07:00
|
|
|
result = new TextureImageDeprecatedTextureHostOGL();
|
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
|
|
|
}
|
|
|
|
|
|
|
|
NS_ASSERTION(result, "Result should have been created.");
|
|
|
|
|
|
|
|
result->SetFlags(aTextureFlags);
|
|
|
|
return result.forget();
|
|
|
|
}
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
|
|
|
|
TemporaryRef<TextureHost>
|
|
|
|
CreateTextureHostOGL(uint64_t aID,
|
|
|
|
const SurfaceDescriptor& aDesc,
|
|
|
|
ISurfaceAllocator* aDeallocator,
|
|
|
|
TextureFlags aFlags)
|
|
|
|
{
|
|
|
|
RefPtr<TextureHost> result;
|
|
|
|
switch (aDesc.type()) {
|
|
|
|
case SurfaceDescriptor::TSurfaceDescriptorShmem:
|
|
|
|
case SurfaceDescriptor::TSurfaceDescriptorMemory: {
|
|
|
|
result = CreateBackendIndependentTextureHost(aID, aDesc,
|
|
|
|
aDeallocator, aFlags);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SurfaceDescriptor::TSharedTextureDescriptor: {
|
|
|
|
const SharedTextureDescriptor& desc = aDesc.get_SharedTextureDescriptor();
|
|
|
|
result = new SharedTextureHostOGL(aID, aFlags,
|
|
|
|
desc.shareType(),
|
|
|
|
desc.handle(),
|
|
|
|
gfx::ToIntSize(desc.size()),
|
|
|
|
desc.inverted());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: return nullptr;
|
|
|
|
}
|
|
|
|
return result.forget();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
static void
|
2013-05-09 14:02:48 -07:00
|
|
|
MakeTextureIfNeeded(gl::GLContext* gl, GLenum aTarget, GLuint& aTexture)
|
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
|
|
|
{
|
|
|
|
if (aTexture != 0)
|
|
|
|
return;
|
|
|
|
|
2013-05-09 14:02:48 -07:00
|
|
|
GLenum target = aTarget;
|
|
|
|
// GL_TEXTURE_EXTERNAL requires us to initialize the texture
|
|
|
|
// using the GL_TEXTURE_2D attachment.
|
|
|
|
if (target == LOCAL_GL_TEXTURE_EXTERNAL) {
|
|
|
|
target = LOCAL_GL_TEXTURE_2D;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
gl->fGenTextures(1, &aTexture);
|
|
|
|
|
2013-05-09 14:02:48 -07:00
|
|
|
gl->fBindTexture(target, aTexture);
|
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-05-09 14:02:48 -07:00
|
|
|
gl->fTexParameteri(target, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_LINEAR);
|
|
|
|
gl->fTexParameteri(target, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_LINEAR);
|
|
|
|
gl->fTexParameteri(target, LOCAL_GL_TEXTURE_WRAP_S, LOCAL_GL_CLAMP_TO_EDGE);
|
|
|
|
gl->fTexParameteri(target, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
static gl::TextureImage::Flags
|
|
|
|
FlagsToGLFlags(TextureFlags aFlags)
|
|
|
|
{
|
|
|
|
uint32_t result = TextureImage::NoFlags;
|
|
|
|
|
2013-08-06 10:36:35 -07:00
|
|
|
if (aFlags & TEXTURE_USE_NEAREST_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 02:20:52 -07:00
|
|
|
result |= TextureImage::UseNearestFilter;
|
2013-08-06 10:36:35 -07:00
|
|
|
if (aFlags & TEXTURE_NEEDS_Y_FLIP)
|
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
|
|
|
result |= TextureImage::NeedsYFlip;
|
2013-08-01 16:02:06 -07:00
|
|
|
if (aFlags & TEXTURE_DISALLOW_BIGIMAGE)
|
|
|
|
result |= TextureImage::DisallowBigImage;
|
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
|
|
|
|
|
|
|
return static_cast<gl::TextureImage::Flags>(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
GLenum
|
|
|
|
WrapMode(gl::GLContext *aGl, bool aAllowRepeat)
|
|
|
|
{
|
|
|
|
if (aAllowRepeat &&
|
|
|
|
(aGl->IsExtensionSupported(GLContext::ARB_texture_non_power_of_two) ||
|
|
|
|
aGl->IsExtensionSupported(GLContext::OES_texture_npot))) {
|
|
|
|
return LOCAL_GL_REPEAT;
|
|
|
|
}
|
|
|
|
return LOCAL_GL_CLAMP_TO_EDGE;
|
|
|
|
}
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
bool
|
|
|
|
TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
|
|
|
|
TextureFlags aFlags,
|
|
|
|
nsIntRegion* aDestRegion,
|
|
|
|
gfx::IntPoint* aSrcOffset)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mGL);
|
|
|
|
if (!mGL) {
|
|
|
|
NS_WARNING("trying to update TextureImageTextureSourceOGL without a GLContext");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
MOZ_ASSERT(aSurface);
|
|
|
|
|
|
|
|
nsIntSize size = ThebesIntSize(aSurface->GetSize());
|
|
|
|
if (!mTexImage ||
|
|
|
|
mTexImage->GetSize() != size ||
|
|
|
|
mTexImage->GetContentType() != gfx::ContentForFormat(aSurface->GetFormat())) {
|
2013-08-01 16:02:06 -07:00
|
|
|
if (mAllowBigImage) {
|
2013-07-30 02:59:51 -07:00
|
|
|
// XXX - clarify the which size we want to use. Some use cases may
|
|
|
|
// require the size of the destnation surface to be different from
|
|
|
|
// the size of aSurface.
|
|
|
|
mTexImage = mGL->CreateTextureImage(size,
|
|
|
|
gfx::ContentForFormat(aSurface->GetFormat()),
|
2013-08-06 10:36:35 -07:00
|
|
|
WrapMode(mGL, aFlags & TEXTURE_ALLOW_REPEAT),
|
2013-07-30 02:59:51 -07:00
|
|
|
FlagsToGLFlags(aFlags));
|
|
|
|
} else {
|
|
|
|
mTexImage = CreateBasicTextureImage(mGL,
|
|
|
|
size,
|
|
|
|
gfx::ContentForFormat(aSurface->GetFormat()),
|
2013-08-06 10:36:35 -07:00
|
|
|
WrapMode(mGL, aFlags & TEXTURE_ALLOW_REPEAT),
|
2013-07-30 02:59:51 -07:00
|
|
|
FlagsToGLFlags(aFlags));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mTexImage->UpdateFromDataSource(aSurface, aDestRegion, aSrcOffset);
|
|
|
|
|
|
|
|
if (mTexImage->InUpdate()) {
|
|
|
|
mTexImage->EndUpdate();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::IntSize
|
|
|
|
TextureImageTextureSourceOGL::GetSize() const
|
|
|
|
{
|
|
|
|
if (mTexImage) {
|
|
|
|
if (mIterating) {
|
|
|
|
nsIntRect rect = mTexImage->GetTileRect();
|
|
|
|
return gfx::IntSize(rect.width, rect.height);
|
|
|
|
}
|
|
|
|
return gfx::IntSize(mTexImage->GetSize().width, mTexImage->GetSize().height);
|
|
|
|
}
|
|
|
|
NS_WARNING("Trying to query the size of an empty TextureSource.");
|
|
|
|
return gfx::IntSize(0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::SurfaceFormat
|
|
|
|
TextureImageTextureSourceOGL::GetFormat() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mTexImage);
|
|
|
|
return mTexImage->GetTextureFormat();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TextureImageTextureSourceOGL::BindTexture(GLenum aTextureUnit)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mTexImage,
|
|
|
|
"Trying to bind a TextureSource that does not have an underlying GL texture.");
|
|
|
|
mTexImage->BindTexture(aTextureUnit);
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedTextureSourceOGL::SharedTextureSourceOGL(CompositorOGL* aCompositor,
|
|
|
|
gl::SharedTextureHandle aHandle,
|
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
GLenum aTarget,
|
|
|
|
GLenum aWrapMode,
|
|
|
|
SharedTextureShareType aShareType,
|
|
|
|
gfx::IntSize aSize,
|
|
|
|
const gfx3DMatrix& aTexTransform)
|
|
|
|
: mTextureTransform(aTexTransform)
|
|
|
|
, mSize(aSize)
|
|
|
|
, mCompositor(aCompositor)
|
|
|
|
, mSharedHandle(aHandle)
|
|
|
|
, mFormat(aFormat)
|
|
|
|
, mShareType(aShareType)
|
|
|
|
, mTextureTarget(aTarget)
|
|
|
|
, mWrapMode(aWrapMode)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void
|
|
|
|
SharedTextureSourceOGL::BindTexture(GLenum aTextureUnit)
|
|
|
|
{
|
|
|
|
if (!gl()) {
|
|
|
|
NS_WARNING("Trying to bind a texture without a GLContext");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
GLuint tex = mCompositor->GetTemporaryTexture(aTextureUnit);
|
|
|
|
|
|
|
|
gl()->fActiveTexture(aTextureUnit);
|
|
|
|
gl()->fBindTexture(mTextureTarget, tex);
|
|
|
|
if (!gl()->AttachSharedHandle(mShareType, mSharedHandle)) {
|
|
|
|
NS_ERROR("Failed to bind shared texture handle");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SharedTextureSourceOGL::DetachSharedHandle()
|
|
|
|
{
|
|
|
|
if (!gl()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
gl()->DetachSharedHandle(mShareType, mSharedHandle);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SharedTextureSourceOGL::SetCompositor(CompositorOGL* aCompositor)
|
|
|
|
{
|
|
|
|
mCompositor = aCompositor;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SharedTextureSourceOGL::IsValid() const
|
|
|
|
{
|
|
|
|
return gl() != nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
gl::GLContext*
|
|
|
|
SharedTextureSourceOGL::gl() const
|
|
|
|
{
|
|
|
|
return mCompositor ? mCompositor->gl() : nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedTextureHostOGL::SharedTextureHostOGL(uint64_t aID,
|
|
|
|
TextureFlags aFlags,
|
|
|
|
gl::GLContext::SharedTextureShareType aShareType,
|
|
|
|
gl::SharedTextureHandle aSharedHandle,
|
|
|
|
gfx::IntSize aSize,
|
|
|
|
bool inverted)
|
|
|
|
: TextureHost(aID, aFlags)
|
|
|
|
, mSize(aSize)
|
|
|
|
, mCompositor(nullptr)
|
|
|
|
, mSharedHandle(aSharedHandle)
|
|
|
|
, mShareType(aShareType)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedTextureHostOGL::~SharedTextureHostOGL()
|
|
|
|
{
|
|
|
|
// If need to deallocate textures, call DeallocateSharedData() before
|
|
|
|
// the destructor
|
|
|
|
}
|
|
|
|
|
|
|
|
gl::GLContext*
|
|
|
|
SharedTextureHostOGL::gl() const
|
|
|
|
{
|
|
|
|
return mCompositor ? mCompositor->gl() : nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SharedTextureHostOGL::Lock()
|
|
|
|
{
|
|
|
|
if (!mCompositor) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mTextureSource) {
|
|
|
|
// XXX on android GetSharedHandleDetails can call into Java which we'd
|
|
|
|
// rather not do from the compositor
|
|
|
|
GLContext::SharedHandleDetails handleDetails;
|
|
|
|
if (!gl()->GetSharedHandleDetails(mShareType, mSharedHandle, handleDetails)) {
|
|
|
|
NS_WARNING("Could not get shared handle details");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
GLenum wrapMode = LOCAL_GL_CLAMP_TO_EDGE;
|
|
|
|
mTextureSource = new SharedTextureSourceOGL(nullptr, // Compositor
|
|
|
|
mSharedHandle,
|
|
|
|
handleDetails.mTextureFormat,
|
|
|
|
handleDetails.mTarget,
|
|
|
|
wrapMode,
|
|
|
|
mShareType,
|
|
|
|
mSize,
|
|
|
|
handleDetails.mTextureTransform);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SharedTextureHostOGL::Unlock()
|
|
|
|
{
|
|
|
|
if (!mTextureSource) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mTextureSource->DetachSharedHandle();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SharedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
|
|
|
{
|
|
|
|
CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
|
|
|
|
if (mTextureSource) {
|
|
|
|
mTextureSource->SetCompositor(glCompositor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::SurfaceFormat
|
|
|
|
SharedTextureHostOGL::GetFormat() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mTextureSource);
|
|
|
|
return mTextureSource->GetFormat();
|
|
|
|
}
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
TextureImageDeprecatedTextureHostOGL::~TextureImageDeprecatedTextureHostOGL()
|
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-08 14:30:44 -07:00
|
|
|
MOZ_COUNT_DTOR(TextureImageDeprecatedTextureHostOGL);
|
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
|
|
|
if (mTexture && mTexture->InUpdate()) {
|
|
|
|
mTexture->EndUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::IntSize
|
2013-07-08 14:30:44 -07:00
|
|
|
TextureImageDeprecatedTextureHostOGL::GetSize() const
|
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
|
|
|
{
|
|
|
|
if (mTexture) {
|
|
|
|
if (mIterating) {
|
|
|
|
nsIntRect rect = mTexture->GetTileRect();
|
|
|
|
return gfx::IntSize(rect.width, rect.height);
|
|
|
|
}
|
|
|
|
return gfx::IntSize(mTexture->GetSize().width, mTexture->GetSize().height);
|
|
|
|
}
|
|
|
|
return gfx::IntSize(0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
TextureImageDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
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
|
|
|
{
|
|
|
|
CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
|
|
|
|
GLContext* newGL = glCompositor ? glCompositor->gl() : nullptr;
|
|
|
|
if (mGL != newGL) {
|
|
|
|
mGL = newGL;
|
|
|
|
mTexture = nullptr;
|
|
|
|
// if we have a buffer we reupload it with the new gl context
|
2013-07-08 14:30:44 -07:00
|
|
|
// Post landing TODO: the new DeprecatedTextureClient/Host model will make this
|
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
|
|
|
// go away.
|
|
|
|
if (newGL && mBuffer && IsSurfaceDescriptorValid(*mBuffer)) {
|
|
|
|
UpdateImpl(*mBuffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-15 20:45:43 -07:00
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
TextureImageDeprecatedTextureHostOGL::EnsureBuffer(const nsIntSize& aSize,
|
2013-05-15 20:45:43 -07:00
|
|
|
gfxContentType aContentType)
|
|
|
|
{
|
|
|
|
if (!mTexture ||
|
|
|
|
mTexture->GetSize() != aSize ||
|
|
|
|
mTexture->GetContentType() != aContentType) {
|
|
|
|
mTexture = mGL->CreateTextureImage(aSize,
|
|
|
|
aContentType,
|
2013-08-06 10:36:35 -07:00
|
|
|
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
|
2013-05-15 20:45:43 -07:00
|
|
|
FlagsToGLFlags(mFlags));
|
|
|
|
}
|
|
|
|
mTexture->Resize(aSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
TextureImageDeprecatedTextureHostOGL::CopyTo(const nsIntRect& aSourceRect,
|
|
|
|
DeprecatedTextureHost *aDest,
|
2013-05-15 20:45:43 -07:00
|
|
|
const nsIntRect& aDestRect)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aDest->AsSourceOGL(), "Incompatible destination type!");
|
2013-07-08 14:30:44 -07:00
|
|
|
TextureImageDeprecatedTextureHostOGL *dest =
|
|
|
|
aDest->AsSourceOGL()->AsTextureImageDeprecatedTextureHost();
|
2013-05-15 20:45:43 -07:00
|
|
|
MOZ_ASSERT(dest, "Incompatible destination type!");
|
|
|
|
|
|
|
|
mGL->BlitTextureImage(mTexture, aSourceRect,
|
|
|
|
dest->mTexture, aDestRect);
|
|
|
|
dest->mTexture->MarkValid();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
TextureImageDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
2013-05-15 20:45:43 -07:00
|
|
|
nsIntRegion* aRegion,
|
|
|
|
nsIntPoint* aOffset)
|
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
|
|
|
{
|
|
|
|
if (!mGL) {
|
2013-07-08 14:30:44 -07:00
|
|
|
NS_WARNING("trying to update TextureImageDeprecatedTextureHostOGL without a compositor?");
|
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
|
|
|
return;
|
|
|
|
}
|
2013-08-07 15:38:21 -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
|
|
|
AutoOpenSurface surf(OPEN_READ_ONLY, aImage);
|
|
|
|
nsIntSize size = surf.Size();
|
2013-08-07 15:38:21 -07:00
|
|
|
TextureImage::ImageFormat format = surf.ImageFormat();
|
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
|
|
|
|
|
|
|
if (!mTexture ||
|
2013-05-15 20:45:43 -07:00
|
|
|
(mTexture->GetSize() != size && !aOffset) ||
|
2013-08-07 15:38:21 -07:00
|
|
|
mTexture->GetContentType() != surf.ContentType() ||
|
|
|
|
(mTexture->GetImageFormat() != format &&
|
|
|
|
mTexture->GetImageFormat() != gfxASurface::ImageFormatUnknown)) {
|
|
|
|
|
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
|
|
|
mTexture = mGL->CreateTextureImage(size,
|
|
|
|
surf.ContentType(),
|
2013-08-06 10:36:35 -07:00
|
|
|
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
|
2013-08-07 15:38:21 -07:00
|
|
|
FlagsToGLFlags(mFlags),
|
|
|
|
format);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
// XXX this is always just ridiculously slow
|
|
|
|
nsIntRegion updateRegion;
|
|
|
|
|
|
|
|
if (!aRegion) {
|
|
|
|
updateRegion = nsIntRegion(nsIntRect(0, 0, size.width, size.height));
|
|
|
|
} else {
|
|
|
|
updateRegion = *aRegion;
|
|
|
|
}
|
2013-05-15 20:45:43 -07:00
|
|
|
nsIntPoint offset;
|
|
|
|
if (aOffset) {
|
|
|
|
offset = *aOffset;
|
|
|
|
}
|
|
|
|
mTexture->DirectUpdate(surf.Get(), updateRegion, offset);
|
2013-07-04 10:25:50 -07:00
|
|
|
mFormat = mTexture->GetTextureFormat();
|
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
|
|
|
|
|
|
|
if (mTexture->InUpdate()) {
|
|
|
|
mTexture->EndUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 14:30:44 -07:00
|
|
|
TextureImageDeprecatedTextureHostOGL::Lock()
|
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
|
|
|
{
|
|
|
|
if (!mTexture) {
|
2013-07-08 14:30:44 -07:00
|
|
|
NS_WARNING("TextureImageDeprecatedTextureHost to be composited without texture");
|
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
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-07-04 10:25:50 -07:00
|
|
|
mFormat = mTexture->GetTextureFormat();
|
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
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
SharedDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
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
|
|
|
{
|
|
|
|
CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
|
|
|
|
if (mGL && !glCompositor) {
|
|
|
|
DeleteTextures();
|
|
|
|
}
|
|
|
|
mGL = glCompositor ? glCompositor->gl() : nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
SharedDeprecatedTextureHostOGL::DeleteTextures()
|
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
|
|
|
{
|
|
|
|
MOZ_ASSERT(mGL);
|
|
|
|
mGL->MakeCurrent();
|
|
|
|
if (mSharedHandle) {
|
|
|
|
mGL->ReleaseSharedHandle(mShareType, mSharedHandle);
|
|
|
|
mSharedHandle = 0;
|
|
|
|
}
|
|
|
|
if (mTextureHandle) {
|
|
|
|
mGL->fDeleteTextures(1, &mTextureHandle);
|
|
|
|
mTextureHandle = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
SharedDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
2013-05-15 20:45:43 -07:00
|
|
|
nsIntRegion* aRegion,
|
|
|
|
nsIntPoint* aOffset)
|
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
|
|
|
{
|
|
|
|
SwapTexturesImpl(aImage, aRegion);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
SharedDeprecatedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
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
|
|
|
nsIntRegion* aRegion)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(aImage.type() == SurfaceDescriptor::TSharedTextureDescriptor,
|
|
|
|
"Invalid descriptor");
|
|
|
|
|
|
|
|
SharedTextureDescriptor texture = aImage.get_SharedTextureDescriptor();
|
|
|
|
|
|
|
|
SharedTextureHandle newHandle = texture.handle();
|
|
|
|
nsIntSize size = texture.size();
|
|
|
|
mSize = gfx::IntSize(size.width, size.height);
|
|
|
|
if (texture.inverted()) {
|
2013-08-06 10:36:35 -07:00
|
|
|
mFlags |= TEXTURE_NEEDS_Y_FLIP;
|
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-04-11 16:42:26 -07:00
|
|
|
|
|
|
|
if (mSharedHandle && mSharedHandle != newHandle) {
|
|
|
|
mGL->ReleaseSharedHandle(mShareType, mSharedHandle);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
mShareType = texture.shareType();
|
|
|
|
mSharedHandle = newHandle;
|
|
|
|
|
|
|
|
GLContext::SharedHandleDetails handleDetails;
|
2013-04-11 16:42:26 -07:00
|
|
|
if (mSharedHandle && mGL->GetSharedHandleDetails(mShareType, mSharedHandle, handleDetails)) {
|
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
|
|
|
mTextureTarget = handleDetails.mTarget;
|
2013-07-04 10:25:50 -07:00
|
|
|
mFormat = handleDetails.mTextureFormat;
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 14:30:44 -07:00
|
|
|
SharedDeprecatedTextureHostOGL::Lock()
|
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-05-09 14:02:48 -07:00
|
|
|
MakeTextureIfNeeded(mGL, mTextureTarget, mTextureHandle);
|
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
|
|
|
|
|
|
|
mGL->fActiveTexture(LOCAL_GL_TEXTURE0);
|
|
|
|
mGL->fBindTexture(mTextureTarget, mTextureHandle);
|
|
|
|
if (!mGL->AttachSharedHandle(mShareType, mSharedHandle)) {
|
|
|
|
NS_ERROR("Failed to bind shared texture handle");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
SharedDeprecatedTextureHostOGL::Unlock()
|
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
|
|
|
{
|
|
|
|
mGL->DetachSharedHandle(mShareType, mSharedHandle);
|
|
|
|
mGL->fBindTexture(LOCAL_GL_TEXTURE_2D, 0);
|
|
|
|
}
|
|
|
|
|
2013-05-08 15:04:59 -07:00
|
|
|
|
|
|
|
gfx3DMatrix
|
2013-07-08 14:30:44 -07:00
|
|
|
SharedDeprecatedTextureHostOGL::GetTextureTransform()
|
2013-05-08 15:04:59 -07:00
|
|
|
{
|
|
|
|
GLContext::SharedHandleDetails handleDetails;
|
|
|
|
// GetSharedHandleDetails can call into Java which we'd
|
|
|
|
// rather not do from the compositor
|
|
|
|
if (mSharedHandle) {
|
|
|
|
mGL->GetSharedHandleDetails(mShareType, mSharedHandle, handleDetails);
|
|
|
|
}
|
|
|
|
return handleDetails.mTextureTransform;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
void
|
|
|
|
SurfaceStreamHostOGL::SetCompositor(Compositor* aCompositor)
|
|
|
|
{
|
|
|
|
CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
|
|
|
|
if (mGL && !glCompositor) {
|
|
|
|
DeleteTextures();
|
|
|
|
}
|
|
|
|
mGL = glCompositor ? glCompositor->gl() : nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SurfaceStreamHostOGL::DeleteTextures()
|
|
|
|
{
|
|
|
|
if (mUploadTexture) {
|
|
|
|
MOZ_ASSERT(mGL);
|
|
|
|
mGL->MakeCurrent();
|
|
|
|
mGL->fDeleteTextures(1, &mUploadTexture);
|
|
|
|
mUploadTexture = 0;
|
|
|
|
mTextureHandle = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-08-01 18:12:15 -07:00
|
|
|
SurfaceStreamHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
|
|
|
nsIntRegion* aRegion,
|
|
|
|
nsIntPoint* aOffset)
|
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
|
|
|
{
|
|
|
|
MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TSurfaceStreamDescriptor,
|
|
|
|
"Invalid descriptor");
|
2013-07-18 21:23:07 -07:00
|
|
|
|
2013-08-01 18:12:15 -07:00
|
|
|
// Bug 894405
|
|
|
|
//
|
|
|
|
// The SurfaceStream's GLContext was refed before being passed up to us, so
|
|
|
|
// we need to ensure it gets unrefed when we are finished.
|
|
|
|
const SurfaceStreamDescriptor& streamDesc =
|
|
|
|
aImage.get_SurfaceStreamDescriptor();
|
2013-08-01 21:45:09 -07:00
|
|
|
|
2013-08-01 18:12:15 -07:00
|
|
|
mStream = SurfaceStream::FromHandle(streamDesc.handle());
|
|
|
|
MOZ_ASSERT(mStream);
|
|
|
|
mStreamGL = dont_AddRef(mStream->GLContext());
|
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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SurfaceStreamHostOGL::Unlock()
|
|
|
|
{
|
|
|
|
// We don't know what this is unless we're locked
|
|
|
|
mFormat = gfx::FORMAT_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SurfaceStreamHostOGL::Lock()
|
|
|
|
{
|
|
|
|
mGL->MakeCurrent();
|
|
|
|
|
2013-08-01 18:12:15 -07:00
|
|
|
SharedSurface* sharedSurf = mStream->SwapConsumer();
|
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
|
|
|
if (!sharedSurf) {
|
|
|
|
// We don't have a valid surf to show yet.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
mGL->MakeCurrent();
|
|
|
|
|
|
|
|
mSize = IntSize(sharedSurf->Size().width, sharedSurf->Size().height);
|
|
|
|
|
|
|
|
gfxImageSurface* toUpload = nullptr;
|
|
|
|
switch (sharedSurf->Type()) {
|
|
|
|
case SharedSurfaceType::GLTextureShare: {
|
2013-06-04 17:05:28 -07:00
|
|
|
SharedSurface_GLTexture* glTexSurf = SharedSurface_GLTexture::Cast(sharedSurf);
|
|
|
|
glTexSurf->SetConsumerGL(mGL);
|
|
|
|
mTextureHandle = glTexSurf->Texture();
|
2013-07-17 20:24:15 -07:00
|
|
|
mTextureTarget = glTexSurf->TextureTarget();
|
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
|
|
|
MOZ_ASSERT(mTextureHandle);
|
2013-07-04 10:25:50 -07:00
|
|
|
mFormat = sharedSurf->HasAlpha() ? FORMAT_R8G8B8A8
|
|
|
|
: FORMAT_R8G8B8X8;
|
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
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SharedSurfaceType::EGLImageShare: {
|
|
|
|
SharedSurface_EGLImage* eglImageSurf =
|
|
|
|
SharedSurface_EGLImage::Cast(sharedSurf);
|
|
|
|
|
|
|
|
mTextureHandle = eglImageSurf->AcquireConsumerTexture(mGL);
|
2013-07-17 20:24:15 -07:00
|
|
|
mTextureTarget = eglImageSurf->TextureTarget();
|
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
|
|
|
if (!mTextureHandle) {
|
|
|
|
toUpload = eglImageSurf->GetPixels();
|
|
|
|
MOZ_ASSERT(toUpload);
|
|
|
|
} else {
|
2013-07-04 10:25:50 -07:00
|
|
|
mFormat = sharedSurf->HasAlpha() ? FORMAT_R8G8B8A8
|
|
|
|
: FORMAT_R8G8B8X8;
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2013-07-17 20:24:15 -07:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
case SharedSurfaceType::IOSurface: {
|
|
|
|
SharedSurface_IOSurface* glTexSurf = SharedSurface_IOSurface::Cast(sharedSurf);
|
|
|
|
mTextureHandle = glTexSurf->Texture();
|
|
|
|
mTextureTarget = glTexSurf->TextureTarget();
|
|
|
|
MOZ_ASSERT(mTextureHandle);
|
|
|
|
mFormat = sharedSurf->HasAlpha() ? FORMAT_R8G8B8A8
|
|
|
|
: FORMAT_R8G8B8X8;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#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 02:20:52 -07:00
|
|
|
case SharedSurfaceType::Basic: {
|
|
|
|
toUpload = SharedSurface_Basic::Cast(sharedSurf)->GetData();
|
|
|
|
MOZ_ASSERT(toUpload);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2013-06-28 18:38:30 -07:00
|
|
|
MOZ_CRASH("Invalid SharedSurface type.");
|
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
|
|
|
}
|
|
|
|
|
|
|
|
if (toUpload) {
|
|
|
|
// mBounds seems to end up as (0,0,0,0) a lot, so don't use it?
|
|
|
|
nsIntSize size(toUpload->GetSize());
|
|
|
|
nsIntRect rect(nsIntPoint(0,0), size);
|
|
|
|
nsIntRegion bounds(rect);
|
2013-07-04 10:25:50 -07:00
|
|
|
mFormat = mGL->UploadSurfaceToTexture(toUpload,
|
|
|
|
bounds,
|
|
|
|
mUploadTexture,
|
|
|
|
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 02:20:52 -07:00
|
|
|
mTextureHandle = mUploadTexture;
|
2013-07-17 20:24:15 -07:00
|
|
|
mTextureTarget = LOCAL_GL_TEXTURE_2D;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ASSERT(mTextureHandle);
|
2013-07-17 20:24:15 -07:00
|
|
|
mGL->fBindTexture(mTextureTarget, mTextureHandle);
|
|
|
|
mGL->fTexParameteri(mTextureTarget,
|
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
|
|
|
LOCAL_GL_TEXTURE_WRAP_S,
|
|
|
|
LOCAL_GL_CLAMP_TO_EDGE);
|
2013-07-17 20:24:15 -07:00
|
|
|
mGL->fTexParameteri(mTextureTarget,
|
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
|
|
|
LOCAL_GL_TEXTURE_WRAP_T,
|
|
|
|
LOCAL_GL_CLAMP_TO_EDGE);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
YCbCrDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
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
|
|
|
{
|
|
|
|
CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
|
|
|
|
GLContext* newGL = glCompositor ? glCompositor->gl() : nullptr;
|
|
|
|
if (mGL != newGL) {
|
|
|
|
mGL = newGL;
|
|
|
|
mYTexture->mTexImage = nullptr;
|
|
|
|
mCbTexture->mTexImage = nullptr;
|
|
|
|
mCrTexture->mTexImage = nullptr;
|
|
|
|
// if we have a buffer we reupload it with the new gl context
|
|
|
|
if (newGL && mBuffer && mBuffer->type() == SurfaceDescriptor::TYCbCrImage) {
|
|
|
|
UpdateImpl(*mBuffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
YCbCrDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
2013-05-15 20:45:43 -07:00
|
|
|
nsIntRegion* aRegion,
|
|
|
|
nsIntPoint* aOffset)
|
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
|
|
|
{
|
|
|
|
if (!mGL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
NS_ASSERTION(aImage.type() == SurfaceDescriptor::TYCbCrImage, "SurfaceDescriptor mismatch");
|
|
|
|
|
2013-05-23 00:17:10 -07:00
|
|
|
YCbCrImageDataDeserializer deserializer(aImage.get_YCbCrImage().data().get<uint8_t>());
|
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-05-23 00:17:10 -07:00
|
|
|
gfxIntSize gfxSize = deserializer.GetYSize();
|
|
|
|
gfxIntSize gfxCbCrSize = deserializer.GetCbCrSize();
|
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
|
|
|
|
|
|
|
if (!mYTexture->mTexImage || mYTexture->mTexImage->GetSize() != gfxSize) {
|
2013-04-11 22:08:23 -07:00
|
|
|
mYTexture->mTexImage = CreateBasicTextureImage(mGL,
|
|
|
|
gfxSize,
|
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
|
|
|
gfxASurface::CONTENT_ALPHA,
|
2013-08-06 10:36:35 -07:00
|
|
|
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
|
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
|
|
|
FlagsToGLFlags(mFlags));
|
|
|
|
}
|
|
|
|
if (!mCbTexture->mTexImage || mCbTexture->mTexImage->GetSize() != gfxCbCrSize) {
|
2013-04-11 22:08:23 -07:00
|
|
|
mCbTexture->mTexImage = CreateBasicTextureImage(mGL,
|
|
|
|
gfxCbCrSize,
|
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
|
|
|
gfxASurface::CONTENT_ALPHA,
|
2013-08-06 10:36:35 -07:00
|
|
|
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
|
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
|
|
|
FlagsToGLFlags(mFlags));
|
|
|
|
}
|
2013-04-11 22:08:23 -07:00
|
|
|
if (!mCrTexture->mTexImage || mCrTexture->mTexImage->GetSize() != gfxCbCrSize) {
|
|
|
|
mCrTexture->mTexImage = CreateBasicTextureImage(mGL,
|
|
|
|
gfxCbCrSize,
|
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
|
|
|
gfxASurface::CONTENT_ALPHA,
|
2013-08-06 10:36:35 -07:00
|
|
|
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
|
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
|
|
|
FlagsToGLFlags(mFlags));
|
|
|
|
}
|
|
|
|
|
2013-05-23 00:17:10 -07:00
|
|
|
RefPtr<gfxImageSurface> tempY = new gfxImageSurface(deserializer.GetYData(),
|
|
|
|
gfxSize, deserializer.GetYStride(),
|
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
|
|
|
gfxASurface::ImageFormatA8);
|
2013-05-23 00:17:10 -07:00
|
|
|
RefPtr<gfxImageSurface> tempCb = new gfxImageSurface(deserializer.GetCbData(),
|
|
|
|
gfxCbCrSize, deserializer.GetCbCrStride(),
|
|
|
|
gfxASurface::ImageFormatA8);
|
|
|
|
RefPtr<gfxImageSurface> tempCr = new gfxImageSurface(deserializer.GetCrData(),
|
|
|
|
gfxCbCrSize, deserializer.GetCbCrStride(),
|
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
|
|
|
gfxASurface::ImageFormatA8);
|
|
|
|
|
|
|
|
nsIntRegion yRegion(nsIntRect(0, 0, gfxSize.width, gfxSize.height));
|
|
|
|
nsIntRegion cbCrRegion(nsIntRect(0, 0, gfxCbCrSize.width, gfxCbCrSize.height));
|
|
|
|
|
|
|
|
mYTexture->mTexImage->DirectUpdate(tempY, yRegion);
|
|
|
|
mCbTexture->mTexImage->DirectUpdate(tempCb, cbCrRegion);
|
|
|
|
mCrTexture->mTexImage->DirectUpdate(tempCr, cbCrRegion);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 14:30:44 -07:00
|
|
|
YCbCrDeprecatedTextureHostOGL::Lock()
|
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
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
TiledDeprecatedTextureHostOGL::~TiledDeprecatedTextureHostOGL()
|
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
|
|
|
{
|
|
|
|
DeleteTextures();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
GetFormatAndTileForImageFormat(gfxASurface::gfxImageFormat aFormat,
|
|
|
|
GLenum& aOutFormat,
|
|
|
|
GLenum& aOutType)
|
|
|
|
{
|
|
|
|
if (aFormat == gfxASurface::ImageFormatRGB16_565) {
|
|
|
|
aOutFormat = LOCAL_GL_RGB;
|
|
|
|
aOutType = LOCAL_GL_UNSIGNED_SHORT_5_6_5;
|
|
|
|
} else {
|
|
|
|
aOutFormat = LOCAL_GL_RGBA;
|
|
|
|
aOutType = LOCAL_GL_UNSIGNED_BYTE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
TiledDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
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
|
|
|
{
|
|
|
|
CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
|
|
|
|
if (mGL && !glCompositor) {
|
|
|
|
DeleteTextures();
|
|
|
|
}
|
|
|
|
mGL = glCompositor ? glCompositor->gl() : nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
TiledDeprecatedTextureHostOGL::DeleteTextures()
|
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
|
|
|
{
|
|
|
|
if (mTextureHandle) {
|
|
|
|
mGL->MakeCurrent();
|
|
|
|
mGL->fDeleteTextures(1, &mTextureHandle);
|
|
|
|
|
|
|
|
gl::GLContext::UpdateTextureMemoryUsage(gl::GLContext::MemoryFreed, mGLFormat,
|
|
|
|
GetTileType(), TILEDLAYERBUFFER_TILE_SIZE);
|
|
|
|
mTextureHandle = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
TiledDeprecatedTextureHostOGL::Update(gfxReusableSurfaceWrapper* aReusableSurface, TextureFlags aFlags, const gfx::IntSize& aSize)
|
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
|
|
|
{
|
|
|
|
mSize = aSize;
|
|
|
|
mGL->MakeCurrent();
|
2013-08-06 10:36:35 -07:00
|
|
|
if (aFlags & TEXTURE_NEW_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
|
|
|
SetFlags(aFlags);
|
|
|
|
mGL->fGenTextures(1, &mTextureHandle);
|
|
|
|
mGL->fBindTexture(LOCAL_GL_TEXTURE_2D, mTextureHandle);
|
|
|
|
mGL->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_LINEAR);
|
|
|
|
mGL->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_LINEAR);
|
|
|
|
mGL->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_S, LOCAL_GL_CLAMP_TO_EDGE);
|
|
|
|
mGL->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE);
|
|
|
|
} else {
|
|
|
|
mGL->fBindTexture(LOCAL_GL_TEXTURE_2D, mTextureHandle);
|
|
|
|
// We're re-using a texture, but the format may change. Update the memory
|
|
|
|
// reporter with a free and alloc (below) using the old and new formats.
|
|
|
|
gl::GLContext::UpdateTextureMemoryUsage(gl::GLContext::MemoryFreed, mGLFormat,
|
|
|
|
GetTileType(), TILEDLAYERBUFFER_TILE_SIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
GLenum type;
|
|
|
|
GetFormatAndTileForImageFormat(aReusableSurface->Format(), mGLFormat, type);
|
|
|
|
|
|
|
|
const unsigned char* buf = aReusableSurface->GetReadOnlyData();
|
|
|
|
mGL->fTexImage2D(LOCAL_GL_TEXTURE_2D, 0, mGLFormat,
|
|
|
|
TILEDLAYERBUFFER_TILE_SIZE, TILEDLAYERBUFFER_TILE_SIZE, 0,
|
|
|
|
mGLFormat, type, buf);
|
|
|
|
|
|
|
|
gl::GLContext::UpdateTextureMemoryUsage(gl::GLContext::MemoryAllocated, mGLFormat,
|
|
|
|
type, TILEDLAYERBUFFER_TILE_SIZE);
|
|
|
|
|
|
|
|
if (mGLFormat == LOCAL_GL_RGB) {
|
|
|
|
mFormat = FORMAT_R8G8B8X8;
|
|
|
|
} else {
|
|
|
|
mFormat = FORMAT_B8G8R8A8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 14:30:44 -07:00
|
|
|
TiledDeprecatedTextureHostOGL::Lock()
|
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
|
|
|
{
|
|
|
|
if (!mTextureHandle) {
|
2013-07-08 14:30:44 -07:00
|
|
|
NS_WARNING("TiledDeprecatedTextureHostOGL not ready to be composited");
|
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
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
mGL->MakeCurrent();
|
|
|
|
mGL->fActiveTexture(LOCAL_GL_TEXTURE0);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
static gfx::SurfaceFormat
|
2013-05-27 07:12:13 -07:00
|
|
|
SurfaceFormatForAndroidPixelFormat(android::PixelFormat aFormat,
|
|
|
|
bool swapRB = 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 02:20:52 -07:00
|
|
|
{
|
|
|
|
switch (aFormat) {
|
2013-05-27 07:12:13 -07:00
|
|
|
case android::PIXEL_FORMAT_BGRA_8888:
|
|
|
|
return swapRB ? FORMAT_R8G8B8A8 : FORMAT_B8G8R8A8;
|
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
|
|
|
case android::PIXEL_FORMAT_RGBA_8888:
|
2013-05-27 07:12:13 -07:00
|
|
|
return swapRB ? FORMAT_B8G8R8A8 : FORMAT_R8G8B8A8;
|
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
|
|
|
case android::PIXEL_FORMAT_RGBX_8888:
|
2013-05-27 07:12:13 -07:00
|
|
|
return swapRB ? FORMAT_B8G8R8X8 : FORMAT_R8G8B8X8;
|
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
|
|
|
case android::PIXEL_FORMAT_RGB_565:
|
|
|
|
return FORMAT_R5G6B5;
|
|
|
|
case android::PIXEL_FORMAT_A_8:
|
|
|
|
return FORMAT_A8;
|
2013-04-30 03:14:20 -07:00
|
|
|
case HAL_PIXEL_FORMAT_YCbCr_422_SP:
|
|
|
|
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
|
|
|
|
case HAL_PIXEL_FORMAT_YCbCr_422_I:
|
|
|
|
case HAL_PIXEL_FORMAT_YV12:
|
2013-04-17 13:56:03 -07:00
|
|
|
return FORMAT_B8G8R8A8; // yup, use FORMAT_B8G8R8A8 even though it's a YUV texture. This is an external texture.
|
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
|
|
|
default:
|
2013-04-30 03:14:20 -07:00
|
|
|
if (aFormat >= 0x100 && aFormat <= 0x1FF) {
|
|
|
|
// Reserved range for HAL specific formats.
|
|
|
|
return FORMAT_B8G8R8A8;
|
|
|
|
} else {
|
|
|
|
// This is not super-unreachable, there's a bunch of hypothetical pixel
|
|
|
|
// formats we don't deal with.
|
|
|
|
// We only want to abort in debug builds here, since if we crash here
|
|
|
|
// we'll take down the compositor process and thus the phone. This seems
|
|
|
|
// like undesirable behaviour. We'd rather have a subtle artifact.
|
|
|
|
MOZ_ASSERT(false, "Unknown Android pixel format.");
|
|
|
|
return FORMAT_UNKNOWN;
|
|
|
|
}
|
2013-04-17 13:56:03 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GLenum
|
|
|
|
TextureTargetForAndroidPixelFormat(android::PixelFormat aFormat)
|
|
|
|
{
|
|
|
|
switch (aFormat) {
|
2013-04-30 03:14:20 -07:00
|
|
|
case HAL_PIXEL_FORMAT_YCbCr_422_SP:
|
|
|
|
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
|
|
|
|
case HAL_PIXEL_FORMAT_YCbCr_422_I:
|
|
|
|
case HAL_PIXEL_FORMAT_YV12:
|
2013-04-17 13:56:03 -07:00
|
|
|
return LOCAL_GL_TEXTURE_EXTERNAL;
|
2013-04-30 03:14:20 -07:00
|
|
|
case android::PIXEL_FORMAT_RGBA_8888:
|
|
|
|
case android::PIXEL_FORMAT_RGBX_8888:
|
|
|
|
case android::PIXEL_FORMAT_RGB_565:
|
|
|
|
case android::PIXEL_FORMAT_A_8:
|
2013-04-17 13:56:03 -07:00
|
|
|
return LOCAL_GL_TEXTURE_2D;
|
2013-04-30 03:14:20 -07:00
|
|
|
default:
|
|
|
|
if (aFormat >= 0x100 && aFormat <= 0x1FF) {
|
|
|
|
// Reserved range for HAL specific formats.
|
|
|
|
return LOCAL_GL_TEXTURE_EXTERNAL;
|
|
|
|
} else {
|
|
|
|
// This is not super-unreachable, there's a bunch of hypothetical pixel
|
|
|
|
// formats we don't deal with.
|
|
|
|
// We only want to abort in debug builds here, since if we crash here
|
|
|
|
// we'll take down the compositor process and thus the phone. This seems
|
|
|
|
// like undesirable behaviour. We'd rather have a subtle artifact.
|
|
|
|
MOZ_ASSERT(false, "Unknown Android pixel format.");
|
|
|
|
return LOCAL_GL_TEXTURE_EXTERNAL;
|
|
|
|
}
|
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-08 14:30:44 -07:00
|
|
|
GrallocDeprecatedTextureHostOGL::GrallocDeprecatedTextureHostOGL()
|
2013-06-04 11:44:37 -07:00
|
|
|
: mCompositor(nullptr)
|
|
|
|
, mTextureTarget(0)
|
|
|
|
, mEGLImage(0)
|
2013-06-11 03:14:33 -07:00
|
|
|
, mIsRBSwapped(false)
|
2013-06-04 11:44:37 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
void GrallocDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
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
|
|
|
{
|
|
|
|
CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
|
2013-06-04 11:44:37 -07:00
|
|
|
if (mCompositor && !glCompositor) {
|
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
|
|
|
DeleteTextures();
|
|
|
|
}
|
2013-06-04 11:44:37 -07:00
|
|
|
mCompositor = glCompositor;
|
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
|
|
|
gfx::SurfaceFormat
|
|
|
|
GrallocDeprecatedTextureHostOGL::GetFormat() const
|
|
|
|
{
|
|
|
|
if (mTextureTarget == LOCAL_GL_TEXTURE_EXTERNAL) {
|
|
|
|
return gfx::FORMAT_R8G8B8A8;
|
|
|
|
}
|
|
|
|
MOZ_ASSERT(mTextureTarget == LOCAL_GL_TEXTURE_2D);
|
|
|
|
return mFormat;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
GrallocDeprecatedTextureHostOGL::DeleteTextures()
|
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-06-04 11:44:37 -07:00
|
|
|
if (mEGLImage) {
|
|
|
|
gl()->MakeCurrent();
|
|
|
|
gl()->DestroyEGLImage(mEGLImage);
|
|
|
|
mEGLImage = 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 02:20:52 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-26 20:31:53 -07:00
|
|
|
// only used for hacky fix in gecko 23 for bug 862324
|
|
|
|
static void
|
2013-07-08 14:30:44 -07:00
|
|
|
RegisterDeprecatedTextureHostAtGrallocBufferActor(DeprecatedTextureHost* aDeprecatedTextureHost, const SurfaceDescriptor& aSurfaceDescriptor)
|
2013-04-26 20:31:53 -07:00
|
|
|
{
|
|
|
|
if (IsSurfaceDescriptorValid(aSurfaceDescriptor)) {
|
|
|
|
GrallocBufferActor* actor = static_cast<GrallocBufferActor*>(aSurfaceDescriptor.get_SurfaceDescriptorGralloc().bufferParent());
|
2013-07-08 14:30:44 -07:00
|
|
|
actor->SetDeprecatedTextureHost(aDeprecatedTextureHost);
|
2013-04-26 20:31:53 -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
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
GrallocDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
2013-05-15 20:45:43 -07:00
|
|
|
nsIntRegion* aRegion,
|
|
|
|
nsIntPoint* aOffset)
|
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
|
|
|
{
|
|
|
|
SwapTexturesImpl(aImage, aRegion);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
GrallocDeprecatedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
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
|
|
|
nsIntRegion*)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TSurfaceDescriptorGralloc);
|
|
|
|
|
2013-04-30 03:14:21 -07:00
|
|
|
if (mBuffer) {
|
|
|
|
// only done for hacky fix in gecko 23 for bug 862324.
|
2013-07-08 14:30:44 -07:00
|
|
|
RegisterDeprecatedTextureHostAtGrallocBufferActor(nullptr, *mBuffer);
|
2013-04-30 03:14:21 -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
|
|
|
const SurfaceDescriptorGralloc& desc = aImage.get_SurfaceDescriptorGralloc();
|
|
|
|
mGraphicBuffer = GrallocBufferActor::GetFrom(desc);
|
2013-06-11 03:14:33 -07:00
|
|
|
mIsRBSwapped = desc.isRBSwapped();
|
2013-05-27 07:12:13 -07:00
|
|
|
mFormat = SurfaceFormatForAndroidPixelFormat(mGraphicBuffer->getPixelFormat(),
|
2013-06-11 03:14:33 -07:00
|
|
|
mIsRBSwapped);
|
|
|
|
|
2013-04-17 13:56:03 -07:00
|
|
|
mTextureTarget = TextureTargetForAndroidPixelFormat(mGraphicBuffer->getPixelFormat());
|
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
|
|
|
|
|
|
|
DeleteTextures();
|
2013-04-26 20:31:53 -07:00
|
|
|
|
|
|
|
// only done for hacky fix in gecko 23 for bug 862324.
|
2013-07-24 09:08:35 -07:00
|
|
|
// Doing this in SetBuffer is not enough, as DeprecatedImageHostBuffered::SwapTextures can
|
2013-04-26 20:31:53 -07:00
|
|
|
// change the value of *mBuffer without calling SetBuffer again.
|
2013-07-08 14:30:44 -07:00
|
|
|
RegisterDeprecatedTextureHostAtGrallocBufferActor(this, aImage);
|
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-06-04 11:44:37 -07:00
|
|
|
gl::GLContext*
|
2013-07-08 14:30:44 -07:00
|
|
|
GrallocDeprecatedTextureHostOGL::gl() const
|
2013-06-04 11:44:37 -07:00
|
|
|
{
|
|
|
|
return mCompositor ? mCompositor->gl() : nullptr;
|
|
|
|
}
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
void GrallocDeprecatedTextureHostOGL::BindTexture(GLenum aTextureUnit)
|
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-06-04 11:44:37 -07:00
|
|
|
/*
|
|
|
|
* The job of this function is to ensure that the texture is tied to the
|
|
|
|
* android::GraphicBuffer, so that texturing will source the GraphicBuffer.
|
|
|
|
*
|
|
|
|
* To this effect we create an EGLImage wrapping this GraphicBuffer,
|
|
|
|
* using CreateEGLImageForNativeBuffer, and then we tie this EGLImage to our
|
|
|
|
* texture using fEGLImageTargetTexture2D.
|
|
|
|
*
|
|
|
|
* We try to avoid re-creating the EGLImage everytime, by keeping it around
|
|
|
|
* as the mEGLImage member of this class.
|
|
|
|
*/
|
|
|
|
MOZ_ASSERT(gl());
|
|
|
|
gl()->MakeCurrent();
|
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-06-04 11:44:37 -07:00
|
|
|
GLuint tex = mCompositor->GetTemporaryTexture(aTextureUnit);
|
|
|
|
|
|
|
|
gl()->fActiveTexture(aTextureUnit);
|
|
|
|
gl()->fBindTexture(mTextureTarget, tex);
|
|
|
|
if (!mEGLImage) {
|
|
|
|
mEGLImage = gl()->CreateEGLImageForNativeBuffer(mGraphicBuffer->getNativeBuffer());
|
|
|
|
}
|
|
|
|
gl()->fEGLImageTargetTexture2D(mTextureTarget, mEGLImage);
|
|
|
|
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
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-04-11 09:37:07 -07:00
|
|
|
bool
|
2013-07-08 14:30:44 -07:00
|
|
|
GrallocDeprecatedTextureHostOGL::IsValid() const
|
2013-04-11 09:37:07 -07:00
|
|
|
{
|
2013-06-04 11:44:37 -07:00
|
|
|
return !!gl() && !!mGraphicBuffer.get();
|
2013-04-11 09:37:07 -07:00
|
|
|
}
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
GrallocDeprecatedTextureHostOGL::~GrallocDeprecatedTextureHostOGL()
|
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
|
|
|
{
|
|
|
|
DeleteTextures();
|
2013-04-26 20:31:53 -07:00
|
|
|
|
|
|
|
// only done for hacky fix in gecko 23 for bug 862324.
|
|
|
|
if (mBuffer) {
|
|
|
|
// make sure that if the GrallocBufferActor survives us, it doesn't keep a dangling
|
|
|
|
// pointer to us.
|
2013-07-08 14:30:44 -07:00
|
|
|
RegisterDeprecatedTextureHostAtGrallocBufferActor(nullptr, *mBuffer);
|
2013-04-26 20:31:53 -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
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 14:30:44 -07:00
|
|
|
GrallocDeprecatedTextureHostOGL::Lock()
|
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-06-04 11:44:37 -07:00
|
|
|
// Lock/Unlock is done internally when binding the gralloc buffer to a gl texture
|
|
|
|
return IsValid();
|
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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
GrallocDeprecatedTextureHostOGL::Unlock()
|
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-06-04 11:44:37 -07:00
|
|
|
// Lock/Unlock is done internally when binding the gralloc buffer to a gl texture
|
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-04-26 20:31:53 -07:00
|
|
|
void
|
2013-07-08 14:30:44 -07:00
|
|
|
GrallocDeprecatedTextureHostOGL::SetBuffer(SurfaceDescriptor* aBuffer, ISurfaceAllocator* aAllocator)
|
2013-04-26 20:31:53 -07:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(!mBuffer, "Will leak the old mBuffer");
|
|
|
|
mBuffer = aBuffer;
|
|
|
|
mDeAllocator = aAllocator;
|
|
|
|
|
|
|
|
// only done for hacky fix in gecko 23 for bug 862324.
|
|
|
|
// Doing this in SwapTextures is not enough, as the crash could occur right after SetBuffer.
|
2013-07-08 14:30:44 -07:00
|
|
|
RegisterDeprecatedTextureHostAtGrallocBufferActor(this, *mBuffer);
|
2013-04-26 20:31:53 -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-06-05 15:14:51 -07:00
|
|
|
LayerRenderState
|
2013-07-08 14:30:44 -07:00
|
|
|
GrallocDeprecatedTextureHostOGL::GetRenderState()
|
2013-06-05 15:14:51 -07:00
|
|
|
{
|
2013-07-12 06:06:26 -07:00
|
|
|
if (mGraphicBuffer.get()) {
|
2013-06-11 03:14:33 -07:00
|
|
|
|
2013-08-06 10:36:35 -07:00
|
|
|
uint32_t flags = mFlags & TEXTURE_NEEDS_Y_FLIP ? LAYER_RENDER_STATE_Y_FLIPPED : 0;
|
2013-06-11 03:14:33 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The 32 bit format of gralloc buffer is created as RGBA8888 or RGBX888 by default.
|
|
|
|
* For software rendering (non-GL rendering), the content is drawn with BGRA
|
|
|
|
* or BGRX. Therefore, we need to pass the RBSwapped flag for HW composer to swap format.
|
|
|
|
*
|
|
|
|
* For GL rendering content, the content format is RGBA or RGBX which is the same as
|
|
|
|
* the pixel format of gralloc buffer and no need for the RBSwapped flag.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (mIsRBSwapped) {
|
|
|
|
flags |= LAYER_RENDER_STATE_FORMAT_RB_SWAP;
|
|
|
|
}
|
|
|
|
|
2013-07-12 06:06:26 -07:00
|
|
|
nsIntSize bufferSize(mGraphicBuffer->getWidth(), mGraphicBuffer->getHeight());
|
|
|
|
|
2013-06-05 15:14:51 -07:00
|
|
|
return LayerRenderState(mGraphicBuffer.get(),
|
2013-07-12 06:06:26 -07:00
|
|
|
bufferSize,
|
2013-06-11 03:14:33 -07:00
|
|
|
flags);
|
2013-06-05 15:14:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return LayerRenderState();
|
|
|
|
}
|
2013-06-04 11:44:37 -07:00
|
|
|
#endif // MOZ_WIDGET_GONK
|
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-05-25 19:43:43 -07:00
|
|
|
already_AddRefed<gfxImageSurface>
|
2013-07-08 14:30:44 -07:00
|
|
|
TextureImageDeprecatedTextureHostOGL::GetAsSurface() {
|
2013-05-25 19:43:43 -07:00
|
|
|
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
|
|
|
mGL->GetTexImage(mTexture->GetTextureID(),
|
|
|
|
false,
|
2013-07-04 10:25:50 -07:00
|
|
|
mTexture->GetTextureFormat())
|
2013-05-25 19:43:43 -07:00
|
|
|
: nullptr;
|
|
|
|
return surf.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<gfxImageSurface>
|
2013-07-08 14:30:44 -07:00
|
|
|
YCbCrDeprecatedTextureHostOGL::GetAsSurface() {
|
2013-05-25 19:43:43 -07:00
|
|
|
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
|
|
|
mGL->GetTexImage(mYTexture->mTexImage->GetTextureID(),
|
|
|
|
false,
|
2013-07-04 10:25:50 -07:00
|
|
|
mYTexture->mTexImage->GetTextureFormat())
|
2013-05-25 19:43:43 -07:00
|
|
|
: nullptr;
|
|
|
|
return surf.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<gfxImageSurface>
|
2013-07-08 14:30:44 -07:00
|
|
|
SharedDeprecatedTextureHostOGL::GetAsSurface() {
|
2013-05-25 19:43:43 -07:00
|
|
|
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
|
|
|
mGL->GetTexImage(GetTextureHandle(),
|
|
|
|
false,
|
2013-07-30 02:59:51 -07:00
|
|
|
GetFormat())
|
2013-05-25 19:43:43 -07:00
|
|
|
: nullptr;
|
|
|
|
return surf.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<gfxImageSurface>
|
|
|
|
SurfaceStreamHostOGL::GetAsSurface() {
|
|
|
|
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
|
|
|
mGL->GetTexImage(mTextureHandle,
|
|
|
|
false,
|
2013-07-30 02:59:51 -07:00
|
|
|
GetFormat())
|
2013-05-25 19:43:43 -07:00
|
|
|
: nullptr;
|
|
|
|
return surf.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<gfxImageSurface>
|
2013-07-08 14:30:44 -07:00
|
|
|
TiledDeprecatedTextureHostOGL::GetAsSurface() {
|
2013-05-25 19:43:43 -07:00
|
|
|
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
|
|
|
mGL->GetTexImage(mTextureHandle,
|
|
|
|
false,
|
2013-07-30 02:59:51 -07:00
|
|
|
GetFormat())
|
2013-05-25 19:43:43 -07:00
|
|
|
: nullptr;
|
|
|
|
return surf.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
already_AddRefed<gfxImageSurface>
|
2013-07-08 14:30:44 -07:00
|
|
|
GrallocDeprecatedTextureHostOGL::GetAsSurface() {
|
2013-06-04 11:44:37 -07:00
|
|
|
gl()->MakeCurrent();
|
|
|
|
|
|
|
|
GLuint tex = mCompositor->GetTemporaryTexture(LOCAL_GL_TEXTURE0);
|
|
|
|
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
|
|
|
gl()->fBindTexture(mTextureTarget, tex);
|
|
|
|
if (!mEGLImage) {
|
|
|
|
mEGLImage = gl()->CreateEGLImageForNativeBuffer(mGraphicBuffer->getNativeBuffer());
|
|
|
|
}
|
|
|
|
gl()->fEGLImageTargetTexture2D(mTextureTarget, mEGLImage);
|
|
|
|
|
|
|
|
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
|
|
|
gl()->GetTexImage(tex,
|
|
|
|
false,
|
2013-07-30 02:59:51 -07:00
|
|
|
GetFormat())
|
2013-05-25 19:43:43 -07:00
|
|
|
: nullptr;
|
|
|
|
return surf.forget();
|
|
|
|
}
|
|
|
|
#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 02:20:52 -07:00
|
|
|
} // namespace
|
|
|
|
} // namespace
|