Workaround for Adreno INITIALIZATION_FAILED bug

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2352083002

Review-Url: https://codereview.chromium.org/2352083002
This commit is contained in:
egdaniel 2016-09-20 08:54:23 -07:00 committed by Commit bot
parent 388127f192
commit be9d82161d
3 changed files with 20 additions and 2 deletions

View File

@ -17,6 +17,7 @@ GrVkCaps::GrVkCaps(const GrContextOptions& contextOptions, const GrVkInterface*
: INHERITED(contextOptions) {
fCanUseGLSLForShaderModule = false;
fMustDoCopiesFromOrigin = false;
fAllowInitializationErrorOnTearDown = false;
/**************************************************************************
* GrDrawTargetCaps fields
@ -69,6 +70,7 @@ void GrVkCaps::init(const GrContextOptions& contextOptions, const GrVkInterface*
if (kQualcomm_VkVendor == properties.vendorID) {
fMustDoCopiesFromOrigin = true;
fAllowInitializationErrorOnTearDown = true;
}
this->applyOptionsOverrides(contextOptions);

View File

@ -66,6 +66,10 @@ public:
return fMustDoCopiesFromOrigin;
}
bool allowInitializationErrorOnTearDown() const {
return fAllowInitializationErrorOnTearDown;
}
/**
* Returns both a supported and most prefered stencil format to use in draws.
*/
@ -119,6 +123,11 @@ private:
// copyImageToBuffer. This flag says that we must do the copy starting from the origin always.
bool fMustDoCopiesFromOrigin;
// On Adreno, there is a bug where vkQueueWaitIdle will once in a while return
// VK_ERROR_INITIALIZATION_FAILED instead of the required VK_SUCCESS or VK_DEVICE_LOST. This
// flag says we will accept VK_ERROR_INITIALIZATION_FAILED as well.
bool fAllowInitializationErrorOnTearDown;
typedef GrCaps INHERITED;
};

View File

@ -177,8 +177,15 @@ GrVkGpu::~GrVkGpu() {
#endif
#endif
// VK_ERROR_DEVICE_LOST is acceptable when tearing down (see 4.2.4 in spec)
SkASSERT(VK_SUCCESS == res || VK_ERROR_DEVICE_LOST == res);
#ifdef SK_DEBUG
if (this->vkCaps().allowInitializationErrorOnTearDown()) {
SkASSERT(VK_SUCCESS == res ||
VK_ERROR_DEVICE_LOST == res ||
VK_ERROR_INITIALIZATION_FAILED == res);
} else {
SkASSERT(VK_SUCCESS == res || VK_ERROR_DEVICE_LOST == res);
}
#endif
// must call this just before we destroy the VkDevice
fResourceProvider.destroyResources();