aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2016-09-20 08:54:23 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-20 08:54:23 -0700
commitbe9d82161d8347929a66ef942dabbe56abf592a4 (patch)
tree2a90ef981c6427bada15c20af059522ac69d8f68 /src/gpu
parent388127f1927ec6ba699a925969fd38a86cf56b3a (diff)
Workaround for Adreno INITIALIZATION_FAILED bug
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/vk/GrVkCaps.cpp2
-rw-r--r--src/gpu/vk/GrVkCaps.h9
-rw-r--r--src/gpu/vk/GrVkGpu.cpp11
3 files changed, 20 insertions, 2 deletions
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index 3348916d25..1d735aa8d6 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -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);
diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h
index f1ab8d050a..6f46952f43 100644
--- a/src/gpu/vk/GrVkCaps.h
+++ b/src/gpu/vk/GrVkCaps.h
@@ -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;
};
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 82e7394330..4d410a7b3a 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -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();