Bug 1146912 - Finish replacing TextureHost::GetTextureSource by BindTextureSource. r=sotaro

This commit is contained in:
Nicolas Silva 2015-03-27 11:16:34 +01:00
parent ba24a94dc6
commit 2683def1bf
14 changed files with 55 additions and 79 deletions

View File

@ -131,14 +131,15 @@ DIBTextureHost::DIBTextureHost(TextureFlags aFlags,
gfxPlatform::GetPlatform()->OptimalFormatForContent(mSurface->GetContentType()));
}
TextureSource*
DIBTextureHost::GetTextureSources()
bool
DIBTextureHost::BindTextureSource(CompositableTextureSourceRef& aTexture)
{
if (!mTextureSource) {
Updated();
}
return mTextureSource;
aTexture = mTextureSource;
return !!aTexture;
}
void

View File

@ -72,7 +72,7 @@ public:
DIBTextureHost(TextureFlags aFlags,
const SurfaceDescriptorDIB& aDescriptor);
virtual TextureSource* GetTextureSources() override;
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override;
virtual void DeallocateDeviceData() override;

View File

@ -64,9 +64,10 @@ public:
virtual gfx::SurfaceFormat GetFormat() const override;
virtual TextureSource* GetTextureSources() override
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override
{
return mTextureSource;
aTexture = mTextureSource;
return !!aTexture;
}
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() override

View File

@ -147,13 +147,6 @@ TextureHost::GetIPDLActor()
return mActor;
}
bool
TextureHost::BindTextureSource(CompositableTextureSourceRef& texture)
{
texture = GetTextureSources();
return !!texture;
}
FenceHandle
TextureHost::GetAndResetReleaseFenceHandle()
{
@ -450,12 +443,13 @@ BufferTextureHost::Unlock()
mLocked = false;
}
TextureSource*
BufferTextureHost::GetTextureSources()
bool
BufferTextureHost::BindTextureSource(CompositableTextureSourceRef& aTexture)
{
MOZ_ASSERT(mLocked);
MOZ_ASSERT(mFirstSource);
return mFirstSource;
aTexture = mFirstSource;
return !!aTexture;
}
gfx::SurfaceFormat

View File

@ -204,19 +204,6 @@ public:
return *this;
}
CompositableTextureRef& operator=(const TemporaryRef<T>& aOther)
{
RefPtr<T> temp = aOther;
if (temp) {
temp->AddCompositableRef();
}
if (mRef) {
mRef->ReleaseCompositableRef();
}
mRef = temp;
return *this;
}
CompositableTextureRef& operator=(T* aOther)
{
if (aOther) {
@ -378,15 +365,6 @@ public:
*/
virtual gfx::SurfaceFormat GetFormat() const = 0;
/**
* Return a list of TextureSources for use with a Compositor.
*
* This can trigger texture uploads, so do not call it inside transactions
* so as to not upload textures while the main thread is blocked.
* Must not be called while this TextureHost is not sucessfully Locked.
*/
virtual TextureSource* GetTextureSources() = 0;
/**
* Called during the transaction. The TextureSource may or may not be composited.
*
@ -399,7 +377,7 @@ public:
*
* Note that this is called only withing lock/unlock.
*/
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture);
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) = 0;
/**
* Called when another TextureHost will take over.
@ -586,7 +564,7 @@ public:
virtual void Unlock() override;
virtual TextureSource* GetTextureSources() override;
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override;
virtual void DeallocateDeviceData() override;
@ -594,7 +572,7 @@ public:
/**
* Return the format that is exposed to the compositor when calling
* GetTextureSources.
* BindTextureSource.
*
* If the shared format is YCbCr and the compositor does not support it,
* GetFormat will be RGB32 (even though mFormat is SurfaceFormat::YUV).
@ -723,10 +701,11 @@ public:
virtual bool Lock() override;
virtual void Unlock() override;
virtual TextureSource* GetTextureSources() override {
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override {
MOZ_ASSERT(mIsLocked);
MOZ_ASSERT(mTexSource);
return mTexSource;
aTexture = mTexSource;
return !!aTexture;
}
virtual gfx::SurfaceFormat GetFormat() const override;

View File

@ -30,9 +30,10 @@ public:
virtual gfx::IntSize GetSize() const override;
virtual TextureSource* GetTextureSources() override
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override
{
return mTextureSource;
aTexture = mTextureSource;
return !!aTexture;
}
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() override

View File

@ -637,13 +637,14 @@ DXGITextureHostD3D11::Unlock()
mIsLocked = false;
}
TextureSource*
DXGITextureHostD3D11::GetTextureSources()
bool
DXGITextureHostD3D11::BindTextureSource(CompositableTextureSourceRef& aTexture)
{
MOZ_ASSERT(mIsLocked);
// If Lock was successful we must have a valid TextureSource.
MOZ_ASSERT(mTextureSource);
return mTextureSource.get();
aTexture = mTextureSource;
return !!aTexture;
}
DXGIYCbCrTextureHostD3D11::DXGIYCbCrTextureHostD3D11(TextureFlags aFlags,
@ -740,13 +741,14 @@ DXGIYCbCrTextureHostD3D11::Unlock()
mIsLocked = false;
}
TextureSource*
DXGIYCbCrTextureHostD3D11::GetTextureSources()
bool
DXGIYCbCrTextureHostD3D11::BindTextureSource(CompositableTextureSourceRef& aTexture)
{
MOZ_ASSERT(mIsLocked);
// If Lock was successful we must have a valid TextureSource.
MOZ_ASSERT(mTextureSources[0] && mTextureSources[1] && mTextureSources[2]);
return mTextureSources[0].get();
aTexture = mTextureSources[0].get();
return !!aTexture;
}
bool

View File

@ -244,7 +244,7 @@ public:
DXGITextureHostD3D11(TextureFlags aFlags,
const SurfaceDescriptorD3D10& aDescriptor);
virtual TextureSource* GetTextureSources() override;
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override;
virtual void DeallocateDeviceData() override {}
@ -283,7 +283,7 @@ public:
DXGIYCbCrTextureHostD3D11(TextureFlags aFlags,
const SurfaceDescriptorDXGIYCbCr& aDescriptor);
virtual TextureSource* GetTextureSources() override;
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override;
virtual void DeallocateDeviceData() override{}

View File

@ -918,12 +918,13 @@ TextureHostD3D9::SetCompositor(Compositor* aCompositor)
}
}
TextureSource*
TextureHostD3D9::GetTextureSources()
bool
TextureHostD3D9::BindTextureSource(CompositableTextureSourceRef& aTexture)
{
MOZ_ASSERT(mIsLocked);
MOZ_ASSERT(mTextureSource);
return mTextureSource;
aTexture = mTextureSource;
return !!aTexture;
}
bool
@ -994,12 +995,13 @@ DXGITextureHostD3D9::OpenSharedHandle()
return;
}
TextureSource*
DXGITextureHostD3D9::GetTextureSources()
bool
DXGITextureHostD3D9::BindTextureSource(CompositableTextureSourceRef& aTexture)
{
MOZ_ASSERT(mIsLocked);
MOZ_ASSERT(mTextureSource);
return mTextureSource;
aTexture = mTextureSource;
return !!aTexture;
}
bool
@ -1112,13 +1114,14 @@ DXGIYCbCrTextureHostD3D9::Unlock()
mIsLocked = false;
}
TextureSource*
DXGIYCbCrTextureHostD3D9::GetTextureSources()
bool
DXGIYCbCrTextureHostD3D9::BindTextureSource(CompositableTextureSourceRef& aTexture)
{
MOZ_ASSERT(mIsLocked);
// If Lock was successful we must have a valid TextureSource.
MOZ_ASSERT(mTextureSources[0] && mTextureSources[1] && mTextureSources[2]);
return mTextureSources[0].get();
aTexture = mTextureSources[0].get();
return !!aTexture;
}
}

View File

@ -298,7 +298,7 @@ public:
TextureHostD3D9(TextureFlags aFlags,
const SurfaceDescriptorD3D9& aDescriptor);
virtual TextureSource* GetTextureSources() override;
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override;
virtual void DeallocateDeviceData() override;
@ -339,7 +339,7 @@ public:
DXGITextureHostD3D9(TextureFlags aFlags,
const SurfaceDescriptorD3D10& aDescriptor);
virtual TextureSource* GetTextureSources() override;
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override;
virtual void DeallocateDeviceData() override;
@ -376,7 +376,7 @@ public:
DXGIYCbCrTextureHostD3D9(TextureFlags aFlags,
const SurfaceDescriptorDXGIYCbCr& aDescriptor);
virtual TextureSource* GetTextureSources() override;
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override;
virtual void DeallocateDeviceData() override {}

View File

@ -244,12 +244,6 @@ GrallocTextureHostOGL::GetAsSurface() {
return surf.forget();
}
TextureSource*
GrallocTextureHostOGL::GetTextureSources()
{
return nullptr;
}
void
GrallocTextureHostOGL::UnbindTextureSource()
{

View File

@ -53,8 +53,6 @@ public:
virtual void UnbindTextureSource() override;
virtual TextureSource* GetTextureSources() override;
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
virtual TextureHostOGL* AsHostOGL() override
{

View File

@ -74,9 +74,10 @@ public:
virtual gfx::SurfaceFormat GetFormat() const override;
virtual TextureSource* GetTextureSources() override
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override
{
return mTextureSource;
aTexture = mTextureSource;
return !!aTexture;
}
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() override

View File

@ -400,9 +400,10 @@ public:
virtual gfx::SurfaceFormat GetFormat() const override;
virtual TextureSource* GetTextureSources() override
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override
{
return mTextureSource;
aTexture = mTextureSource;
return !!aTexture;
}
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() override
@ -492,9 +493,10 @@ public:
virtual gfx::SurfaceFormat GetFormat() const override;
virtual TextureSource* GetTextureSources() override
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override
{
return mTextureSource;
aTexture = mTextureSource;
return !!aTexture;
}
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() override