blob: 35729c1b6496156ebd6ae8b3fad5172a1c4d967e [file] [log] [blame]
Derek Sollenberger0e3cba32016-11-09 11:58:36 -05001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "VulkanManager.h"
18
Derek Sollenbergera19b71a2019-02-15 16:36:30 -050019#include <android/sync.h>
Stan Iliev305e13a2018-11-13 11:14:48 -050020#include <gui/Surface.h>
21
Greg Danielcd558522016-11-17 13:31:40 -050022#include "Properties.h"
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050023#include "RenderThread.h"
Greg Daniel45ec62b2017-01-04 14:27:00 -050024#include "renderstate/RenderState.h"
Ben Wagnereec27d52017-01-11 15:32:07 -050025#include "utils/FatVector.h"
John Reck322b8ab2019-03-14 13:15:28 -070026#include "utils/TraceUtils.h"
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050027
Derek Sollenbergera19b71a2019-02-15 16:36:30 -050028#include <GrBackendSemaphore.h>
Greg Danielac2d2322017-07-12 11:30:15 -040029#include <GrBackendSurface.h>
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050030#include <GrContext.h>
31#include <GrTypes.h>
Greg Daniela227dbb2018-08-20 09:19:48 -040032#include <GrTypes.h>
33#include <vk/GrVkExtensions.h>
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050034#include <vk/GrVkTypes.h>
35
36namespace android {
37namespace uirenderer {
38namespace renderthread {
39
Bo Liu7b8c1eb2019-01-08 20:17:55 -080040static void free_features_extensions_structs(const VkPhysicalDeviceFeatures2& features) {
41 // All Vulkan structs that could be part of the features chain will start with the
42 // structure type followed by the pNext pointer. We cast to the CommonVulkanHeader
43 // so we can get access to the pNext for the next struct.
44 struct CommonVulkanHeader {
45 VkStructureType sType;
46 void* pNext;
47 };
48
49 void* pNext = features.pNext;
50 while (pNext) {
51 void* current = pNext;
52 pNext = static_cast<CommonVulkanHeader*>(current)->pNext;
53 free(current);
54 }
55}
56
Greg Daniel2ff202712018-06-14 11:50:10 -040057#define GET_PROC(F) m##F = (PFN_vk##F)vkGetInstanceProcAddr(VK_NULL_HANDLE, "vk" #F)
58#define GET_INST_PROC(F) m##F = (PFN_vk##F)vkGetInstanceProcAddr(mInstance, "vk" #F)
59#define GET_DEV_PROC(F) m##F = (PFN_vk##F)vkGetDeviceProcAddr(mDevice, "vk" #F)
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050060
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050061void VulkanManager::destroy() {
Greg Daniel26e0dca2018-09-18 10:33:19 -040062 // We don't need to explicitly free the command buffer since it automatically gets freed when we
63 // delete the VkCommandPool below.
64 mDummyCB = VK_NULL_HANDLE;
65
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050066 if (VK_NULL_HANDLE != mCommandPool) {
Greg Daniel2ff202712018-06-14 11:50:10 -040067 mDestroyCommandPool(mDevice, mCommandPool, nullptr);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050068 mCommandPool = VK_NULL_HANDLE;
69 }
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050070
Greg Daniel2ff202712018-06-14 11:50:10 -040071 if (mDevice != VK_NULL_HANDLE) {
72 mDeviceWaitIdle(mDevice);
73 mDestroyDevice(mDevice, nullptr);
John Reck1bcacfd2017-11-03 10:12:19 -070074 }
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050075
Greg Daniel2ff202712018-06-14 11:50:10 -040076 if (mInstance != VK_NULL_HANDLE) {
77 mDestroyInstance(mInstance, nullptr);
78 }
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050079
Greg Daniel2ff202712018-06-14 11:50:10 -040080 mGraphicsQueue = VK_NULL_HANDLE;
81 mPresentQueue = VK_NULL_HANDLE;
82 mDevice = VK_NULL_HANDLE;
83 mPhysicalDevice = VK_NULL_HANDLE;
84 mInstance = VK_NULL_HANDLE;
Roman Kiryanov74ace839e2019-03-07 18:22:19 -080085 mInstanceExtensionsOwner.clear();
Bo Liu7b8c1eb2019-01-08 20:17:55 -080086 mInstanceExtensions.clear();
Roman Kiryanov74ace839e2019-03-07 18:22:19 -080087 mDeviceExtensionsOwner.clear();
Bo Liu7b8c1eb2019-01-08 20:17:55 -080088 mDeviceExtensions.clear();
89 free_features_extensions_structs(mPhysicalDeviceFeatures2);
90 mPhysicalDeviceFeatures2 = {};
Greg Daniel2ff202712018-06-14 11:50:10 -040091}
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050092
Stan Iliev90276c82019-02-03 18:01:02 -050093void VulkanManager::setupDevice(GrVkExtensions& grExtensions, VkPhysicalDeviceFeatures2& features) {
Greg Daniel2ff202712018-06-14 11:50:10 -040094 VkResult err;
95
96 constexpr VkApplicationInfo app_info = {
97 VK_STRUCTURE_TYPE_APPLICATION_INFO, // sType
98 nullptr, // pNext
99 "android framework", // pApplicationName
100 0, // applicationVersion
101 "android framework", // pEngineName
102 0, // engineVerison
Greg Danieleaf310e2019-01-28 16:10:32 -0500103 mAPIVersion, // apiVersion
Greg Daniel2ff202712018-06-14 11:50:10 -0400104 };
105
Greg Daniel2ff202712018-06-14 11:50:10 -0400106 {
107 GET_PROC(EnumerateInstanceExtensionProperties);
108
109 uint32_t extensionCount = 0;
110 err = mEnumerateInstanceExtensionProperties(nullptr, &extensionCount, nullptr);
Stan Iliev90276c82019-02-03 18:01:02 -0500111 LOG_ALWAYS_FATAL_IF(VK_SUCCESS != err);
Roman Kiryanov74ace839e2019-03-07 18:22:19 -0800112 mInstanceExtensionsOwner.resize(extensionCount);
113 err = mEnumerateInstanceExtensionProperties(nullptr, &extensionCount,
114 mInstanceExtensionsOwner.data());
Stan Iliev90276c82019-02-03 18:01:02 -0500115 LOG_ALWAYS_FATAL_IF(VK_SUCCESS != err);
Greg Daniel2ff202712018-06-14 11:50:10 -0400116 bool hasKHRSurfaceExtension = false;
117 bool hasKHRAndroidSurfaceExtension = false;
Roman Kiryanov74ace839e2019-03-07 18:22:19 -0800118 for (const VkExtensionProperties& extension : mInstanceExtensionsOwner) {
119 mInstanceExtensions.push_back(extension.extensionName);
120 if (!strcmp(extension.extensionName, VK_KHR_SURFACE_EXTENSION_NAME)) {
Greg Daniel2ff202712018-06-14 11:50:10 -0400121 hasKHRSurfaceExtension = true;
122 }
Roman Kiryanov74ace839e2019-03-07 18:22:19 -0800123 if (!strcmp(extension.extensionName, VK_KHR_ANDROID_SURFACE_EXTENSION_NAME)) {
Greg Daniel2ff202712018-06-14 11:50:10 -0400124 hasKHRAndroidSurfaceExtension = true;
125 }
126 }
Stan Iliev90276c82019-02-03 18:01:02 -0500127 LOG_ALWAYS_FATAL_IF(!hasKHRSurfaceExtension || !hasKHRAndroidSurfaceExtension);
Greg Daniel2ff202712018-06-14 11:50:10 -0400128 }
129
130 const VkInstanceCreateInfo instance_create = {
131 VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, // sType
132 nullptr, // pNext
133 0, // flags
134 &app_info, // pApplicationInfo
135 0, // enabledLayerNameCount
136 nullptr, // ppEnabledLayerNames
Bo Liu7b8c1eb2019-01-08 20:17:55 -0800137 (uint32_t) mInstanceExtensions.size(), // enabledExtensionNameCount
138 mInstanceExtensions.data(), // ppEnabledExtensionNames
Greg Daniel2ff202712018-06-14 11:50:10 -0400139 };
140
141 GET_PROC(CreateInstance);
142 err = mCreateInstance(&instance_create, nullptr, &mInstance);
Stan Iliev90276c82019-02-03 18:01:02 -0500143 LOG_ALWAYS_FATAL_IF(err < 0);
Greg Daniel2ff202712018-06-14 11:50:10 -0400144
145 GET_INST_PROC(DestroyInstance);
146 GET_INST_PROC(EnumeratePhysicalDevices);
Greg Daniel96259622018-10-01 14:42:56 -0400147 GET_INST_PROC(GetPhysicalDeviceProperties);
Greg Daniel2ff202712018-06-14 11:50:10 -0400148 GET_INST_PROC(GetPhysicalDeviceQueueFamilyProperties);
Greg Daniela227dbb2018-08-20 09:19:48 -0400149 GET_INST_PROC(GetPhysicalDeviceFeatures2);
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500150 GET_INST_PROC(GetPhysicalDeviceImageFormatProperties2);
Greg Daniel2ff202712018-06-14 11:50:10 -0400151 GET_INST_PROC(CreateDevice);
152 GET_INST_PROC(EnumerateDeviceExtensionProperties);
153 GET_INST_PROC(CreateAndroidSurfaceKHR);
154 GET_INST_PROC(DestroySurfaceKHR);
155 GET_INST_PROC(GetPhysicalDeviceSurfaceSupportKHR);
156 GET_INST_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR);
157 GET_INST_PROC(GetPhysicalDeviceSurfaceFormatsKHR);
158 GET_INST_PROC(GetPhysicalDeviceSurfacePresentModesKHR);
159
160 uint32_t gpuCount;
Stan Iliev90276c82019-02-03 18:01:02 -0500161 LOG_ALWAYS_FATAL_IF(mEnumeratePhysicalDevices(mInstance, &gpuCount, nullptr));
162 LOG_ALWAYS_FATAL_IF(!gpuCount);
Greg Daniel2ff202712018-06-14 11:50:10 -0400163 // Just returning the first physical device instead of getting the whole array. Since there
164 // should only be one device on android.
165 gpuCount = 1;
166 err = mEnumeratePhysicalDevices(mInstance, &gpuCount, &mPhysicalDevice);
167 // VK_INCOMPLETE is returned when the count we provide is less than the total device count.
Stan Iliev90276c82019-02-03 18:01:02 -0500168 LOG_ALWAYS_FATAL_IF(err && VK_INCOMPLETE != err);
Greg Daniel2ff202712018-06-14 11:50:10 -0400169
Greg Daniel96259622018-10-01 14:42:56 -0400170 VkPhysicalDeviceProperties physDeviceProperties;
171 mGetPhysicalDeviceProperties(mPhysicalDevice, &physDeviceProperties);
Stan Iliev90276c82019-02-03 18:01:02 -0500172 LOG_ALWAYS_FATAL_IF(physDeviceProperties.apiVersion < VK_MAKE_VERSION(1, 1, 0));
Stan Ilievbf99c442019-03-29 11:09:11 -0400173 mDriverVersion = physDeviceProperties.driverVersion;
Greg Daniel96259622018-10-01 14:42:56 -0400174
Greg Daniel2ff202712018-06-14 11:50:10 -0400175 // query to get the initial queue props size
176 uint32_t queueCount;
177 mGetPhysicalDeviceQueueFamilyProperties(mPhysicalDevice, &queueCount, nullptr);
Stan Iliev90276c82019-02-03 18:01:02 -0500178 LOG_ALWAYS_FATAL_IF(!queueCount);
Greg Daniel2ff202712018-06-14 11:50:10 -0400179
180 // now get the actual queue props
181 std::unique_ptr<VkQueueFamilyProperties[]> queueProps(new VkQueueFamilyProperties[queueCount]);
182 mGetPhysicalDeviceQueueFamilyProperties(mPhysicalDevice, &queueCount, queueProps.get());
183
184 // iterate to find the graphics queue
185 mGraphicsQueueIndex = queueCount;
186 for (uint32_t i = 0; i < queueCount; i++) {
187 if (queueProps[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
188 mGraphicsQueueIndex = i;
189 break;
190 }
191 }
Stan Iliev90276c82019-02-03 18:01:02 -0500192 LOG_ALWAYS_FATAL_IF(mGraphicsQueueIndex == queueCount);
Greg Daniel2ff202712018-06-14 11:50:10 -0400193
194 // All physical devices and queue families on Android must be capable of
195 // presentation with any native window. So just use the first one.
196 mPresentQueueIndex = 0;
197
Greg Daniel2ff202712018-06-14 11:50:10 -0400198 {
199 uint32_t extensionCount = 0;
200 err = mEnumerateDeviceExtensionProperties(mPhysicalDevice, nullptr, &extensionCount,
201 nullptr);
Stan Iliev90276c82019-02-03 18:01:02 -0500202 LOG_ALWAYS_FATAL_IF(VK_SUCCESS != err);
Roman Kiryanov74ace839e2019-03-07 18:22:19 -0800203 mDeviceExtensionsOwner.resize(extensionCount);
Greg Daniel2ff202712018-06-14 11:50:10 -0400204 err = mEnumerateDeviceExtensionProperties(mPhysicalDevice, nullptr, &extensionCount,
Roman Kiryanov74ace839e2019-03-07 18:22:19 -0800205 mDeviceExtensionsOwner.data());
Stan Iliev90276c82019-02-03 18:01:02 -0500206 LOG_ALWAYS_FATAL_IF(VK_SUCCESS != err);
Greg Daniel2ff202712018-06-14 11:50:10 -0400207 bool hasKHRSwapchainExtension = false;
Roman Kiryanov74ace839e2019-03-07 18:22:19 -0800208 for (const VkExtensionProperties& extension : mDeviceExtensionsOwner) {
209 mDeviceExtensions.push_back(extension.extensionName);
210 if (!strcmp(extension.extensionName, VK_KHR_SWAPCHAIN_EXTENSION_NAME)) {
Greg Daniel2ff202712018-06-14 11:50:10 -0400211 hasKHRSwapchainExtension = true;
212 }
213 }
Stan Iliev90276c82019-02-03 18:01:02 -0500214 LOG_ALWAYS_FATAL_IF(!hasKHRSwapchainExtension);
Greg Daniel2ff202712018-06-14 11:50:10 -0400215 }
216
Greg Daniela227dbb2018-08-20 09:19:48 -0400217 auto getProc = [] (const char* proc_name, VkInstance instance, VkDevice device) {
218 if (device != VK_NULL_HANDLE) {
219 return vkGetDeviceProcAddr(device, proc_name);
220 }
221 return vkGetInstanceProcAddr(instance, proc_name);
222 };
Roman Kiryanov74ace839e2019-03-07 18:22:19 -0800223
Bo Liu7b8c1eb2019-01-08 20:17:55 -0800224 grExtensions.init(getProc, mInstance, mPhysicalDevice, mInstanceExtensions.size(),
225 mInstanceExtensions.data(), mDeviceExtensions.size(), mDeviceExtensions.data());
Greg Daniela227dbb2018-08-20 09:19:48 -0400226
Stan Iliev90276c82019-02-03 18:01:02 -0500227 LOG_ALWAYS_FATAL_IF(!grExtensions.hasExtension(VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME, 1));
Greg Daniel26e0dca2018-09-18 10:33:19 -0400228
Greg Daniela227dbb2018-08-20 09:19:48 -0400229 memset(&features, 0, sizeof(VkPhysicalDeviceFeatures2));
230 features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
231 features.pNext = nullptr;
232
233 // Setup all extension feature structs we may want to use.
234 void** tailPNext = &features.pNext;
235
236 if (grExtensions.hasExtension(VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME, 2)) {
237 VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT* blend;
238 blend = (VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT*) malloc(
239 sizeof(VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT));
240 LOG_ALWAYS_FATAL_IF(!blend);
241 blend->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT;
242 blend->pNext = nullptr;
243 *tailPNext = blend;
244 tailPNext = &blend->pNext;
245 }
246
Greg Daniel05036172018-11-28 17:08:04 -0500247 VkPhysicalDeviceSamplerYcbcrConversionFeatures* ycbcrFeature;
248 ycbcrFeature = (VkPhysicalDeviceSamplerYcbcrConversionFeatures*) malloc(
249 sizeof(VkPhysicalDeviceSamplerYcbcrConversionFeatures));
250 LOG_ALWAYS_FATAL_IF(!ycbcrFeature);
251 ycbcrFeature->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES;
252 ycbcrFeature->pNext = nullptr;
253 *tailPNext = ycbcrFeature;
254 tailPNext = &ycbcrFeature->pNext;
255
Greg Daniela227dbb2018-08-20 09:19:48 -0400256 // query to get the physical device features
257 mGetPhysicalDeviceFeatures2(mPhysicalDevice, &features);
Greg Daniel2ff202712018-06-14 11:50:10 -0400258 // this looks like it would slow things down,
259 // and we can't depend on it on all platforms
Greg Daniela227dbb2018-08-20 09:19:48 -0400260 features.features.robustBufferAccess = VK_FALSE;
Greg Daniel2ff202712018-06-14 11:50:10 -0400261
262 float queuePriorities[1] = { 0.0 };
263
Stan Iliev7e733362019-02-28 13:16:36 -0500264 void* queueNextPtr = nullptr;
265
266 VkDeviceQueueGlobalPriorityCreateInfoEXT queuePriorityCreateInfo;
267
268 if (Properties::contextPriority != 0
269 && grExtensions.hasExtension(VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME, 2)) {
270 memset(&queuePriorityCreateInfo, 0, sizeof(VkDeviceQueueGlobalPriorityCreateInfoEXT));
271 queuePriorityCreateInfo.sType =
272 VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT;
273 queuePriorityCreateInfo.pNext = nullptr;
274 switch (Properties::contextPriority) {
275 case EGL_CONTEXT_PRIORITY_LOW_IMG:
276 queuePriorityCreateInfo.globalPriority = VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT;
277 break;
278 case EGL_CONTEXT_PRIORITY_MEDIUM_IMG:
279 queuePriorityCreateInfo.globalPriority = VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT;
280 break;
281 case EGL_CONTEXT_PRIORITY_HIGH_IMG:
282 queuePriorityCreateInfo.globalPriority = VK_QUEUE_GLOBAL_PRIORITY_HIGH_EXT;
283 break;
284 default:
285 LOG_ALWAYS_FATAL("Unsupported context priority");
286 }
287 queueNextPtr = &queuePriorityCreateInfo;
288 }
289
Greg Daniel2ff202712018-06-14 11:50:10 -0400290 const VkDeviceQueueCreateInfo queueInfo[2] = {
291 {
292 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // sType
Stan Iliev7e733362019-02-28 13:16:36 -0500293 queueNextPtr, // pNext
Greg Daniel2ff202712018-06-14 11:50:10 -0400294 0, // VkDeviceQueueCreateFlags
295 mGraphicsQueueIndex, // queueFamilyIndex
296 1, // queueCount
297 queuePriorities, // pQueuePriorities
298 },
299 {
300 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // sType
Stan Iliev7e733362019-02-28 13:16:36 -0500301 queueNextPtr, // pNext
Greg Daniel2ff202712018-06-14 11:50:10 -0400302 0, // VkDeviceQueueCreateFlags
303 mPresentQueueIndex, // queueFamilyIndex
304 1, // queueCount
305 queuePriorities, // pQueuePriorities
306 }
307 };
308 uint32_t queueInfoCount = (mPresentQueueIndex != mGraphicsQueueIndex) ? 2 : 1;
309
310 const VkDeviceCreateInfo deviceInfo = {
311 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, // sType
Greg Daniela227dbb2018-08-20 09:19:48 -0400312 &features, // pNext
Greg Daniel2ff202712018-06-14 11:50:10 -0400313 0, // VkDeviceCreateFlags
314 queueInfoCount, // queueCreateInfoCount
315 queueInfo, // pQueueCreateInfos
316 0, // layerCount
317 nullptr, // ppEnabledLayerNames
Bo Liu7b8c1eb2019-01-08 20:17:55 -0800318 (uint32_t) mDeviceExtensions.size(), // extensionCount
319 mDeviceExtensions.data(), // ppEnabledExtensionNames
Greg Daniela227dbb2018-08-20 09:19:48 -0400320 nullptr, // ppEnabledFeatures
Greg Daniel2ff202712018-06-14 11:50:10 -0400321 };
322
Stan Iliev90276c82019-02-03 18:01:02 -0500323 LOG_ALWAYS_FATAL_IF(mCreateDevice(mPhysicalDevice, &deviceInfo, nullptr, &mDevice));
Greg Daniel2ff202712018-06-14 11:50:10 -0400324
325 GET_DEV_PROC(GetDeviceQueue);
326 GET_DEV_PROC(DeviceWaitIdle);
327 GET_DEV_PROC(DestroyDevice);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500328 GET_DEV_PROC(CreateCommandPool);
329 GET_DEV_PROC(DestroyCommandPool);
330 GET_DEV_PROC(AllocateCommandBuffers);
331 GET_DEV_PROC(FreeCommandBuffers);
332 GET_DEV_PROC(ResetCommandBuffer);
333 GET_DEV_PROC(BeginCommandBuffer);
334 GET_DEV_PROC(EndCommandBuffer);
335 GET_DEV_PROC(CmdPipelineBarrier);
336 GET_DEV_PROC(GetDeviceQueue);
337 GET_DEV_PROC(QueueSubmit);
338 GET_DEV_PROC(QueueWaitIdle);
339 GET_DEV_PROC(DeviceWaitIdle);
340 GET_DEV_PROC(CreateSemaphore);
341 GET_DEV_PROC(DestroySemaphore);
Greg Daniel26e0dca2018-09-18 10:33:19 -0400342 GET_DEV_PROC(ImportSemaphoreFdKHR);
343 GET_DEV_PROC(GetSemaphoreFdKHR);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500344 GET_DEV_PROC(CreateFence);
345 GET_DEV_PROC(DestroyFence);
346 GET_DEV_PROC(WaitForFences);
347 GET_DEV_PROC(ResetFences);
Greg Daniel2ff202712018-06-14 11:50:10 -0400348}
349
350void VulkanManager::initialize() {
351 if (mDevice != VK_NULL_HANDLE) {
352 return;
353 }
354
Greg Daniela227dbb2018-08-20 09:19:48 -0400355 GET_PROC(EnumerateInstanceVersion);
Greg Danieleaf310e2019-01-28 16:10:32 -0500356 uint32_t instanceVersion;
357 LOG_ALWAYS_FATAL_IF(mEnumerateInstanceVersion(&instanceVersion));
358 LOG_ALWAYS_FATAL_IF(instanceVersion < VK_MAKE_VERSION(1, 1, 0));
Greg Daniela227dbb2018-08-20 09:19:48 -0400359
Stan Iliev981afe72019-02-13 14:24:33 -0500360 this->setupDevice(mExtensions, mPhysicalDeviceFeatures2);
Greg Daniel2ff202712018-06-14 11:50:10 -0400361
362 mGetDeviceQueue(mDevice, mGraphicsQueueIndex, 0, &mGraphicsQueue);
363
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500364 // create the command pool for the command buffers
365 if (VK_NULL_HANDLE == mCommandPool) {
366 VkCommandPoolCreateInfo commandPoolInfo;
367 memset(&commandPoolInfo, 0, sizeof(VkCommandPoolCreateInfo));
368 commandPoolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
369 // this needs to be on the render queue
Greg Daniel2ff202712018-06-14 11:50:10 -0400370 commandPoolInfo.queueFamilyIndex = mGraphicsQueueIndex;
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500371 commandPoolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
Greg Daniel2ff202712018-06-14 11:50:10 -0400372 SkDEBUGCODE(VkResult res =) mCreateCommandPool(mDevice, &commandPoolInfo, nullptr,
373 &mCommandPool);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500374 SkASSERT(VK_SUCCESS == res);
375 }
Greg Daniel26e0dca2018-09-18 10:33:19 -0400376 LOG_ALWAYS_FATAL_IF(mCommandPool == VK_NULL_HANDLE);
377
378 if (!setupDummyCommandBuffer()) {
379 this->destroy();
Stan Iliev90276c82019-02-03 18:01:02 -0500380 // Pass through will crash on next line.
Greg Daniel26e0dca2018-09-18 10:33:19 -0400381 }
382 LOG_ALWAYS_FATAL_IF(mDummyCB == VK_NULL_HANDLE);
383
Greg Daniel2ff202712018-06-14 11:50:10 -0400384 mGetDeviceQueue(mDevice, mPresentQueueIndex, 0, &mPresentQueue);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500385
Greg Danielcd558522016-11-17 13:31:40 -0500386 if (Properties::enablePartialUpdates && Properties::useBufferAge) {
387 mSwapBehavior = SwapBehavior::BufferAge;
388 }
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500389}
390
Stan Iliev898123b2019-02-14 14:57:44 -0500391sk_sp<GrContext> VulkanManager::createContext(const GrContextOptions& options) {
Stan Iliev981afe72019-02-13 14:24:33 -0500392 auto getProc = [] (const char* proc_name, VkInstance instance, VkDevice device) {
393 if (device != VK_NULL_HANDLE) {
394 return vkGetDeviceProcAddr(device, proc_name);
395 }
396 return vkGetInstanceProcAddr(instance, proc_name);
397 };
398
399 GrVkBackendContext backendContext;
400 backendContext.fInstance = mInstance;
401 backendContext.fPhysicalDevice = mPhysicalDevice;
402 backendContext.fDevice = mDevice;
403 backendContext.fQueue = mGraphicsQueue;
404 backendContext.fGraphicsQueueIndex = mGraphicsQueueIndex;
405 backendContext.fMaxAPIVersion = mAPIVersion;
406 backendContext.fVkExtensions = &mExtensions;
407 backendContext.fDeviceFeatures2 = &mPhysicalDeviceFeatures2;
408 backendContext.fGetProc = std::move(getProc);
409
410 return GrContext::MakeVulkan(backendContext, options);
411}
412
Bo Liu7b8c1eb2019-01-08 20:17:55 -0800413VkFunctorInitParams VulkanManager::getVkFunctorInitParams() const {
414 return VkFunctorInitParams{
415 .instance = mInstance,
416 .physical_device = mPhysicalDevice,
417 .device = mDevice,
418 .queue = mGraphicsQueue,
419 .graphics_queue_index = mGraphicsQueueIndex,
Greg Danieleaf310e2019-01-28 16:10:32 -0500420 .api_version = mAPIVersion,
Bo Liu7b8c1eb2019-01-08 20:17:55 -0800421 .enabled_instance_extension_names = mInstanceExtensions.data(),
422 .enabled_instance_extension_names_length =
423 static_cast<uint32_t>(mInstanceExtensions.size()),
424 .enabled_device_extension_names = mDeviceExtensions.data(),
425 .enabled_device_extension_names_length =
426 static_cast<uint32_t>(mDeviceExtensions.size()),
427 .device_features_2 = &mPhysicalDeviceFeatures2,
428 };
429}
430
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500431Frame VulkanManager::dequeueNextBuffer(VulkanSurface* surface) {
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500432
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500433 VulkanSurface::NativeBufferInfo* bufferInfo = surface->dequeueNativeBuffer();
434
435 if (bufferInfo == nullptr) {
436 ALOGE("VulkanSurface::dequeueNativeBuffer called with an invalid surface!");
437 return Frame(-1, -1, 0);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500438 }
439
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500440 LOG_ALWAYS_FATAL_IF(!bufferInfo->dequeued);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500441
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500442 if (bufferInfo->dequeue_fence != -1) {
Stan Iliev197843d2019-03-21 11:34:15 -0400443 struct sync_file_info* finfo = sync_file_info(bufferInfo->dequeue_fence);
444 bool isSignalPending = false;
445 if (finfo != NULL) {
446 isSignalPending = finfo->status != 1;
447 sync_file_info_free(finfo);
448 }
449 if (isSignalPending) {
450 int fence_clone = dup(bufferInfo->dequeue_fence);
451 if (fence_clone == -1) {
452 ALOGE("dup(fence) failed, stalling until signalled: %s (%d)", strerror(errno),
453 errno);
454 sync_wait(bufferInfo->dequeue_fence, -1 /* forever */);
455 } else {
456 VkSemaphoreCreateInfo semaphoreInfo;
457 semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
458 semaphoreInfo.pNext = nullptr;
459 semaphoreInfo.flags = 0;
460 VkSemaphore semaphore;
461 VkResult err = mCreateSemaphore(mDevice, &semaphoreInfo, nullptr, &semaphore);
462 LOG_ALWAYS_FATAL_IF(VK_SUCCESS != err, "Failed to create import semaphore, err: %d",
463 err);
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500464
Stan Iliev197843d2019-03-21 11:34:15 -0400465 VkImportSemaphoreFdInfoKHR importInfo;
466 importInfo.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR;
467 importInfo.pNext = nullptr;
468 importInfo.semaphore = semaphore;
469 importInfo.flags = VK_SEMAPHORE_IMPORT_TEMPORARY_BIT;
470 importInfo.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
471 importInfo.fd = fence_clone;
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500472
Stan Iliev197843d2019-03-21 11:34:15 -0400473 err = mImportSemaphoreFdKHR(mDevice, &importInfo);
474 LOG_ALWAYS_FATAL_IF(VK_SUCCESS != err, "Failed to import semaphore, err: %d", err);
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500475
Stan Iliev197843d2019-03-21 11:34:15 -0400476 GrBackendSemaphore backendSemaphore;
477 backendSemaphore.initVulkan(semaphore);
478 bufferInfo->skSurface->wait(1, &backendSemaphore);
479 // The following flush blocks the GPU immediately instead of waiting for other
480 // drawing ops. It seems dequeue_fence is not respected otherwise.
481 //TODO: remove the flush after finding why backendSemaphore is not working.
482 bufferInfo->skSurface->flush();
483 }
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500484 }
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500485 }
486
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500487 int bufferAge = (mSwapBehavior == SwapBehavior::Discard) ? 0 : surface->getCurrentBuffersAge();
488 return Frame(surface->logicalWidth(), surface->logicalHeight(), bufferAge);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500489}
490
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500491void VulkanManager::swapBuffers(VulkanSurface* surface, const SkRect& dirtyRect) {
492 if (CC_UNLIKELY(Properties::waitForGpuCompletion)) {
493 ATRACE_NAME("Finishing GPU work");
494 mDeviceWaitIdle(mDevice);
Stan Iliev305e13a2018-11-13 11:14:48 -0500495 }
496
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500497 VkExportSemaphoreCreateInfo exportInfo;
498 exportInfo.sType = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO;
499 exportInfo.pNext = nullptr;
500 exportInfo.handleTypes = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500501
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500502 VkSemaphoreCreateInfo semaphoreInfo;
503 semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
504 semaphoreInfo.pNext = &exportInfo;
505 semaphoreInfo.flags = 0;
506 VkSemaphore semaphore;
507 VkResult err = mCreateSemaphore(mDevice, &semaphoreInfo, nullptr, &semaphore);
508 ALOGE_IF(VK_SUCCESS != err, "VulkanManager::swapBuffers(): Failed to create semaphore");
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500509
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500510 GrBackendSemaphore backendSemaphore;
511 backendSemaphore.initVulkan(semaphore);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500512
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500513 VulkanSurface::NativeBufferInfo* bufferInfo = surface->getCurrentBufferInfo();
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500514
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500515 int fenceFd = -1;
516 GrSemaphoresSubmitted submitted =
517 bufferInfo->skSurface->flush(SkSurface::BackendSurfaceAccess::kPresent,
518 SkSurface::kNone_FlushFlags, 1, &backendSemaphore);
519 if (submitted == GrSemaphoresSubmitted::kYes) {
520 VkSemaphoreGetFdInfoKHR getFdInfo;
521 getFdInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR;
522 getFdInfo.pNext = nullptr;
523 getFdInfo.semaphore = semaphore;
524 getFdInfo.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500525
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500526 err = mGetSemaphoreFdKHR(mDevice, &getFdInfo, &fenceFd);
527 ALOGE_IF(VK_SUCCESS != err, "VulkanManager::swapBuffers(): Failed to get semaphore Fd");
528 } else {
529 ALOGE("VulkanManager::swapBuffers(): Semaphore submission failed");
530 mQueueWaitIdle(mGraphicsQueue);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500531 }
532
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500533 surface->presentCurrentBuffer(dirtyRect, fenceFd);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500534
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500535 // Exporting a semaphore with copy transference via vkGetSemaphoreFdKHR, has the same effect of
536 // destroying the semaphore and creating a new one with the same handle, and the payloads
537 // ownership is move to the Fd we created. Thus the semaphore is in a state that we can delete
538 // it and we don't need to wait on the command buffer we submitted to finish.
539 mDestroySemaphore(mDevice, semaphore, nullptr);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500540}
541
542void VulkanManager::destroySurface(VulkanSurface* surface) {
543 // Make sure all submit commands have finished before starting to destroy objects.
544 if (VK_NULL_HANDLE != mPresentQueue) {
545 mQueueWaitIdle(mPresentQueue);
546 }
Greg Daniel2ff202712018-06-14 11:50:10 -0400547 mDeviceWaitIdle(mDevice);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500548
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500549 delete surface;
550}
551
Stan Iliev987a80c02018-12-04 10:07:21 -0500552VulkanSurface* VulkanManager::createSurface(ANativeWindow* window, ColorMode colorMode,
Peiyong Lin3bff1352018-12-11 07:56:07 -0800553 sk_sp<SkColorSpace> surfaceColorSpace,
Stan Iliev981afe72019-02-13 14:24:33 -0500554 SkColorType surfaceColorType,
555 GrContext* grContext) {
556 LOG_ALWAYS_FATAL_IF(!hasVkContext(), "Not initialized");
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500557 if (!window) {
558 return nullptr;
559 }
560
Derek Sollenbergera19b71a2019-02-15 16:36:30 -0500561 return VulkanSurface::Create(window, colorMode, surfaceColorType, surfaceColorSpace, grContext,
562 *this);
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500563}
564
Greg Daniel26e0dca2018-09-18 10:33:19 -0400565bool VulkanManager::setupDummyCommandBuffer() {
566 if (mDummyCB != VK_NULL_HANDLE) {
567 return true;
568 }
569
570 VkCommandBufferAllocateInfo commandBuffersInfo;
571 memset(&commandBuffersInfo, 0, sizeof(VkCommandBufferAllocateInfo));
572 commandBuffersInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
573 commandBuffersInfo.pNext = nullptr;
574 commandBuffersInfo.commandPool = mCommandPool;
575 commandBuffersInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
576 commandBuffersInfo.commandBufferCount = 1;
577
578 VkResult err = mAllocateCommandBuffers(mDevice, &commandBuffersInfo, &mDummyCB);
579 if (err != VK_SUCCESS) {
580 // It is probably unnecessary to set this back to VK_NULL_HANDLE, but we set it anyways to
581 // make sure the driver didn't set a value and then return a failure.
582 mDummyCB = VK_NULL_HANDLE;
583 return false;
584 }
585
586 VkCommandBufferBeginInfo beginInfo;
587 memset(&beginInfo, 0, sizeof(VkCommandBufferBeginInfo));
588 beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
589 beginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT;
590
591 mBeginCommandBuffer(mDummyCB, &beginInfo);
592 mEndCommandBuffer(mDummyCB);
593 return true;
594}
595
Stan Iliev564ca3e2018-09-04 22:00:00 +0000596status_t VulkanManager::fenceWait(sp<Fence>& fence) {
Greg Daniel26e0dca2018-09-18 10:33:19 -0400597 if (!hasVkContext()) {
598 ALOGE("VulkanManager::fenceWait: VkDevice not initialized");
599 return INVALID_OPERATION;
600 }
601
Stan Iliev7a081272018-10-26 17:54:18 -0400602 // Block GPU on the fence.
603 int fenceFd = fence->dup();
604 if (fenceFd == -1) {
605 ALOGE("VulkanManager::fenceWait: error dup'ing fence fd: %d", errno);
606 return -errno;
Stan Iliev564ca3e2018-09-04 22:00:00 +0000607 }
Stan Iliev7a081272018-10-26 17:54:18 -0400608
609 VkSemaphoreCreateInfo semaphoreInfo;
610 semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
611 semaphoreInfo.pNext = nullptr;
612 semaphoreInfo.flags = 0;
613 VkSemaphore semaphore;
614 VkResult err = mCreateSemaphore(mDevice, &semaphoreInfo, nullptr, &semaphore);
615 if (VK_SUCCESS != err) {
616 ALOGE("Failed to create import semaphore, err: %d", err);
617 return UNKNOWN_ERROR;
618 }
619 VkImportSemaphoreFdInfoKHR importInfo;
620 importInfo.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR;
621 importInfo.pNext = nullptr;
622 importInfo.semaphore = semaphore;
623 importInfo.flags = VK_SEMAPHORE_IMPORT_TEMPORARY_BIT;
624 importInfo.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
625 importInfo.fd = fenceFd;
626
627 err = mImportSemaphoreFdKHR(mDevice, &importInfo);
628 if (VK_SUCCESS != err) {
629 ALOGE("Failed to import semaphore, err: %d", err);
630 return UNKNOWN_ERROR;
631 }
632
633 LOG_ALWAYS_FATAL_IF(mDummyCB == VK_NULL_HANDLE);
634
635 VkPipelineStageFlags waitDstStageFlags = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
636
637 VkSubmitInfo submitInfo;
638 memset(&submitInfo, 0, sizeof(VkSubmitInfo));
639 submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
640 submitInfo.waitSemaphoreCount = 1;
641 // Wait to make sure aquire semaphore set above has signaled.
642 submitInfo.pWaitSemaphores = &semaphore;
643 submitInfo.pWaitDstStageMask = &waitDstStageFlags;
644 submitInfo.commandBufferCount = 1;
645 submitInfo.pCommandBuffers = &mDummyCB;
646 submitInfo.signalSemaphoreCount = 0;
647
648 mQueueSubmit(mGraphicsQueue, 1, &submitInfo, VK_NULL_HANDLE);
649
650 // On Android when we import a semaphore, it is imported using temporary permanence. That
651 // means as soon as we queue the semaphore for a wait it reverts to its previous permanent
652 // state before importing. This means it will now be in an idle state with no pending
653 // signal or wait operations, so it is safe to immediately delete it.
654 mDestroySemaphore(mDevice, semaphore, nullptr);
Stan Iliev564ca3e2018-09-04 22:00:00 +0000655 return OK;
656}
657
658status_t VulkanManager::createReleaseFence(sp<Fence>& nativeFence) {
Greg Daniel26e0dca2018-09-18 10:33:19 -0400659 if (!hasVkContext()) {
660 ALOGE("VulkanManager::createReleaseFence: VkDevice not initialized");
661 return INVALID_OPERATION;
662 }
663
Greg Daniel26e0dca2018-09-18 10:33:19 -0400664 VkExportSemaphoreCreateInfo exportInfo;
665 exportInfo.sType = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO;
666 exportInfo.pNext = nullptr;
667 exportInfo.handleTypes = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
668
669 VkSemaphoreCreateInfo semaphoreInfo;
670 semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
671 semaphoreInfo.pNext = &exportInfo;
672 semaphoreInfo.flags = 0;
673 VkSemaphore semaphore;
674 VkResult err = mCreateSemaphore(mDevice, &semaphoreInfo, nullptr, &semaphore);
675 if (VK_SUCCESS != err) {
676 ALOGE("VulkanManager::createReleaseFence: Failed to create semaphore");
677 return INVALID_OPERATION;
678 }
679
680 LOG_ALWAYS_FATAL_IF(mDummyCB == VK_NULL_HANDLE);
681
682 VkSubmitInfo submitInfo;
683 memset(&submitInfo, 0, sizeof(VkSubmitInfo));
684 submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
685 submitInfo.waitSemaphoreCount = 0;
686 submitInfo.pWaitSemaphores = nullptr;
687 submitInfo.pWaitDstStageMask = nullptr;
688 submitInfo.commandBufferCount = 1;
689 submitInfo.pCommandBuffers = &mDummyCB;
690 submitInfo.signalSemaphoreCount = 1;
691 submitInfo.pSignalSemaphores = &semaphore;
692
693 mQueueSubmit(mGraphicsQueue, 1, &submitInfo, VK_NULL_HANDLE);
694
695 VkSemaphoreGetFdInfoKHR getFdInfo;
696 getFdInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR;
697 getFdInfo.pNext = nullptr;
698 getFdInfo.semaphore = semaphore;
699 getFdInfo.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
700
701 int fenceFd = 0;
702
703 err = mGetSemaphoreFdKHR(mDevice, &getFdInfo, &fenceFd);
704 if (VK_SUCCESS != err) {
705 ALOGE("VulkanManager::createReleaseFence: Failed to get semaphore Fd");
706 return INVALID_OPERATION;
707 }
708 nativeFence = new Fence(fenceFd);
709
710 // Exporting a semaphore with copy transference via vkGetSemahporeFdKHR, has the same effect of
711 // destroying the semaphore and creating a new one with the same handle, and the payloads
712 // ownership is move to the Fd we created. Thus the semahpore is in a state that we can delete
713 // it and we don't need to wait on the command buffer we submitted to finish.
714 mDestroySemaphore(mDevice, semaphore, nullptr);
715
Stan Iliev564ca3e2018-09-04 22:00:00 +0000716 return OK;
717}
718
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500719} /* namespace renderthread */
720} /* namespace uirenderer */
721} /* namespace android */