From aa3e498bbc9825b8c07a2094dc83e15b6bb47ffc Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Mon, 14 Dec 2020 14:47:57 -0800 Subject: Turn on vk unit tests * Degrade error when changing the rendering backend from Properties to no longer be fatal. * Support using a single graphics queue for the Vulkan backend. Cloud devices only support a single queue and some Vulkan implementations such as Swiftshader expose only one queue for simplying their implementation, so we'll need to support one. Bug: 175618060 Bug: 162628999 Test: hwui_unit_tests Test: experiment on Pixel 4 enforcing a single queue (settings app, maps, sysui) Change-Id: I495fcabc3c89bd62bbb833998eab4944c6660f6f --- libs/hwui/Properties.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'libs/hwui/Properties.cpp') diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp index ba44d056dda3..65f4e8c8ecec 100644 --- a/libs/hwui/Properties.cpp +++ b/libs/hwui/Properties.cpp @@ -15,7 +15,9 @@ */ #include "Properties.h" + #include "Debug.h" +#include "log/log_main.h" #ifdef __ANDROID__ #include "HWUIProperties.sysprop.h" #endif @@ -190,15 +192,12 @@ RenderPipelineType Properties::getRenderPipelineType() { return sRenderPipelineType; } -void Properties::overrideRenderPipelineType(RenderPipelineType type) { +void Properties::overrideRenderPipelineType(RenderPipelineType type, bool inUnitTest) { // If we're doing actual rendering then we can't change the renderer after it's been set. - // Unit tests can freely change this as often as it wants, though, as there's no actual - // GL rendering happening - if (sRenderPipelineType != RenderPipelineType::NotInitialized) { - LOG_ALWAYS_FATAL_IF(sRenderPipelineType != type, - "Trying to change pipeline but it's already set"); - return; - } + // Unit tests can freely change this as often as it wants. + LOG_ALWAYS_FATAL_IF(sRenderPipelineType != RenderPipelineType::NotInitialized && + sRenderPipelineType != type && !inUnitTest, + "Trying to change pipeline but it's already set."); sRenderPipelineType = type; } -- cgit v1.2.3-59-g8ed1b