Add ability to change context priority of RT Vulkan queues
Test: Pixel 3 does not support VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME
Bug: 126595186
Change-Id: I4b2e9c6d5f92665fd2274d0aabf4b012a7a29f46
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp
index 3b43f12..5af660c 100644
--- a/libs/hwui/renderthread/VulkanManager.cpp
+++ b/libs/hwui/renderthread/VulkanManager.cpp
@@ -254,10 +254,36 @@
float queuePriorities[1] = { 0.0 };
+ void* queueNextPtr = nullptr;
+
+ VkDeviceQueueGlobalPriorityCreateInfoEXT queuePriorityCreateInfo;
+
+ if (Properties::contextPriority != 0
+ && grExtensions.hasExtension(VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME, 2)) {
+ memset(&queuePriorityCreateInfo, 0, sizeof(VkDeviceQueueGlobalPriorityCreateInfoEXT));
+ queuePriorityCreateInfo.sType =
+ VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT;
+ queuePriorityCreateInfo.pNext = nullptr;
+ switch (Properties::contextPriority) {
+ case EGL_CONTEXT_PRIORITY_LOW_IMG:
+ queuePriorityCreateInfo.globalPriority = VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT;
+ break;
+ case EGL_CONTEXT_PRIORITY_MEDIUM_IMG:
+ queuePriorityCreateInfo.globalPriority = VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT;
+ break;
+ case EGL_CONTEXT_PRIORITY_HIGH_IMG:
+ queuePriorityCreateInfo.globalPriority = VK_QUEUE_GLOBAL_PRIORITY_HIGH_EXT;
+ break;
+ default:
+ LOG_ALWAYS_FATAL("Unsupported context priority");
+ }
+ queueNextPtr = &queuePriorityCreateInfo;
+ }
+
const VkDeviceQueueCreateInfo queueInfo[2] = {
{
VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // sType
- nullptr, // pNext
+ queueNextPtr, // pNext
0, // VkDeviceQueueCreateFlags
mGraphicsQueueIndex, // queueFamilyIndex
1, // queueCount
@@ -265,7 +291,7 @@
},
{
VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // sType
- nullptr, // pNext
+ queueNextPtr, // pNext
0, // VkDeviceQueueCreateFlags
mPresentQueueIndex, // queueFamilyIndex
1, // queueCount