Bug 1254400 - Handle device reset for d3d9. r=dvander

--HG--
extra : commitid : 8yHPSR3Z73s
This commit is contained in:
Morris Tseng 2016-03-29 09:26:29 +08:00
parent eb9d46b90f
commit 97773ba583
5 changed files with 17 additions and 3 deletions

View File

@ -670,7 +670,9 @@ CompositorD3D9::FailedToResetDevice() {
// 10 is a totally arbitrary number that we may want to increase or decrease
// depending on how things behave in the wild.
if (mFailedResetAttempts > 10) {
MOZ_CRASH("GFX: Unable to get a working D3D9 Compositor");
mFailedResetAttempts = 0;
gfxWindowsPlatform::GetPlatform()->D3D9DeviceReset();
gfxWarning() << "[D3D9] Unable to get a working D3D9 Compositor";
}
}

View File

@ -904,7 +904,7 @@ TextureHostD3D9::UpdatedInternal(const nsIntRegion* aRegion)
}
if (!mTextureSource->UpdateFromTexture(mTexture, regionToUpdate)) {
gfxCriticalError() << "[D3D9] DataTextureSourceD3D9::UpdateFromTexture failed";
gfxWarning() << "[D3D9] DataTextureSourceD3D9::UpdateFromTexture failed";
}
}

View File

@ -83,7 +83,7 @@ protected:
TextureSourceD3D9* mPreviousHost;
TextureSourceD3D9* mNextHost;
// The device manager that created our textures.
DeviceManagerD3D9* mCreatingDeviceManager;
RefPtr<DeviceManagerD3D9> mCreatingDeviceManager;
StereoMode mStereoMode;
RefPtr<IDirect3DTexture9> mTexture;

View File

@ -377,6 +377,7 @@ gfxWindowsPlatform::gfxWindowsPlatform()
, mAcceleration(FeatureStatus::Unused)
, mD3D11Status(FeatureStatus::Unused)
, mD2D1Status(FeatureStatus::Unused)
, mHasD3D9DeviceReset(false)
{
mUseClearTypeForDownloadableFonts = UNINITIALIZED_VALUE;
mUseClearTypeAlways = UNINITIALIZED_VALUE;
@ -483,6 +484,7 @@ gfxWindowsPlatform::HandleDeviceReset()
// will be recomputed by InitializeDevices().
mHasDeviceReset = false;
mHasFakeDeviceReset = false;
mHasD3D9DeviceReset = false;
mCompositorD3D11TextureSharingWorks = false;
mDeviceResetReason = DeviceResetReason::OK;
@ -996,6 +998,9 @@ gfxWindowsPlatform::DidRenderingDeviceReset(DeviceResetReason* aResetReason)
return true;
}
}
if (mHasD3D9DeviceReset) {
return true;
}
if (XRE_IsParentProcess() && gfxPrefs::DeviceResetForTesting()) {
TestDeviceReset((DeviceResetReason)gfxPrefs::DeviceResetForTesting());
if (aResetReason) {
@ -1392,6 +1397,11 @@ gfxWindowsPlatform::GetD3D9Device()
return manager ? manager->device() : nullptr;
}
void
gfxWindowsPlatform::D3D9DeviceReset() {
mHasD3D9DeviceReset = true;
}
DeviceManagerD3D9*
gfxWindowsPlatform::GetD3D9DeviceManager()
{

View File

@ -212,6 +212,7 @@ public:
void OnDeviceManagerDestroy(mozilla::layers::DeviceManagerD3D9* aDeviceManager);
mozilla::layers::DeviceManagerD3D9* GetD3D9DeviceManager();
IDirect3DDevice9* GetD3D9Device();
void D3D9DeviceReset();
ID3D11Device *GetD3D11ContentDevice();
// Create a D3D11 device to be used for DXVA decoding.
@ -333,6 +334,7 @@ private:
bool mHasDeviceReset;
bool mHasFakeDeviceReset;
bool mCompositorD3D11TextureSharingWorks;
mozilla::Atomic<bool> mHasD3D9DeviceReset;
DeviceResetReason mDeviceResetReason;
RefPtr<mozilla::layers::ReadbackManagerD3D11> mD3D11ReadbackManager;