summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/VulkanManager.cpp
diff options
context:
space:
mode:
authorYiwei Zhang <zzyiwei@google.com>2020-09-03 12:00:00 -0700
committerYiwei Zhang <zzyiwei@google.com>2020-09-03 12:07:28 -0700
commit276d5fc7b105d83ec460fb18782750a10bee4710 (patch)
tree00642c146a04615761cc42af05cdf93fbd5d93ff /libs/hwui/renderthread/VulkanManager.cpp
parent0f2655292deeb6b9989f1452e5720980ab5ad194 (diff)
downloadbase-276d5fc7b105d83ec460fb18782750a10bee4710.tar.gz
HWUI: remove the redundant present queue
This change also fixed that the graphics queue should be the one to wait on upon surface destruction. Bug: 162628999 Bug: 167693610 Test: no new regressions in CtsUiRenderingTestCases with Vulkan backend Change-Id: I919748b85b2194bb4f13e1af6950d6493a17921d
Diffstat (limited to 'libs/hwui/renderthread/VulkanManager.cpp')
-rw-r--r--libs/hwui/renderthread/VulkanManager.cpp41
1 files changed, 12 insertions, 29 deletions
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp
index 76ec078ce3c9..4dbce92ed01c 100644
--- a/libs/hwui/renderthread/VulkanManager.cpp
+++ b/libs/hwui/renderthread/VulkanManager.cpp
@@ -84,7 +84,6 @@ VulkanManager::~VulkanManager() {
mGraphicsQueue = VK_NULL_HANDLE;
mAHBUploadQueue = VK_NULL_HANDLE;
- mPresentQueue = VK_NULL_HANDLE;
mDevice = VK_NULL_HANDLE;
mPhysicalDevice = VK_NULL_HANDLE;
mInstance = VK_NULL_HANDLE;
@@ -192,10 +191,6 @@ void VulkanManager::setupDevice(GrVkExtensions& grExtensions, VkPhysicalDeviceFe
}
LOG_ALWAYS_FATAL_IF(mGraphicsQueueIndex == queueCount);
- // All physical devices and queue families on Android must be capable of
- // presentation with any native window. So just use the first one.
- mPresentQueueIndex = 0;
-
{
uint32_t extensionCount = 0;
err = mEnumerateDeviceExtensionProperties(mPhysicalDevice, nullptr, &extensionCount,
@@ -289,31 +284,21 @@ void VulkanManager::setupDevice(GrVkExtensions& grExtensions, VkPhysicalDeviceFe
queueNextPtr = &queuePriorityCreateInfo;
}
- const VkDeviceQueueCreateInfo queueInfo[2] = {
- {
- VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // sType
- queueNextPtr, // pNext
- 0, // VkDeviceQueueCreateFlags
- mGraphicsQueueIndex, // queueFamilyIndex
- 2, // queueCount
- queuePriorities, // pQueuePriorities
- },
- {
- VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // sType
- queueNextPtr, // pNext
- 0, // VkDeviceQueueCreateFlags
- mPresentQueueIndex, // queueFamilyIndex
- 1, // queueCount
- queuePriorities, // pQueuePriorities
- }};
- uint32_t queueInfoCount = (mPresentQueueIndex != mGraphicsQueueIndex) ? 2 : 1;
+ const VkDeviceQueueCreateInfo queueInfo = {
+ VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // sType
+ queueNextPtr, // pNext
+ 0, // VkDeviceQueueCreateFlags
+ mGraphicsQueueIndex, // queueFamilyIndex
+ 2, // queueCount
+ queuePriorities, // pQueuePriorities
+ };
const VkDeviceCreateInfo deviceInfo = {
VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, // sType
&features, // pNext
0, // VkDeviceCreateFlags
- queueInfoCount, // queueCreateInfoCount
- queueInfo, // pQueueCreateInfos
+ 1, // queueCreateInfoCount
+ &queueInfo, // pQueueCreateInfos
0, // layerCount
nullptr, // ppEnabledLayerNames
(uint32_t)mDeviceExtensions.size(), // extensionCount
@@ -361,8 +346,6 @@ void VulkanManager::initialize() {
mGetDeviceQueue(mDevice, mGraphicsQueueIndex, 0, &mGraphicsQueue);
mGetDeviceQueue(mDevice, mGraphicsQueueIndex, 1, &mAHBUploadQueue);
- mGetDeviceQueue(mDevice, mPresentQueueIndex, 0, &mPresentQueue);
-
if (Properties::enablePartialUpdates && Properties::useBufferAge) {
mSwapBehavior = SwapBehavior::BufferAge;
}
@@ -555,8 +538,8 @@ void VulkanManager::swapBuffers(VulkanSurface* surface, const SkRect& dirtyRect)
void VulkanManager::destroySurface(VulkanSurface* surface) {
// Make sure all submit commands have finished before starting to destroy objects.
- if (VK_NULL_HANDLE != mPresentQueue) {
- mQueueWaitIdle(mPresentQueue);
+ if (VK_NULL_HANDLE != mGraphicsQueue) {
+ mQueueWaitIdle(mGraphicsQueue);
}
mDeviceWaitIdle(mDevice);