mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 858914 - Mark all TextureHost and TextureClient classes deprecated. r=mattwoodrow
This commit is contained in:
parent
d8bc6ad4fd
commit
e997aad0fc
@ -94,7 +94,7 @@
|
||||
* under gfx/layers/. To add a new backend, implement at least the following
|
||||
* interfaces:
|
||||
* - Compositor (ex. CompositorOGL)
|
||||
* - TextureHost (ex. TextureImageTextureHost)
|
||||
* - TextureHost (ex. SharedTextureHostOGL)
|
||||
* Depending on the type of data that needs to be serialized, you may need to
|
||||
* add specific TextureClient implementations.
|
||||
*/
|
||||
|
@ -45,7 +45,7 @@ const TextureFlags OwnByClient = 0x80;
|
||||
* determine how the texture client is drawn into and how the memory
|
||||
* is shared between client and host.
|
||||
*/
|
||||
enum TextureClientType
|
||||
enum DeprecatedTextureClientType
|
||||
{
|
||||
TEXTURE_CONTENT, // dynamically drawn content
|
||||
TEXTURE_SHMEM, // shared memory
|
||||
@ -77,7 +77,7 @@ enum CompositableType
|
||||
/**
|
||||
* How the texture host is used for composition,
|
||||
*/
|
||||
enum TextureHostFlags
|
||||
enum DeprecatedTextureHostFlags
|
||||
{
|
||||
TEXTURE_HOST_DEFAULT = 0, // The default texture host for the given
|
||||
// SurfaceDescriptor
|
||||
@ -126,25 +126,25 @@ const TextureIdentifier TextureOnWhiteBack = 4;
|
||||
struct TextureInfo
|
||||
{
|
||||
CompositableType mCompositableType;
|
||||
uint32_t mTextureHostFlags;
|
||||
uint32_t mDeprecatedTextureHostFlags;
|
||||
uint32_t mTextureFlags;
|
||||
|
||||
TextureInfo()
|
||||
: mCompositableType(BUFFER_UNKNOWN)
|
||||
, mTextureHostFlags(0)
|
||||
, mDeprecatedTextureHostFlags(0)
|
||||
, mTextureFlags(0)
|
||||
{}
|
||||
|
||||
TextureInfo(CompositableType aType)
|
||||
: mCompositableType(aType)
|
||||
, mTextureHostFlags(0)
|
||||
, mDeprecatedTextureHostFlags(0)
|
||||
, mTextureFlags(0)
|
||||
{}
|
||||
|
||||
bool operator==(const TextureInfo& aOther) const
|
||||
{
|
||||
return mCompositableType == aOther.mCompositableType &&
|
||||
mTextureHostFlags == aOther.mTextureHostFlags &&
|
||||
mDeprecatedTextureHostFlags == aOther.mDeprecatedTextureHostFlags &&
|
||||
mTextureFlags == aOther.mTextureFlags;
|
||||
}
|
||||
};
|
||||
|
@ -225,35 +225,35 @@ struct EffectChain
|
||||
};
|
||||
|
||||
inline TemporaryRef<TexturedEffect>
|
||||
CreateTexturedEffect(TextureHost *aTextureHost,
|
||||
TextureHost *aTextureHostOnWhite,
|
||||
CreateTexturedEffect(DeprecatedTextureHost *aDeprecatedTextureHost,
|
||||
DeprecatedTextureHost *aDeprecatedTextureHostOnWhite,
|
||||
const gfx::Filter& aFilter)
|
||||
{
|
||||
if (aTextureHostOnWhite) {
|
||||
MOZ_ASSERT(aTextureHost->GetFormat() == gfx::FORMAT_R8G8B8X8 ||
|
||||
aTextureHost->GetFormat() == gfx::FORMAT_B8G8R8X8);
|
||||
return new EffectComponentAlpha(aTextureHost, aTextureHostOnWhite, aFilter);
|
||||
if (aDeprecatedTextureHostOnWhite) {
|
||||
MOZ_ASSERT(aDeprecatedTextureHost->GetFormat() == gfx::FORMAT_R8G8B8X8 ||
|
||||
aDeprecatedTextureHost->GetFormat() == gfx::FORMAT_B8G8R8X8);
|
||||
return new EffectComponentAlpha(aDeprecatedTextureHost, aDeprecatedTextureHostOnWhite, aFilter);
|
||||
}
|
||||
|
||||
RefPtr<TexturedEffect> result;
|
||||
switch (aTextureHost->GetFormat()) {
|
||||
switch (aDeprecatedTextureHost->GetFormat()) {
|
||||
case gfx::FORMAT_B8G8R8A8:
|
||||
result = new EffectBGRA(aTextureHost, true, aFilter);
|
||||
result = new EffectBGRA(aDeprecatedTextureHost, true, aFilter);
|
||||
break;
|
||||
case gfx::FORMAT_B8G8R8X8:
|
||||
result = new EffectBGRX(aTextureHost, true, aFilter);
|
||||
result = new EffectBGRX(aDeprecatedTextureHost, true, aFilter);
|
||||
break;
|
||||
case gfx::FORMAT_R8G8B8X8:
|
||||
result = new EffectRGBX(aTextureHost, true, aFilter);
|
||||
result = new EffectRGBX(aDeprecatedTextureHost, true, aFilter);
|
||||
break;
|
||||
case gfx::FORMAT_R5G6B5:
|
||||
result = new EffectRGBX(aTextureHost, true, aFilter);
|
||||
result = new EffectRGBX(aDeprecatedTextureHost, true, aFilter);
|
||||
break;
|
||||
case gfx::FORMAT_R8G8B8A8:
|
||||
result = new EffectRGBA(aTextureHost, true, aFilter);
|
||||
result = new EffectRGBA(aDeprecatedTextureHost, true, aFilter);
|
||||
break;
|
||||
case gfx::FORMAT_YUV:
|
||||
result = new EffectYCbCr(aTextureHost, aFilter);
|
||||
result = new EffectYCbCr(aDeprecatedTextureHost, aFilter);
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH("unhandled program type");
|
||||
@ -263,10 +263,10 @@ CreateTexturedEffect(TextureHost *aTextureHost,
|
||||
}
|
||||
|
||||
inline TemporaryRef<TexturedEffect>
|
||||
CreateTexturedEffect(TextureHost *aTextureHost,
|
||||
CreateTexturedEffect(DeprecatedTextureHost *aDeprecatedTextureHost,
|
||||
const gfx::Filter& aFilter)
|
||||
{
|
||||
return CreateTexturedEffect(aTextureHost, nullptr, aFilter);
|
||||
return CreateTexturedEffect(aDeprecatedTextureHost, nullptr, aFilter);
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
|
@ -286,7 +286,7 @@ protected:
|
||||
* unset the provider when inactive, by calling
|
||||
* SetBufferProvider(nullptr).
|
||||
*/
|
||||
void SetBufferProvider(TextureClient* aClient)
|
||||
void SetBufferProvider(DeprecatedTextureClient* aClient)
|
||||
{
|
||||
// Only this buffer provider can give us a buffer. If we
|
||||
// already have one, something has gone wrong.
|
||||
@ -299,7 +299,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
void SetBufferProviderOnWhite(TextureClient* aClient)
|
||||
void SetBufferProviderOnWhite(DeprecatedTextureClient* aClient)
|
||||
{
|
||||
// Only this buffer provider can give us a buffer. If we
|
||||
// already have one, something has gone wrong.
|
||||
@ -350,8 +350,8 @@ protected:
|
||||
* when we're using surfaces that require explicit map/unmap. Only one
|
||||
* may be used at a time.
|
||||
*/
|
||||
TextureClient* mBufferProvider;
|
||||
TextureClient* mBufferProviderOnWhite;
|
||||
DeprecatedTextureClient* mBufferProvider;
|
||||
DeprecatedTextureClient* mBufferProviderOnWhite;
|
||||
|
||||
BufferSizePolicy mBufferSizePolicy;
|
||||
};
|
||||
|
@ -30,8 +30,8 @@ public:
|
||||
/**
|
||||
* Texture source and host implementaion for software compositing.
|
||||
*/
|
||||
class TextureHostBasic : public TextureHost
|
||||
, public TextureSourceBasic
|
||||
class DeprecatedTextureHostBasic : public DeprecatedTextureHost
|
||||
, public TextureSourceBasic
|
||||
{
|
||||
public:
|
||||
virtual IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
||||
@ -45,7 +45,7 @@ public:
|
||||
mCompositor = static_cast<BasicCompositor*>(aCompositor);
|
||||
}
|
||||
|
||||
virtual const char *Name() { return "TextureHostBasic"; }
|
||||
virtual const char *Name() { return "DeprecatedTextureHostBasic"; }
|
||||
|
||||
protected:
|
||||
virtual void UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
@ -105,7 +105,7 @@ DeserializerToPlanarYCbCrImageData(YCbCrImageDataDeserializer& aDeserializer, Pl
|
||||
aData.mPicSize = aDeserializer.GetYSize();
|
||||
}
|
||||
|
||||
class YCbCrTextureHostBasic : public TextureHostBasic
|
||||
class YCbCrDeprecatedTextureHostBasic : public DeprecatedTextureHostBasic
|
||||
{
|
||||
public:
|
||||
virtual void UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
@ -162,19 +162,19 @@ public:
|
||||
|
||||
};
|
||||
|
||||
TemporaryRef<TextureHost>
|
||||
CreateBasicTextureHost(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aTextureHostFlags,
|
||||
uint32_t aTextureFlags)
|
||||
TemporaryRef<DeprecatedTextureHost>
|
||||
CreateBasicDeprecatedTextureHost(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aTextureHostFlags,
|
||||
uint32_t aTextureFlags)
|
||||
{
|
||||
if (aDescriptorType == SurfaceDescriptor::TYCbCrImage) {
|
||||
return new YCbCrTextureHostBasic();
|
||||
return new YCbCrDeprecatedTextureHostBasic();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aDescriptorType == SurfaceDescriptor::TShmem ||
|
||||
aDescriptorType == SurfaceDescriptor::TMemoryImage,
|
||||
"We can only support Shmem currently");
|
||||
return new TextureHostBasic();
|
||||
return new DeprecatedTextureHostBasic();
|
||||
}
|
||||
|
||||
BasicCompositor::BasicCompositor(nsIWidget *aWidget)
|
||||
|
@ -41,7 +41,7 @@ CanvasClient::CreateCanvasClient(CompositableType aCompositableHostType,
|
||||
void
|
||||
CanvasClient::Updated()
|
||||
{
|
||||
mForwarder->UpdateTexture(this, 1, mTextureClient->GetDescriptor());
|
||||
mForwarder->UpdateTexture(this, 1, mDeprecatedTextureClient->GetDescriptor());
|
||||
}
|
||||
|
||||
|
||||
@ -55,26 +55,26 @@ CanvasClient2D::CanvasClient2D(CompositableForwarder* aFwd,
|
||||
void
|
||||
CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
||||
{
|
||||
if (!mTextureClient) {
|
||||
mTextureClient = CreateTextureClient(TEXTURE_CONTENT);
|
||||
MOZ_ASSERT(mTextureClient, "Failed to create texture client");
|
||||
if (!mDeprecatedTextureClient) {
|
||||
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_CONTENT);
|
||||
MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
|
||||
}
|
||||
|
||||
bool isOpaque = (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE);
|
||||
gfxASurface::gfxContentType contentType = isOpaque
|
||||
? gfxASurface::CONTENT_COLOR
|
||||
: gfxASurface::CONTENT_COLOR_ALPHA;
|
||||
mTextureClient->EnsureAllocated(aSize, contentType);
|
||||
mDeprecatedTextureClient->EnsureAllocated(aSize, contentType);
|
||||
|
||||
gfxASurface* surface = mTextureClient->LockSurface();
|
||||
gfxASurface* surface = mDeprecatedTextureClient->LockSurface();
|
||||
aLayer->UpdateSurface(surface);
|
||||
mTextureClient->Unlock();
|
||||
mDeprecatedTextureClient->Unlock();
|
||||
}
|
||||
|
||||
void
|
||||
CanvasClientWebGL::Updated()
|
||||
{
|
||||
mForwarder->UpdateTextureNoSwap(this, 1, mTextureClient->GetDescriptor());
|
||||
mForwarder->UpdateTextureNoSwap(this, 1, mDeprecatedTextureClient->GetDescriptor());
|
||||
}
|
||||
|
||||
|
||||
@ -88,15 +88,15 @@ CanvasClientWebGL::CanvasClientWebGL(CompositableForwarder* aFwd,
|
||||
void
|
||||
CanvasClientWebGL::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
||||
{
|
||||
if (!mTextureClient) {
|
||||
mTextureClient = CreateTextureClient(TEXTURE_STREAM_GL);
|
||||
MOZ_ASSERT(mTextureClient, "Failed to create texture client");
|
||||
if (!mDeprecatedTextureClient) {
|
||||
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_STREAM_GL);
|
||||
MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
|
||||
}
|
||||
|
||||
NS_ASSERTION(aLayer->mGLContext, "CanvasClientWebGL should only be used with GL canvases");
|
||||
|
||||
// the content type won't be used
|
||||
mTextureClient->EnsureAllocated(aSize, gfxASurface::CONTENT_COLOR);
|
||||
mDeprecatedTextureClient->EnsureAllocated(aSize, gfxASurface::CONTENT_COLOR);
|
||||
|
||||
GLScreenBuffer* screen = aLayer->mGLContext->Screen();
|
||||
SurfaceStream* stream = screen->Stream();
|
||||
@ -117,14 +117,14 @@ CanvasClientWebGL::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
||||
}
|
||||
|
||||
SharedSurface_Gralloc* grallocSurf = SharedSurface_Gralloc::Cast(surf);
|
||||
mTextureClient->SetDescriptor(grallocSurf->GetDescriptor());
|
||||
mDeprecatedTextureClient->SetDescriptor(grallocSurf->GetDescriptor());
|
||||
#else
|
||||
printf_stderr("isCrossProcess, but not MOZ_WIDGET_GONK! Someone needs to write some code!");
|
||||
MOZ_ASSERT(false);
|
||||
#endif
|
||||
} else {
|
||||
SurfaceStreamHandle handle = stream->GetShareHandle();
|
||||
mTextureClient->SetDescriptor(SurfaceStreamDescriptor(handle, false));
|
||||
mDeprecatedTextureClient->SetDescriptor(SurfaceStreamDescriptor(handle, false));
|
||||
}
|
||||
|
||||
aLayer->Painted();
|
||||
|
@ -45,10 +45,10 @@ public:
|
||||
virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE
|
||||
{
|
||||
mTextureClient->SetDescriptorFromReply(aDescriptor);
|
||||
mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
|
||||
}
|
||||
protected:
|
||||
RefPtr<TextureClient> mTextureClient;
|
||||
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
|
||||
TextureInfo mTextureInfo;
|
||||
};
|
||||
|
||||
|
@ -76,46 +76,46 @@ CompositableChild::Destroy()
|
||||
Send__delete__(this);
|
||||
}
|
||||
|
||||
TemporaryRef<TextureClient>
|
||||
CompositableClient::CreateTextureClient(TextureClientType aTextureClientType)
|
||||
TemporaryRef<DeprecatedTextureClient>
|
||||
CompositableClient::CreateDeprecatedTextureClient(DeprecatedTextureClientType aDeprecatedTextureClientType)
|
||||
{
|
||||
MOZ_ASSERT(GetForwarder(), "Can't create a texture client if the compositable is not connected to the compositor.");
|
||||
LayersBackend parentBackend = GetForwarder()->GetCompositorBackendType();
|
||||
RefPtr<TextureClient> result;
|
||||
RefPtr<DeprecatedTextureClient> result;
|
||||
|
||||
switch (aTextureClientType) {
|
||||
switch (aDeprecatedTextureClientType) {
|
||||
case TEXTURE_SHARED_GL:
|
||||
if (parentBackend == LAYERS_OPENGL) {
|
||||
result = new TextureClientSharedOGL(GetForwarder(), GetTextureInfo());
|
||||
result = new DeprecatedTextureClientSharedOGL(GetForwarder(), GetTextureInfo());
|
||||
}
|
||||
break;
|
||||
case TEXTURE_SHARED_GL_EXTERNAL:
|
||||
if (parentBackend == LAYERS_OPENGL) {
|
||||
result = new TextureClientSharedOGLExternal(GetForwarder(), GetTextureInfo());
|
||||
result = new DeprecatedTextureClientSharedOGLExternal(GetForwarder(), GetTextureInfo());
|
||||
}
|
||||
break;
|
||||
case TEXTURE_STREAM_GL:
|
||||
if (parentBackend == LAYERS_OPENGL) {
|
||||
result = new TextureClientStreamOGL(GetForwarder(), GetTextureInfo());
|
||||
result = new DeprecatedTextureClientStreamOGL(GetForwarder(), GetTextureInfo());
|
||||
}
|
||||
break;
|
||||
case TEXTURE_YCBCR:
|
||||
if (parentBackend == LAYERS_OPENGL ||
|
||||
parentBackend == LAYERS_D3D11 ||
|
||||
parentBackend == LAYERS_BASIC) {
|
||||
result = new TextureClientShmemYCbCr(GetForwarder(), GetTextureInfo());
|
||||
result = new DeprecatedTextureClientShmemYCbCr(GetForwarder(), GetTextureInfo());
|
||||
}
|
||||
break;
|
||||
case TEXTURE_CONTENT:
|
||||
#ifdef XP_WIN
|
||||
if (parentBackend == LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice()) {
|
||||
result = new TextureClientD3D11(GetForwarder(), GetTextureInfo());
|
||||
result = new DeprecatedTextureClientD3D11(GetForwarder(), GetTextureInfo());
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
// fall through to TEXTURE_SHMEM
|
||||
case TEXTURE_SHMEM:
|
||||
result = new TextureClientShmem(GetForwarder(), GetTextureInfo());
|
||||
result = new DeprecatedTextureClientShmem(GetForwarder(), GetTextureInfo());
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(false, "Unhandled texture client type");
|
||||
@ -128,7 +128,7 @@ CompositableClient::CreateTextureClient(TextureClientType aTextureClientType)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(result->SupportsType(aTextureClientType),
|
||||
MOZ_ASSERT(result->SupportsType(aDeprecatedTextureClientType),
|
||||
"Created the wrong texture client?");
|
||||
result->SetFlags(GetTextureInfo().mTextureFlags);
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace layers {
|
||||
|
||||
class CompositableChild;
|
||||
class CompositableClient;
|
||||
class TextureClient;
|
||||
class DeprecatedTextureClient;
|
||||
class ImageBridgeChild;
|
||||
class ShadowableLayer;
|
||||
class CompositableForwarder;
|
||||
@ -78,8 +78,8 @@ public:
|
||||
|
||||
LayersBackend GetCompositorBackendType() const;
|
||||
|
||||
TemporaryRef<TextureClient>
|
||||
CreateTextureClient(TextureClientType aTextureClientType);
|
||||
TemporaryRef<DeprecatedTextureClient>
|
||||
CreateDeprecatedTextureClient(DeprecatedTextureClientType aDeprecatedTextureClientType);
|
||||
|
||||
virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aDescriptor)
|
||||
|
@ -95,13 +95,13 @@ ContentClientBasic::CreateDTBuffer(ContentType aType,
|
||||
void
|
||||
ContentClientRemoteBuffer::DestroyBuffers()
|
||||
{
|
||||
if (!mTextureClient) {
|
||||
if (!mDeprecatedTextureClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mTextureClient->GetAccessMode() == TextureClient::ACCESS_READ_WRITE);
|
||||
mTextureClient = nullptr;
|
||||
mTextureClientOnWhite = nullptr;
|
||||
MOZ_ASSERT(mDeprecatedTextureClient->GetAccessMode() == DeprecatedTextureClient::ACCESS_READ_WRITE);
|
||||
mDeprecatedTextureClient = nullptr;
|
||||
mDeprecatedTextureClientOnWhite = nullptr;
|
||||
|
||||
DestroyFrontBuffer();
|
||||
|
||||
@ -111,13 +111,13 @@ ContentClientRemoteBuffer::DestroyBuffers()
|
||||
void
|
||||
ContentClientRemoteBuffer::BeginPaint()
|
||||
{
|
||||
// XXX: So we might not have a TextureClient yet.. because it will
|
||||
// XXX: So we might not have a DeprecatedTextureClient yet.. because it will
|
||||
// only be created by CreateBuffer.. which will deliver a locked surface!.
|
||||
if (mTextureClient) {
|
||||
SetBufferProvider(mTextureClient);
|
||||
if (mDeprecatedTextureClient) {
|
||||
SetBufferProvider(mDeprecatedTextureClient);
|
||||
}
|
||||
if (mTextureClientOnWhite) {
|
||||
SetBufferProviderOnWhite(mTextureClientOnWhite);
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
SetBufferProviderOnWhite(mDeprecatedTextureClientOnWhite);
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,16 +130,16 @@ ContentClientRemoteBuffer::EndPaint()
|
||||
SetBufferProviderOnWhite(nullptr);
|
||||
mOldTextures.Clear();
|
||||
|
||||
if (mTextureClient) {
|
||||
mTextureClient->Unlock();
|
||||
if (mDeprecatedTextureClient) {
|
||||
mDeprecatedTextureClient->Unlock();
|
||||
}
|
||||
if (mTextureClientOnWhite) {
|
||||
mTextureClientOnWhite->Unlock();
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mDeprecatedTextureClientOnWhite->Unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ContentClientRemoteBuffer::BuildTextureClients(ContentType aType,
|
||||
ContentClientRemoteBuffer::BuildDeprecatedTextureClients(ContentType aType,
|
||||
const nsIntRect& aRect,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
@ -148,29 +148,29 @@ ContentClientRemoteBuffer::BuildTextureClients(ContentType aType,
|
||||
|
||||
mIsNewBuffer = true;
|
||||
|
||||
if (mTextureClient) {
|
||||
mOldTextures.AppendElement(mTextureClient);
|
||||
if (mTextureClientOnWhite) {
|
||||
mOldTextures.AppendElement(mTextureClientOnWhite);
|
||||
if (mDeprecatedTextureClient) {
|
||||
mOldTextures.AppendElement(mDeprecatedTextureClient);
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mOldTextures.AppendElement(mDeprecatedTextureClientOnWhite);
|
||||
}
|
||||
DestroyBuffers();
|
||||
}
|
||||
mTextureInfo.mTextureFlags = aFlags | HostRelease;
|
||||
mTextureClient = CreateTextureClient(TEXTURE_CONTENT);
|
||||
MOZ_ASSERT(mTextureClient, "Failed to create texture client");
|
||||
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_CONTENT);
|
||||
MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
|
||||
if (aFlags & BUFFER_COMPONENT_ALPHA) {
|
||||
mTextureClientOnWhite = CreateTextureClient(TEXTURE_CONTENT);
|
||||
MOZ_ASSERT(mTextureClientOnWhite, "Failed to create texture client");
|
||||
mDeprecatedTextureClientOnWhite = CreateDeprecatedTextureClient(TEXTURE_CONTENT);
|
||||
MOZ_ASSERT(mDeprecatedTextureClientOnWhite, "Failed to create texture client");
|
||||
mTextureInfo.mTextureFlags |= ComponentAlpha;
|
||||
}
|
||||
|
||||
mContentType = aType;
|
||||
mSize = gfx::IntSize(aRect.width, aRect.height);
|
||||
mTextureClient->EnsureAllocated(mSize, mContentType);
|
||||
MOZ_ASSERT(IsSurfaceDescriptorValid(*mTextureClient->GetDescriptor()));
|
||||
if (mTextureClientOnWhite) {
|
||||
mTextureClientOnWhite->EnsureAllocated(mSize, mContentType);
|
||||
MOZ_ASSERT(IsSurfaceDescriptorValid(*mTextureClientOnWhite->GetDescriptor()));
|
||||
mDeprecatedTextureClient->EnsureAllocated(mSize, mContentType);
|
||||
MOZ_ASSERT(IsSurfaceDescriptorValid(*mDeprecatedTextureClient->GetDescriptor()));
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mDeprecatedTextureClientOnWhite->EnsureAllocated(mSize, mContentType);
|
||||
MOZ_ASSERT(IsSurfaceDescriptorValid(*mDeprecatedTextureClientOnWhite->GetDescriptor()));
|
||||
}
|
||||
|
||||
CreateFrontBufferAndNotify(aRect);
|
||||
@ -182,9 +182,9 @@ ContentClientRemoteBuffer::CreateDTBuffer(ContentType aType,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
MOZ_ASSERT(!(aFlags & BUFFER_COMPONENT_ALPHA), "We don't support component alpha here!");
|
||||
BuildTextureClients(aType, aRect, aFlags);
|
||||
BuildDeprecatedTextureClients(aType, aRect, aFlags);
|
||||
|
||||
RefPtr<DrawTarget> ret = mTextureClient->LockDrawTarget();
|
||||
RefPtr<DrawTarget> ret = mDeprecatedTextureClient->LockDrawTarget();
|
||||
return ret.forget();
|
||||
}
|
||||
|
||||
@ -194,11 +194,11 @@ ContentClientRemoteBuffer::CreateBuffer(ContentType aType,
|
||||
uint32_t aFlags,
|
||||
gfxASurface** aWhiteSurface)
|
||||
{
|
||||
BuildTextureClients(aType, aRect, aFlags);
|
||||
BuildDeprecatedTextureClients(aType, aRect, aFlags);
|
||||
|
||||
nsRefPtr<gfxASurface> ret = mTextureClient->LockSurface();
|
||||
nsRefPtr<gfxASurface> ret = mDeprecatedTextureClient->LockSurface();
|
||||
if (aFlags & BUFFER_COMPONENT_ALPHA) {
|
||||
nsRefPtr<gfxASurface> retWhite = mTextureClientOnWhite->LockSurface();
|
||||
nsRefPtr<gfxASurface> retWhite = mDeprecatedTextureClientOnWhite->LockSurface();
|
||||
*aWhiteSurface = retWhite.forget().get();
|
||||
}
|
||||
return ret.forget();
|
||||
@ -226,7 +226,7 @@ ContentClientRemoteBuffer::GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
|
||||
|
||||
NS_ASSERTION(BufferRect().Contains(aRegionToDraw.GetBounds()),
|
||||
"Update outside of buffer rect!");
|
||||
NS_ABORT_IF_FALSE(mTextureClient, "should have a back buffer by now");
|
||||
NS_ABORT_IF_FALSE(mDeprecatedTextureClient, "should have a back buffer by now");
|
||||
|
||||
return updatedRegion;
|
||||
}
|
||||
@ -240,10 +240,10 @@ ContentClientRemoteBuffer::Updated(const nsIntRegion& aRegionToDraw,
|
||||
aVisibleRegion,
|
||||
aDidSelfCopy);
|
||||
|
||||
MOZ_ASSERT(mTextureClient);
|
||||
mTextureClient->SetAccessMode(TextureClient::ACCESS_NONE);
|
||||
if (mTextureClientOnWhite) {
|
||||
mTextureClientOnWhite->SetAccessMode(TextureClient::ACCESS_NONE);
|
||||
MOZ_ASSERT(mDeprecatedTextureClient);
|
||||
mDeprecatedTextureClient->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mDeprecatedTextureClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
|
||||
}
|
||||
LockFrontBuffer();
|
||||
mForwarder->UpdateTextureRegion(this,
|
||||
@ -255,27 +255,27 @@ ContentClientRemoteBuffer::Updated(const nsIntRegion& aRegionToDraw,
|
||||
void
|
||||
ContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
|
||||
{
|
||||
MOZ_ASSERT(mTextureClient->GetAccessMode() == TextureClient::ACCESS_NONE);
|
||||
MOZ_ASSERT(!mTextureClientOnWhite || mTextureClientOnWhite->GetAccessMode() == TextureClient::ACCESS_NONE);
|
||||
MOZ_ASSERT(mTextureClient);
|
||||
MOZ_ASSERT(mDeprecatedTextureClient->GetAccessMode() == DeprecatedTextureClient::ACCESS_NONE);
|
||||
MOZ_ASSERT(!mDeprecatedTextureClientOnWhite || mDeprecatedTextureClientOnWhite->GetAccessMode() == DeprecatedTextureClient::ACCESS_NONE);
|
||||
MOZ_ASSERT(mDeprecatedTextureClient);
|
||||
|
||||
mFrontAndBackBufferDiffer = true;
|
||||
mTextureClient->SetAccessMode(TextureClient::ACCESS_READ_WRITE);
|
||||
if (mTextureClientOnWhite) {
|
||||
mTextureClientOnWhite->SetAccessMode(TextureClient::ACCESS_READ_WRITE);
|
||||
mDeprecatedTextureClient->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_WRITE);
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mDeprecatedTextureClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
ContentClientDoubleBuffered::~ContentClientDoubleBuffered()
|
||||
{
|
||||
if (mTextureClient) {
|
||||
if (mDeprecatedTextureClient) {
|
||||
MOZ_ASSERT(mFrontClient);
|
||||
mTextureClient->SetDescriptor(SurfaceDescriptor());
|
||||
mDeprecatedTextureClient->SetDescriptor(SurfaceDescriptor());
|
||||
mFrontClient->SetDescriptor(SurfaceDescriptor());
|
||||
}
|
||||
if (mTextureClientOnWhite) {
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
MOZ_ASSERT(mFrontClientOnWhite);
|
||||
mTextureClientOnWhite->SetDescriptor(SurfaceDescriptor());
|
||||
mDeprecatedTextureClientOnWhite->SetDescriptor(SurfaceDescriptor());
|
||||
mFrontClientOnWhite->SetDescriptor(SurfaceDescriptor());
|
||||
}
|
||||
}
|
||||
@ -283,7 +283,7 @@ ContentClientDoubleBuffered::~ContentClientDoubleBuffered()
|
||||
void
|
||||
ContentClientDoubleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect)
|
||||
{
|
||||
mFrontClient = CreateTextureClient(TEXTURE_CONTENT);
|
||||
mFrontClient = CreateDeprecatedTextureClient(TEXTURE_CONTENT);
|
||||
MOZ_ASSERT(mFrontClient, "Failed to create texture client");
|
||||
mFrontClient->EnsureAllocated(mSize, mContentType);
|
||||
|
||||
@ -291,24 +291,24 @@ ContentClientDoubleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBuffer
|
||||
mFrontBufferRotation = nsIntPoint();
|
||||
|
||||
if (mTextureInfo.mTextureFlags & ComponentAlpha) {
|
||||
mFrontClientOnWhite = CreateTextureClient(TEXTURE_CONTENT);
|
||||
mFrontClientOnWhite = CreateDeprecatedTextureClient(TEXTURE_CONTENT);
|
||||
MOZ_ASSERT(mFrontClientOnWhite, "Failed to create texture client");
|
||||
mFrontClientOnWhite->EnsureAllocated(mSize, mContentType);
|
||||
}
|
||||
|
||||
mForwarder->CreatedDoubleBuffer(this,
|
||||
*mFrontClient->GetDescriptor(),
|
||||
*mTextureClient->GetDescriptor(),
|
||||
*mDeprecatedTextureClient->GetDescriptor(),
|
||||
mTextureInfo,
|
||||
mFrontClientOnWhite ? mFrontClientOnWhite->GetDescriptor() : nullptr,
|
||||
mTextureClientOnWhite ? mTextureClientOnWhite->GetDescriptor() : nullptr);
|
||||
mDeprecatedTextureClientOnWhite ? mDeprecatedTextureClientOnWhite->GetDescriptor() : nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
ContentClientDoubleBuffered::DestroyFrontBuffer()
|
||||
{
|
||||
MOZ_ASSERT(mFrontClient);
|
||||
MOZ_ASSERT(mFrontClient->GetAccessMode() != TextureClient::ACCESS_NONE);
|
||||
MOZ_ASSERT(mFrontClient->GetAccessMode() != DeprecatedTextureClient::ACCESS_NONE);
|
||||
|
||||
mFrontClient = nullptr;
|
||||
mFrontClientOnWhite = nullptr;
|
||||
@ -318,9 +318,9 @@ void
|
||||
ContentClientDoubleBuffered::LockFrontBuffer()
|
||||
{
|
||||
MOZ_ASSERT(mFrontClient);
|
||||
mFrontClient->SetAccessMode(TextureClient::ACCESS_NONE);
|
||||
mFrontClient->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
|
||||
if (mFrontClientOnWhite) {
|
||||
mFrontClientOnWhite->SetAccessMode(TextureClient::ACCESS_NONE);
|
||||
mFrontClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -329,12 +329,12 @@ ContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
|
||||
{
|
||||
mFrontUpdatedRegion = aFrontUpdatedRegion;
|
||||
|
||||
RefPtr<TextureClient> oldBack = mTextureClient;
|
||||
mTextureClient = mFrontClient;
|
||||
RefPtr<DeprecatedTextureClient> oldBack = mDeprecatedTextureClient;
|
||||
mDeprecatedTextureClient = mFrontClient;
|
||||
mFrontClient = oldBack;
|
||||
|
||||
oldBack = mTextureClientOnWhite;
|
||||
mTextureClientOnWhite = mFrontClientOnWhite;
|
||||
oldBack = mDeprecatedTextureClientOnWhite;
|
||||
mDeprecatedTextureClientOnWhite = mFrontClientOnWhite;
|
||||
mFrontClientOnWhite = oldBack;
|
||||
|
||||
nsIntRect oldBufferRect = mBufferRect;
|
||||
@ -346,25 +346,25 @@ ContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
|
||||
mFrontBufferRotation = oldBufferRotation;
|
||||
|
||||
MOZ_ASSERT(mFrontClient);
|
||||
mFrontClient->SetAccessMode(TextureClient::ACCESS_READ_ONLY);
|
||||
mFrontClient->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_ONLY);
|
||||
if (mFrontClientOnWhite) {
|
||||
mFrontClientOnWhite->SetAccessMode(TextureClient::ACCESS_READ_ONLY);
|
||||
mFrontClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_ONLY);
|
||||
}
|
||||
|
||||
ContentClientRemoteBuffer::SwapBuffers(aFrontUpdatedRegion);
|
||||
}
|
||||
|
||||
struct AutoTextureClient {
|
||||
AutoTextureClient()
|
||||
struct AutoDeprecatedTextureClient {
|
||||
AutoDeprecatedTextureClient()
|
||||
: mTexture(nullptr)
|
||||
{}
|
||||
~AutoTextureClient()
|
||||
~AutoDeprecatedTextureClient()
|
||||
{
|
||||
if (mTexture) {
|
||||
mTexture->Unlock();
|
||||
}
|
||||
}
|
||||
gfxASurface* GetSurface(TextureClient* aTexture)
|
||||
gfxASurface* GetSurface(DeprecatedTextureClient* aTexture)
|
||||
{
|
||||
MOZ_ASSERT(!mTexture);
|
||||
mTexture = aTexture;
|
||||
@ -373,7 +373,7 @@ struct AutoTextureClient {
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
DrawTarget* GetDrawTarget(TextureClient* aTexture)
|
||||
DrawTarget* GetDrawTarget(DeprecatedTextureClient* aTexture)
|
||||
{
|
||||
MOZ_ASSERT(!mTexture);
|
||||
mTexture = aTexture;
|
||||
@ -383,7 +383,7 @@ struct AutoTextureClient {
|
||||
return nullptr;
|
||||
}
|
||||
private:
|
||||
TextureClient* mTexture;
|
||||
DeprecatedTextureClient* mTexture;
|
||||
};
|
||||
|
||||
void
|
||||
@ -393,9 +393,9 @@ ContentClientDoubleBuffered::SyncFrontBufferToBackBuffer()
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(mFrontClient);
|
||||
MOZ_ASSERT(mFrontClient->GetAccessMode() == TextureClient::ACCESS_READ_ONLY);
|
||||
MOZ_ASSERT(mFrontClient->GetAccessMode() == DeprecatedTextureClient::ACCESS_READ_ONLY);
|
||||
MOZ_ASSERT(!mFrontClientOnWhite ||
|
||||
mFrontClientOnWhite->GetAccessMode() == TextureClient::ACCESS_READ_ONLY);
|
||||
mFrontClientOnWhite->GetAccessMode() == DeprecatedTextureClient::ACCESS_READ_ONLY);
|
||||
|
||||
MOZ_LAYERS_LOG(("BasicShadowableThebes(%p): reading back <x=%d,y=%d,w=%d,h=%d>",
|
||||
this,
|
||||
@ -433,8 +433,8 @@ ContentClientDoubleBuffered::SyncFrontBufferToBackBuffer()
|
||||
mBufferRotation = mFrontBufferRotation;
|
||||
}
|
||||
|
||||
AutoTextureClient autoTextureFront;
|
||||
AutoTextureClient autoTextureFrontOnWhite;
|
||||
AutoDeprecatedTextureClient autoTextureFront;
|
||||
AutoDeprecatedTextureClient autoTextureFrontOnWhite;
|
||||
if (gfxPlatform::GetPlatform()->SupportsAzureContent()) {
|
||||
RotatedBuffer frontBuffer(autoTextureFront.GetDrawTarget(mFrontClient),
|
||||
autoTextureFrontOnWhite.GetDrawTarget(mFrontClientOnWhite),
|
||||
@ -503,11 +503,11 @@ ContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer& aSource,
|
||||
|
||||
ContentClientSingleBuffered::~ContentClientSingleBuffered()
|
||||
{
|
||||
if (mTextureClient) {
|
||||
mTextureClient->SetDescriptor(SurfaceDescriptor());
|
||||
if (mDeprecatedTextureClient) {
|
||||
mDeprecatedTextureClient->SetDescriptor(SurfaceDescriptor());
|
||||
}
|
||||
if (mTextureClientOnWhite) {
|
||||
mTextureClientOnWhite->SetDescriptor(SurfaceDescriptor());
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mDeprecatedTextureClientOnWhite->SetDescriptor(SurfaceDescriptor());
|
||||
}
|
||||
}
|
||||
|
||||
@ -515,9 +515,9 @@ void
|
||||
ContentClientSingleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect)
|
||||
{
|
||||
mForwarder->CreatedSingleBuffer(this,
|
||||
*mTextureClient->GetDescriptor(),
|
||||
*mDeprecatedTextureClient->GetDescriptor(),
|
||||
mTextureInfo,
|
||||
mTextureClientOnWhite ? mTextureClientOnWhite->GetDescriptor() : nullptr);
|
||||
mDeprecatedTextureClientOnWhite ? mDeprecatedTextureClientOnWhite->GetDescriptor() : nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
@ -528,8 +528,8 @@ ContentClientSingleBuffered::SyncFrontBufferToBackBuffer()
|
||||
}
|
||||
|
||||
gfxASurface* backBuffer = GetBuffer();
|
||||
if (!backBuffer && mTextureClient) {
|
||||
backBuffer = mTextureClient->LockSurface();
|
||||
if (!backBuffer && mDeprecatedTextureClient) {
|
||||
backBuffer = mDeprecatedTextureClient->LockSurface();
|
||||
}
|
||||
|
||||
nsRefPtr<gfxASurface> oldBuffer;
|
||||
@ -538,8 +538,8 @@ ContentClientSingleBuffered::SyncFrontBufferToBackBuffer()
|
||||
mBufferRotation);
|
||||
|
||||
backBuffer = GetBufferOnWhite();
|
||||
if (!backBuffer && mTextureClientOnWhite) {
|
||||
backBuffer = mTextureClientOnWhite->LockSurface();
|
||||
if (!backBuffer && mDeprecatedTextureClientOnWhite) {
|
||||
backBuffer = mDeprecatedTextureClientOnWhite->LockSurface();
|
||||
}
|
||||
|
||||
oldBuffer = SetBufferOnWhite(backBuffer);
|
||||
@ -574,7 +574,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
|
||||
ThebesLayerBuffer::ContentType aContentType,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
mTextureInfo.mTextureHostFlags = 0;
|
||||
mTextureInfo.mDeprecatedTextureHostFlags = 0;
|
||||
PaintState result;
|
||||
// We need to disable rotation if we're going to be resampled when
|
||||
// drawing, because we might sample across the rotation boundary.
|
||||
@ -737,7 +737,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
|
||||
if (createdBuffer) {
|
||||
if (mHasBuffer &&
|
||||
(mode != Layer::SURFACE_COMPONENT_ALPHA || mHasBufferOnWhite)) {
|
||||
mTextureInfo.mTextureHostFlags = TEXTURE_HOST_COPY_PREVIOUS;
|
||||
mTextureInfo.mDeprecatedTextureHostFlags = TEXTURE_HOST_COPY_PREVIOUS;
|
||||
}
|
||||
|
||||
mHasBuffer = true;
|
||||
|
@ -172,7 +172,7 @@ public:
|
||||
ContentClientRemoteBuffer(CompositableForwarder* aForwarder)
|
||||
: ContentClientRemote(aForwarder)
|
||||
, ThebesLayerBuffer(ContainsVisibleBounds)
|
||||
, mTextureClient(nullptr)
|
||||
, mDeprecatedTextureClient(nullptr)
|
||||
, mIsNewBuffer(false)
|
||||
, mFrontAndBackBufferDiffer(false)
|
||||
, mContentType(gfxASurface::CONTENT_COLOR_ALPHA)
|
||||
@ -240,10 +240,10 @@ protected:
|
||||
const nsIntRegion& aVisibleRegion,
|
||||
bool aDidSelfCopy);
|
||||
|
||||
// create and configure mTextureClient
|
||||
void BuildTextureClients(ContentType aType,
|
||||
const nsIntRect& aRect,
|
||||
uint32_t aFlags);
|
||||
// create and configure mDeprecatedTextureClient
|
||||
void BuildDeprecatedTextureClients(ContentType aType,
|
||||
const nsIntRect& aRect,
|
||||
uint32_t aFlags);
|
||||
|
||||
// Create the front buffer for the ContentClient/Host pair if necessary
|
||||
// and notify the compositor that we have created the buffer(s).
|
||||
@ -253,11 +253,11 @@ protected:
|
||||
// lock it now.
|
||||
virtual void LockFrontBuffer() {}
|
||||
|
||||
RefPtr<TextureClient> mTextureClient;
|
||||
RefPtr<TextureClient> mTextureClientOnWhite;
|
||||
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
|
||||
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClientOnWhite;
|
||||
// keep a record of texture clients we have created and need to keep
|
||||
// around, then unlock when we are done painting
|
||||
nsTArray<RefPtr<TextureClient> > mOldTextures;
|
||||
nsTArray<RefPtr<DeprecatedTextureClient> > mOldTextures;
|
||||
|
||||
TextureInfo mTextureInfo;
|
||||
bool mIsNewBuffer;
|
||||
@ -267,10 +267,10 @@ protected:
|
||||
};
|
||||
|
||||
/**
|
||||
* A double buffered ContentClient. mTextureClient is the back buffer, which
|
||||
* A double buffered ContentClient. mDeprecatedTextureClient is the back buffer, which
|
||||
* we draw into. mFrontClient is the front buffer which we may read from, but
|
||||
* not write to, when the compositor does not have the 'soft' lock. We can write
|
||||
* into mTextureClient at any time.
|
||||
* into mDeprecatedTextureClient at any time.
|
||||
*
|
||||
* The ContentHost keeps a reference to both corresponding texture hosts, in
|
||||
* response to our UpdateTextureRegion message, the compositor swaps its
|
||||
@ -300,8 +300,8 @@ private:
|
||||
void UpdateDestinationFrom(const RotatedBuffer& aSource,
|
||||
const nsIntRegion& aUpdateRegion);
|
||||
|
||||
RefPtr<TextureClient> mFrontClient;
|
||||
RefPtr<TextureClient> mFrontClientOnWhite;
|
||||
RefPtr<DeprecatedTextureClient> mFrontClient;
|
||||
RefPtr<DeprecatedTextureClient> mFrontClientOnWhite;
|
||||
nsIntRegion mFrontUpdatedRegion;
|
||||
nsIntRect mFrontBufferRect;
|
||||
nsIntPoint mFrontBufferRotation;
|
||||
|
@ -77,15 +77,15 @@ ImageClientSingle::ImageClientSingle(CompositableForwarder* aFwd,
|
||||
}
|
||||
|
||||
bool
|
||||
ImageClientSingle::EnsureTextureClient(TextureClientType aType)
|
||||
ImageClientSingle::EnsureDeprecatedTextureClient(DeprecatedTextureClientType aType)
|
||||
{
|
||||
// We should not call this method if using ImageBridge or tiled texture
|
||||
// clients since SupportsType always fails
|
||||
if (mTextureClient && mTextureClient->SupportsType(aType)) {
|
||||
if (mDeprecatedTextureClient && mDeprecatedTextureClient->SupportsType(aType)) {
|
||||
return true;
|
||||
}
|
||||
mTextureClient = CreateTextureClient(aType);
|
||||
return !!mTextureClient;
|
||||
mDeprecatedTextureClient = CreateDeprecatedTextureClient(aType);
|
||||
return !!mDeprecatedTextureClient;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -104,11 +104,11 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
|
||||
}
|
||||
|
||||
if (image->GetFormat() == PLANAR_YCBCR &&
|
||||
EnsureTextureClient(TEXTURE_YCBCR)) {
|
||||
EnsureDeprecatedTextureClient(TEXTURE_YCBCR)) {
|
||||
PlanarYCbCrImage* ycbcr = static_cast<PlanarYCbCrImage*>(image);
|
||||
|
||||
if (ycbcr->AsSharedPlanarYCbCrImage()) {
|
||||
AutoLockTextureClient lock(mTextureClient);
|
||||
AutoLockDeprecatedTextureClient lock(mDeprecatedTextureClient);
|
||||
|
||||
SurfaceDescriptor sd;
|
||||
if (!ycbcr->AsSharedPlanarYCbCrImage()->ToSurfaceDescriptor(sd)) {
|
||||
@ -121,15 +121,15 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
|
||||
|
||||
*lock.GetSurfaceDescriptor() = sd;
|
||||
} else {
|
||||
AutoLockYCbCrClient clientLock(mTextureClient);
|
||||
AutoLockYCbCrClient clientLock(mDeprecatedTextureClient);
|
||||
|
||||
if (!clientLock.Update(ycbcr)) {
|
||||
NS_WARNING("failed to update TextureClient (YCbCr)");
|
||||
NS_WARNING("failed to update DeprecatedTextureClient (YCbCr)");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (image->GetFormat() == SHARED_TEXTURE &&
|
||||
EnsureTextureClient(TEXTURE_SHARED_GL_EXTERNAL)) {
|
||||
EnsureDeprecatedTextureClient(TEXTURE_SHARED_GL_EXTERNAL)) {
|
||||
SharedTextureImage* sharedImage = static_cast<SharedTextureImage*>(image);
|
||||
const SharedTextureImage::Data *data = sharedImage->GetData();
|
||||
|
||||
@ -137,65 +137,65 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
|
||||
data->mHandle,
|
||||
data->mSize,
|
||||
data->mInverted);
|
||||
mTextureClient->SetDescriptor(SurfaceDescriptor(texture));
|
||||
mDeprecatedTextureClient->SetDescriptor(SurfaceDescriptor(texture));
|
||||
} else if (image->GetFormat() == SHARED_RGB &&
|
||||
EnsureTextureClient(TEXTURE_SHMEM)) {
|
||||
EnsureDeprecatedTextureClient(TEXTURE_SHMEM)) {
|
||||
nsIntRect rect(0, 0,
|
||||
image->GetSize().width,
|
||||
image->GetSize().height);
|
||||
UpdatePictureRect(rect);
|
||||
|
||||
AutoLockTextureClient lock(mTextureClient);
|
||||
AutoLockDeprecatedTextureClient lock(mDeprecatedTextureClient);
|
||||
|
||||
SurfaceDescriptor desc;
|
||||
if (!static_cast<SharedRGBImage*>(image)->ToSurfaceDescriptor(desc)) {
|
||||
return false;
|
||||
}
|
||||
mTextureClient->SetDescriptor(desc);
|
||||
mDeprecatedTextureClient->SetDescriptor(desc);
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
} else if (image->GetFormat() == GONK_IO_SURFACE &&
|
||||
EnsureTextureClient(TEXTURE_SHARED_GL_EXTERNAL)) {
|
||||
EnsureDeprecatedTextureClient(TEXTURE_SHARED_GL_EXTERNAL)) {
|
||||
nsIntRect rect(0, 0,
|
||||
image->GetSize().width,
|
||||
image->GetSize().height);
|
||||
UpdatePictureRect(rect);
|
||||
|
||||
AutoLockTextureClient lock(mTextureClient);
|
||||
AutoLockDeprecatedTextureClient lock(mDeprecatedTextureClient);
|
||||
|
||||
SurfaceDescriptor desc = static_cast<GonkIOSurfaceImage*>(image)->GetSurfaceDescriptor();
|
||||
if (!IsSurfaceDescriptorValid(desc)) {
|
||||
return false;
|
||||
}
|
||||
mTextureClient->SetDescriptor(desc);
|
||||
mDeprecatedTextureClient->SetDescriptor(desc);
|
||||
} else if (image->GetFormat() == GRALLOC_PLANAR_YCBCR) {
|
||||
EnsureTextureClient(TEXTURE_SHARED_GL_EXTERNAL);
|
||||
EnsureDeprecatedTextureClient(TEXTURE_SHARED_GL_EXTERNAL);
|
||||
|
||||
nsIntRect rect(0, 0,
|
||||
image->GetSize().width,
|
||||
image->GetSize().height);
|
||||
UpdatePictureRect(rect);
|
||||
|
||||
AutoLockTextureClient lock(mTextureClient);
|
||||
AutoLockDeprecatedTextureClient lock(mDeprecatedTextureClient);
|
||||
|
||||
SurfaceDescriptor desc = static_cast<GrallocPlanarYCbCrImage*>(image)->GetSurfaceDescriptor();
|
||||
if (!IsSurfaceDescriptorValid(desc)) {
|
||||
return false;
|
||||
}
|
||||
mTextureClient->SetDescriptor(desc);
|
||||
mDeprecatedTextureClient->SetDescriptor(desc);
|
||||
#endif
|
||||
} else {
|
||||
nsRefPtr<gfxASurface> surface = image->GetAsSurface();
|
||||
MOZ_ASSERT(surface);
|
||||
|
||||
EnsureTextureClient(TEXTURE_SHMEM);
|
||||
MOZ_ASSERT(mTextureClient, "Failed to create texture client");
|
||||
EnsureDeprecatedTextureClient(TEXTURE_SHMEM);
|
||||
MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
|
||||
|
||||
nsRefPtr<gfxPattern> pattern = new gfxPattern(surface);
|
||||
pattern->SetFilter(mFilter);
|
||||
|
||||
AutoLockShmemClient clientLock(mTextureClient);
|
||||
AutoLockShmemClient clientLock(mDeprecatedTextureClient);
|
||||
if (!clientLock.Update(image, aContentFlags, pattern)) {
|
||||
NS_WARNING("failed to update TextureClient");
|
||||
NS_WARNING("failed to update DeprecatedTextureClient");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -215,7 +215,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
|
||||
void
|
||||
ImageClientSingle::Updated()
|
||||
{
|
||||
mForwarder->UpdateTexture(this, 1, mTextureClient->GetDescriptor());
|
||||
mForwarder->UpdateTexture(this, 1, mDeprecatedTextureClient->GetDescriptor());
|
||||
}
|
||||
|
||||
ImageClientBridge::ImageClientBridge(CompositableForwarder* aFwd,
|
||||
|
@ -87,14 +87,14 @@ public:
|
||||
* Returns true if the texture client was created succesfully,
|
||||
* false otherwise.
|
||||
*/
|
||||
bool EnsureTextureClient(TextureClientType aType);
|
||||
bool EnsureDeprecatedTextureClient(DeprecatedTextureClientType aType);
|
||||
|
||||
virtual void Updated();
|
||||
|
||||
virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE
|
||||
{
|
||||
mTextureClient->SetDescriptorFromReply(aDescriptor);
|
||||
mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
|
||||
}
|
||||
|
||||
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
||||
@ -103,14 +103,14 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<TextureClient> mTextureClient;
|
||||
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
|
||||
TextureInfo mTextureInfo;
|
||||
};
|
||||
|
||||
/**
|
||||
* Image class to be used for async image uploads using the image bridge
|
||||
* protocol.
|
||||
* We store the ImageBridge id in the TextureClientIdentifier.
|
||||
* We store the ImageBridge id in the DeprecatedTextureClientIdentifier.
|
||||
*/
|
||||
class ImageClientBridge : public ImageClient
|
||||
{
|
||||
|
@ -23,31 +23,31 @@ using namespace mozilla::gl;
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
TextureClient::TextureClient(CompositableForwarder* aForwarder,
|
||||
DeprecatedTextureClient::DeprecatedTextureClient(CompositableForwarder* aForwarder,
|
||||
const TextureInfo& aTextureInfo)
|
||||
: mForwarder(aForwarder)
|
||||
, mTextureInfo(aTextureInfo)
|
||||
, mAccessMode(ACCESS_READ_WRITE)
|
||||
{
|
||||
MOZ_COUNT_CTOR(TextureClient);
|
||||
MOZ_COUNT_CTOR(DeprecatedTextureClient);
|
||||
}
|
||||
|
||||
TextureClient::~TextureClient()
|
||||
DeprecatedTextureClient::~DeprecatedTextureClient()
|
||||
{
|
||||
MOZ_COUNT_DTOR(TextureClient);
|
||||
MOZ_COUNT_DTOR(DeprecatedTextureClient);
|
||||
MOZ_ASSERT(mDescriptor.type() == SurfaceDescriptor::T__None, "Need to release surface!");
|
||||
}
|
||||
|
||||
TextureClientShmem::TextureClientShmem(CompositableForwarder* aForwarder,
|
||||
DeprecatedTextureClientShmem::DeprecatedTextureClientShmem(CompositableForwarder* aForwarder,
|
||||
const TextureInfo& aTextureInfo)
|
||||
: TextureClient(aForwarder, aTextureInfo)
|
||||
: DeprecatedTextureClient(aForwarder, aTextureInfo)
|
||||
, mSurface(nullptr)
|
||||
, mSurfaceAsImage(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientShmem::ReleaseResources()
|
||||
DeprecatedTextureClientShmem::ReleaseResources()
|
||||
{
|
||||
if (mSurface) {
|
||||
mSurface = nullptr;
|
||||
@ -66,7 +66,7 @@ TextureClientShmem::ReleaseResources()
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientShmem::EnsureAllocated(gfx::IntSize aSize,
|
||||
DeprecatedTextureClientShmem::EnsureAllocated(gfx::IntSize aSize,
|
||||
gfxASurface::gfxContentType aContentType)
|
||||
{
|
||||
if (aSize != mSize ||
|
||||
@ -85,7 +85,7 @@ TextureClientShmem::EnsureAllocated(gfx::IntSize aSize,
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientShmem::SetDescriptor(const SurfaceDescriptor& aDescriptor)
|
||||
DeprecatedTextureClientShmem::SetDescriptor(const SurfaceDescriptor& aDescriptor)
|
||||
{
|
||||
if (IsSurfaceDescriptorValid(aDescriptor)) {
|
||||
ReleaseResources();
|
||||
@ -104,7 +104,7 @@ TextureClientShmem::SetDescriptor(const SurfaceDescriptor& aDescriptor)
|
||||
}
|
||||
|
||||
gfxASurface*
|
||||
TextureClientShmem::GetSurface()
|
||||
DeprecatedTextureClientShmem::GetSurface()
|
||||
{
|
||||
if (!mSurface) {
|
||||
if (!IsSurfaceDescriptorValid(mDescriptor)) {
|
||||
@ -121,7 +121,7 @@ TextureClientShmem::GetSurface()
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientShmem::Unlock()
|
||||
DeprecatedTextureClientShmem::Unlock()
|
||||
{
|
||||
mSurface = nullptr;
|
||||
mSurfaceAsImage = nullptr;
|
||||
@ -130,7 +130,7 @@ TextureClientShmem::Unlock()
|
||||
}
|
||||
|
||||
gfxImageSurface*
|
||||
TextureClientShmem::LockImageSurface()
|
||||
DeprecatedTextureClientShmem::LockImageSurface()
|
||||
{
|
||||
if (!mSurfaceAsImage) {
|
||||
mSurfaceAsImage = GetSurface()->GetAsImageSurface();
|
||||
@ -140,13 +140,13 @@ TextureClientShmem::LockImageSurface()
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientShmemYCbCr::ReleaseResources()
|
||||
DeprecatedTextureClientShmemYCbCr::ReleaseResources()
|
||||
{
|
||||
GetForwarder()->DestroySharedSurface(&mDescriptor);
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientShmemYCbCr::SetDescriptor(const SurfaceDescriptor& aDescriptor)
|
||||
DeprecatedTextureClientShmemYCbCr::SetDescriptor(const SurfaceDescriptor& aDescriptor)
|
||||
{
|
||||
MOZ_ASSERT(aDescriptor.type() == SurfaceDescriptor::TYCbCrImage);
|
||||
|
||||
@ -158,7 +158,7 @@ TextureClientShmemYCbCr::SetDescriptor(const SurfaceDescriptor& aDescriptor)
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientShmemYCbCr::SetDescriptorFromReply(const SurfaceDescriptor& aDescriptor)
|
||||
DeprecatedTextureClientShmemYCbCr::SetDescriptorFromReply(const SurfaceDescriptor& aDescriptor)
|
||||
{
|
||||
MOZ_ASSERT(aDescriptor.type() == SurfaceDescriptor::TYCbCrImage);
|
||||
SharedPlanarYCbCrImage* shYCbCr = SharedPlanarYCbCrImage::FromSurfaceDescriptor(aDescriptor);
|
||||
@ -171,31 +171,31 @@ TextureClientShmemYCbCr::SetDescriptorFromReply(const SurfaceDescriptor& aDescri
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientShmemYCbCr::EnsureAllocated(gfx::IntSize aSize,
|
||||
DeprecatedTextureClientShmemYCbCr::EnsureAllocated(gfx::IntSize aSize,
|
||||
gfxASurface::gfxContentType aType)
|
||||
{
|
||||
NS_RUNTIMEABORT("not enough arguments to do this (need both Y and CbCr sizes)");
|
||||
}
|
||||
|
||||
|
||||
TextureClientTile::TextureClientTile(const TextureClientTile& aOther)
|
||||
: TextureClient(aOther.mForwarder, aOther.mTextureInfo)
|
||||
DeprecatedTextureClientTile::DeprecatedTextureClientTile(const DeprecatedTextureClientTile& aOther)
|
||||
: DeprecatedTextureClient(aOther.mForwarder, aOther.mTextureInfo)
|
||||
, mSurface(aOther.mSurface)
|
||||
{}
|
||||
|
||||
TextureClientTile::~TextureClientTile()
|
||||
DeprecatedTextureClientTile::~DeprecatedTextureClientTile()
|
||||
{}
|
||||
|
||||
TextureClientTile::TextureClientTile(CompositableForwarder* aForwarder,
|
||||
DeprecatedTextureClientTile::DeprecatedTextureClientTile(CompositableForwarder* aForwarder,
|
||||
const TextureInfo& aTextureInfo)
|
||||
: TextureClient(aForwarder, aTextureInfo)
|
||||
: DeprecatedTextureClient(aForwarder, aTextureInfo)
|
||||
, mSurface(nullptr)
|
||||
{
|
||||
mTextureInfo.mTextureHostFlags = TEXTURE_HOST_TILED;
|
||||
mTextureInfo.mDeprecatedTextureHostFlags = TEXTURE_HOST_TILED;
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientTile::EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType)
|
||||
DeprecatedTextureClientTile::EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType)
|
||||
{
|
||||
if (!mSurface ||
|
||||
mSurface->Format() != gfxPlatform::GetPlatform()->OptimalFormatForContent(aType)) {
|
||||
@ -208,7 +208,7 @@ TextureClientTile::EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentTy
|
||||
}
|
||||
|
||||
gfxImageSurface*
|
||||
TextureClientTile::LockImageSurface()
|
||||
DeprecatedTextureClientTile::LockImageSurface()
|
||||
{
|
||||
// Use the gfxReusableSurfaceWrapper, which will reuse the surface
|
||||
// if the compositor no longer has a read lock, otherwise the surface
|
||||
@ -240,14 +240,14 @@ bool AutoLockShmemClient::Update(Image* aImage,
|
||||
isOpaque) {
|
||||
contentType = gfxASurface::CONTENT_COLOR;
|
||||
}
|
||||
mTextureClient->EnsureAllocated(gfx::IntSize(size.width, size.height), contentType);
|
||||
mDeprecatedTextureClient->EnsureAllocated(gfx::IntSize(size.width, size.height), contentType);
|
||||
|
||||
OpenMode mode = mTextureClient->GetAccessMode() == TextureClient::ACCESS_READ_WRITE
|
||||
OpenMode mode = mDeprecatedTextureClient->GetAccessMode() == DeprecatedTextureClient::ACCESS_READ_WRITE
|
||||
? OPEN_READ_WRITE
|
||||
: OPEN_READ_ONLY;
|
||||
nsRefPtr<gfxASurface> tmpASurface =
|
||||
ShadowLayerForwarder::OpenDescriptor(mode,
|
||||
*mTextureClient->LockSurfaceDescriptor());
|
||||
*mDeprecatedTextureClient->LockSurfaceDescriptor());
|
||||
if (!tmpASurface) {
|
||||
return false;
|
||||
}
|
||||
@ -272,7 +272,7 @@ AutoLockYCbCrClient::Update(PlanarYCbCrImage* aImage)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EnsureTextureClient(aImage)) {
|
||||
if (!EnsureDeprecatedTextureClient(aImage)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ AutoLockYCbCrClient::Update(PlanarYCbCrImage* aImage)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AutoLockYCbCrClient::EnsureTextureClient(PlanarYCbCrImage* aImage)
|
||||
bool AutoLockYCbCrClient::EnsureDeprecatedTextureClient(PlanarYCbCrImage* aImage)
|
||||
{
|
||||
MOZ_ASSERT(aImage);
|
||||
if (!aImage) {
|
||||
@ -318,13 +318,13 @@ bool AutoLockYCbCrClient::EnsureTextureClient(PlanarYCbCrImage* aImage)
|
||||
return true;
|
||||
}
|
||||
|
||||
mTextureClient->ReleaseResources();
|
||||
mDeprecatedTextureClient->ReleaseResources();
|
||||
|
||||
ipc::SharedMemory::SharedMemoryType shmType = OptimalShmemType();
|
||||
size_t size = YCbCrImageDataSerializer::ComputeMinBufferSize(data->mYSize,
|
||||
data->mCbCrSize);
|
||||
ipc::Shmem shmem;
|
||||
if (!mTextureClient->GetForwarder()->AllocUnsafeShmem(size, shmType, &shmem)) {
|
||||
if (!mDeprecatedTextureClient->GetForwarder()->AllocUnsafeShmem(size, shmType, &shmem)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -27,17 +27,19 @@ class Image;
|
||||
class CompositableForwarder;
|
||||
|
||||
/**
|
||||
* XXX - This class is deprecated, will be removed soon.
|
||||
*
|
||||
* This class allows texture clients to draw into textures through Azure or
|
||||
* thebes and applies locking semantics to allow GPU or CPU level
|
||||
* synchronization.
|
||||
* TextureClient's purpose is for the texture data to be
|
||||
* DeprecatedTextureClient's purpose is for the texture data to be
|
||||
* forwarded to the right place on the compositor side and with correct locking
|
||||
* semantics.
|
||||
*
|
||||
* When modifying a TextureClient's data, first call LockDescriptor, modify the
|
||||
* When modifying a DeprecatedTextureClient's data, first call LockDescriptor, modify the
|
||||
* data in the descriptor, and then call Unlock. This makes sure that if the
|
||||
* data is shared with the compositor, the later will not try to read while the
|
||||
* data is being modified (on the other side, TextureHost also has Lock/Unlock
|
||||
* data is being modified (on the other side, DeprecatedTextureHost also has Lock/Unlock
|
||||
* semantics).
|
||||
* After unlocking, call Updated in order to add the modification to the current
|
||||
* layer transaction.
|
||||
@ -45,23 +47,23 @@ class CompositableForwarder;
|
||||
* can be no-ops. What's important is that the Client/Host pair implement the
|
||||
* same semantics.
|
||||
*
|
||||
* Ownership of the surface descriptor depends on how the TextureClient/Host is
|
||||
* Ownership of the surface descriptor depends on how the DeprecatedTextureClient/Host is
|
||||
* used by the CompositableClient/Host.
|
||||
*/
|
||||
class TextureClient : public RefCounted<TextureClient>
|
||||
class DeprecatedTextureClient : public RefCounted<DeprecatedTextureClient>
|
||||
{
|
||||
public:
|
||||
typedef gl::SharedTextureHandle SharedTextureHandle;
|
||||
typedef gl::GLContext GLContext;
|
||||
typedef gl::TextureImage TextureImage;
|
||||
|
||||
virtual ~TextureClient();
|
||||
virtual ~DeprecatedTextureClient();
|
||||
|
||||
/* This will return an identifier that can be sent accross a process or
|
||||
* thread boundary and used to construct a TextureHost object
|
||||
* thread boundary and used to construct a DeprecatedTextureHost object
|
||||
* which can then be used as a texture for rendering by a compatible
|
||||
* compositor. This texture should have been created with the
|
||||
* TextureHostIdentifier specified by the compositor that this identifier
|
||||
* DeprecatedTextureHostIdentifier specified by the compositor that this identifier
|
||||
* is to be used with.
|
||||
*/
|
||||
virtual const TextureInfo& GetTextureInfo() const
|
||||
@ -69,7 +71,7 @@ public:
|
||||
return mTextureInfo;
|
||||
}
|
||||
|
||||
virtual bool SupportsType(TextureClientType aType) { return false; }
|
||||
virtual bool SupportsType(DeprecatedTextureClientType aType) { return false; }
|
||||
|
||||
/**
|
||||
* The Lock* methods lock the texture client for drawing into, providing some
|
||||
@ -140,24 +142,24 @@ public:
|
||||
virtual gfxASurface::gfxContentType GetContentType() = 0;
|
||||
|
||||
protected:
|
||||
TextureClient(CompositableForwarder* aForwarder,
|
||||
DeprecatedTextureClient(CompositableForwarder* aForwarder,
|
||||
const TextureInfo& aTextureInfo);
|
||||
|
||||
CompositableForwarder* mForwarder;
|
||||
// So far all TextureClients use a SurfaceDescriptor, so it makes sense to
|
||||
// So far all DeprecatedTextureClients use a SurfaceDescriptor, so it makes sense to
|
||||
// keep the reference here.
|
||||
SurfaceDescriptor mDescriptor;
|
||||
TextureInfo mTextureInfo;
|
||||
AccessMode mAccessMode;
|
||||
};
|
||||
|
||||
class TextureClientShmem : public TextureClient
|
||||
class DeprecatedTextureClientShmem : public DeprecatedTextureClient
|
||||
{
|
||||
public:
|
||||
TextureClientShmem(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo);
|
||||
~TextureClientShmem() { ReleaseResources(); }
|
||||
DeprecatedTextureClientShmem(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo);
|
||||
~DeprecatedTextureClientShmem() { ReleaseResources(); }
|
||||
|
||||
virtual bool SupportsType(TextureClientType aType) MOZ_OVERRIDE
|
||||
virtual bool SupportsType(DeprecatedTextureClientType aType) MOZ_OVERRIDE
|
||||
{
|
||||
return aType == TEXTURE_SHMEM || aType == TEXTURE_CONTENT;
|
||||
}
|
||||
@ -181,15 +183,15 @@ private:
|
||||
friend class CompositingFactory;
|
||||
};
|
||||
|
||||
class TextureClientShmemYCbCr : public TextureClient
|
||||
class DeprecatedTextureClientShmemYCbCr : public DeprecatedTextureClient
|
||||
{
|
||||
public:
|
||||
TextureClientShmemYCbCr(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo)
|
||||
: TextureClient(aForwarder, aTextureInfo)
|
||||
DeprecatedTextureClientShmemYCbCr(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo)
|
||||
: DeprecatedTextureClient(aForwarder, aTextureInfo)
|
||||
{ }
|
||||
~TextureClientShmemYCbCr() { ReleaseResources(); }
|
||||
~DeprecatedTextureClientShmemYCbCr() { ReleaseResources(); }
|
||||
|
||||
virtual bool SupportsType(TextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_YCBCR; }
|
||||
virtual bool SupportsType(DeprecatedTextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_YCBCR; }
|
||||
void EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType) MOZ_OVERRIDE;
|
||||
virtual void SetDescriptorFromReply(const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE;
|
||||
virtual void SetDescriptor(const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE;
|
||||
@ -197,13 +199,13 @@ public:
|
||||
virtual gfxASurface::gfxContentType GetContentType() MOZ_OVERRIDE { return gfxASurface::CONTENT_COLOR_ALPHA; }
|
||||
};
|
||||
|
||||
class TextureClientTile : public TextureClient
|
||||
class DeprecatedTextureClientTile : public DeprecatedTextureClient
|
||||
{
|
||||
public:
|
||||
TextureClientTile(const TextureClientTile& aOther);
|
||||
TextureClientTile(CompositableForwarder* aForwarder,
|
||||
DeprecatedTextureClientTile(const DeprecatedTextureClientTile& aOther);
|
||||
DeprecatedTextureClientTile(CompositableForwarder* aForwarder,
|
||||
const TextureInfo& aTextureInfo);
|
||||
~TextureClientTile();
|
||||
~DeprecatedTextureClientTile();
|
||||
|
||||
virtual void EnsureAllocated(gfx::IntSize aSize,
|
||||
gfxASurface::gfxContentType aType) MOZ_OVERRIDE;
|
||||
@ -230,25 +232,16 @@ private:
|
||||
friend class CompositingFactory;
|
||||
};
|
||||
|
||||
/*
|
||||
* The logic of converting input image data into a Surface descriptor should be
|
||||
* outside of TextureClient. For Image layers we implement them in the AutoLock*
|
||||
* idiom so that the states need for the purpose of convertion only exist within
|
||||
* the conversion operation, and to avoid adding special interfaces in
|
||||
* TextureClient tht are only used in one place and not implemented everywhere.
|
||||
* We should do this for all the input data type.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for AutoLock*Client.
|
||||
* handles lock/unlock
|
||||
*/
|
||||
class AutoLockTextureClient
|
||||
class AutoLockDeprecatedTextureClient
|
||||
{
|
||||
public:
|
||||
AutoLockTextureClient(TextureClient* aTexture)
|
||||
AutoLockDeprecatedTextureClient(DeprecatedTextureClient* aTexture)
|
||||
{
|
||||
mTextureClient = aTexture;
|
||||
mDeprecatedTextureClient = aTexture;
|
||||
mDescriptor = aTexture->LockSurfaceDescriptor();
|
||||
}
|
||||
|
||||
@ -257,34 +250,34 @@ public:
|
||||
return mDescriptor;
|
||||
}
|
||||
|
||||
virtual ~AutoLockTextureClient()
|
||||
virtual ~AutoLockDeprecatedTextureClient()
|
||||
{
|
||||
mTextureClient->Unlock();
|
||||
mDeprecatedTextureClient->Unlock();
|
||||
}
|
||||
protected:
|
||||
TextureClient* mTextureClient;
|
||||
DeprecatedTextureClient* mDeprecatedTextureClient;
|
||||
SurfaceDescriptor* mDescriptor;
|
||||
};
|
||||
|
||||
/**
|
||||
* Writes the content of a PlanarYCbCrImage into a SurfaceDescriptor.
|
||||
*/
|
||||
class AutoLockYCbCrClient : public AutoLockTextureClient
|
||||
class AutoLockYCbCrClient : public AutoLockDeprecatedTextureClient
|
||||
{
|
||||
public:
|
||||
AutoLockYCbCrClient(TextureClient* aTexture) : AutoLockTextureClient(aTexture) {}
|
||||
AutoLockYCbCrClient(DeprecatedTextureClient* aTexture) : AutoLockDeprecatedTextureClient(aTexture) {}
|
||||
bool Update(PlanarYCbCrImage* aImage);
|
||||
protected:
|
||||
bool EnsureTextureClient(PlanarYCbCrImage* aImage);
|
||||
bool EnsureDeprecatedTextureClient(PlanarYCbCrImage* aImage);
|
||||
};
|
||||
|
||||
/**
|
||||
* Writes the content of a gfxASurface into a SurfaceDescriptor.
|
||||
*/
|
||||
class AutoLockShmemClient : public AutoLockTextureClient
|
||||
class AutoLockShmemClient : public AutoLockDeprecatedTextureClient
|
||||
{
|
||||
public:
|
||||
AutoLockShmemClient(TextureClient* aTexture) : AutoLockTextureClient(aTexture) {}
|
||||
AutoLockShmemClient(DeprecatedTextureClient* aTexture) : AutoLockDeprecatedTextureClient(aTexture) {}
|
||||
bool Update(Image* aImage, uint32_t aContentFlags, gfxPattern* pat);
|
||||
};
|
||||
|
||||
|
@ -205,12 +205,12 @@ BasicTiledLayerBuffer::ValidateTileInternal(BasicTiledLayerTile aTile,
|
||||
const nsIntRect& aDirtyRect)
|
||||
{
|
||||
if (aTile.IsPlaceholderTile()) {
|
||||
RefPtr<TextureClient> textureClient =
|
||||
new TextureClientTile(mManager, TextureInfo(BUFFER_TILED));
|
||||
aTile.mTextureClient = static_cast<TextureClientTile*>(textureClient.get());
|
||||
RefPtr<DeprecatedTextureClient> textureClient =
|
||||
new DeprecatedTextureClientTile(mManager, TextureInfo(BUFFER_TILED));
|
||||
aTile.mDeprecatedTextureClient = static_cast<DeprecatedTextureClientTile*>(textureClient.get());
|
||||
}
|
||||
aTile.mTextureClient->EnsureAllocated(gfx::IntSize(GetTileLength(), GetTileLength()), GetContentType());
|
||||
gfxASurface* writableSurface = aTile.mTextureClient->LockImageSurface();
|
||||
aTile.mDeprecatedTextureClient->EnsureAllocated(gfx::IntSize(GetTileLength(), GetTileLength()), GetContentType());
|
||||
gfxASurface* writableSurface = aTile.mDeprecatedTextureClient->LockImageSurface();
|
||||
// Bug 742100, this gfxContext really should live on the stack.
|
||||
nsRefPtr<gfxContext> ctxt = new gfxContext(writableSurface);
|
||||
|
||||
@ -471,8 +471,8 @@ BasicTiledLayerBuffer::DeepCopy() const
|
||||
for (size_t i = 0; i < result.mRetainedTiles.Length(); i++) {
|
||||
if (result.mRetainedTiles[i].IsPlaceholderTile()) continue;
|
||||
|
||||
result.mRetainedTiles[i].mTextureClient =
|
||||
new TextureClientTile(*result.mRetainedTiles[i].mTextureClient);
|
||||
result.mRetainedTiles[i].mDeprecatedTextureClient =
|
||||
new DeprecatedTextureClientTile(*result.mRetainedTiles[i].mDeprecatedTextureClient);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -23,38 +23,38 @@ namespace layers {
|
||||
* Ideal place to store per tile debug information.
|
||||
*/
|
||||
struct BasicTiledLayerTile {
|
||||
RefPtr<TextureClientTile> mTextureClient;
|
||||
RefPtr<DeprecatedTextureClientTile> mDeprecatedTextureClient;
|
||||
#ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
|
||||
TimeStamp mLastUpdate;
|
||||
#endif
|
||||
|
||||
// Placeholder
|
||||
BasicTiledLayerTile()
|
||||
: mTextureClient(nullptr)
|
||||
: mDeprecatedTextureClient(nullptr)
|
||||
{}
|
||||
|
||||
BasicTiledLayerTile(const BasicTiledLayerTile& o) {
|
||||
mTextureClient = o.mTextureClient;
|
||||
mDeprecatedTextureClient = o.mDeprecatedTextureClient;
|
||||
#ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
|
||||
mLastUpdate = o.mLastUpdate;
|
||||
#endif
|
||||
}
|
||||
BasicTiledLayerTile& operator=(const BasicTiledLayerTile& o) {
|
||||
if (this == &o) return *this;
|
||||
mTextureClient = o.mTextureClient;
|
||||
mDeprecatedTextureClient = o.mDeprecatedTextureClient;
|
||||
#ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
|
||||
mLastUpdate = o.mLastUpdate;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
bool operator== (const BasicTiledLayerTile& o) const {
|
||||
return mTextureClient == o.mTextureClient;
|
||||
return mDeprecatedTextureClient == o.mDeprecatedTextureClient;
|
||||
}
|
||||
bool operator!= (const BasicTiledLayerTile& o) const {
|
||||
return mTextureClient != o.mTextureClient;
|
||||
return mDeprecatedTextureClient != o.mDeprecatedTextureClient;
|
||||
}
|
||||
|
||||
bool IsPlaceholderTile() { return mTextureClient == nullptr; }
|
||||
bool IsPlaceholderTile() { return mDeprecatedTextureClient == nullptr; }
|
||||
|
||||
void ReadUnlock() {
|
||||
GetSurface()->ReadUnlock();
|
||||
@ -64,7 +64,7 @@ struct BasicTiledLayerTile {
|
||||
}
|
||||
|
||||
gfxReusableSurfaceWrapper* GetSurface() {
|
||||
return mTextureClient->GetReusableSurfaceWrapper();
|
||||
return mDeprecatedTextureClient->GetReusableSurfaceWrapper();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -17,15 +17,15 @@ bool
|
||||
CompositableHost::Update(const SurfaceDescriptor& aImage,
|
||||
SurfaceDescriptor* aResult)
|
||||
{
|
||||
if (!GetTextureHost()) {
|
||||
if (!GetDeprecatedTextureHost()) {
|
||||
*aResult = aImage;
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(!GetTextureHost()->GetBuffer(),
|
||||
MOZ_ASSERT(!GetDeprecatedTextureHost()->GetBuffer(),
|
||||
"This path not suitable for texture-level double buffering.");
|
||||
GetTextureHost()->Update(aImage);
|
||||
GetDeprecatedTextureHost()->Update(aImage);
|
||||
*aResult = aImage;
|
||||
return GetTextureHost()->IsValid();
|
||||
return GetDeprecatedTextureHost()->IsValid();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -33,7 +33,7 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
bool aIs3D)
|
||||
{
|
||||
RefPtr<TextureSource> source = GetTextureHost();
|
||||
RefPtr<TextureSource> source = GetDeprecatedTextureHost();
|
||||
|
||||
if (!source) {
|
||||
NS_WARNING("Using compositable with no texture host as mask layer");
|
||||
@ -77,7 +77,7 @@ CompositableHost::Create(const TextureInfo& aTextureInfo)
|
||||
}
|
||||
|
||||
void
|
||||
CompositableHost::DumpTextureHost(FILE* aFile, TextureHost* aTexture)
|
||||
CompositableHost::DumpDeprecatedTextureHost(FILE* aFile, DeprecatedTextureHost* aTexture)
|
||||
{
|
||||
if (!aTexture) {
|
||||
return;
|
||||
|
@ -28,7 +28,7 @@ struct TiledLayerProperties
|
||||
};
|
||||
|
||||
class Layer;
|
||||
class TextureHost;
|
||||
class DeprecatedTextureHost;
|
||||
class SurfaceDescriptor;
|
||||
|
||||
/**
|
||||
@ -136,7 +136,7 @@ public:
|
||||
* aAllocator - the allocator used to allocate and de-allocate resources.
|
||||
* aTextureInfo - contains flags for the texture.
|
||||
*/
|
||||
virtual void EnsureTextureHost(TextureIdentifier aTextureId,
|
||||
virtual void EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo) = 0;
|
||||
@ -150,14 +150,14 @@ public:
|
||||
* don't have a single surface for the texture contents, and we
|
||||
* need to allocate our own one to be updated later.
|
||||
*/
|
||||
virtual void EnsureTextureHostIncremental(ISurfaceAllocator* aAllocator,
|
||||
virtual void EnsureDeprecatedTextureHostIncremental(ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo,
|
||||
const nsIntRect& aBufferRect)
|
||||
{
|
||||
MOZ_ASSERT(false, "should be implemented or not used");
|
||||
}
|
||||
|
||||
virtual TextureHost* GetTextureHost() { return nullptr; }
|
||||
virtual DeprecatedTextureHost* GetDeprecatedTextureHost() { return nullptr; }
|
||||
|
||||
virtual LayerRenderState GetRenderState() = 0;
|
||||
|
||||
@ -198,7 +198,7 @@ public:
|
||||
virtual void Dump(FILE* aFile=NULL,
|
||||
const char* aPrefix="",
|
||||
bool aDumpHtml=false) { }
|
||||
static void DumpTextureHost(FILE* aFile, TextureHost* aTexture);
|
||||
static void DumpDeprecatedTextureHost(FILE* aFile, DeprecatedTextureHost* aTexture);
|
||||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
virtual already_AddRefed<gfxImageSurface> GetAsSurface() { return nullptr; }
|
||||
|
@ -21,21 +21,21 @@ ContentHostBase::ContentHostBase(const TextureInfo& aTextureInfo)
|
||||
ContentHostBase::~ContentHostBase()
|
||||
{}
|
||||
|
||||
TextureHost*
|
||||
ContentHostBase::GetTextureHost()
|
||||
DeprecatedTextureHost*
|
||||
ContentHostBase::GetDeprecatedTextureHost()
|
||||
{
|
||||
return mTextureHost;
|
||||
return mDeprecatedTextureHost;
|
||||
}
|
||||
|
||||
void
|
||||
ContentHostBase::DestroyFrontHost()
|
||||
{
|
||||
MOZ_ASSERT(!mTextureHost || mTextureHost->GetDeAllocator(),
|
||||
MOZ_ASSERT(!mDeprecatedTextureHost || mDeprecatedTextureHost->GetDeAllocator(),
|
||||
"We won't be able to destroy our SurfaceDescriptor");
|
||||
MOZ_ASSERT(!mTextureHostOnWhite || mTextureHostOnWhite->GetDeAllocator(),
|
||||
MOZ_ASSERT(!mDeprecatedTextureHostOnWhite || mDeprecatedTextureHostOnWhite->GetDeAllocator(),
|
||||
"We won't be able to destroy our SurfaceDescriptor");
|
||||
mTextureHost = nullptr;
|
||||
mTextureHostOnWhite = nullptr;
|
||||
mDeprecatedTextureHost = nullptr;
|
||||
mDeprecatedTextureHostOnWhite = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
@ -50,17 +50,17 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
|
||||
{
|
||||
NS_ASSERTION(aVisibleRegion, "Requires a visible region");
|
||||
|
||||
AutoLockTextureHost lock(mTextureHost);
|
||||
AutoLockTextureHost lockOnWhite(mTextureHostOnWhite);
|
||||
AutoLockDeprecatedTextureHost lock(mDeprecatedTextureHost);
|
||||
AutoLockDeprecatedTextureHost lockOnWhite(mDeprecatedTextureHostOnWhite);
|
||||
|
||||
if (!mTextureHost ||
|
||||
if (!mDeprecatedTextureHost ||
|
||||
!lock.IsValid() ||
|
||||
!lockOnWhite.IsValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<TexturedEffect> effect =
|
||||
CreateTexturedEffect(mTextureHost, mTextureHostOnWhite, aFilter);
|
||||
CreateTexturedEffect(mDeprecatedTextureHost, mDeprecatedTextureHostOnWhite, aFilter);
|
||||
|
||||
aEffectChain.mPrimaryEffect = effect;
|
||||
|
||||
@ -81,7 +81,7 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
|
||||
region.MoveBy(-origin); // translate into TexImage space, buffer origin might not be at texture (0,0)
|
||||
|
||||
// Figure out the intersecting draw region
|
||||
TextureSource* source = mTextureHost;
|
||||
TextureSource* source = mDeprecatedTextureHost;
|
||||
MOZ_ASSERT(source);
|
||||
gfx::IntSize texSize = source->GetSize();
|
||||
nsIntRect textureRect = nsIntRect(0, 0, texSize.width, texSize.height);
|
||||
@ -113,8 +113,8 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
|
||||
tileIter->BeginTileIteration();
|
||||
}
|
||||
|
||||
if (mTextureHostOnWhite) {
|
||||
iterOnWhite = mTextureHostOnWhite->AsTileIterator();
|
||||
if (mDeprecatedTextureHostOnWhite) {
|
||||
iterOnWhite = mDeprecatedTextureHostOnWhite->AsTileIterator();
|
||||
MOZ_ASSERT(!tileIter || tileIter->GetTileCount() == iterOnWhite->GetTileCount(),
|
||||
"Tile count mismatch on component alpha texture");
|
||||
if (iterOnWhite) {
|
||||
@ -203,11 +203,11 @@ void
|
||||
ContentHostBase::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
CompositableHost::SetCompositor(aCompositor);
|
||||
if (mTextureHost) {
|
||||
mTextureHost->SetCompositor(aCompositor);
|
||||
if (mDeprecatedTextureHost) {
|
||||
mDeprecatedTextureHost->SetCompositor(aCompositor);
|
||||
}
|
||||
if (mTextureHostOnWhite) {
|
||||
mTextureHostOnWhite->SetCompositor(aCompositor);
|
||||
if (mDeprecatedTextureHostOnWhite) {
|
||||
mDeprecatedTextureHostOnWhite->SetCompositor(aCompositor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,16 +222,16 @@ ContentHostBase::Dump(FILE* aFile,
|
||||
if (aDumpHtml) {
|
||||
fprintf(aFile, "<ul>");
|
||||
}
|
||||
if (mTextureHost) {
|
||||
if (mDeprecatedTextureHost) {
|
||||
fprintf(aFile, "%s", aPrefix);
|
||||
fprintf(aFile, aDumpHtml ? "<li> <a href=" : "Front buffer: ");
|
||||
DumpTextureHost(aFile, mTextureHost);
|
||||
DumpDeprecatedTextureHost(aFile, mDeprecatedTextureHost);
|
||||
fprintf(aFile, aDumpHtml ? "> Front buffer </a></li> " : " ");
|
||||
}
|
||||
if (mTextureHostOnWhite) {
|
||||
if (mDeprecatedTextureHostOnWhite) {
|
||||
fprintf(aFile, "%s", aPrefix);
|
||||
fprintf(aFile, aDumpHtml ? "<li> <a href=" : "TextureHost on white: ");
|
||||
DumpTextureHost(aFile, mTextureHostOnWhite);
|
||||
fprintf(aFile, aDumpHtml ? "<li> <a href=" : "DeprecatedTextureHost on white: ");
|
||||
DumpDeprecatedTextureHost(aFile, mDeprecatedTextureHostOnWhite);
|
||||
fprintf(aFile, aDumpHtml ? "> Front buffer on white </a> </li> " : " ");
|
||||
}
|
||||
if (aDumpHtml) {
|
||||
@ -247,18 +247,18 @@ ContentHostSingleBuffered::~ContentHostSingleBuffered()
|
||||
}
|
||||
|
||||
void
|
||||
ContentHostSingleBuffered::EnsureTextureHost(TextureIdentifier aTextureId,
|
||||
ContentHostSingleBuffered::EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo)
|
||||
{
|
||||
MOZ_ASSERT(aTextureId == TextureFront ||
|
||||
aTextureId == TextureOnWhiteFront);
|
||||
RefPtr<TextureHost> *newHost =
|
||||
RefPtr<DeprecatedTextureHost> *newHost =
|
||||
(aTextureId == TextureFront) ? &mNewFrontHost : &mNewFrontHostOnWhite;
|
||||
|
||||
*newHost = TextureHost::CreateTextureHost(aSurface.type(),
|
||||
aTextureInfo.mTextureHostFlags,
|
||||
*newHost = DeprecatedTextureHost::CreateDeprecatedTextureHost(aSurface.type(),
|
||||
aTextureInfo.mDeprecatedTextureHostFlags,
|
||||
aTextureInfo.mTextureFlags);
|
||||
|
||||
(*newHost)->SetBuffer(new SurfaceDescriptor(aSurface), aAllocator);
|
||||
@ -278,7 +278,7 @@ ContentHostSingleBuffered::DestroyTextures()
|
||||
mNewFrontHost = nullptr;
|
||||
mNewFrontHostOnWhite = nullptr;
|
||||
|
||||
// don't touch mTextureHost, we might need it for compositing
|
||||
// don't touch mDeprecatedTextureHost, we might need it for compositing
|
||||
}
|
||||
|
||||
void
|
||||
@ -289,22 +289,22 @@ ContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData,
|
||||
{
|
||||
aUpdatedRegionBack->SetEmpty();
|
||||
|
||||
if (!mTextureHost && !mNewFrontHost) {
|
||||
if (!mDeprecatedTextureHost && !mNewFrontHost) {
|
||||
mInitialised = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mNewFrontHost) {
|
||||
DestroyFrontHost();
|
||||
mTextureHost = mNewFrontHost;
|
||||
mDeprecatedTextureHost = mNewFrontHost;
|
||||
mNewFrontHost = nullptr;
|
||||
if (mNewFrontHostOnWhite) {
|
||||
mTextureHostOnWhite = mNewFrontHostOnWhite;
|
||||
mDeprecatedTextureHostOnWhite = mNewFrontHostOnWhite;
|
||||
mNewFrontHostOnWhite = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mTextureHost);
|
||||
MOZ_ASSERT(mDeprecatedTextureHost);
|
||||
MOZ_ASSERT(!mNewFrontHostOnWhite, "New white host without a new black?");
|
||||
|
||||
// updated is in screen coordinates. Convert it to buffer coordinates.
|
||||
@ -326,9 +326,9 @@ ContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData,
|
||||
MOZ_ASSERT((destBounds.y % size.height) + destBounds.height <= size.height,
|
||||
"updated region lies across rotation boundaries!");
|
||||
|
||||
mTextureHost->Update(*mTextureHost->GetBuffer(), &destRegion);
|
||||
if (mTextureHostOnWhite) {
|
||||
mTextureHostOnWhite->Update(*mTextureHostOnWhite->GetBuffer(), &destRegion);
|
||||
mDeprecatedTextureHost->Update(*mDeprecatedTextureHost->GetBuffer(), &destRegion);
|
||||
if (mDeprecatedTextureHostOnWhite) {
|
||||
mDeprecatedTextureHostOnWhite->Update(*mDeprecatedTextureHostOnWhite->GetBuffer(), &destRegion);
|
||||
}
|
||||
mInitialised = true;
|
||||
|
||||
@ -343,13 +343,13 @@ ContentHostDoubleBuffered::~ContentHostDoubleBuffered()
|
||||
}
|
||||
|
||||
void
|
||||
ContentHostDoubleBuffered::EnsureTextureHost(TextureIdentifier aTextureId,
|
||||
ContentHostDoubleBuffered::EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo)
|
||||
{
|
||||
RefPtr<TextureHost> newHost = TextureHost::CreateTextureHost(aSurface.type(),
|
||||
aTextureInfo.mTextureHostFlags,
|
||||
RefPtr<DeprecatedTextureHost> newHost = DeprecatedTextureHost::CreateDeprecatedTextureHost(aSurface.type(),
|
||||
aTextureInfo.mDeprecatedTextureHostFlags,
|
||||
aTextureInfo.mTextureFlags);
|
||||
|
||||
newHost->SetBuffer(new SurfaceDescriptor(aSurface), aAllocator);
|
||||
@ -408,7 +408,7 @@ ContentHostDoubleBuffered::DestroyTextures()
|
||||
mBackHostOnWhite = nullptr;
|
||||
}
|
||||
|
||||
// don't touch mTextureHost, we might need it for compositing
|
||||
// don't touch mDeprecatedTextureHost, we might need it for compositing
|
||||
}
|
||||
|
||||
void
|
||||
@ -417,7 +417,7 @@ ContentHostDoubleBuffered::UpdateThebes(const ThebesBufferData& aData,
|
||||
const nsIntRegion& aOldValidRegionBack,
|
||||
nsIntRegion* aUpdatedRegionBack)
|
||||
{
|
||||
if (!mTextureHost && !mNewFrontHost) {
|
||||
if (!mDeprecatedTextureHost && !mNewFrontHost) {
|
||||
mInitialised = false;
|
||||
|
||||
*aUpdatedRegionBack = aUpdated;
|
||||
@ -426,29 +426,29 @@ ContentHostDoubleBuffered::UpdateThebes(const ThebesBufferData& aData,
|
||||
|
||||
if (mNewFrontHost) {
|
||||
DestroyFrontHost();
|
||||
mTextureHost = mNewFrontHost;
|
||||
mDeprecatedTextureHost = mNewFrontHost;
|
||||
mNewFrontHost = nullptr;
|
||||
if (mNewFrontHostOnWhite) {
|
||||
mTextureHostOnWhite = mNewFrontHostOnWhite;
|
||||
mDeprecatedTextureHostOnWhite = mNewFrontHostOnWhite;
|
||||
mNewFrontHostOnWhite = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mTextureHost);
|
||||
MOZ_ASSERT(mDeprecatedTextureHost);
|
||||
MOZ_ASSERT(!mNewFrontHostOnWhite, "New white host without a new black?");
|
||||
MOZ_ASSERT(mBackHost);
|
||||
|
||||
RefPtr<TextureHost> oldFront = mTextureHost;
|
||||
mTextureHost = mBackHost;
|
||||
RefPtr<DeprecatedTextureHost> oldFront = mDeprecatedTextureHost;
|
||||
mDeprecatedTextureHost = mBackHost;
|
||||
mBackHost = oldFront;
|
||||
|
||||
oldFront = mTextureHostOnWhite;
|
||||
mTextureHostOnWhite = mBackHostOnWhite;
|
||||
oldFront = mDeprecatedTextureHostOnWhite;
|
||||
mDeprecatedTextureHostOnWhite = mBackHostOnWhite;
|
||||
mBackHostOnWhite = oldFront;
|
||||
|
||||
mTextureHost->Update(*mTextureHost->GetBuffer());
|
||||
if (mTextureHostOnWhite) {
|
||||
mTextureHostOnWhite->Update(*mTextureHostOnWhite->GetBuffer());
|
||||
mDeprecatedTextureHost->Update(*mDeprecatedTextureHost->GetBuffer());
|
||||
if (mDeprecatedTextureHostOnWhite) {
|
||||
mDeprecatedTextureHostOnWhite->Update(*mDeprecatedTextureHostOnWhite->GetBuffer());
|
||||
}
|
||||
mInitialised = true;
|
||||
|
||||
@ -468,7 +468,7 @@ ContentHostDoubleBuffered::UpdateThebes(const ThebesBufferData& aData,
|
||||
}
|
||||
|
||||
void
|
||||
ContentHostIncremental::EnsureTextureHostIncremental(ISurfaceAllocator* aAllocator,
|
||||
ContentHostIncremental::EnsureDeprecatedTextureHostIncremental(ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo,
|
||||
const nsIntRect& aBufferRect)
|
||||
{
|
||||
@ -504,19 +504,19 @@ ContentHostIncremental::ProcessTextureUpdates()
|
||||
void
|
||||
ContentHostIncremental::TextureCreationRequest::Execute(ContentHostIncremental* aHost)
|
||||
{
|
||||
RefPtr<TextureHost> newHost =
|
||||
TextureHost::CreateTextureHost(SurfaceDescriptor::TShmem,
|
||||
mTextureInfo.mTextureHostFlags,
|
||||
RefPtr<DeprecatedTextureHost> newHost =
|
||||
DeprecatedTextureHost::CreateDeprecatedTextureHost(SurfaceDescriptor::TShmem,
|
||||
mTextureInfo.mDeprecatedTextureHostFlags,
|
||||
mTextureInfo.mTextureFlags);
|
||||
Compositor* compositor = aHost->GetCompositor();
|
||||
if (compositor) {
|
||||
newHost->SetCompositor(compositor);
|
||||
}
|
||||
RefPtr<TextureHost> newHostOnWhite;
|
||||
RefPtr<DeprecatedTextureHost> newHostOnWhite;
|
||||
if (mTextureInfo.mTextureFlags & ComponentAlpha) {
|
||||
newHostOnWhite =
|
||||
TextureHost::CreateTextureHost(SurfaceDescriptor::TShmem,
|
||||
mTextureInfo.mTextureHostFlags,
|
||||
DeprecatedTextureHost::CreateDeprecatedTextureHost(SurfaceDescriptor::TShmem,
|
||||
mTextureInfo.mDeprecatedTextureHostFlags,
|
||||
mTextureInfo.mTextureFlags);
|
||||
Compositor* compositor = aHost->GetCompositor();
|
||||
if (compositor) {
|
||||
@ -524,7 +524,7 @@ ContentHostIncremental::TextureCreationRequest::Execute(ContentHostIncremental*
|
||||
}
|
||||
}
|
||||
|
||||
if (mTextureInfo.mTextureHostFlags & TEXTURE_HOST_COPY_PREVIOUS) {
|
||||
if (mTextureInfo.mDeprecatedTextureHostFlags & TEXTURE_HOST_COPY_PREVIOUS) {
|
||||
nsIntRect bufferRect = aHost->mBufferRect;
|
||||
nsIntPoint bufferRotation = aHost->mBufferRotation;
|
||||
nsIntRect overlap;
|
||||
@ -595,46 +595,46 @@ ContentHostIncremental::TextureCreationRequest::Execute(ContentHostIncremental*
|
||||
dstRectDrawBottomLeft.MoveBy(-mBufferRect.TopLeft());
|
||||
|
||||
newHost->EnsureBuffer(mBufferRect.Size(),
|
||||
ContentForFormat(aHost->mTextureHost->GetFormat()));
|
||||
ContentForFormat(aHost->mDeprecatedTextureHost->GetFormat()));
|
||||
|
||||
aHost->mTextureHost->CopyTo(srcRect, newHost, dstRect);
|
||||
aHost->mDeprecatedTextureHost->CopyTo(srcRect, newHost, dstRect);
|
||||
if (bufferRotation != nsIntPoint(0, 0)) {
|
||||
// Draw the remaining quadrants. We call BlitTextureImage 3 extra
|
||||
// times instead of doing a single draw call because supporting that
|
||||
// with a tiled source is quite tricky.
|
||||
|
||||
if (!srcRectDrawTopRight.IsEmpty())
|
||||
aHost->mTextureHost->CopyTo(srcRectDrawTopRight,
|
||||
aHost->mDeprecatedTextureHost->CopyTo(srcRectDrawTopRight,
|
||||
newHost, dstRectDrawTopRight);
|
||||
if (!srcRectDrawTopLeft.IsEmpty())
|
||||
aHost->mTextureHost->CopyTo(srcRectDrawTopLeft,
|
||||
aHost->mDeprecatedTextureHost->CopyTo(srcRectDrawTopLeft,
|
||||
newHost, dstRectDrawTopLeft);
|
||||
if (!srcRectDrawBottomLeft.IsEmpty())
|
||||
aHost->mTextureHost->CopyTo(srcRectDrawBottomLeft,
|
||||
aHost->mDeprecatedTextureHost->CopyTo(srcRectDrawBottomLeft,
|
||||
newHost, dstRectDrawBottomLeft);
|
||||
}
|
||||
|
||||
if (newHostOnWhite) {
|
||||
newHostOnWhite->EnsureBuffer(mBufferRect.Size(),
|
||||
ContentForFormat(aHost->mTextureHostOnWhite->GetFormat()));
|
||||
aHost->mTextureHostOnWhite->CopyTo(srcRect, newHostOnWhite, dstRect);
|
||||
ContentForFormat(aHost->mDeprecatedTextureHostOnWhite->GetFormat()));
|
||||
aHost->mDeprecatedTextureHostOnWhite->CopyTo(srcRect, newHostOnWhite, dstRect);
|
||||
if (bufferRotation != nsIntPoint(0, 0)) {
|
||||
// draw the remaining quadrants
|
||||
if (!srcRectDrawTopRight.IsEmpty())
|
||||
aHost->mTextureHostOnWhite->CopyTo(srcRectDrawTopRight,
|
||||
aHost->mDeprecatedTextureHostOnWhite->CopyTo(srcRectDrawTopRight,
|
||||
newHostOnWhite, dstRectDrawTopRight);
|
||||
if (!srcRectDrawTopLeft.IsEmpty())
|
||||
aHost->mTextureHostOnWhite->CopyTo(srcRectDrawTopLeft,
|
||||
aHost->mDeprecatedTextureHostOnWhite->CopyTo(srcRectDrawTopLeft,
|
||||
newHostOnWhite, dstRectDrawTopLeft);
|
||||
if (!srcRectDrawBottomLeft.IsEmpty())
|
||||
aHost->mTextureHostOnWhite->CopyTo(srcRectDrawBottomLeft,
|
||||
aHost->mDeprecatedTextureHostOnWhite->CopyTo(srcRectDrawBottomLeft,
|
||||
newHostOnWhite, dstRectDrawBottomLeft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aHost->mTextureHost = newHost;
|
||||
aHost->mTextureHostOnWhite = newHostOnWhite;
|
||||
aHost->mDeprecatedTextureHost = newHost;
|
||||
aHost->mDeprecatedTextureHostOnWhite = newHostOnWhite;
|
||||
|
||||
aHost->mBufferRect = mBufferRect;
|
||||
aHost->mBufferRotation = nsIntPoint();
|
||||
@ -673,9 +673,9 @@ ContentHostIncremental::TextureUpdateRequest::Execute(ContentHostIncremental* aH
|
||||
nsIntPoint offset = -mUpdated.GetBounds().TopLeft();
|
||||
|
||||
if (mTextureId == TextureFront) {
|
||||
aHost->mTextureHost->Update(mDescriptor, &mUpdated, &offset);
|
||||
aHost->mDeprecatedTextureHost->Update(mDescriptor, &mUpdated, &offset);
|
||||
} else {
|
||||
aHost->mTextureHostOnWhite->Update(mDescriptor, &mUpdated, &offset);
|
||||
aHost->mDeprecatedTextureHostOnWhite->Update(mDescriptor, &mUpdated, &offset);
|
||||
}
|
||||
}
|
||||
|
||||
@ -695,9 +695,9 @@ ContentHostSingleBuffered::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
nsAutoCString pfx(aPrefix);
|
||||
pfx += " ";
|
||||
|
||||
if (mTextureHost) {
|
||||
if (mDeprecatedTextureHost) {
|
||||
aTo += "\n";
|
||||
mTextureHost->PrintInfo(aTo, pfx.get());
|
||||
mDeprecatedTextureHost->PrintInfo(aTo, pfx.get());
|
||||
}
|
||||
}
|
||||
|
||||
@ -716,9 +716,9 @@ ContentHostDoubleBuffered::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
nsAutoCString prefix(aPrefix);
|
||||
prefix += " ";
|
||||
|
||||
if (mTextureHost) {
|
||||
if (mDeprecatedTextureHost) {
|
||||
aTo += "\n";
|
||||
mTextureHost->PrintInfo(aTo, prefix.get());
|
||||
mDeprecatedTextureHost->PrintInfo(aTo, prefix.get());
|
||||
}
|
||||
|
||||
if (mBackHost) {
|
||||
@ -743,13 +743,13 @@ ContentHostDoubleBuffered::Dump(FILE* aFile,
|
||||
if (mBackHost) {
|
||||
fprintf(aFile, "%s", aPrefix);
|
||||
fprintf(aFile, aDumpHtml ? "<li> <a href=" : "Back buffer: ");
|
||||
DumpTextureHost(aFile, mBackHost);
|
||||
DumpDeprecatedTextureHost(aFile, mBackHost);
|
||||
fprintf(aFile, aDumpHtml ? " >Back buffer</a></li>" : " ");
|
||||
}
|
||||
if (mBackHostOnWhite) {
|
||||
fprintf(aFile, "%s", aPrefix);
|
||||
fprintf(aFile, aDumpHtml ? "<li> <a href=" : "Back buffer on white: ");
|
||||
DumpTextureHost(aFile, mBackHostOnWhite);
|
||||
DumpDeprecatedTextureHost(aFile, mBackHostOnWhite);
|
||||
fprintf(aFile, aDumpHtml ? " >Back buffer on white</a> </li>" : " ");
|
||||
}
|
||||
if (aDumpHtml) {
|
||||
|
@ -46,8 +46,8 @@ protected:
|
||||
* Base class for non-tiled ContentHosts.
|
||||
*
|
||||
* Ownership of the SurfaceDescriptor and the resources it represents is passed
|
||||
* from the ContentClient to the ContentHost when the TextureClient/Hosts are
|
||||
* created, that is recevied here by SetTextureHosts which assigns one or two
|
||||
* from the ContentClient to the ContentHost when the DeprecatedTextureClient/Hosts are
|
||||
* created, that is recevied here by SetDeprecatedTextureHosts which assigns one or two
|
||||
* texture hosts (for single and double buffering) to the ContentHost.
|
||||
*
|
||||
* It is the responsibility of the ContentHost to destroy its resources when
|
||||
@ -79,7 +79,7 @@ public:
|
||||
|
||||
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE
|
||||
{
|
||||
LayerRenderState result = mTextureHost->GetRenderState();
|
||||
LayerRenderState result = mDeprecatedTextureHost->GetRenderState();
|
||||
|
||||
if (mBufferRotation != nsIntPoint()) {
|
||||
result.mFlags |= LAYER_RENDER_STATE_BUFFER_ROTATION;
|
||||
@ -93,7 +93,7 @@ public:
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
virtual already_AddRefed<gfxImageSurface> GetAsSurface()
|
||||
{
|
||||
return mTextureHost->GetAsSurface();
|
||||
return mDeprecatedTextureHost->GetAsSurface();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -101,7 +101,7 @@ public:
|
||||
const char* aPrefix="",
|
||||
bool aDumpHtml=false) MOZ_OVERRIDE;
|
||||
|
||||
virtual TextureHost* GetTextureHost() MOZ_OVERRIDE;
|
||||
virtual DeprecatedTextureHost* GetDeprecatedTextureHost() MOZ_OVERRIDE;
|
||||
|
||||
virtual void SetPaintWillResample(bool aResample) { mPaintWillResample = aResample; }
|
||||
// The client has destroyed its texture clients and we should destroy our
|
||||
@ -123,19 +123,19 @@ protected:
|
||||
|
||||
nsIntRect mBufferRect;
|
||||
nsIntPoint mBufferRotation;
|
||||
RefPtr<TextureHost> mTextureHost;
|
||||
RefPtr<TextureHost> mTextureHostOnWhite;
|
||||
// When we set a new front buffer TextureHost, we don't want to stomp on
|
||||
RefPtr<DeprecatedTextureHost> mDeprecatedTextureHost;
|
||||
RefPtr<DeprecatedTextureHost> mDeprecatedTextureHostOnWhite;
|
||||
// When we set a new front buffer DeprecatedTextureHost, we don't want to stomp on
|
||||
// the old one which might still be used for compositing. So we store it
|
||||
// here and move it to mTextureHost once we do the first buffer swap.
|
||||
RefPtr<TextureHost> mNewFrontHost;
|
||||
RefPtr<TextureHost> mNewFrontHostOnWhite;
|
||||
// here and move it to mDeprecatedTextureHost once we do the first buffer swap.
|
||||
RefPtr<DeprecatedTextureHost> mNewFrontHost;
|
||||
RefPtr<DeprecatedTextureHost> mNewFrontHostOnWhite;
|
||||
bool mPaintWillResample;
|
||||
bool mInitialised;
|
||||
};
|
||||
|
||||
/**
|
||||
* Double buffering is implemented by swapping the front and back TextureHosts.
|
||||
* Double buffering is implemented by swapping the front and back DeprecatedTextureHosts.
|
||||
*/
|
||||
class ContentHostDoubleBuffered : public ContentHostBase
|
||||
{
|
||||
@ -153,7 +153,7 @@ public:
|
||||
const nsIntRegion& aOldValidRegionBack,
|
||||
nsIntRegion* aUpdatedRegionBack);
|
||||
|
||||
virtual void EnsureTextureHost(TextureIdentifier aTextureId,
|
||||
virtual void EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
|
||||
@ -169,15 +169,15 @@ public:
|
||||
protected:
|
||||
nsIntRegion mValidRegionForNextBackBuffer;
|
||||
// Texture host for the back buffer. We never read or write this buffer. We
|
||||
// only swap it with the front buffer (mTextureHost) when we are told by the
|
||||
// only swap it with the front buffer (mDeprecatedTextureHost) when we are told by the
|
||||
// content thread.
|
||||
RefPtr<TextureHost> mBackHost;
|
||||
RefPtr<TextureHost> mBackHostOnWhite;
|
||||
RefPtr<DeprecatedTextureHost> mBackHost;
|
||||
RefPtr<DeprecatedTextureHost> mBackHostOnWhite;
|
||||
};
|
||||
|
||||
/**
|
||||
* Single buffered, therefore we must synchronously upload the image from the
|
||||
* TextureHost in the layers transaction (i.e., in UpdateThebes).
|
||||
* DeprecatedTextureHost in the layers transaction (i.e., in UpdateThebes).
|
||||
*/
|
||||
class ContentHostSingleBuffered : public ContentHostBase
|
||||
{
|
||||
@ -194,7 +194,7 @@ public:
|
||||
const nsIntRegion& aOldValidRegionBack,
|
||||
nsIntRegion* aUpdatedRegionBack);
|
||||
|
||||
virtual void EnsureTextureHost(TextureIdentifier aTextureId,
|
||||
virtual void EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
|
||||
@ -225,11 +225,11 @@ public:
|
||||
|
||||
virtual CompositableType GetType() { return BUFFER_CONTENT; }
|
||||
|
||||
virtual void EnsureTextureHostIncremental(ISurfaceAllocator* aAllocator,
|
||||
virtual void EnsureDeprecatedTextureHostIncremental(ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo,
|
||||
const nsIntRect& aBufferRect) MOZ_OVERRIDE;
|
||||
|
||||
virtual void EnsureTextureHost(TextureIdentifier aTextureId,
|
||||
virtual void EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo)
|
||||
@ -270,8 +270,8 @@ public:
|
||||
|
||||
virtual void DestroyTextures()
|
||||
{
|
||||
mTextureHost = nullptr;
|
||||
mTextureHostOnWhite = nullptr;
|
||||
mDeprecatedTextureHost = nullptr;
|
||||
mDeprecatedTextureHostOnWhite = nullptr;
|
||||
mUpdateList.Clear();
|
||||
}
|
||||
|
||||
|
@ -19,44 +19,44 @@ namespace layers {
|
||||
void
|
||||
ImageHostSingle::SetCompositor(Compositor* aCompositor) {
|
||||
CompositableHost::SetCompositor(aCompositor);
|
||||
if (mTextureHost) {
|
||||
mTextureHost->SetCompositor(aCompositor);
|
||||
if (mDeprecatedTextureHost) {
|
||||
mDeprecatedTextureHost->SetCompositor(aCompositor);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ImageHostSingle::EnsureTextureHost(TextureIdentifier aTextureId,
|
||||
ImageHostSingle::EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo)
|
||||
{
|
||||
if (mTextureHost &&
|
||||
mTextureHost->GetBuffer() &&
|
||||
mTextureHost->GetBuffer()->type() == aSurface.type()) {
|
||||
if (mDeprecatedTextureHost &&
|
||||
mDeprecatedTextureHost->GetBuffer() &&
|
||||
mDeprecatedTextureHost->GetBuffer()->type() == aSurface.type()) {
|
||||
return;
|
||||
}
|
||||
|
||||
MakeTextureHost(aTextureId,
|
||||
MakeDeprecatedTextureHost(aTextureId,
|
||||
aSurface,
|
||||
aAllocator,
|
||||
aTextureInfo);
|
||||
}
|
||||
|
||||
void
|
||||
ImageHostSingle::MakeTextureHost(TextureIdentifier aTextureId,
|
||||
ImageHostSingle::MakeDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo)
|
||||
{
|
||||
mTextureHost = TextureHost::CreateTextureHost(aSurface.type(),
|
||||
mTextureInfo.mTextureHostFlags,
|
||||
mDeprecatedTextureHost = DeprecatedTextureHost::CreateDeprecatedTextureHost(aSurface.type(),
|
||||
mTextureInfo.mDeprecatedTextureHostFlags,
|
||||
mTextureInfo.mTextureFlags);
|
||||
|
||||
NS_ASSERTION(mTextureHost, "Failed to create texture host");
|
||||
NS_ASSERTION(mDeprecatedTextureHost, "Failed to create texture host");
|
||||
|
||||
Compositor* compositor = GetCompositor();
|
||||
if (compositor && mTextureHost) {
|
||||
mTextureHost->SetCompositor(compositor);
|
||||
if (compositor && mDeprecatedTextureHost) {
|
||||
mDeprecatedTextureHost->SetCompositor(compositor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,13 +70,13 @@ ImageHostSingle::Composite(EffectChain& aEffectChain,
|
||||
const nsIntRegion* aVisibleRegion,
|
||||
TiledLayerProperties* aLayerProperties)
|
||||
{
|
||||
if (!mTextureHost) {
|
||||
NS_WARNING("Can't composite an invalid or null TextureHost");
|
||||
if (!mDeprecatedTextureHost) {
|
||||
NS_WARNING("Can't composite an invalid or null DeprecatedTextureHost");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mTextureHost->IsValid()) {
|
||||
NS_WARNING("Can't composite an invalid TextureHost");
|
||||
if (!mDeprecatedTextureHost->IsValid()) {
|
||||
NS_WARNING("Can't composite an invalid DeprecatedTextureHost");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -85,17 +85,17 @@ ImageHostSingle::Composite(EffectChain& aEffectChain,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mTextureHost->Lock()) {
|
||||
if (!mDeprecatedTextureHost->Lock()) {
|
||||
NS_ASSERTION(false, "failed to lock texture host");
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<TexturedEffect> effect =
|
||||
CreateTexturedEffect(mTextureHost, aFilter);
|
||||
CreateTexturedEffect(mDeprecatedTextureHost, aFilter);
|
||||
|
||||
aEffectChain.mPrimaryEffect = effect;
|
||||
|
||||
TileIterator* it = mTextureHost->AsTileIterator();
|
||||
TileIterator* it = mDeprecatedTextureHost->AsTileIterator();
|
||||
if (it) {
|
||||
it->BeginTileIteration();
|
||||
do {
|
||||
@ -108,7 +108,7 @@ ImageHostSingle::Composite(EffectChain& aEffectChain,
|
||||
} while (it->NextTile());
|
||||
it->EndTileIteration();
|
||||
} else {
|
||||
IntSize textureSize = mTextureHost->GetSize();
|
||||
IntSize textureSize = mDeprecatedTextureHost->GetSize();
|
||||
gfx::Rect rect(0, 0,
|
||||
mPictureRect.width,
|
||||
mPictureRect.height);
|
||||
@ -122,7 +122,7 @@ ImageHostSingle::Composite(EffectChain& aEffectChain,
|
||||
rect = gfx::Rect(0, 0, textureSize.width, textureSize.height);
|
||||
}
|
||||
|
||||
if (mTextureHost->GetFlags() & NeedsYFlip) {
|
||||
if (mDeprecatedTextureHost->GetFlags() & NeedsYFlip) {
|
||||
effect->mTextureCoords.y = effect->mTextureCoords.YMost();
|
||||
effect->mTextureCoords.height = -effect->mTextureCoords.height;
|
||||
}
|
||||
@ -133,7 +133,7 @@ ImageHostSingle::Composite(EffectChain& aEffectChain,
|
||||
rect, aClipRect, aTransform, aOffset);
|
||||
}
|
||||
|
||||
mTextureHost->Unlock();
|
||||
mDeprecatedTextureHost->Unlock();
|
||||
}
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
@ -145,11 +145,11 @@ ImageHostSingle::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
|
||||
AppendToString(aTo, mPictureRect, " [picture-rect=", "]");
|
||||
|
||||
if (mTextureHost) {
|
||||
if (mDeprecatedTextureHost) {
|
||||
nsAutoCString pfx(aPrefix);
|
||||
pfx += " ";
|
||||
aTo += "\n";
|
||||
mTextureHost->PrintInfo(aTo, pfx.get());
|
||||
mDeprecatedTextureHost->PrintInfo(aTo, pfx.get());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -157,26 +157,26 @@ ImageHostSingle::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
bool
|
||||
ImageHostBuffered::Update(const SurfaceDescriptor& aImage,
|
||||
SurfaceDescriptor* aResult) {
|
||||
if (!GetTextureHost()) {
|
||||
if (!GetDeprecatedTextureHost()) {
|
||||
*aResult = aImage;
|
||||
return false;
|
||||
}
|
||||
GetTextureHost()->SwapTextures(aImage, aResult);
|
||||
return GetTextureHost()->IsValid();
|
||||
GetDeprecatedTextureHost()->SwapTextures(aImage, aResult);
|
||||
return GetDeprecatedTextureHost()->IsValid();
|
||||
}
|
||||
|
||||
void
|
||||
ImageHostBuffered::MakeTextureHost(TextureIdentifier aTextureId,
|
||||
ImageHostBuffered::MakeDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo)
|
||||
{
|
||||
ImageHostSingle::MakeTextureHost(aTextureId,
|
||||
ImageHostSingle::MakeDeprecatedTextureHost(aTextureId,
|
||||
aSurface,
|
||||
aAllocator,
|
||||
aTextureInfo);
|
||||
if (mTextureHost) {
|
||||
mTextureHost->SetBuffer(new SurfaceDescriptor(null_t()), aAllocator);
|
||||
if (mDeprecatedTextureHost) {
|
||||
mDeprecatedTextureHost->SetBuffer(new SurfaceDescriptor(null_t()), aAllocator);
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,11 +188,11 @@ ImageHostSingle::Dump(FILE* aFile,
|
||||
if (!aFile) {
|
||||
aFile = stderr;
|
||||
}
|
||||
if (mTextureHost) {
|
||||
if (mDeprecatedTextureHost) {
|
||||
fprintf(aFile, "%s", aPrefix);
|
||||
fprintf(aFile, aDumpHtml ? "<ul><li>TextureHost: "
|
||||
: "TextureHost: ");
|
||||
DumpTextureHost(aFile, mTextureHost);
|
||||
fprintf(aFile, aDumpHtml ? "<ul><li>DeprecatedTextureHost: "
|
||||
: "DeprecatedTextureHost: ");
|
||||
DumpDeprecatedTextureHost(aFile, mDeprecatedTextureHost);
|
||||
fprintf(aFile, aDumpHtml ? " </li></ul> " : " ");
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace layers {
|
||||
class ImageHost : public CompositableHost
|
||||
{
|
||||
public:
|
||||
TextureHost* GetTextureHost() MOZ_OVERRIDE { return nullptr; }
|
||||
DeprecatedTextureHost* GetDeprecatedTextureHost() MOZ_OVERRIDE { return nullptr; }
|
||||
|
||||
protected:
|
||||
ImageHost(const TextureInfo& aTextureInfo)
|
||||
@ -36,24 +36,24 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
// ImageHost with a single TextureHost
|
||||
// ImageHost with a single DeprecatedTextureHost
|
||||
class ImageHostSingle : public ImageHost
|
||||
{
|
||||
public:
|
||||
ImageHostSingle(const TextureInfo& aTextureInfo)
|
||||
: ImageHost(aTextureInfo)
|
||||
, mTextureHost(nullptr)
|
||||
, mDeprecatedTextureHost(nullptr)
|
||||
, mHasPictureRect(false)
|
||||
{}
|
||||
|
||||
virtual CompositableType GetType() { return mTextureInfo.mCompositableType; }
|
||||
|
||||
virtual void EnsureTextureHost(TextureIdentifier aTextureId,
|
||||
virtual void EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
|
||||
|
||||
TextureHost* GetTextureHost() MOZ_OVERRIDE { return mTextureHost; }
|
||||
DeprecatedTextureHost* GetDeprecatedTextureHost() MOZ_OVERRIDE { return mDeprecatedTextureHost; }
|
||||
|
||||
virtual void Composite(EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
@ -78,8 +78,8 @@ public:
|
||||
|
||||
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE
|
||||
{
|
||||
if (mTextureHost) {
|
||||
return mTextureHost->GetRenderState();
|
||||
if (mDeprecatedTextureHost) {
|
||||
return mDeprecatedTextureHost->GetRenderState();
|
||||
}
|
||||
return LayerRenderState();
|
||||
}
|
||||
@ -97,17 +97,17 @@ public:
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE
|
||||
{
|
||||
return mTextureHost->GetAsSurface();
|
||||
return mDeprecatedTextureHost->GetAsSurface();
|
||||
}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void MakeTextureHost(TextureIdentifier aTextureId,
|
||||
virtual void MakeDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo);
|
||||
|
||||
RefPtr<TextureHost> mTextureHost;
|
||||
RefPtr<DeprecatedTextureHost> mDeprecatedTextureHost;
|
||||
nsIntRect mPictureRect;
|
||||
bool mHasPictureRect;
|
||||
};
|
||||
@ -126,7 +126,7 @@ public:
|
||||
SurfaceDescriptor* aResult = nullptr) MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void MakeTextureHost(TextureIdentifier aTextureId,
|
||||
virtual void MakeDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
|
||||
|
@ -105,8 +105,8 @@ ImageLayerComposite::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToS
|
||||
|
||||
// Snap image edges to pixel boundaries
|
||||
gfxRect sourceRect(0, 0, 0, 0);
|
||||
if (mImageHost && mImageHost->GetTextureHost()) {
|
||||
IntSize size = mImageHost->GetTextureHost()->GetSize();
|
||||
if (mImageHost && mImageHost->GetDeprecatedTextureHost()) {
|
||||
IntSize size = mImageHost->GetDeprecatedTextureHost()->GetSize();
|
||||
sourceRect.SizeTo(size.width, size.height);
|
||||
if (mScaleMode != SCALE_NONE &&
|
||||
sourceRect.width != 0.0 && sourceRect.height != 0.0) {
|
||||
|
@ -12,68 +12,68 @@ namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
// implemented in TextureOGL.cpp
|
||||
TemporaryRef<TextureHost> CreateTextureHostOGL(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aTextureHostFlags,
|
||||
uint32_t aTextureFlags);
|
||||
TemporaryRef<DeprecatedTextureHost> CreateDeprecatedTextureHostOGL(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aDeprecatedTextureHostFlags,
|
||||
uint32_t aTextureFlags);
|
||||
// implemented in BasicCompositor.cpp
|
||||
TemporaryRef<TextureHost> CreateBasicTextureHost(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aTextureHostFlags,
|
||||
uint32_t aTextureFlags);
|
||||
TemporaryRef<DeprecatedTextureHost> CreateBasicDeprecatedTextureHost(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aDeprecatedTextureHostFlags,
|
||||
uint32_t aTextureFlags);
|
||||
|
||||
TemporaryRef<TextureHost> CreateTextureHostD3D9(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aTextureHostFlags,
|
||||
uint32_t aTextureFlags)
|
||||
TemporaryRef<DeprecatedTextureHost> CreateDeprecatedTextureHostD3D9(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aDeprecatedTextureHostFlags,
|
||||
uint32_t aTextureFlags)
|
||||
{
|
||||
NS_RUNTIMEABORT("not implemented");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
TemporaryRef<TextureHost> CreateTextureHostD3D11(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aTextureHostFlags,
|
||||
uint32_t aTextureFlags);
|
||||
TemporaryRef<DeprecatedTextureHost> CreateDeprecatedTextureHostD3D11(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aDeprecatedTextureHostFlags,
|
||||
uint32_t aTextureFlags);
|
||||
#endif
|
||||
|
||||
/* static */ TemporaryRef<TextureHost>
|
||||
TextureHost::CreateTextureHost(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aTextureHostFlags,
|
||||
uint32_t aTextureFlags)
|
||||
/* static */ TemporaryRef<DeprecatedTextureHost>
|
||||
DeprecatedTextureHost::CreateDeprecatedTextureHost(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aDeprecatedTextureHostFlags,
|
||||
uint32_t aTextureFlags)
|
||||
{
|
||||
switch (Compositor::GetBackend()) {
|
||||
case LAYERS_OPENGL:
|
||||
return CreateTextureHostOGL(aDescriptorType,
|
||||
aTextureHostFlags,
|
||||
aTextureFlags);
|
||||
return CreateDeprecatedTextureHostOGL(aDescriptorType,
|
||||
aDeprecatedTextureHostFlags,
|
||||
aTextureFlags);
|
||||
case LAYERS_D3D9:
|
||||
return CreateTextureHostD3D9(aDescriptorType,
|
||||
aTextureHostFlags,
|
||||
aTextureFlags);
|
||||
return CreateDeprecatedTextureHostD3D9(aDescriptorType,
|
||||
aDeprecatedTextureHostFlags,
|
||||
aTextureFlags);
|
||||
#ifdef XP_WIN
|
||||
case LAYERS_D3D11:
|
||||
return CreateTextureHostD3D11(aDescriptorType,
|
||||
aTextureHostFlags,
|
||||
aTextureFlags);
|
||||
return CreateDeprecatedTextureHostD3D11(aDescriptorType,
|
||||
aDeprecatedTextureHostFlags,
|
||||
aTextureFlags);
|
||||
#endif
|
||||
case LAYERS_BASIC:
|
||||
return CreateBasicTextureHost(aDescriptorType,
|
||||
aTextureHostFlags,
|
||||
aTextureFlags);
|
||||
return CreateBasicDeprecatedTextureHost(aDescriptorType,
|
||||
aDeprecatedTextureHostFlags,
|
||||
aTextureFlags);
|
||||
default:
|
||||
MOZ_CRASH("Couldn't create texture host");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TextureHost::TextureHost()
|
||||
DeprecatedTextureHost::DeprecatedTextureHost()
|
||||
: mFlags(0)
|
||||
, mBuffer(nullptr)
|
||||
, mFormat(gfx::FORMAT_UNKNOWN)
|
||||
, mDeAllocator(nullptr)
|
||||
{
|
||||
MOZ_COUNT_CTOR(TextureHost);
|
||||
MOZ_COUNT_CTOR(DeprecatedTextureHost);
|
||||
}
|
||||
|
||||
TextureHost::~TextureHost()
|
||||
DeprecatedTextureHost::~DeprecatedTextureHost()
|
||||
{
|
||||
if (mBuffer) {
|
||||
if (!(mFlags & OwnByClient)) {
|
||||
@ -85,21 +85,21 @@ TextureHost::~TextureHost()
|
||||
}
|
||||
delete mBuffer;
|
||||
}
|
||||
MOZ_COUNT_DTOR(TextureHost);
|
||||
MOZ_COUNT_DTOR(DeprecatedTextureHost);
|
||||
}
|
||||
|
||||
void
|
||||
TextureHost::Update(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion* aRegion,
|
||||
nsIntPoint* aOffset)
|
||||
DeprecatedTextureHost::Update(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion* aRegion,
|
||||
nsIntPoint* aOffset)
|
||||
{
|
||||
UpdateImpl(aImage, aRegion, aOffset);
|
||||
}
|
||||
|
||||
void
|
||||
TextureHost::SwapTextures(const SurfaceDescriptor& aImage,
|
||||
SurfaceDescriptor* aResult,
|
||||
nsIntRegion* aRegion)
|
||||
DeprecatedTextureHost::SwapTextures(const SurfaceDescriptor& aImage,
|
||||
SurfaceDescriptor* aResult,
|
||||
nsIntRegion* aRegion)
|
||||
{
|
||||
SwapTexturesImpl(aImage, aRegion);
|
||||
|
||||
@ -119,7 +119,7 @@ TextureSource::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
}
|
||||
|
||||
void
|
||||
TextureHost::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
DeprecatedTextureHost::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
{
|
||||
aTo += aPrefix;
|
||||
aTo += nsPrintfCString("%s (0x%p)", Name(), this);
|
||||
|
@ -30,7 +30,7 @@ class TextureSourceBasic;
|
||||
class TextureParent;
|
||||
|
||||
/**
|
||||
* A view on a TextureHost where the texture is internally represented as tiles
|
||||
* A view on a DeprecatedTextureHost where the texture is internally represented as tiles
|
||||
* (contrast with a tiled buffer, where each texture is a tile). For iteration by
|
||||
* the texture's buffer host.
|
||||
* This is only useful when the underlying surface is too big to fit in one
|
||||
@ -103,28 +103,30 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* TextureHost is a thin abstraction over texture data that need to be shared
|
||||
* or transfered from the content process to the compositor process. It is the
|
||||
* compositor-side half of a TextureClient/TextureHost pair. A corresponding
|
||||
* TextureClient lives on the client-side.
|
||||
* XXX - This class is deprectaed, will be removed soon.
|
||||
*
|
||||
* TextureHost only knows how to deserialize or synchronize generic image data
|
||||
* DeprecatedTextureHost is a thin abstraction over texture data that need to be shared
|
||||
* or transfered from the content process to the compositor process. It is the
|
||||
* compositor-side half of a DeprecatedTextureClient/DeprecatedTextureHost pair. A corresponding
|
||||
* DeprecatedTextureClient lives on the client-side.
|
||||
*
|
||||
* DeprecatedTextureHost only knows how to deserialize or synchronize generic image data
|
||||
* (SurfaceDescriptor) and provide access to one or more TextureSource objects
|
||||
* (these provide the necessary APIs for compositor backends to composite the
|
||||
* image).
|
||||
*
|
||||
* A TextureHost should mostly correspond to one or several SurfaceDescriptor
|
||||
* A DeprecatedTextureHost should mostly correspond to one or several SurfaceDescriptor
|
||||
* types. This means that for YCbCr planes, even though they are represented as
|
||||
* 3 textures internally, use 1 TextureHost and not 3, because the 3 planes
|
||||
* 3 textures internally, use 1 DeprecatedTextureHost and not 3, because the 3 planes
|
||||
* arrive in the same IPC message.
|
||||
*
|
||||
* The Lock/Unlock mecanism here mirrors Lock/Unlock in TextureClient. These two
|
||||
* The Lock/Unlock mecanism here mirrors Lock/Unlock in DeprecatedTextureClient. These two
|
||||
* methods don't always have to use blocking locks, unless a resource is shared
|
||||
* between the two sides (like shared texture handles). For instance, in some
|
||||
* cases the data received in Update(...) is a copy in shared memory of the data
|
||||
* owned by the content process, in which case no blocking lock is required.
|
||||
*
|
||||
* TextureHosts can be changed at any time, for example if we receive a
|
||||
* DeprecatedTextureHosts can be changed at any time, for example if we receive a
|
||||
* SurfaceDescriptor type that was not expected. This should be an incentive
|
||||
* to keep the ownership model simple (especially on the OpenGL case, where
|
||||
* we have additionnal constraints).
|
||||
@ -135,38 +137,38 @@ public:
|
||||
* composition when the compositor 'ticks'. We may composite many times before
|
||||
* update.
|
||||
*
|
||||
* Update ends up at TextureHost::UpdateImpl. It always occurs in a layers
|
||||
* Update ends up at DeprecatedTextureHost::UpdateImpl. It always occurs in a layers
|
||||
* transacton. (TextureParent should call EnsureTexture before updating to
|
||||
* ensure the TextureHost exists and is of the correct type).
|
||||
* ensure the DeprecatedTextureHost exists and is of the correct type).
|
||||
*
|
||||
* CompositableHost::Composite does compositing. It should check the texture
|
||||
* host exists (and give up otherwise), then lock the texture host
|
||||
* (TextureHost::Lock). Then it passes the texture host to the Compositor in an
|
||||
* (DeprecatedTextureHost::Lock). Then it passes the texture host to the Compositor in an
|
||||
* effect as a texture source, which does the actual composition. Finally the
|
||||
* compositable calls Unlock on the TextureHost.
|
||||
* compositable calls Unlock on the DeprecatedTextureHost.
|
||||
*
|
||||
* The class TextureImageTextureHostOGL is a good example of a TextureHost
|
||||
* The class TextureImageDeprecatedTextureHostOGL is a good example of a DeprecatedTextureHost
|
||||
* implementation.
|
||||
*
|
||||
* This class is used only on the compositor side.
|
||||
*/
|
||||
class TextureHost : public TextureSource
|
||||
class DeprecatedTextureHost : public TextureSource
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create a new texture host to handle surfaces of aDescriptorType
|
||||
*
|
||||
* @param aDescriptorType The SurfaceDescriptor type being passed
|
||||
* @param aTextureHostFlags Modifier flags that specify changes in
|
||||
* the usage of a aDescriptorType, see TextureHostFlags
|
||||
* @param aTextureFlags Flags to pass to the new TextureHost
|
||||
* @param aDeprecatedTextureHostFlags Modifier flags that specify changes in
|
||||
* the usage of a aDescriptorType, see DeprecatedTextureHostFlags
|
||||
* @param aTextureFlags Flags to pass to the new DeprecatedTextureHost
|
||||
*/
|
||||
static TemporaryRef<TextureHost> CreateTextureHost(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aTextureHostFlags,
|
||||
static TemporaryRef<DeprecatedTextureHost> CreateDeprecatedTextureHost(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aDeprecatedTextureHostFlags,
|
||||
uint32_t aTextureFlags);
|
||||
|
||||
TextureHost();
|
||||
virtual ~TextureHost();
|
||||
DeprecatedTextureHost();
|
||||
virtual ~DeprecatedTextureHost();
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const { return mFormat; }
|
||||
|
||||
@ -200,7 +202,7 @@ public:
|
||||
const gfx::IntSize& aSize) {}
|
||||
|
||||
/**
|
||||
* Lock the texture host for compositing, returns true if the TextureHost is
|
||||
* Lock the texture host for compositing, returns true if the DeprecatedTextureHost is
|
||||
* valid for composition.
|
||||
*/
|
||||
virtual bool Lock() { return IsValid(); }
|
||||
@ -216,10 +218,10 @@ public:
|
||||
TextureFlags GetFlags() { return mFlags; }
|
||||
|
||||
/**
|
||||
* Sets ths TextureHost's compositor.
|
||||
* A TextureHost can change compositor on certain occasions, in particular if
|
||||
* Sets ths DeprecatedTextureHost's compositor.
|
||||
* A DeprecatedTextureHost can change compositor on certain occasions, in particular if
|
||||
* it belongs to an async Compositable.
|
||||
* aCompositor can be null, in which case the TextureHost must cleanup all
|
||||
* aCompositor can be null, in which case the DeprecatedTextureHost must cleanup all
|
||||
* of it's device textures.
|
||||
*/
|
||||
virtual void SetCompositor(Compositor* aCompositor) {}
|
||||
@ -229,11 +231,11 @@ public:
|
||||
return mDeAllocator;
|
||||
}
|
||||
|
||||
bool operator== (const TextureHost& o) const
|
||||
bool operator== (const DeprecatedTextureHost& o) const
|
||||
{
|
||||
return GetIdentifier() == o.GetIdentifier();
|
||||
}
|
||||
bool operator!= (const TextureHost& o) const
|
||||
bool operator!= (const DeprecatedTextureHost& o) const
|
||||
{
|
||||
return GetIdentifier() != o.GetIdentifier();
|
||||
}
|
||||
@ -258,11 +260,11 @@ public:
|
||||
*/
|
||||
virtual void EnsureBuffer(const nsIntSize& aSize, gfxASurface::gfxContentType aType)
|
||||
{
|
||||
NS_RUNTIMEABORT("TextureHost doesn't support EnsureBuffer");
|
||||
NS_RUNTIMEABORT("DeprecatedTextureHost doesn't support EnsureBuffer");
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the contents of this TextureHost to aDest. aDest must already
|
||||
* Copy the contents of this DeprecatedTextureHost to aDest. aDest must already
|
||||
* have a suitable buffer allocated using EnsureBuffer.
|
||||
*
|
||||
* @param aSourceRect Area of this texture host to copy.
|
||||
@ -270,10 +272,10 @@ public:
|
||||
* @param aDestRect Destination rect.
|
||||
*/
|
||||
virtual void CopyTo(const nsIntRect& aSourceRect,
|
||||
TextureHost *aDest,
|
||||
DeprecatedTextureHost *aDest,
|
||||
const nsIntRect& aDestRect)
|
||||
{
|
||||
NS_RUNTIMEABORT("TextureHost doesn't support CopyTo");
|
||||
NS_RUNTIMEABORT("DeprecatedTextureHost doesn't support CopyTo");
|
||||
}
|
||||
|
||||
|
||||
@ -281,11 +283,11 @@ public:
|
||||
|
||||
/**
|
||||
* Set a SurfaceDescriptor for this texture host. By setting a buffer and
|
||||
* allocator/de-allocator for the TextureHost, you cause the TextureHost to
|
||||
* allocator/de-allocator for the DeprecatedTextureHost, you cause the DeprecatedTextureHost to
|
||||
* retain a SurfaceDescriptor.
|
||||
* Ownership of the SurfaceDescriptor passes to this.
|
||||
*/
|
||||
// only made virtual to allow overriding in GrallocTextureHostOGL, for hacky fix in gecko 23 for bug 862324.
|
||||
// only made virtual to allow overriding in GrallocDeprecatedTextureHostOGL, for hacky fix in gecko 23 for bug 862324.
|
||||
// see bug 865908 about fixing this.
|
||||
virtual void SetBuffer(SurfaceDescriptor* aBuffer, ISurfaceAllocator* aAllocator)
|
||||
{
|
||||
@ -300,7 +302,7 @@ public:
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Should be implemented by the backend-specific TextureHost classes
|
||||
* Should be implemented by the backend-specific DeprecatedTextureHost classes
|
||||
*
|
||||
* It should not take a reference to aImage, unless it knows the data
|
||||
* to be thread-safe.
|
||||
@ -313,7 +315,7 @@ protected:
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be implemented by the backend-specific TextureHost classes.
|
||||
* Should be implemented by the backend-specific DeprecatedTextureHost classes.
|
||||
*
|
||||
* Doesn't need to do the actual surface descriptor swap, just
|
||||
* any preparation work required to use the new descriptor.
|
||||
@ -347,29 +349,29 @@ protected:
|
||||
ISurfaceAllocator* mDeAllocator;
|
||||
};
|
||||
|
||||
class AutoLockTextureHost
|
||||
class AutoLockDeprecatedTextureHost
|
||||
{
|
||||
public:
|
||||
AutoLockTextureHost(TextureHost* aHost)
|
||||
: mTextureHost(aHost)
|
||||
AutoLockDeprecatedTextureHost(DeprecatedTextureHost* aHost)
|
||||
: mDeprecatedTextureHost(aHost)
|
||||
, mIsValid(true)
|
||||
{
|
||||
if (mTextureHost) {
|
||||
mIsValid = mTextureHost->Lock();
|
||||
if (mDeprecatedTextureHost) {
|
||||
mIsValid = mDeprecatedTextureHost->Lock();
|
||||
}
|
||||
}
|
||||
|
||||
~AutoLockTextureHost()
|
||||
~AutoLockDeprecatedTextureHost()
|
||||
{
|
||||
if (mTextureHost && mIsValid) {
|
||||
mTextureHost->Unlock();
|
||||
if (mDeprecatedTextureHost && mIsValid) {
|
||||
mDeprecatedTextureHost->Unlock();
|
||||
}
|
||||
}
|
||||
|
||||
bool IsValid() { return mIsValid; }
|
||||
|
||||
private:
|
||||
TextureHost *mTextureHost;
|
||||
DeprecatedTextureHost *mDeprecatedTextureHost;
|
||||
bool mIsValid;
|
||||
};
|
||||
|
||||
|
@ -184,11 +184,11 @@ TiledContentHost::RenderTile(const TiledTexture& aTile,
|
||||
const nsIntPoint& aTextureOffset,
|
||||
const nsIntSize& aTextureBounds)
|
||||
{
|
||||
MOZ_ASSERT(aTile.mTextureHost, "Trying to render a placeholder tile?");
|
||||
MOZ_ASSERT(aTile.mDeprecatedTextureHost, "Trying to render a placeholder tile?");
|
||||
|
||||
RefPtr<TexturedEffect> effect =
|
||||
CreateTexturedEffect(aTile.mTextureHost, aFilter);
|
||||
if (aTile.mTextureHost->Lock()) {
|
||||
CreateTexturedEffect(aTile.mDeprecatedTextureHost, aFilter);
|
||||
if (aTile.mDeprecatedTextureHost->Lock()) {
|
||||
aEffectChain.mPrimaryEffect = effect;
|
||||
} else {
|
||||
return;
|
||||
@ -209,7 +209,7 @@ TiledContentHost::RenderTile(const TiledTexture& aTile,
|
||||
graphicsRect, aClipRect, aTransform, aOffset);
|
||||
}
|
||||
|
||||
aTile.mTextureHost->Unlock();
|
||||
aTile.mDeprecatedTextureHost->Unlock();
|
||||
}
|
||||
|
||||
void
|
||||
@ -294,16 +294,16 @@ void
|
||||
TiledTexture::Validate(gfxReusableSurfaceWrapper* aReusableSurface, Compositor* aCompositor, uint16_t aSize)
|
||||
{
|
||||
TextureFlags flags = 0;
|
||||
if (!mTextureHost) {
|
||||
if (!mDeprecatedTextureHost) {
|
||||
// convert placeholder tile to a real tile
|
||||
mTextureHost = TextureHost::CreateTextureHost(SurfaceDescriptor::Tnull_t,
|
||||
mDeprecatedTextureHost = DeprecatedTextureHost::CreateDeprecatedTextureHost(SurfaceDescriptor::Tnull_t,
|
||||
TEXTURE_HOST_TILED,
|
||||
flags);
|
||||
mTextureHost->SetCompositor(aCompositor);
|
||||
mDeprecatedTextureHost->SetCompositor(aCompositor);
|
||||
flags |= NewTile;
|
||||
}
|
||||
|
||||
mTextureHost->Update(aReusableSurface, flags, gfx::IntSize(aSize, aSize));
|
||||
mDeprecatedTextureHost->Update(aReusableSurface, flags, gfx::IntSize(aSize, aSize));
|
||||
}
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
@ -333,7 +333,7 @@ TiledContentHost::Dump(FILE* aFile,
|
||||
for (;it != stop; ++it) {
|
||||
fprintf(aFile, "%s", aPrefix);
|
||||
fprintf(aFile, aDumpHtml ? "<li> <a href=" : "Tile ");
|
||||
DumpTextureHost(aFile, it->mTextureHost);
|
||||
DumpDeprecatedTextureHost(aFile, it->mDeprecatedTextureHost);
|
||||
fprintf(aFile, aDumpHtml ? " >Tile</a></li>" : " ");
|
||||
}
|
||||
if (aDumpHtml) {
|
||||
|
@ -23,41 +23,41 @@ public:
|
||||
// essentially, this is a sentinel used to represent an invalid or blank
|
||||
// tile.
|
||||
TiledTexture()
|
||||
: mTextureHost(nullptr)
|
||||
: mDeprecatedTextureHost(nullptr)
|
||||
{}
|
||||
|
||||
// Constructs a TiledTexture from a TextureHost.
|
||||
TiledTexture(TextureHost* aTextureHost)
|
||||
: mTextureHost(aTextureHost)
|
||||
// Constructs a TiledTexture from a DeprecatedTextureHost.
|
||||
TiledTexture(DeprecatedTextureHost* aDeprecatedTextureHost)
|
||||
: mDeprecatedTextureHost(aDeprecatedTextureHost)
|
||||
{}
|
||||
|
||||
TiledTexture(const TiledTexture& o) {
|
||||
mTextureHost = o.mTextureHost;
|
||||
mDeprecatedTextureHost = o.mDeprecatedTextureHost;
|
||||
}
|
||||
TiledTexture& operator=(const TiledTexture& o) {
|
||||
if (this == &o) {
|
||||
return *this;
|
||||
}
|
||||
mTextureHost = o.mTextureHost;
|
||||
mDeprecatedTextureHost = o.mDeprecatedTextureHost;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Validate(gfxReusableSurfaceWrapper* aReusableSurface, Compositor* aCompositor, uint16_t aSize);
|
||||
|
||||
bool operator== (const TiledTexture& o) const {
|
||||
if (!mTextureHost || !o.mTextureHost) {
|
||||
return mTextureHost == o.mTextureHost;
|
||||
if (!mDeprecatedTextureHost || !o.mDeprecatedTextureHost) {
|
||||
return mDeprecatedTextureHost == o.mDeprecatedTextureHost;
|
||||
}
|
||||
return *mTextureHost == *o.mTextureHost;
|
||||
return *mDeprecatedTextureHost == *o.mDeprecatedTextureHost;
|
||||
}
|
||||
bool operator!= (const TiledTexture& o) const {
|
||||
if (!mTextureHost || !o.mTextureHost) {
|
||||
return mTextureHost != o.mTextureHost;
|
||||
if (!mDeprecatedTextureHost || !o.mDeprecatedTextureHost) {
|
||||
return mDeprecatedTextureHost != o.mDeprecatedTextureHost;
|
||||
}
|
||||
return *mTextureHost != *o.mTextureHost;
|
||||
return *mDeprecatedTextureHost != *o.mDeprecatedTextureHost;
|
||||
}
|
||||
|
||||
RefPtr<TextureHost> mTextureHost;
|
||||
RefPtr<DeprecatedTextureHost> mDeprecatedTextureHost;
|
||||
};
|
||||
|
||||
class TiledLayerBufferComposite
|
||||
@ -185,7 +185,7 @@ public:
|
||||
|
||||
virtual TiledLayerComposer* AsTiledLayerComposer() MOZ_OVERRIDE { return this; }
|
||||
|
||||
virtual void EnsureTextureHost(TextureIdentifier aTextureId,
|
||||
virtual void EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo) MOZ_OVERRIDE
|
||||
|
@ -19,18 +19,18 @@ using namespace gfx;
|
||||
|
||||
namespace layers {
|
||||
|
||||
TemporaryRef<TextureHost>
|
||||
CreateTextureHostD3D11(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aTextureHostFlags,
|
||||
uint32_t aTextureFlags)
|
||||
TemporaryRef<DeprecatedTextureHost>
|
||||
CreateDeprecatedTextureHostD3D11(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aDeprecatedTextureHostFlags,
|
||||
uint32_t aTextureFlags)
|
||||
{
|
||||
RefPtr<TextureHost> result;
|
||||
RefPtr<DeprecatedTextureHost> result;
|
||||
if (aDescriptorType == SurfaceDescriptor::TYCbCrImage) {
|
||||
result = new TextureHostYCbCrD3D11();
|
||||
result = new DeprecatedTextureHostYCbCrD3D11();
|
||||
} else if (aDescriptorType == SurfaceDescriptor::TSurfaceDescriptorD3D10) {
|
||||
result = new TextureHostDXGID3D11();
|
||||
result = new DeprecatedTextureHostDXGID3D11();
|
||||
} else {
|
||||
result = new TextureHostShmemD3D11();
|
||||
result = new DeprecatedTextureHostShmemD3D11();
|
||||
}
|
||||
|
||||
result->SetFlags(aTextureFlags);
|
||||
@ -63,14 +63,14 @@ CompositingRenderTargetD3D11::GetSize() const
|
||||
return TextureSourceD3D11::GetSize();
|
||||
}
|
||||
|
||||
TextureClientD3D11::TextureClientD3D11(CompositableForwarder* aCompositableForwarder, const TextureInfo& aTextureInfo)
|
||||
: TextureClient(aCompositableForwarder, aTextureInfo)
|
||||
DeprecatedTextureClientD3D11::DeprecatedTextureClientD3D11(CompositableForwarder* aCompositableForwarder, const TextureInfo& aTextureInfo)
|
||||
: DeprecatedTextureClient(aCompositableForwarder, aTextureInfo)
|
||||
, mIsLocked(false)
|
||||
{
|
||||
mTextureInfo = aTextureInfo;
|
||||
}
|
||||
|
||||
TextureClientD3D11::~TextureClientD3D11()
|
||||
DeprecatedTextureClientD3D11::~DeprecatedTextureClientD3D11()
|
||||
{
|
||||
mDescriptor = SurfaceDescriptor();
|
||||
|
||||
@ -78,7 +78,7 @@ TextureClientD3D11::~TextureClientD3D11()
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientD3D11::EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType)
|
||||
DeprecatedTextureClientD3D11::EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType)
|
||||
{
|
||||
D3D10_TEXTURE2D_DESC desc;
|
||||
|
||||
@ -127,7 +127,7 @@ TextureClientD3D11::EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentT
|
||||
}
|
||||
|
||||
gfxASurface*
|
||||
TextureClientD3D11::LockSurface()
|
||||
DeprecatedTextureClientD3D11::LockSurface()
|
||||
{
|
||||
EnsureSurface();
|
||||
|
||||
@ -136,7 +136,7 @@ TextureClientD3D11::LockSurface()
|
||||
}
|
||||
|
||||
DrawTarget*
|
||||
TextureClientD3D11::LockDrawTarget()
|
||||
DeprecatedTextureClientD3D11::LockDrawTarget()
|
||||
{
|
||||
EnsureDrawTarget();
|
||||
|
||||
@ -145,7 +145,7 @@ TextureClientD3D11::LockDrawTarget()
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientD3D11::Unlock()
|
||||
DeprecatedTextureClientD3D11::Unlock()
|
||||
{
|
||||
// TODO - Things seem to believe they can hold on to our surface... well...
|
||||
// They shouldn't!!
|
||||
@ -153,7 +153,7 @@ TextureClientD3D11::Unlock()
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientD3D11::SetDescriptor(const SurfaceDescriptor& aDescriptor)
|
||||
DeprecatedTextureClientD3D11::SetDescriptor(const SurfaceDescriptor& aDescriptor)
|
||||
{
|
||||
if (aDescriptor.type() == SurfaceDescriptor::Tnull_t) {
|
||||
EnsureAllocated(mSize, mContentType);
|
||||
@ -177,7 +177,7 @@ TextureClientD3D11::SetDescriptor(const SurfaceDescriptor& aDescriptor)
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientD3D11::EnsureSurface()
|
||||
DeprecatedTextureClientD3D11::EnsureSurface()
|
||||
{
|
||||
if (mSurface) {
|
||||
return;
|
||||
@ -189,7 +189,7 @@ TextureClientD3D11::EnsureSurface()
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientD3D11::EnsureDrawTarget()
|
||||
DeprecatedTextureClientD3D11::EnsureDrawTarget()
|
||||
{
|
||||
if (mDrawTarget) {
|
||||
return;
|
||||
@ -217,7 +217,7 @@ TextureClientD3D11::EnsureDrawTarget()
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientD3D11::LockTexture()
|
||||
DeprecatedTextureClientD3D11::LockTexture()
|
||||
{
|
||||
RefPtr<IDXGIKeyedMutex> mutex;
|
||||
mTexture->QueryInterface((IDXGIKeyedMutex**)byRef(mutex));
|
||||
@ -227,7 +227,7 @@ TextureClientD3D11::LockTexture()
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientD3D11::ReleaseTexture()
|
||||
DeprecatedTextureClientD3D11::ReleaseTexture()
|
||||
{
|
||||
// TODO - Bas - We seem to have places that unlock without ever having locked,
|
||||
// that's kind of bad.
|
||||
@ -247,7 +247,7 @@ TextureClientD3D11::ReleaseTexture()
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientD3D11::ClearDT()
|
||||
DeprecatedTextureClientD3D11::ClearDT()
|
||||
{
|
||||
// An Azure DrawTarget needs to be locked when it gets NULL'ed as this is
|
||||
// when it calls EndDraw. This EndDraw should not execute anything so it
|
||||
@ -262,7 +262,7 @@ TextureClientD3D11::ClearDT()
|
||||
}
|
||||
|
||||
IntSize
|
||||
TextureHostShmemD3D11::GetSize() const
|
||||
DeprecatedTextureHostShmemD3D11::GetSize() const
|
||||
{
|
||||
if (mIterating) {
|
||||
gfx::IntRect rect = GetTileRect(mCurrentTile);
|
||||
@ -272,7 +272,7 @@ TextureHostShmemD3D11::GetSize() const
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
TextureHostShmemD3D11::GetTileRect()
|
||||
DeprecatedTextureHostShmemD3D11::GetTileRect()
|
||||
{
|
||||
IntRect rect = GetTileRect(mCurrentTile);
|
||||
return nsIntRect(rect.x, rect.y, rect.width, rect.height);
|
||||
@ -288,14 +288,14 @@ static uint32_t GetRequiredTiles(uint32_t aSize, uint32_t aMaxSize)
|
||||
}
|
||||
|
||||
void
|
||||
TextureHostShmemD3D11::SetCompositor(Compositor* aCompositor)
|
||||
DeprecatedTextureHostShmemD3D11::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
CompositorD3D11 *d3dCompositor = static_cast<CompositorD3D11*>(aCompositor);
|
||||
mDevice = d3dCompositor ? d3dCompositor->GetDevice() : nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
TextureHostShmemD3D11::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
DeprecatedTextureHostShmemD3D11::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion *aRegion,
|
||||
nsIntPoint *aOffset)
|
||||
{
|
||||
@ -365,7 +365,7 @@ TextureHostShmemD3D11::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
}
|
||||
|
||||
IntRect
|
||||
TextureHostShmemD3D11::GetTileRect(uint32_t aID) const
|
||||
DeprecatedTextureHostShmemD3D11::GetTileRect(uint32_t aID) const
|
||||
{
|
||||
uint32_t maxSize = GetMaxTextureSizeForFeatureLevel(mDevice->GetFeatureLevel());
|
||||
uint32_t horizontalTiles = GetRequiredTiles(mSize.width, maxSize);
|
||||
@ -381,33 +381,33 @@ TextureHostShmemD3D11::GetTileRect(uint32_t aID) const
|
||||
}
|
||||
|
||||
void
|
||||
TextureHostDXGID3D11::SetCompositor(Compositor* aCompositor)
|
||||
DeprecatedTextureHostDXGID3D11::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
CompositorD3D11 *d3dCompositor = static_cast<CompositorD3D11*>(aCompositor);
|
||||
mDevice = d3dCompositor ? d3dCompositor->GetDevice() : nullptr;
|
||||
}
|
||||
|
||||
IntSize
|
||||
TextureHostDXGID3D11::GetSize() const
|
||||
DeprecatedTextureHostDXGID3D11::GetSize() const
|
||||
{
|
||||
return TextureSourceD3D11::GetSize();
|
||||
}
|
||||
|
||||
bool
|
||||
TextureHostDXGID3D11::Lock()
|
||||
DeprecatedTextureHostDXGID3D11::Lock()
|
||||
{
|
||||
LockTexture();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
TextureHostDXGID3D11::Unlock()
|
||||
DeprecatedTextureHostDXGID3D11::Unlock()
|
||||
{
|
||||
ReleaseTexture();
|
||||
}
|
||||
|
||||
void
|
||||
TextureHostDXGID3D11::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
DeprecatedTextureHostDXGID3D11::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion *aRegion,
|
||||
nsIntPoint *aOffset)
|
||||
{
|
||||
@ -424,7 +424,7 @@ TextureHostDXGID3D11::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
}
|
||||
|
||||
void
|
||||
TextureHostDXGID3D11::LockTexture()
|
||||
DeprecatedTextureHostDXGID3D11::LockTexture()
|
||||
{
|
||||
RefPtr<IDXGIKeyedMutex> mutex;
|
||||
mTextures[0]->QueryInterface((IDXGIKeyedMutex**)byRef(mutex));
|
||||
@ -433,7 +433,7 @@ TextureHostDXGID3D11::LockTexture()
|
||||
}
|
||||
|
||||
void
|
||||
TextureHostDXGID3D11::ReleaseTexture()
|
||||
DeprecatedTextureHostDXGID3D11::ReleaseTexture()
|
||||
{
|
||||
RefPtr<IDXGIKeyedMutex> mutex;
|
||||
mTextures[0]->QueryInterface((IDXGIKeyedMutex**)byRef(mutex));
|
||||
@ -442,20 +442,20 @@ TextureHostDXGID3D11::ReleaseTexture()
|
||||
}
|
||||
|
||||
void
|
||||
TextureHostYCbCrD3D11::SetCompositor(Compositor* aCompositor)
|
||||
DeprecatedTextureHostYCbCrD3D11::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
CompositorD3D11 *d3dCompositor = static_cast<CompositorD3D11*>(aCompositor);
|
||||
mDevice = d3dCompositor ? d3dCompositor->GetDevice() : nullptr;
|
||||
}
|
||||
|
||||
IntSize
|
||||
TextureHostYCbCrD3D11::GetSize() const
|
||||
DeprecatedTextureHostYCbCrD3D11::GetSize() const
|
||||
{
|
||||
return TextureSourceD3D11::GetSize();
|
||||
}
|
||||
|
||||
void
|
||||
TextureHostYCbCrD3D11::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
DeprecatedTextureHostYCbCrD3D11::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion *aRegion,
|
||||
nsIntPoint *aOffset)
|
||||
{
|
||||
|
@ -62,13 +62,13 @@ private:
|
||||
RefPtr<ID3D11RenderTargetView> mRTView;
|
||||
};
|
||||
|
||||
class TextureClientD3D11 : public TextureClient
|
||||
class DeprecatedTextureClientD3D11 : public DeprecatedTextureClient
|
||||
{
|
||||
public:
|
||||
TextureClientD3D11(CompositableForwarder* aCompositableForwarder, const TextureInfo& aTextureInfo);
|
||||
~TextureClientD3D11();
|
||||
DeprecatedTextureClientD3D11(CompositableForwarder* aCompositableForwarder, const TextureInfo& aTextureInfo);
|
||||
~DeprecatedTextureClientD3D11();
|
||||
|
||||
virtual bool SupportsType(TextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_CONTENT; }
|
||||
virtual bool SupportsType(DeprecatedTextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_CONTENT; }
|
||||
|
||||
virtual void EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType) MOZ_OVERRIDE;
|
||||
|
||||
@ -95,12 +95,12 @@ private:
|
||||
gfxContentType mContentType;
|
||||
};
|
||||
|
||||
class TextureHostShmemD3D11 : public TextureHost
|
||||
class DeprecatedTextureHostShmemD3D11 : public DeprecatedTextureHost
|
||||
, public TextureSourceD3D11
|
||||
, public TileIterator
|
||||
{
|
||||
public:
|
||||
TextureHostShmemD3D11()
|
||||
DeprecatedTextureHostShmemD3D11()
|
||||
: mDevice(nullptr)
|
||||
, mIsTiled(false)
|
||||
, mCurrentTile(0)
|
||||
@ -128,7 +128,7 @@ public:
|
||||
}
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual const char* Name() { return "TextureHostShmemD3D11"; }
|
||||
virtual const char* Name() { return "DeprecatedTextureHostShmemD3D11"; }
|
||||
#endif
|
||||
|
||||
virtual void BeginTileIteration() MOZ_OVERRIDE {
|
||||
@ -162,11 +162,11 @@ private:
|
||||
bool mIterating;
|
||||
};
|
||||
|
||||
class TextureHostDXGID3D11 : public TextureHost
|
||||
class DeprecatedTextureHostDXGID3D11 : public DeprecatedTextureHost
|
||||
, public TextureSourceD3D11
|
||||
{
|
||||
public:
|
||||
TextureHostDXGID3D11()
|
||||
DeprecatedTextureHostDXGID3D11()
|
||||
: mDevice(nullptr)
|
||||
{
|
||||
}
|
||||
@ -186,7 +186,7 @@ public:
|
||||
}
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual const char* Name() { return "TextureHostDXGID3D11"; }
|
||||
virtual const char* Name() { return "DeprecatedTextureHostDXGID3D11"; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
@ -202,11 +202,11 @@ private:
|
||||
RefPtr<ID3D11Device> mDevice;
|
||||
};
|
||||
|
||||
class TextureHostYCbCrD3D11 : public TextureHost
|
||||
class DeprecatedTextureHostYCbCrD3D11 : public DeprecatedTextureHost
|
||||
, public TextureSourceD3D11
|
||||
{
|
||||
public:
|
||||
TextureHostYCbCrD3D11()
|
||||
DeprecatedTextureHostYCbCrD3D11()
|
||||
: mDevice(nullptr)
|
||||
{
|
||||
mFormat = gfx::FORMAT_YUV;
|
||||
@ -226,7 +226,7 @@ public:
|
||||
}
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual const char* Name() MOZ_OVERRIDE { return "TextureImageTextureHostD3D11"; }
|
||||
virtual const char* Name() MOZ_OVERRIDE { return "TextureImageDeprecatedTextureHostD3D11"; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
@ -19,7 +19,7 @@ class CompositableClient;
|
||||
class TextureFactoryIdentifier;
|
||||
class SurfaceDescriptor;
|
||||
class ThebesBufferData;
|
||||
class TextureClient;
|
||||
class DeprecatedTextureClient;
|
||||
class BasicTiledLayerBuffer;
|
||||
|
||||
/**
|
||||
@ -35,7 +35,7 @@ class BasicTiledLayerBuffer;
|
||||
class CompositableForwarder : public ISurfaceAllocator
|
||||
{
|
||||
friend class AutoOpenSurface;
|
||||
friend class TextureClientShmem;
|
||||
friend class DeprecatedTextureClientShmem;
|
||||
public:
|
||||
typedef gfxASurface::gfxContentType gfxContentType;
|
||||
|
||||
|
@ -32,7 +32,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
||||
static_cast<CompositableParent*>(op.compositableParent());
|
||||
CompositableHost* compositable = compositableParent->GetCompositableHost();
|
||||
|
||||
compositable->EnsureTextureHost(op.textureId(), op.descriptor(),
|
||||
compositable->EnsureDeprecatedTextureHost(op.textureId(), op.descriptor(),
|
||||
compositableParent->GetCompositableManager(),
|
||||
op.textureInfo());
|
||||
|
||||
@ -46,7 +46,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
||||
static_cast<CompositableParent*>(op.compositableParent());
|
||||
CompositableHost* compositable = compositableParent->GetCompositableHost();
|
||||
|
||||
compositable->EnsureTextureHostIncremental(compositableParent->GetCompositableManager(),
|
||||
compositable->EnsureDeprecatedTextureHostIncremental(compositableParent->GetCompositableManager(),
|
||||
op.textureInfo(),
|
||||
op.bufferRect());
|
||||
break;
|
||||
@ -88,11 +88,11 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
||||
|
||||
if (compositable) {
|
||||
const SurfaceDescriptor& descriptor = op.image();
|
||||
compositable->EnsureTextureHost(op.textureId(),
|
||||
compositable->EnsureDeprecatedTextureHost(op.textureId(),
|
||||
descriptor,
|
||||
compositableParent->GetCompositableManager(),
|
||||
TextureInfo());
|
||||
MOZ_ASSERT(compositable->GetTextureHost());
|
||||
MOZ_ASSERT(compositable->GetDeprecatedTextureHost());
|
||||
|
||||
SurfaceDescriptor newBack;
|
||||
bool shouldRecomposite = compositable->Update(descriptor, &newBack);
|
||||
|
@ -111,7 +111,7 @@ ISurfaceAllocator() {}
|
||||
|
||||
protected:
|
||||
// this method is needed for a temporary fix, will be removed after
|
||||
// TextureClient/Host rework.
|
||||
// DeprecatedTextureClient/Host rework.
|
||||
virtual bool IsOnCompositorSide() const = 0;
|
||||
static bool PlatformDestroySharedSurface(SurfaceDescriptor* aSurface);
|
||||
virtual bool PlatformAllocSurfaceDescriptor(const gfxIntSize& aSize,
|
||||
|
@ -199,7 +199,7 @@ NS_MEMORY_REPORTER_IMPLEMENT(GrallocBufferActor,
|
||||
|
||||
GrallocBufferActor::GrallocBufferActor()
|
||||
: mAllocBytes(0)
|
||||
, mTextureHost(nullptr)
|
||||
, mDeprecatedTextureHost(nullptr)
|
||||
{
|
||||
static bool registered;
|
||||
if (!registered) {
|
||||
@ -253,15 +253,15 @@ GrallocBufferActor::Create(const gfxIntSize& aSize,
|
||||
// used only for hacky fix in gecko 23 for bug 862324
|
||||
void GrallocBufferActor::ActorDestroy(ActorDestroyReason)
|
||||
{
|
||||
if (mTextureHost) {
|
||||
mTextureHost->ForgetBuffer();
|
||||
if (mDeprecatedTextureHost) {
|
||||
mDeprecatedTextureHost->ForgetBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
// used only for hacky fix in gecko 23 for bug 862324
|
||||
void GrallocBufferActor::SetTextureHost(TextureHost* aTextureHost)
|
||||
void GrallocBufferActor::SetDeprecatedTextureHost(DeprecatedTextureHost* aDeprecatedTextureHost)
|
||||
{
|
||||
mTextureHost = aTextureHost;
|
||||
mDeprecatedTextureHost = aDeprecatedTextureHost;
|
||||
}
|
||||
|
||||
/*static*/ already_AddRefed<TextureImage>
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
|
||||
// used only for hacky fix in gecko 23 for bug 862324
|
||||
// see bug 865908 about fixing this.
|
||||
void SetTextureHost(TextureHost* aTextureHost);
|
||||
void SetDeprecatedTextureHost(DeprecatedTextureHost* aDeprecatedTextureHost);
|
||||
|
||||
private:
|
||||
GrallocBufferActor();
|
||||
@ -102,7 +102,7 @@ private:
|
||||
|
||||
// used only for hacky fix in gecko 23 for bug 862324
|
||||
// see bug 865908 about fixing this.
|
||||
TextureHost* mTextureHost;
|
||||
DeprecatedTextureHost* mDeprecatedTextureHost;
|
||||
|
||||
friend class ISurfaceAllocator;
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ class TiledLayerComposer;
|
||||
class Transaction;
|
||||
class SurfaceDescriptor;
|
||||
class CanvasSurface;
|
||||
class TextureClientShmem;
|
||||
class DeprecatedTextureClientShmem;
|
||||
class ContentClientRemote;
|
||||
class CompositableChild;
|
||||
class ImageClient;
|
||||
@ -135,7 +135,7 @@ class ContentClient;
|
||||
class ShadowLayerForwarder : public CompositableForwarder
|
||||
{
|
||||
friend class AutoOpenSurface;
|
||||
friend class TextureClientShmem;
|
||||
friend class DeprecatedTextureClientShmem;
|
||||
friend class ContentClientIncremental;
|
||||
|
||||
public:
|
||||
|
@ -11,27 +11,27 @@ using namespace mozilla::gl;
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
TextureClientSharedOGL::TextureClientSharedOGL(CompositableForwarder* aForwarder,
|
||||
DeprecatedTextureClientSharedOGL::DeprecatedTextureClientSharedOGL(CompositableForwarder* aForwarder,
|
||||
const TextureInfo& aTextureInfo)
|
||||
: TextureClient(aForwarder, aTextureInfo)
|
||||
: DeprecatedTextureClient(aForwarder, aTextureInfo)
|
||||
, mGL(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientSharedOGL::ReleaseResources()
|
||||
DeprecatedTextureClientSharedOGL::ReleaseResources()
|
||||
{
|
||||
if (!IsSurfaceDescriptorValid(mDescriptor)) {
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(mDescriptor.type() == SurfaceDescriptor::TSharedTextureDescriptor);
|
||||
mDescriptor = SurfaceDescriptor();
|
||||
// It's important our handle gets released! SharedTextureHostOGL will take
|
||||
// It's important our handle gets released! SharedDeprecatedTextureHostOGL will take
|
||||
// care of this for us though.
|
||||
}
|
||||
|
||||
void
|
||||
TextureClientSharedOGL::EnsureAllocated(gfx::IntSize aSize,
|
||||
DeprecatedTextureClientSharedOGL::EnsureAllocated(gfx::IntSize aSize,
|
||||
gfxASurface::gfxContentType aContentType)
|
||||
{
|
||||
mSize = aSize;
|
||||
|
@ -12,13 +12,13 @@
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class TextureClientSharedOGL : public TextureClient
|
||||
class DeprecatedTextureClientSharedOGL : public DeprecatedTextureClient
|
||||
{
|
||||
public:
|
||||
TextureClientSharedOGL(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo);
|
||||
~TextureClientSharedOGL() { ReleaseResources(); }
|
||||
DeprecatedTextureClientSharedOGL(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo);
|
||||
~DeprecatedTextureClientSharedOGL() { ReleaseResources(); }
|
||||
|
||||
virtual bool SupportsType(TextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_SHARED_GL; }
|
||||
virtual bool SupportsType(DeprecatedTextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_SHARED_GL; }
|
||||
virtual void EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType);
|
||||
virtual void ReleaseResources();
|
||||
virtual gfxASurface::gfxContentType GetContentType() MOZ_OVERRIDE { return gfxASurface::CONTENT_COLOR_ALPHA; }
|
||||
@ -31,26 +31,26 @@ protected:
|
||||
};
|
||||
|
||||
// Doesn't own the surface descriptor, so we shouldn't delete it
|
||||
class TextureClientSharedOGLExternal : public TextureClientSharedOGL
|
||||
class DeprecatedTextureClientSharedOGLExternal : public DeprecatedTextureClientSharedOGL
|
||||
{
|
||||
public:
|
||||
TextureClientSharedOGLExternal(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo)
|
||||
: TextureClientSharedOGL(aForwarder, aTextureInfo)
|
||||
DeprecatedTextureClientSharedOGLExternal(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo)
|
||||
: DeprecatedTextureClientSharedOGL(aForwarder, aTextureInfo)
|
||||
{}
|
||||
|
||||
virtual bool SupportsType(TextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_SHARED_GL_EXTERNAL; }
|
||||
virtual bool SupportsType(DeprecatedTextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_SHARED_GL_EXTERNAL; }
|
||||
virtual void ReleaseResources() {}
|
||||
};
|
||||
|
||||
class TextureClientStreamOGL : public TextureClient
|
||||
class DeprecatedTextureClientStreamOGL : public DeprecatedTextureClient
|
||||
{
|
||||
public:
|
||||
TextureClientStreamOGL(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo)
|
||||
: TextureClient(aForwarder, aTextureInfo)
|
||||
DeprecatedTextureClientStreamOGL(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo)
|
||||
: DeprecatedTextureClient(aForwarder, aTextureInfo)
|
||||
{}
|
||||
~TextureClientStreamOGL() { ReleaseResources(); }
|
||||
~DeprecatedTextureClientStreamOGL() { ReleaseResources(); }
|
||||
|
||||
virtual bool SupportsType(TextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_STREAM_GL; }
|
||||
virtual bool SupportsType(DeprecatedTextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_STREAM_GL; }
|
||||
virtual void EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType) { }
|
||||
virtual void ReleaseResources() { mDescriptor = SurfaceDescriptor(); }
|
||||
virtual gfxASurface::gfxContentType GetContentType() MOZ_OVERRIDE { return gfxASurface::CONTENT_COLOR_ALPHA; }
|
||||
|
@ -21,27 +21,27 @@ using namespace mozilla::gfx;
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
TemporaryRef<TextureHost>
|
||||
CreateTextureHostOGL(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aTextureHostFlags,
|
||||
TemporaryRef<DeprecatedTextureHost>
|
||||
CreateDeprecatedTextureHostOGL(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aDeprecatedTextureHostFlags,
|
||||
uint32_t aTextureFlags)
|
||||
{
|
||||
RefPtr<TextureHost> result = nullptr;
|
||||
RefPtr<DeprecatedTextureHost> result = nullptr;
|
||||
|
||||
if (aDescriptorType == SurfaceDescriptor::TYCbCrImage) {
|
||||
result = new YCbCrTextureHostOGL();
|
||||
result = new YCbCrDeprecatedTextureHostOGL();
|
||||
} else if (aDescriptorType == SurfaceDescriptor::TSurfaceStreamDescriptor) {
|
||||
result = new SurfaceStreamHostOGL();
|
||||
} else if (aDescriptorType == SurfaceDescriptor::TSharedTextureDescriptor) {
|
||||
result = new SharedTextureHostOGL();
|
||||
result = new SharedDeprecatedTextureHostOGL();
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
} else if (aDescriptorType == SurfaceDescriptor::TSurfaceDescriptorGralloc) {
|
||||
result = new GrallocTextureHostOGL();
|
||||
result = new GrallocDeprecatedTextureHostOGL();
|
||||
#endif
|
||||
} else if (aTextureHostFlags & TEXTURE_HOST_TILED) {
|
||||
result = new TiledTextureHostOGL();
|
||||
} else if (aDeprecatedTextureHostFlags & TEXTURE_HOST_TILED) {
|
||||
result = new TiledDeprecatedTextureHostOGL();
|
||||
} else {
|
||||
result = new TextureImageTextureHostOGL();
|
||||
result = new TextureImageDeprecatedTextureHostOGL();
|
||||
}
|
||||
|
||||
NS_ASSERTION(result, "Result should have been created.");
|
||||
@ -99,16 +99,16 @@ WrapMode(gl::GLContext *aGl, bool aAllowRepeat)
|
||||
return LOCAL_GL_CLAMP_TO_EDGE;
|
||||
}
|
||||
|
||||
TextureImageTextureHostOGL::~TextureImageTextureHostOGL()
|
||||
TextureImageDeprecatedTextureHostOGL::~TextureImageDeprecatedTextureHostOGL()
|
||||
{
|
||||
MOZ_COUNT_DTOR(TextureImageTextureHostOGL);
|
||||
MOZ_COUNT_DTOR(TextureImageDeprecatedTextureHostOGL);
|
||||
if (mTexture && mTexture->InUpdate()) {
|
||||
mTexture->EndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
gfx::IntSize
|
||||
TextureImageTextureHostOGL::GetSize() const
|
||||
TextureImageDeprecatedTextureHostOGL::GetSize() const
|
||||
{
|
||||
if (mTexture) {
|
||||
if (mIterating) {
|
||||
@ -121,7 +121,7 @@ TextureImageTextureHostOGL::GetSize() const
|
||||
}
|
||||
|
||||
void
|
||||
TextureImageTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
TextureImageDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
|
||||
GLContext* newGL = glCompositor ? glCompositor->gl() : nullptr;
|
||||
@ -129,7 +129,7 @@ TextureImageTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
mGL = newGL;
|
||||
mTexture = nullptr;
|
||||
// if we have a buffer we reupload it with the new gl context
|
||||
// Post landing TODO: the new TextureClient/Host model will make this
|
||||
// Post landing TODO: the new DeprecatedTextureClient/Host model will make this
|
||||
// go away.
|
||||
if (newGL && mBuffer && IsSurfaceDescriptorValid(*mBuffer)) {
|
||||
UpdateImpl(*mBuffer);
|
||||
@ -138,7 +138,7 @@ TextureImageTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
}
|
||||
|
||||
void
|
||||
TextureImageTextureHostOGL::EnsureBuffer(const nsIntSize& aSize,
|
||||
TextureImageDeprecatedTextureHostOGL::EnsureBuffer(const nsIntSize& aSize,
|
||||
gfxContentType aContentType)
|
||||
{
|
||||
if (!mTexture ||
|
||||
@ -153,13 +153,13 @@ TextureImageTextureHostOGL::EnsureBuffer(const nsIntSize& aSize,
|
||||
}
|
||||
|
||||
void
|
||||
TextureImageTextureHostOGL::CopyTo(const nsIntRect& aSourceRect,
|
||||
TextureHost *aDest,
|
||||
TextureImageDeprecatedTextureHostOGL::CopyTo(const nsIntRect& aSourceRect,
|
||||
DeprecatedTextureHost *aDest,
|
||||
const nsIntRect& aDestRect)
|
||||
{
|
||||
MOZ_ASSERT(aDest->AsSourceOGL(), "Incompatible destination type!");
|
||||
TextureImageTextureHostOGL *dest =
|
||||
aDest->AsSourceOGL()->AsTextureImageTextureHost();
|
||||
TextureImageDeprecatedTextureHostOGL *dest =
|
||||
aDest->AsSourceOGL()->AsTextureImageDeprecatedTextureHost();
|
||||
MOZ_ASSERT(dest, "Incompatible destination type!");
|
||||
|
||||
mGL->BlitTextureImage(mTexture, aSourceRect,
|
||||
@ -168,12 +168,12 @@ TextureImageTextureHostOGL::CopyTo(const nsIntRect& aSourceRect,
|
||||
}
|
||||
|
||||
void
|
||||
TextureImageTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
TextureImageDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion* aRegion,
|
||||
nsIntPoint* aOffset)
|
||||
{
|
||||
if (!mGL) {
|
||||
NS_WARNING("trying to update TextureImageTextureHostOGL without a compositor?");
|
||||
NS_WARNING("trying to update TextureImageDeprecatedTextureHostOGL without a compositor?");
|
||||
return;
|
||||
}
|
||||
AutoOpenSurface surf(OPEN_READ_ONLY, aImage);
|
||||
@ -209,10 +209,10 @@ TextureImageTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
}
|
||||
|
||||
bool
|
||||
TextureImageTextureHostOGL::Lock()
|
||||
TextureImageDeprecatedTextureHostOGL::Lock()
|
||||
{
|
||||
if (!mTexture) {
|
||||
NS_WARNING("TextureImageTextureHost to be composited without texture");
|
||||
NS_WARNING("TextureImageDeprecatedTextureHost to be composited without texture");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ TextureImageTextureHostOGL::Lock()
|
||||
}
|
||||
|
||||
void
|
||||
SharedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
SharedDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
|
||||
if (mGL && !glCompositor) {
|
||||
@ -235,7 +235,7 @@ SharedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
}
|
||||
|
||||
void
|
||||
SharedTextureHostOGL::DeleteTextures()
|
||||
SharedDeprecatedTextureHostOGL::DeleteTextures()
|
||||
{
|
||||
MOZ_ASSERT(mGL);
|
||||
mGL->MakeCurrent();
|
||||
@ -250,7 +250,7 @@ SharedTextureHostOGL::DeleteTextures()
|
||||
}
|
||||
|
||||
void
|
||||
SharedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
SharedDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion* aRegion,
|
||||
nsIntPoint* aOffset)
|
||||
{
|
||||
@ -258,7 +258,7 @@ SharedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
}
|
||||
|
||||
void
|
||||
SharedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
||||
SharedDeprecatedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion* aRegion)
|
||||
{
|
||||
NS_ASSERTION(aImage.type() == SurfaceDescriptor::TSharedTextureDescriptor,
|
||||
@ -288,7 +288,7 @@ SharedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
||||
}
|
||||
|
||||
bool
|
||||
SharedTextureHostOGL::Lock()
|
||||
SharedDeprecatedTextureHostOGL::Lock()
|
||||
{
|
||||
MakeTextureIfNeeded(mGL, mTextureTarget, mTextureHandle);
|
||||
|
||||
@ -303,7 +303,7 @@ SharedTextureHostOGL::Lock()
|
||||
}
|
||||
|
||||
void
|
||||
SharedTextureHostOGL::Unlock()
|
||||
SharedDeprecatedTextureHostOGL::Unlock()
|
||||
{
|
||||
mGL->DetachSharedHandle(mShareType, mSharedHandle);
|
||||
mGL->fBindTexture(LOCAL_GL_TEXTURE_2D, 0);
|
||||
@ -311,7 +311,7 @@ SharedTextureHostOGL::Unlock()
|
||||
|
||||
|
||||
gfx3DMatrix
|
||||
SharedTextureHostOGL::GetTextureTransform()
|
||||
SharedDeprecatedTextureHostOGL::GetTextureTransform()
|
||||
{
|
||||
GLContext::SharedHandleDetails handleDetails;
|
||||
// GetSharedHandleDetails can call into Java which we'd
|
||||
@ -441,7 +441,7 @@ SurfaceStreamHostOGL::Lock()
|
||||
|
||||
|
||||
void
|
||||
YCbCrTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
YCbCrDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
|
||||
GLContext* newGL = glCompositor ? glCompositor->gl() : nullptr;
|
||||
@ -458,7 +458,7 @@ YCbCrTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
}
|
||||
|
||||
void
|
||||
YCbCrTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
YCbCrDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion* aRegion,
|
||||
nsIntPoint* aOffset)
|
||||
{
|
||||
@ -513,12 +513,12 @@ YCbCrTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
}
|
||||
|
||||
bool
|
||||
YCbCrTextureHostOGL::Lock()
|
||||
YCbCrDeprecatedTextureHostOGL::Lock()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
TiledTextureHostOGL::~TiledTextureHostOGL()
|
||||
TiledDeprecatedTextureHostOGL::~TiledDeprecatedTextureHostOGL()
|
||||
{
|
||||
DeleteTextures();
|
||||
}
|
||||
@ -538,7 +538,7 @@ GetFormatAndTileForImageFormat(gfxASurface::gfxImageFormat aFormat,
|
||||
}
|
||||
|
||||
void
|
||||
TiledTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
TiledDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
|
||||
if (mGL && !glCompositor) {
|
||||
@ -548,7 +548,7 @@ TiledTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
}
|
||||
|
||||
void
|
||||
TiledTextureHostOGL::DeleteTextures()
|
||||
TiledDeprecatedTextureHostOGL::DeleteTextures()
|
||||
{
|
||||
if (mTextureHandle) {
|
||||
mGL->MakeCurrent();
|
||||
@ -561,7 +561,7 @@ TiledTextureHostOGL::DeleteTextures()
|
||||
}
|
||||
|
||||
void
|
||||
TiledTextureHostOGL::Update(gfxReusableSurfaceWrapper* aReusableSurface, TextureFlags aFlags, const gfx::IntSize& aSize)
|
||||
TiledDeprecatedTextureHostOGL::Update(gfxReusableSurfaceWrapper* aReusableSurface, TextureFlags aFlags, const gfx::IntSize& aSize)
|
||||
{
|
||||
mSize = aSize;
|
||||
mGL->MakeCurrent();
|
||||
@ -600,10 +600,10 @@ TiledTextureHostOGL::Update(gfxReusableSurfaceWrapper* aReusableSurface, Texture
|
||||
}
|
||||
|
||||
bool
|
||||
TiledTextureHostOGL::Lock()
|
||||
TiledDeprecatedTextureHostOGL::Lock()
|
||||
{
|
||||
if (!mTextureHandle) {
|
||||
NS_WARNING("TiledTextureHostOGL not ready to be composited");
|
||||
NS_WARNING("TiledDeprecatedTextureHostOGL not ready to be composited");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -680,7 +680,7 @@ TextureTargetForAndroidPixelFormat(android::PixelFormat aFormat)
|
||||
}
|
||||
}
|
||||
|
||||
GrallocTextureHostOGL::GrallocTextureHostOGL()
|
||||
GrallocDeprecatedTextureHostOGL::GrallocDeprecatedTextureHostOGL()
|
||||
: mCompositor(nullptr)
|
||||
, mTextureTarget(0)
|
||||
, mEGLImage(0)
|
||||
@ -688,7 +688,7 @@ GrallocTextureHostOGL::GrallocTextureHostOGL()
|
||||
{
|
||||
}
|
||||
|
||||
void GrallocTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
void GrallocDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
|
||||
if (mCompositor && !glCompositor) {
|
||||
@ -698,7 +698,7 @@ void GrallocTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
}
|
||||
|
||||
void
|
||||
GrallocTextureHostOGL::DeleteTextures()
|
||||
GrallocDeprecatedTextureHostOGL::DeleteTextures()
|
||||
{
|
||||
if (mEGLImage) {
|
||||
gl()->MakeCurrent();
|
||||
@ -709,16 +709,16 @@ GrallocTextureHostOGL::DeleteTextures()
|
||||
|
||||
// only used for hacky fix in gecko 23 for bug 862324
|
||||
static void
|
||||
RegisterTextureHostAtGrallocBufferActor(TextureHost* aTextureHost, const SurfaceDescriptor& aSurfaceDescriptor)
|
||||
RegisterDeprecatedTextureHostAtGrallocBufferActor(DeprecatedTextureHost* aDeprecatedTextureHost, const SurfaceDescriptor& aSurfaceDescriptor)
|
||||
{
|
||||
if (IsSurfaceDescriptorValid(aSurfaceDescriptor)) {
|
||||
GrallocBufferActor* actor = static_cast<GrallocBufferActor*>(aSurfaceDescriptor.get_SurfaceDescriptorGralloc().bufferParent());
|
||||
actor->SetTextureHost(aTextureHost);
|
||||
actor->SetDeprecatedTextureHost(aDeprecatedTextureHost);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GrallocTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
GrallocDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion* aRegion,
|
||||
nsIntPoint* aOffset)
|
||||
{
|
||||
@ -726,14 +726,14 @@ GrallocTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
}
|
||||
|
||||
void
|
||||
GrallocTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
||||
GrallocDeprecatedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion*)
|
||||
{
|
||||
MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TSurfaceDescriptorGralloc);
|
||||
|
||||
if (mBuffer) {
|
||||
// only done for hacky fix in gecko 23 for bug 862324.
|
||||
RegisterTextureHostAtGrallocBufferActor(nullptr, *mBuffer);
|
||||
RegisterDeprecatedTextureHostAtGrallocBufferActor(nullptr, *mBuffer);
|
||||
}
|
||||
|
||||
const SurfaceDescriptorGralloc& desc = aImage.get_SurfaceDescriptorGralloc();
|
||||
@ -749,16 +749,16 @@ GrallocTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
||||
// only done for hacky fix in gecko 23 for bug 862324.
|
||||
// Doing this in SetBuffer is not enough, as ImageHostBuffered::SwapTextures can
|
||||
// change the value of *mBuffer without calling SetBuffer again.
|
||||
RegisterTextureHostAtGrallocBufferActor(this, aImage);
|
||||
RegisterDeprecatedTextureHostAtGrallocBufferActor(this, aImage);
|
||||
}
|
||||
|
||||
gl::GLContext*
|
||||
GrallocTextureHostOGL::gl() const
|
||||
GrallocDeprecatedTextureHostOGL::gl() const
|
||||
{
|
||||
return mCompositor ? mCompositor->gl() : nullptr;
|
||||
}
|
||||
|
||||
void GrallocTextureHostOGL::BindTexture(GLenum aTextureUnit)
|
||||
void GrallocDeprecatedTextureHostOGL::BindTexture(GLenum aTextureUnit)
|
||||
{
|
||||
/*
|
||||
* The job of this function is to ensure that the texture is tied to the
|
||||
@ -786,12 +786,12 @@ void GrallocTextureHostOGL::BindTexture(GLenum aTextureUnit)
|
||||
}
|
||||
|
||||
bool
|
||||
GrallocTextureHostOGL::IsValid() const
|
||||
GrallocDeprecatedTextureHostOGL::IsValid() const
|
||||
{
|
||||
return !!gl() && !!mGraphicBuffer.get();
|
||||
}
|
||||
|
||||
GrallocTextureHostOGL::~GrallocTextureHostOGL()
|
||||
GrallocDeprecatedTextureHostOGL::~GrallocDeprecatedTextureHostOGL()
|
||||
{
|
||||
DeleteTextures();
|
||||
|
||||
@ -799,31 +799,31 @@ GrallocTextureHostOGL::~GrallocTextureHostOGL()
|
||||
if (mBuffer) {
|
||||
// make sure that if the GrallocBufferActor survives us, it doesn't keep a dangling
|
||||
// pointer to us.
|
||||
RegisterTextureHostAtGrallocBufferActor(nullptr, *mBuffer);
|
||||
RegisterDeprecatedTextureHostAtGrallocBufferActor(nullptr, *mBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
GrallocTextureHostOGL::Lock()
|
||||
GrallocDeprecatedTextureHostOGL::Lock()
|
||||
{
|
||||
// Lock/Unlock is done internally when binding the gralloc buffer to a gl texture
|
||||
return IsValid();
|
||||
}
|
||||
|
||||
void
|
||||
GrallocTextureHostOGL::Unlock()
|
||||
GrallocDeprecatedTextureHostOGL::Unlock()
|
||||
{
|
||||
// Lock/Unlock is done internally when binding the gralloc buffer to a gl texture
|
||||
}
|
||||
|
||||
gfx::SurfaceFormat
|
||||
GrallocTextureHostOGL::GetFormat() const
|
||||
GrallocDeprecatedTextureHostOGL::GetFormat() const
|
||||
{
|
||||
return mFormat;
|
||||
}
|
||||
|
||||
void
|
||||
GrallocTextureHostOGL::SetBuffer(SurfaceDescriptor* aBuffer, ISurfaceAllocator* aAllocator)
|
||||
GrallocDeprecatedTextureHostOGL::SetBuffer(SurfaceDescriptor* aBuffer, ISurfaceAllocator* aAllocator)
|
||||
{
|
||||
MOZ_ASSERT(!mBuffer, "Will leak the old mBuffer");
|
||||
mBuffer = aBuffer;
|
||||
@ -831,11 +831,11 @@ GrallocTextureHostOGL::SetBuffer(SurfaceDescriptor* aBuffer, ISurfaceAllocator*
|
||||
|
||||
// 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.
|
||||
RegisterTextureHostAtGrallocBufferActor(this, *mBuffer);
|
||||
RegisterDeprecatedTextureHostAtGrallocBufferActor(this, *mBuffer);
|
||||
}
|
||||
|
||||
LayerRenderState
|
||||
GrallocTextureHostOGL::GetRenderState()
|
||||
GrallocDeprecatedTextureHostOGL::GetRenderState()
|
||||
{
|
||||
if (mBuffer && IsSurfaceDescriptorValid(*mBuffer)) {
|
||||
|
||||
@ -864,7 +864,7 @@ GrallocTextureHostOGL::GetRenderState()
|
||||
#endif // MOZ_WIDGET_GONK
|
||||
|
||||
already_AddRefed<gfxImageSurface>
|
||||
TextureImageTextureHostOGL::GetAsSurface() {
|
||||
TextureImageDeprecatedTextureHostOGL::GetAsSurface() {
|
||||
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
||||
mGL->GetTexImage(mTexture->GetTextureID(),
|
||||
false,
|
||||
@ -874,7 +874,7 @@ TextureImageTextureHostOGL::GetAsSurface() {
|
||||
}
|
||||
|
||||
already_AddRefed<gfxImageSurface>
|
||||
YCbCrTextureHostOGL::GetAsSurface() {
|
||||
YCbCrDeprecatedTextureHostOGL::GetAsSurface() {
|
||||
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
||||
mGL->GetTexImage(mYTexture->mTexImage->GetTextureID(),
|
||||
false,
|
||||
@ -884,7 +884,7 @@ YCbCrTextureHostOGL::GetAsSurface() {
|
||||
}
|
||||
|
||||
already_AddRefed<gfxImageSurface>
|
||||
SharedTextureHostOGL::GetAsSurface() {
|
||||
SharedDeprecatedTextureHostOGL::GetAsSurface() {
|
||||
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
||||
mGL->GetTexImage(GetTextureHandle(),
|
||||
false,
|
||||
@ -904,7 +904,7 @@ SurfaceStreamHostOGL::GetAsSurface() {
|
||||
}
|
||||
|
||||
already_AddRefed<gfxImageSurface>
|
||||
TiledTextureHostOGL::GetAsSurface() {
|
||||
TiledDeprecatedTextureHostOGL::GetAsSurface() {
|
||||
nsRefPtr<gfxImageSurface> surf = IsValid() ?
|
||||
mGL->GetTexImage(mTextureHandle,
|
||||
false,
|
||||
@ -915,7 +915,7 @@ TiledTextureHostOGL::GetAsSurface() {
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
already_AddRefed<gfxImageSurface>
|
||||
GrallocTextureHostOGL::GetAsSurface() {
|
||||
GrallocDeprecatedTextureHostOGL::GetAsSurface() {
|
||||
gl()->MakeCurrent();
|
||||
|
||||
GLuint tex = mCompositor->GetTemporaryTexture(LOCAL_GL_TEXTURE0);
|
||||
|
@ -20,7 +20,7 @@
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class TextureImageTextureHostOGL;
|
||||
class TextureImageDeprecatedTextureHostOGL;
|
||||
class CompositorOGL;
|
||||
|
||||
/*
|
||||
@ -57,13 +57,13 @@ public:
|
||||
virtual GLenum GetWrapMode() const = 0;// { return LOCAL_GL_CLAMP_TO_EDGE; } // default
|
||||
virtual gfx3DMatrix GetTextureTransform() { return gfx3DMatrix(); }
|
||||
|
||||
virtual TextureImageTextureHostOGL* AsTextureImageTextureHost() { return nullptr; }
|
||||
virtual TextureImageDeprecatedTextureHostOGL* AsTextureImageDeprecatedTextureHost() { return nullptr; }
|
||||
};
|
||||
|
||||
inline ShaderProgramType
|
||||
GetProgramTypeForTexture(const TextureHost *aTextureHost)
|
||||
GetProgramTypeForTexture(const DeprecatedTextureHost *aDeprecatedTextureHost)
|
||||
{
|
||||
switch (aTextureHost->GetFormat()) {
|
||||
switch (aDeprecatedTextureHost->GetFormat()) {
|
||||
case gfx::FORMAT_B8G8R8A8:
|
||||
return BGRALayerProgramType;;
|
||||
case gfx::FORMAT_B8G8R8X8:
|
||||
@ -78,29 +78,29 @@ GetProgramTypeForTexture(const TextureHost *aTextureHost)
|
||||
}
|
||||
|
||||
/**
|
||||
* TextureHost implementation using a TextureImage as the underlying texture.
|
||||
* DeprecatedTextureHost implementation using a TextureImage as the underlying texture.
|
||||
*/
|
||||
class TextureImageTextureHostOGL : public TextureHost
|
||||
, public TextureSourceOGL
|
||||
, public TileIterator
|
||||
class TextureImageDeprecatedTextureHostOGL : public DeprecatedTextureHost
|
||||
, public TextureSourceOGL
|
||||
, public TileIterator
|
||||
{
|
||||
public:
|
||||
TextureImageTextureHostOGL(gl::TextureImage* aTexImage = nullptr)
|
||||
TextureImageDeprecatedTextureHostOGL(gl::TextureImage* aTexImage = nullptr)
|
||||
: mTexture(aTexImage)
|
||||
, mGL(nullptr)
|
||||
, mIterating(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(TextureImageTextureHostOGL);
|
||||
MOZ_COUNT_CTOR(TextureImageDeprecatedTextureHostOGL);
|
||||
}
|
||||
|
||||
~TextureImageTextureHostOGL();
|
||||
~TextureImageDeprecatedTextureHostOGL();
|
||||
|
||||
TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
virtual TextureImageTextureHostOGL* AsTextureImageTextureHost() MOZ_OVERRIDE
|
||||
virtual TextureImageDeprecatedTextureHostOGL* AsTextureImageDeprecatedTextureHost() MOZ_OVERRIDE
|
||||
{
|
||||
return this;
|
||||
}
|
||||
@ -112,7 +112,7 @@ public:
|
||||
mGL = aGL;
|
||||
}
|
||||
|
||||
// TextureHost
|
||||
// DeprecatedTextureHost
|
||||
|
||||
void UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion* aRegion = nullptr,
|
||||
@ -123,7 +123,7 @@ public:
|
||||
virtual void EnsureBuffer(const nsIntSize& aSize, gfxContentType aType) MOZ_OVERRIDE;
|
||||
|
||||
virtual void CopyTo(const nsIntRect& aSourceRect,
|
||||
TextureHost *aDest,
|
||||
DeprecatedTextureHost *aDest,
|
||||
const nsIntRect& aDestRect) MOZ_OVERRIDE;
|
||||
|
||||
bool IsValid() const MOZ_OVERRIDE
|
||||
@ -202,7 +202,7 @@ public:
|
||||
}
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual const char* Name() { return "TextureImageTextureHostOGL"; }
|
||||
virtual const char* Name() { return "TextureImageDeprecatedTextureHostOGL"; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
@ -213,32 +213,32 @@ protected:
|
||||
|
||||
|
||||
/**
|
||||
* TextureHost implementation for YCbCr images in the OpenGL backend.
|
||||
* DeprecatedTextureHost implementation for YCbCr images in the OpenGL backend.
|
||||
*
|
||||
* This TextureHost is a little bit particular in that it implements
|
||||
* the TextureSource interface, as it is required that a TextureHost
|
||||
* This DeprecatedTextureHost is a little bit particular in that it implements
|
||||
* the TextureSource interface, as it is required that a DeprecatedTextureHost
|
||||
* provides access to a TextureSource, but does not implement the
|
||||
* TextureHostOGL interface. Instead it contains 3 channels (one per
|
||||
* DeprecatedTextureHostOGL interface. Instead it contains 3 channels (one per
|
||||
* plane) that implement the TextureSourceOGL interface, and
|
||||
* YCbCrTextureHostOGL's TextureSource implementation provide access
|
||||
* YCbCrDeprecatedTextureHostOGL's TextureSource implementation provide access
|
||||
* to these channels with the GetSubSource method.
|
||||
*/
|
||||
class YCbCrTextureHostOGL : public TextureHost
|
||||
class YCbCrDeprecatedTextureHostOGL : public DeprecatedTextureHost
|
||||
{
|
||||
public:
|
||||
YCbCrTextureHostOGL()
|
||||
YCbCrDeprecatedTextureHostOGL()
|
||||
: mGL(nullptr)
|
||||
{
|
||||
MOZ_COUNT_CTOR(YCbCrTextureHostOGL);
|
||||
MOZ_COUNT_CTOR(YCbCrDeprecatedTextureHostOGL);
|
||||
mYTexture = new Channel;
|
||||
mCbTexture = new Channel;
|
||||
mCrTexture = new Channel;
|
||||
mFormat = gfx::FORMAT_YUV;
|
||||
}
|
||||
|
||||
~YCbCrTextureHostOGL()
|
||||
~YCbCrDeprecatedTextureHostOGL()
|
||||
{
|
||||
MOZ_COUNT_DTOR(YCbCrTextureHostOGL);
|
||||
MOZ_COUNT_DTOR(YCbCrDeprecatedTextureHostOGL);
|
||||
}
|
||||
|
||||
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
||||
@ -302,7 +302,7 @@ public:
|
||||
gfx::IntSize GetSize() const MOZ_OVERRIDE
|
||||
{
|
||||
if (!mYTexture->mTexImage) {
|
||||
NS_WARNING("YCbCrTextureHost::GetSize called but no data has been set yet");
|
||||
NS_WARNING("YCbCrDeprecatedTextureHost::GetSize called but no data has been set yet");
|
||||
return gfx::IntSize(0,0);
|
||||
}
|
||||
return mYTexture->GetSize();
|
||||
@ -311,7 +311,7 @@ public:
|
||||
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual const char* Name() { return "YCbCrTextureHostOGL"; }
|
||||
virtual const char* Name() { return "YCbCrDeprecatedTextureHostOGL"; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
@ -321,7 +321,7 @@ private:
|
||||
gl::GLContext* mGL;
|
||||
};
|
||||
|
||||
class SharedTextureHostOGL : public TextureHost
|
||||
class SharedDeprecatedTextureHostOGL : public DeprecatedTextureHost
|
||||
, public TextureSourceOGL
|
||||
{
|
||||
public:
|
||||
@ -329,7 +329,7 @@ public:
|
||||
typedef mozilla::gl::GLContext GLContext;
|
||||
typedef mozilla::gl::TextureImage TextureImage;
|
||||
|
||||
SharedTextureHostOGL()
|
||||
SharedDeprecatedTextureHostOGL()
|
||||
: mGL(nullptr)
|
||||
, mTextureHandle(0)
|
||||
, mWrapMode(LOCAL_GL_CLAMP_TO_EDGE)
|
||||
@ -339,7 +339,7 @@ public:
|
||||
|
||||
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
||||
|
||||
virtual ~SharedTextureHostOGL()
|
||||
virtual ~SharedDeprecatedTextureHostOGL()
|
||||
{
|
||||
if (mSharedHandle || mTextureHandle) {
|
||||
DeleteTextures();
|
||||
@ -355,7 +355,7 @@ public:
|
||||
|
||||
bool IsValid() const MOZ_OVERRIDE { return !!mSharedHandle; }
|
||||
|
||||
// override from TextureHost, we support both buffered
|
||||
// override from DeprecatedTextureHost, we support both buffered
|
||||
// and unbuffered operation.
|
||||
virtual void UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion* aRegion = nullptr,
|
||||
@ -402,7 +402,7 @@ public:
|
||||
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual const char* Name() { return "SharedTextureHostOGL"; }
|
||||
virtual const char* Name() { return "SharedDeprecatedTextureHostOGL"; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
@ -417,7 +417,7 @@ protected:
|
||||
gl::GLContext::SharedTextureShareType mShareType;
|
||||
};
|
||||
|
||||
class SurfaceStreamHostOGL : public TextureHost
|
||||
class SurfaceStreamHostOGL : public DeprecatedTextureHost
|
||||
, public TextureSourceOGL
|
||||
{
|
||||
public:
|
||||
@ -442,7 +442,7 @@ public:
|
||||
|
||||
bool IsValid() const MOZ_OVERRIDE { return true; }
|
||||
|
||||
// override from TextureHost
|
||||
// override from DeprecatedTextureHost
|
||||
virtual void SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion* aRegion = nullptr) MOZ_OVERRIDE;
|
||||
virtual bool Lock() MOZ_OVERRIDE;
|
||||
@ -506,15 +506,15 @@ protected:
|
||||
GLenum mWrapMode;
|
||||
};
|
||||
|
||||
class TiledTextureHostOGL : public TextureHost
|
||||
class TiledDeprecatedTextureHostOGL : public DeprecatedTextureHost
|
||||
, public TextureSourceOGL
|
||||
{
|
||||
public:
|
||||
TiledTextureHostOGL()
|
||||
TiledDeprecatedTextureHostOGL()
|
||||
: mTextureHandle(0)
|
||||
, mGL(nullptr)
|
||||
{}
|
||||
~TiledTextureHostOGL();
|
||||
~TiledDeprecatedTextureHostOGL();
|
||||
|
||||
virtual void SetCompositor(Compositor* aCompositor);
|
||||
|
||||
@ -549,7 +549,7 @@ public:
|
||||
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual const char* Name() { return "TiledTextureHostOGL"; }
|
||||
virtual const char* Name() { return "TiledDeprecatedTextureHostOGL"; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
@ -574,18 +574,18 @@ private:
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
|
||||
// For direct texturing with gralloc buffers. The corresponding TextureClient is TextureClientShmem,
|
||||
// For direct texturing with gralloc buffers. The corresponding DeprecatedTextureClient is DeprecatedTextureClientShmem,
|
||||
// which automatically gets gralloc when it can, in which case the compositor sees that the
|
||||
// SurfaceDescriptor is gralloc, and decides to use a GrallocTextureHostOGL to do direct texturing,
|
||||
// SurfaceDescriptor is gralloc, and decides to use a GrallocDeprecatedTextureHostOGL to do direct texturing,
|
||||
// saving the cost of a texture upload.
|
||||
class GrallocTextureHostOGL
|
||||
: public TextureHost
|
||||
class GrallocDeprecatedTextureHostOGL
|
||||
: public DeprecatedTextureHost
|
||||
, public TextureSourceOGL
|
||||
{
|
||||
public:
|
||||
GrallocTextureHostOGL();
|
||||
GrallocDeprecatedTextureHostOGL();
|
||||
|
||||
~GrallocTextureHostOGL();
|
||||
~GrallocDeprecatedTextureHostOGL();
|
||||
|
||||
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
||||
|
||||
@ -621,7 +621,7 @@ public:
|
||||
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual const char* Name() { return "GrallocTextureHostOGL"; }
|
||||
virtual const char* Name() { return "GrallocDeprecatedTextureHostOGL"; }
|
||||
#endif
|
||||
|
||||
void BindTexture(GLenum aTextureUnit) MOZ_OVERRIDE;
|
||||
|
@ -1149,14 +1149,14 @@ struct ParamTraits<mozilla::layers::TextureInfo>
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mCompositableType);
|
||||
WriteParam(aMsg, aParam.mTextureHostFlags);
|
||||
WriteParam(aMsg, aParam.mDeprecatedTextureHostFlags);
|
||||
WriteParam(aMsg, aParam.mTextureFlags);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mCompositableType) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mTextureHostFlags) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mDeprecatedTextureHostFlags) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mTextureFlags);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user