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 // 10 is a totally arbitrary number that we may want to increase or decrease
// depending on how things behave in the wild. // depending on how things behave in the wild.
if (mFailedResetAttempts > 10) { 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)) { 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* mPreviousHost;
TextureSourceD3D9* mNextHost; TextureSourceD3D9* mNextHost;
// The device manager that created our textures. // The device manager that created our textures.
DeviceManagerD3D9* mCreatingDeviceManager; RefPtr<DeviceManagerD3D9> mCreatingDeviceManager;
StereoMode mStereoMode; StereoMode mStereoMode;
RefPtr<IDirect3DTexture9> mTexture; RefPtr<IDirect3DTexture9> mTexture;

View File

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

View File

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