summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderThread.cpp
diff options
context:
space:
mode:
authorAlec Mouri <alecmouri@google.com>2021-01-06 17:46:22 -0800
committerAlec Mouri <alecmouri@google.com>2021-01-06 17:46:22 -0800
commit7e7c3d72bcd903542b1556efb05dd7512606ba4f (patch)
tree0f202f3be6bb62630783f09c41db1831ec4a35c9 /libs/hwui/renderthread/RenderThread.cpp
parent852446ad481a3e69118e70ae59fecbc703a97774 (diff)
Check if mGrContext exists when requiring a vk context.
Vulkan context is shared with HardwareBitmapUploader and the RenderThread, meaning if the upload thread runs prior to the render thread then some configuration is skipped such as recording the max texture size and cache setup, which affects benchmark tools. So we need to check whether the GrContext exists in addition to checking if the shared VkManager has been properly intialized. Bug: 175913056 Test: hwuimacro works for benchmarks that upload HW bitmaps prior to benchmark execution. For example: tvapp_norcEglImage Change-Id: I149c294b39f1e88226fc5d8d72c30bc4fb3d8404
Diffstat (limited to 'libs/hwui/renderthread/RenderThread.cpp')
-rw-r--r--libs/hwui/renderthread/RenderThread.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index a101d46f6da0..7750a31b817f 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -199,7 +199,10 @@ void RenderThread::requireGlContext() {
void RenderThread::requireVkContext() {
// the getter creates the context in the event it had been destroyed by destroyRenderingContext
- if (vulkanManager().hasVkContext()) {
+ // Also check if we have a GrContext before returning fast. VulkanManager may be shared with
+ // the HardwareBitmapUploader which initializes the Vk context without persisting the GrContext
+ // in the rendering thread.
+ if (vulkanManager().hasVkContext() && mGrContext) {
return;
}
mVkManager->initialize();