summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderThread.cpp
diff options
context:
space:
mode:
authorStan Iliev <stani@google.com>2019-02-03 18:01:02 -0500
committerStan Iliev <stani@google.com>2019-02-04 11:51:20 -0500
commit90276c86219c128d1343c6b26d95014fdd40b7fd (patch)
tree3abb27a51750062bf646390c4dfe2a15a75b077c /libs/hwui/renderthread/RenderThread.cpp
parent912ca4023c22c53d3526ce89fd6e7e1a90fe8e58 (diff)
Fix crash when VulkanSurface is no longer valid
SkiaVulkanPipeline::mVkSurface can become obsolete if RenderThread destroys Vulkan context. This CL enables RenderThread to notify active Vulkan pipelines that their surface is invalid. Improve error handling, when trying to draw a frame with null VulkanSurface. Bug: 123640274 Bug: 123541940 Test: Ran several apps Change-Id: If7fba00713d097192c96179df36e90b54f4f8090
Diffstat (limited to 'libs/hwui/renderthread/RenderThread.cpp')
-rw-r--r--libs/hwui/renderthread/RenderThread.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index 8bef35915c4d..3b37c83a6acc 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -203,11 +203,17 @@ void RenderThread::requireGlContext() {
void RenderThread::destroyRenderingContext() {
mFunctorManager.onContextDestroyed();
- if (mEglManager->hasEglContext()) {
- setGrContext(nullptr);
- mEglManager->destroy();
+ if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaGL) {
+ if (mEglManager->hasEglContext()) {
+ setGrContext(nullptr);
+ mEglManager->destroy();
+ }
+ } else {
+ if (vulkanManager().hasVkContext()) {
+ setGrContext(nullptr);
+ vulkanManager().destroy();
+ }
}
- vulkanManager().destroy();
}
void RenderThread::dumpGraphicsMemory(int fd) {