Add a mutex to VulkanManager::initialize.

The initialize call can be made from both an GrallocUploadThread
and the RenderThread. So we need a mutex to make sure both
threads don't try to initialize in parallel.

Bug: 187218890
Test: manual running of device, guessing this could fix bug.
Change-Id: I203afd91fad5eacc131c839dff1a1065864b76f8
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp
index 0112686..07146e8 100644
--- a/libs/hwui/renderthread/VulkanManager.cpp
+++ b/libs/hwui/renderthread/VulkanManager.cpp
@@ -340,6 +340,8 @@
 }
 
 void VulkanManager::initialize() {
+    std::lock_guard _lock{mInitializeLock};
+
     if (mDevice != VK_NULL_HANDLE) {
         return;
     }
diff --git a/libs/hwui/renderthread/VulkanManager.h b/libs/hwui/renderthread/VulkanManager.h
index 7b5fe19..b816649 100644
--- a/libs/hwui/renderthread/VulkanManager.h
+++ b/libs/hwui/renderthread/VulkanManager.h
@@ -220,6 +220,8 @@
 
     VkSemaphore mSwapSemaphore = VK_NULL_HANDLE;
     void* mDestroySemaphoreContext = nullptr;
+
+    std::mutex mInitializeLock;
 };
 
 } /* namespace renderthread */