Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* 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/. */
|
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "GLContext.h" // for GLContext, etc
|
2014-01-10 17:06:06 +04:00
|
|
|
#include "SurfaceStream.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
|
|
|
#include "mozilla/layers/ISurfaceAllocator.h"
|
2014-01-10 17:06:06 +04:00
|
|
|
#include "mozilla/layers/TextureClientOGL.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "nsSize.h" // for nsIntSize
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
|
|
|
using namespace mozilla::gl;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
class CompositableForwarder;
|
|
|
|
|
2013-08-28 00:16:54 +04:00
|
|
|
SharedTextureClientOGL::SharedTextureClientOGL(TextureFlags aFlags)
|
|
|
|
: TextureClient(aFlags)
|
|
|
|
, mHandle(0)
|
2013-08-08 16:53:12 +04:00
|
|
|
, mInverted(false)
|
2013-07-30 13:59:51 +04:00
|
|
|
{
|
2013-10-03 00:52:04 +04:00
|
|
|
// SharedTextureClient is always owned externally.
|
|
|
|
mFlags |= TEXTURE_DEALLOCATE_CLIENT;
|
2013-07-30 13:59:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
SharedTextureClientOGL::~SharedTextureClientOGL()
|
|
|
|
{
|
2013-10-03 00:52:04 +04:00
|
|
|
// the shared data is owned externally.
|
2013-07-30 13:59:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
SharedTextureClientOGL::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
|
|
|
|
{
|
2013-09-06 13:04:50 +04:00
|
|
|
MOZ_ASSERT(IsValid());
|
2013-07-30 13:59:51 +04:00
|
|
|
if (!IsAllocated()) {
|
|
|
|
return false;
|
|
|
|
}
|
2013-12-31 13:06:12 +04:00
|
|
|
aOutDescriptor = SharedTextureDescriptor(mShareType, mHandle, mSize, mInverted);
|
2013-07-30 13:59:51 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SharedTextureClientOGL::InitWith(gl::SharedTextureHandle aHandle,
|
|
|
|
gfx::IntSize aSize,
|
2013-09-04 16:14:52 +04:00
|
|
|
gl::SharedTextureShareType aShareType,
|
2013-07-30 13:59:51 +04:00
|
|
|
bool aInverted)
|
|
|
|
{
|
2013-09-06 13:04:50 +04:00
|
|
|
MOZ_ASSERT(IsValid());
|
2013-07-30 13:59:51 +04:00
|
|
|
MOZ_ASSERT(!IsAllocated());
|
|
|
|
mHandle = aHandle;
|
|
|
|
mSize = aSize;
|
2013-08-28 00:16:54 +04:00
|
|
|
mShareType = aShareType;
|
2013-07-30 13:59:51 +04:00
|
|
|
mInverted = aInverted;
|
2013-10-10 05:20:57 +04:00
|
|
|
if (mInverted) {
|
|
|
|
AddFlags(TEXTURE_NEEDS_Y_FLIP);
|
|
|
|
}
|
2013-07-30 13:59:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SharedTextureClientOGL::IsAllocated() const
|
|
|
|
{
|
|
|
|
return mHandle != 0;
|
|
|
|
}
|
|
|
|
|
2014-01-10 17:06:06 +04:00
|
|
|
StreamTextureClientOGL::StreamTextureClientOGL(TextureFlags aFlags)
|
|
|
|
: TextureClient(aFlags)
|
|
|
|
, mStream(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
StreamTextureClientOGL::~StreamTextureClientOGL()
|
|
|
|
{
|
|
|
|
// the data is owned externally.
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
StreamTextureClientOGL::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
|
|
|
|
{
|
|
|
|
if (!IsAllocated()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::SurfaceStreamHandle handle = mStream->GetShareHandle();
|
|
|
|
aOutDescriptor = SurfaceStreamDescriptor(handle, false);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
StreamTextureClientOGL::InitWith(gfx::SurfaceStream* aStream)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(!IsAllocated());
|
|
|
|
mStream = aStream;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
StreamTextureClientOGL::IsAllocated() const
|
|
|
|
{
|
|
|
|
return mStream != 0;
|
|
|
|
}
|
|
|
|
|
2013-07-09 01:30:44 +04:00
|
|
|
DeprecatedTextureClientSharedOGL::DeprecatedTextureClientSharedOGL(CompositableForwarder* aForwarder,
|
2013-04-12 11:28:55 +04:00
|
|
|
const TextureInfo& aTextureInfo)
|
2013-07-09 01:30:44 +04:00
|
|
|
: DeprecatedTextureClient(aForwarder, aTextureInfo)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
, mGL(nullptr)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-07-09 01:30:44 +04:00
|
|
|
DeprecatedTextureClientSharedOGL::ReleaseResources()
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
{
|
|
|
|
if (!IsSurfaceDescriptorValid(mDescriptor)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
MOZ_ASSERT(mDescriptor.type() == SurfaceDescriptor::TSharedTextureDescriptor);
|
2013-04-12 03:42:26 +04:00
|
|
|
mDescriptor = SurfaceDescriptor();
|
2013-07-09 01:30:44 +04:00
|
|
|
// It's important our handle gets released! SharedDeprecatedTextureHostOGL will take
|
2013-04-12 03:42:26 +04:00
|
|
|
// care of this for us though.
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2013-08-04 11:46:17 +04:00
|
|
|
bool
|
2013-07-09 01:30:44 +04:00
|
|
|
DeprecatedTextureClientSharedOGL::EnsureAllocated(gfx::IntSize aSize,
|
2013-09-25 00:45:13 +04:00
|
|
|
gfxContentType aContentType)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
{
|
|
|
|
mSize = aSize;
|
2013-08-04 11:46:17 +04:00
|
|
|
return true;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
} // namespace
|