From 9a9e06c425ea0a93f1553407d65fef2ab2d4f12b Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 13 Aug 2024 20:45:14 +0000 Subject: [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 --- libs/hwui/Properties.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libs/hwui/Properties.cpp') diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp index b6476c9d466f..ae46a99f09c8 100644 --- a/libs/hwui/Properties.cpp +++ b/libs/hwui/Properties.cpp @@ -50,6 +50,10 @@ constexpr bool skip_eglmanager_telemetry() { constexpr bool resample_gainmap_regions() { return false; } + +constexpr bool query_global_priority() { + return false; +} } // namespace hwui_flags #endif @@ -110,6 +114,7 @@ bool Properties::clipSurfaceViews = false; bool Properties::hdr10bitPlus = false; bool Properties::skipTelemetry = false; bool Properties::resampleGainmapRegions = false; +bool Properties::queryGlobalPriority = false; int Properties::timeoutMultiplier = 1; @@ -187,6 +192,7 @@ bool Properties::load() { 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, -- cgit v1.2.3-59-g8ed1b