summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/VulkanManager.h
diff options
context:
space:
mode:
authorAlec Mouri <alecmouri@google.com>2020-12-14 14:47:57 -0800
committerAlec Mouri <alecmouri@google.com>2021-01-13 14:35:58 -0800
commitaa3e498bbc9825b8c07a2094dc83e15b6bb47ffc (patch)
tree2ef76f41611f7b60a140836abf68f585800f5f7f /libs/hwui/renderthread/VulkanManager.h
parentf717288022eccd07183b2cdcac591aec023d8edf (diff)
Turn on vk unit tests
* Degrade error when changing the rendering backend from Properties to no longer be fatal. * Support using a single graphics queue for the Vulkan backend. Cloud devices only support a single queue and some Vulkan implementations such as Swiftshader expose only one queue for simplying their implementation, so we'll need to support one. Bug: 175618060 Bug: 162628999 Test: hwui_unit_tests Test: experiment on Pixel 4 enforcing a single queue (settings app, maps, sysui) Change-Id: I495fcabc3c89bd62bbb833998eab4944c6660f6f
Diffstat (limited to 'libs/hwui/renderthread/VulkanManager.h')
-rw-r--r--libs/hwui/renderthread/VulkanManager.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/libs/hwui/renderthread/VulkanManager.h b/libs/hwui/renderthread/VulkanManager.h
index 7a77466303cd..121afc90cfe5 100644
--- a/libs/hwui/renderthread/VulkanManager.h
+++ b/libs/hwui/renderthread/VulkanManager.h
@@ -17,6 +17,10 @@
#ifndef VULKANMANAGER_H
#define VULKANMANAGER_H
+#include <functional>
+#include <mutex>
+
+#include "vulkan/vulkan_core.h"
#if !defined(VK_USE_PLATFORM_ANDROID_KHR)
#define VK_USE_PLATFORM_ANDROID_KHR
#endif
@@ -161,8 +165,25 @@ private:
VkDevice mDevice = VK_NULL_HANDLE;
uint32_t mGraphicsQueueIndex;
+
+ std::mutex mGraphicsQueueMutex;
VkQueue mGraphicsQueue = VK_NULL_HANDLE;
- VkQueue mAHBUploadQueue = VK_NULL_HANDLE;
+
+ static VKAPI_ATTR VkResult interceptedVkQueueSubmit(VkQueue queue, uint32_t submitCount,
+ const VkSubmitInfo* pSubmits,
+ VkFence fence) {
+ sp<VulkanManager> manager = VulkanManager::getInstance();
+ std::lock_guard<std::mutex> lock(manager->mGraphicsQueueMutex);
+ return manager->mQueueSubmit(queue, submitCount, pSubmits, fence);
+ }
+
+ static VKAPI_ATTR VkResult interceptedVkQueueWaitIdle(VkQueue queue) {
+ sp<VulkanManager> manager = VulkanManager::getInstance();
+ std::lock_guard<std::mutex> lock(manager->mGraphicsQueueMutex);
+ return manager->mQueueWaitIdle(queue);
+ }
+
+ static GrVkGetProc sSkiaGetProp;
// Variables saved to populate VkFunctorInitParams.
static const uint32_t mAPIVersion = VK_MAKE_VERSION(1, 1, 0);