[Vulkan] Query global priority support for queue creation
Setting up a device queue with a global queue priority above the system
default requires sufficient privileges (SYS_NICE) otherwise queue
creation will fail.
SurfaceFlinger and system_server have SYS_NICE and will set priority to
REALTIME. SysUI and Launcher take that as an indication they should
request HIGH for better preemption strategy. However for upstream DRM
drivers, we currently lack a way to grant them granular access to HIGH
but not RT. For long term, the right way to do this is via drm specific
cgroup for scheduling controls however this is currently being worked
on upstream.
In the meantime, instead of fatally crashing, we can query the global
priorities supported before queue creation and if its not supported,
drop the priority request and log a warning.
Note this requires vkGetPhysicalDeviceQueueFamilyProperties2 which is
provided by Vulkan 1.1 while the global priority query can be safely
added to the pNext chain and will be ignored if
VK_EXT_global_priority_query isn't supported.
Bug: 343986434
Flag: com.android.graphics.hwui.flags.query_global_priority
Test: UI comes up debug.renderengine.backend=skiavkthreaded
Change-Id: I662c9ce3f3724e87690e25d260ee010340451c53
diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp
index b6476c9..ae46a99 100644
--- a/libs/hwui/Properties.cpp
+++ b/libs/hwui/Properties.cpp
@@ -50,6 +50,10 @@
constexpr bool resample_gainmap_regions() {
return false;
}
+
+constexpr bool query_global_priority() {
+ return false;
+}
} // namespace hwui_flags
#endif
@@ -110,6 +114,7 @@
bool Properties::hdr10bitPlus = false;
bool Properties::skipTelemetry = false;
bool Properties::resampleGainmapRegions = false;
+bool Properties::queryGlobalPriority = false;
int Properties::timeoutMultiplier = 1;
@@ -187,6 +192,7 @@
hdr10bitPlus = hwui_flags::hdr_10bit_plus();
resampleGainmapRegions = base::GetBoolProperty("debug.hwui.resample_gainmap_regions",
hwui_flags::resample_gainmap_regions());
+ queryGlobalPriority = hwui_flags::query_global_priority();
timeoutMultiplier = android::base::GetIntProperty("ro.hw_timeout_multiplier", 1);
skipTelemetry = base::GetBoolProperty(PROPERTY_SKIP_EGLMANAGER_TELEMETRY,