зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1223270: P7. Extract D3D11MTAutoEnter and reuse. r=mattwoodrow
MozReview-Commit-ID: Ipz5ygQLxNV --HG-- extra : rebase_source : 7b294cc18ae5cedde2e1baea5c63c7a3286cba56
This commit is contained in:
Родитель
35422755f0
Коммит
2f1f120932
|
@ -69,7 +69,7 @@ D3D11YCbCrImage::SetData(KnowsCompositor* aAllocator,
|
|||
return false;
|
||||
}
|
||||
|
||||
mt->Enter();
|
||||
D3D11MTAutoEnter mtAutoEnter(mt.forget());
|
||||
|
||||
RefPtr<ID3D11DeviceContext> ctx;
|
||||
allocator->GetDevice()->GetImmediateContext(getter_AddRefs(ctx));
|
||||
|
@ -97,8 +97,7 @@ D3D11YCbCrImage::SetData(KnowsCompositor* aAllocator,
|
|||
aData.mCbCrStride,
|
||||
aData.mCbCrStride * aData.mCbCrSize.height);
|
||||
|
||||
mt->Leave();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -160,21 +159,7 @@ D3D11YCbCrImage::GetAsSourceSurface()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
class D3D11MTAutoEnter
|
||||
{
|
||||
public:
|
||||
explicit D3D11MTAutoEnter(already_AddRefed<ID3D10Multithread> aMT)
|
||||
: mMT(aMT)
|
||||
{
|
||||
mMT->Enter();
|
||||
}
|
||||
~D3D11MTAutoEnter()
|
||||
{
|
||||
mMT->Leave();
|
||||
}
|
||||
private:
|
||||
RefPtr<ID3D10Multithread> mMT;
|
||||
} mtAutoEnter(mt.forget());
|
||||
D3D11MTAutoEnter mtAutoEnter(mt.forget());
|
||||
|
||||
texY->GetDesc(&desc);
|
||||
desc.BindFlags = 0;
|
||||
|
|
|
@ -106,12 +106,10 @@ IMFYCbCrImage::GetD3D11TextureData(Data aData, gfx::IntSize aSize)
|
|||
HRESULT hr;
|
||||
RefPtr<ID3D10Multithread> mt;
|
||||
|
||||
RefPtr<ID3D11Device> device =
|
||||
gfx::DeviceManagerDx::Get()->GetContentDevice();
|
||||
RefPtr<ID3D11Device> device = gfx::DeviceManagerDx::Get()->GetContentDevice();
|
||||
|
||||
if (!device) {
|
||||
device =
|
||||
gfx::DeviceManagerDx::Get()->GetCompositorDevice();
|
||||
device = gfx::DeviceManagerDx::Get()->GetCompositorDevice();
|
||||
}
|
||||
|
||||
hr = device->QueryInterface((ID3D10Multithread**)getter_AddRefs(mt));
|
||||
|
@ -169,8 +167,7 @@ IMFYCbCrImage::GetD3D11TextureData(Data aData, gfx::IntSize aSize)
|
|||
AutoLockD3D11Texture lockY(textureY);
|
||||
AutoLockD3D11Texture lockCr(textureCr);
|
||||
AutoLockD3D11Texture lockCb(textureCb);
|
||||
|
||||
mt->Enter();
|
||||
D3D11MTAutoEnter mtAutoEnter(mt.forget());
|
||||
|
||||
RefPtr<ID3D11DeviceContext> ctx;
|
||||
device->GetImmediateContext((ID3D11DeviceContext**)getter_AddRefs(ctx));
|
||||
|
@ -186,8 +183,6 @@ IMFYCbCrImage::GetD3D11TextureData(Data aData, gfx::IntSize aSize)
|
|||
box.bottom = aData.mCbCrSize.height;
|
||||
ctx->UpdateSubresource(textureCb, 0, &box, aData.mCbChannel, aData.mCbCrStride, 0);
|
||||
ctx->UpdateSubresource(textureCr, 0, &box, aData.mCrChannel, aData.mCbCrStride, 0);
|
||||
|
||||
mt->Leave();
|
||||
}
|
||||
|
||||
return DXGIYCbCrTextureData::Create(textureY, textureCb, textureCr,
|
||||
|
|
|
@ -494,6 +494,20 @@ private:
|
|||
RefPtr<IDXGIKeyedMutex> mMutex;
|
||||
};
|
||||
|
||||
class D3D11MTAutoEnter
|
||||
{
|
||||
public:
|
||||
explicit D3D11MTAutoEnter(already_AddRefed<ID3D10Multithread> aMT)
|
||||
: mMT(aMT)
|
||||
{
|
||||
mMT->Enter();
|
||||
}
|
||||
~D3D11MTAutoEnter() { mMT->Leave(); }
|
||||
|
||||
private:
|
||||
RefPtr<ID3D10Multithread> mMT;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче