mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1043929 - Ensure that a locked TextureHost can give access to a valid TextureSource for some of the texture types. r=Bas
This commit is contained in:
parent
c0638f4f0a
commit
580c75e9e0
@ -397,23 +397,26 @@ BufferTextureHost::DeallocateDeviceData()
|
|||||||
bool
|
bool
|
||||||
BufferTextureHost::Lock()
|
BufferTextureHost::Lock()
|
||||||
{
|
{
|
||||||
mLocked = true;
|
MOZ_ASSERT(!mLocked);
|
||||||
return true;
|
if (!MaybeUpload(mPartialUpdate ? &mMaybeUpdatedRegion : nullptr)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
mLocked = !!mFirstSource;
|
||||||
|
return mLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BufferTextureHost::Unlock()
|
BufferTextureHost::Unlock()
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(mLocked);
|
||||||
mLocked = false;
|
mLocked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewTextureSource*
|
NewTextureSource*
|
||||||
BufferTextureHost::GetTextureSources()
|
BufferTextureHost::GetTextureSources()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mLocked, "should never be called while not locked");
|
MOZ_ASSERT(mLocked);
|
||||||
if (!MaybeUpload(mPartialUpdate ? &mMaybeUpdatedRegion : nullptr)) {
|
MOZ_ASSERT(mFirstSource);
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return mFirstSource;
|
return mFirstSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,6 +445,7 @@ BufferTextureHost::MaybeUpload(nsIntRegion *aRegion)
|
|||||||
if (!Upload(aRegion)) {
|
if (!Upload(aRegion)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// If upload returns true we know mFirstSource is not null
|
||||||
mFirstSource->SetUpdateSerial(mUpdateSerial);
|
mFirstSource->SetUpdateSerial(mUpdateSerial);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -546,6 +550,7 @@ BufferTextureHost::Upload(nsIntRegion *aRegion)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MOZ_ASSERT(mFirstSource);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,6 +394,9 @@ DXGITextureHostD3D11::Unlock()
|
|||||||
NewTextureSource*
|
NewTextureSource*
|
||||||
DXGITextureHostD3D11::GetTextureSources()
|
DXGITextureHostD3D11::GetTextureSources()
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(mIsLocked);
|
||||||
|
// If Lock was successful we must have a valid TextureSource.
|
||||||
|
MOZ_ASSERT(mTextureSource);
|
||||||
return mTextureSource.get();
|
return mTextureSource.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -763,6 +763,7 @@ TextureHostD3D9::TextureHostD3D9(TextureFlags aFlags,
|
|||||||
, mIsLocked(false)
|
, mIsLocked(false)
|
||||||
{
|
{
|
||||||
mTexture = reinterpret_cast<IDirect3DTexture9*>(aDescriptor.texture());
|
mTexture = reinterpret_cast<IDirect3DTexture9*>(aDescriptor.texture());
|
||||||
|
MOZ_ASSERT(mTexture);
|
||||||
mTexture->Release(); // see AddRef in CairoTextureClientD3D9::ToSurfaceDescriptor
|
mTexture->Release(); // see AddRef in CairoTextureClientD3D9::ToSurfaceDescriptor
|
||||||
MOZ_ASSERT(mTexture);
|
MOZ_ASSERT(mTexture);
|
||||||
D3DSURFACE_DESC desc;
|
D3DSURFACE_DESC desc;
|
||||||
@ -848,6 +849,7 @@ DataTextureSourceD3D9::UpdateFromTexture(IDirect3DTexture9* aTexture,
|
|||||||
void
|
void
|
||||||
TextureHostD3D9::Updated(const nsIntRegion* aRegion)
|
TextureHostD3D9::Updated(const nsIntRegion* aRegion)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(mTexture);
|
||||||
if (!mTexture) {
|
if (!mTexture) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -879,6 +881,7 @@ NewTextureSource*
|
|||||||
TextureHostD3D9::GetTextureSources()
|
TextureHostD3D9::GetTextureSources()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mIsLocked);
|
MOZ_ASSERT(mIsLocked);
|
||||||
|
MOZ_ASSERT(mTextureSource);
|
||||||
return mTextureSource;
|
return mTextureSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -886,8 +889,11 @@ bool
|
|||||||
TextureHostD3D9::Lock()
|
TextureHostD3D9::Lock()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!mIsLocked);
|
MOZ_ASSERT(!mIsLocked);
|
||||||
mIsLocked = true;
|
// XXX - Currently if a TextureHostD3D9 is created but Update is never called,
|
||||||
return true;
|
// it will not have a TextureSource although it could since it has a valid
|
||||||
|
// D3D9 texture.
|
||||||
|
mIsLocked = !!mTextureSource;
|
||||||
|
return mIsLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -917,12 +923,15 @@ DXGITextureHostD3D9::DXGITextureHostD3D9(TextureFlags aFlags,
|
|||||||
NewTextureSource*
|
NewTextureSource*
|
||||||
DXGITextureHostD3D9::GetTextureSources()
|
DXGITextureHostD3D9::GetTextureSources()
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(mIsLocked);
|
||||||
|
MOZ_ASSERT(mTextureSource);
|
||||||
return mTextureSource;
|
return mTextureSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DXGITextureHostD3D9::Lock()
|
DXGITextureHostD3D9::Lock()
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(!mIsLocked);
|
||||||
DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
|
DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
|
||||||
if (!deviceManager) {
|
if (!deviceManager) {
|
||||||
NS_WARNING("trying to lock a TextureHost without a D3D device");
|
NS_WARNING("trying to lock a TextureHost without a D3D device");
|
||||||
@ -947,7 +956,6 @@ DXGITextureHostD3D9::Lock()
|
|||||||
mTextureSource = new DataTextureSourceD3D9(mFormat, mSize, mCompositor, tex);
|
mTextureSource = new DataTextureSourceD3D9(mFormat, mSize, mCompositor, tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(!mIsLocked);
|
|
||||||
mIsLocked = true;
|
mIsLocked = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user