Read product property to set Vulkan as default render pipeline
Bug: 119267168
Test: Booted pixel 3 with Vulkan rendering
Change-Id: Ibc4b2e00d791b1fb333c0e0f5db2b5f084808c24
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp
index 0503f36..6585bfc 100644
--- a/libs/hwui/Android.bp
+++ b/libs/hwui/Android.bp
@@ -208,6 +208,7 @@
"FrameInfoVisualizer.cpp",
"GpuMemoryTracker.cpp",
"HardwareBitmapUploader.cpp",
+ "HWUIProperties.sysprop",
"Interpolator.cpp",
"JankTracker.cpp",
"Layer.cpp",
diff --git a/libs/hwui/HWUIProperties.sysprop b/libs/hwui/HWUIProperties.sysprop
new file mode 100644
index 0000000..42191ca
--- /dev/null
+++ b/libs/hwui/HWUIProperties.sysprop
@@ -0,0 +1,9 @@
+owner: Platform
+module: "android.uirenderer"
+prop {
+ api_name: "use_vulkan"
+ type: Boolean
+ prop_name: "ro.hwui.use_vulkan"
+ scope: Public
+ access: Readonly
+}
diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp
index 8067313..046ffc4 100644
--- a/libs/hwui/Properties.cpp
+++ b/libs/hwui/Properties.cpp
@@ -18,6 +18,7 @@
#include "Debug.h"
#include "DeviceInfo.h"
#include "SkTraceEventCommon.h"
+#include "HWUIProperties.sysprop.h"
#include <algorithm>
#include <cstdlib>
@@ -174,8 +175,13 @@
if (sRenderPipelineType != RenderPipelineType::NotInitialized) {
return sRenderPipelineType;
}
+ bool useVulkan = use_vulkan().value_or(false);
char prop[PROPERTY_VALUE_MAX];
- property_get(PROPERTY_RENDERER, prop, "skiagl");
+ if (useVulkan) {
+ property_get(PROPERTY_RENDERER, prop, "skiavk");
+ } else {
+ property_get(PROPERTY_RENDERER, prop, "skiagl");
+ }
if (!strcmp(prop, "skiavk")) {
ALOGD("Skia Vulkan Pipeline");
sRenderPipelineType = RenderPipelineType::SkiaVulkan;