Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d9de71e authored by Greg Daniel's avatar Greg Daniel
Browse files

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
parent f477c8fb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -340,6 +340,8 @@ void VulkanManager::setupDevice(GrVkExtensions& grExtensions, VkPhysicalDeviceFe
}

void VulkanManager::initialize() {
    std::lock_guard _lock{mInitializeLock};

    if (mDevice != VK_NULL_HANDLE) {
        return;
    }
+2 −0
Original line number Diff line number Diff line
@@ -220,6 +220,8 @@ private:

    VkSemaphore mSwapSemaphore = VK_NULL_HANDLE;
    void* mDestroySemaphoreContext = nullptr;

    std::mutex mInitializeLock;
};

} /* namespace renderthread */