diff options
author | Jason Macnak <natsu@google.com> | 2023-04-20 01:16:30 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-04-20 01:16:30 +0000 |
commit | a4911846fc74afbc542604a08e0349732f2024dd (patch) | |
tree | db0045eaa070657671a8bf3cda9d06ded022772f | |
parent | a8eaebbacd54cff813fe19cbda9572c420463b0c (diff) | |
parent | 3935a29188de60ffb76a4fb37699145d33fa8367 (diff) | |
download | vulkan-cereal-a4911846fc74afbc542604a08e0349732f2024dd.tar.gz |
Merge "Add vk debug annotations to guest command buffers" am: b10048abbe am: 9346682989 am: 3935a29188
Original change: https://android-review.googlesource.com/c/device/generic/vulkan-cereal/+/2280657
Change-Id: I776c1e0acfa1b9ddb4adcb9355a7ed41826f8647
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | stream-servers/vulkan/VkDecoderGlobalState.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/stream-servers/vulkan/VkDecoderGlobalState.cpp b/stream-servers/vulkan/VkDecoderGlobalState.cpp index 7ad1b1ca..1922dbef 100644 --- a/stream-servers/vulkan/VkDecoderGlobalState.cpp +++ b/stream-servers/vulkan/VkDecoderGlobalState.cpp @@ -3756,9 +3756,14 @@ class VkDecoderGlobalState::Impl { } std::lock_guard<std::recursive_mutex> lock(mLock); + + auto* deviceInfo = android::base::find(mDeviceInfo, device); + if (!deviceInfo) return VK_ERROR_UNKNOWN; + for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) { mCmdBufferInfo[pCommandBuffers[i]] = CommandBufferInfo(); mCmdBufferInfo[pCommandBuffers[i]].device = device; + mCmdBufferInfo[pCommandBuffers[i]].debugUtilsHelper = deviceInfo->debugUtilsHelper; mCmdBufferInfo[pCommandBuffers[i]].cmdPool = pAllocateInfo->commandPool; auto boxed = new_boxed_VkCommandBuffer(pCommandBuffers[i], vk, false /* does not own dispatch */); @@ -4199,8 +4204,16 @@ class VkDecoderGlobalState::Impl { } std::lock_guard<std::recursive_mutex> lock(mLock); - auto& bufferInfo = mCmdBufferInfo[commandBuffer]; - bufferInfo.reset(); + + auto* commandBufferInfo = android::base::find(mCmdBufferInfo, commandBuffer); + if (!commandBufferInfo) return VK_ERROR_UNKNOWN; + commandBufferInfo->reset(); + + if (context.processName) { + commandBufferInfo->debugUtilsHelper.cmdBeginDebugLabel(commandBuffer, "Process %s", + context.processName); + } + return VK_SUCCESS; } @@ -4217,6 +4230,15 @@ class VkDecoderGlobalState::Impl { auto commandBuffer = unbox_VkCommandBuffer(boxed_commandBuffer); auto vk = dispatch_VkCommandBuffer(boxed_commandBuffer); + std::lock_guard<std::recursive_mutex> lock(mLock); + + auto* commandBufferInfo = android::base::find(mCmdBufferInfo, commandBuffer); + if (!commandBufferInfo) return VK_ERROR_UNKNOWN; + + if (context.processName) { + commandBufferInfo->debugUtilsHelper.cmdEndDebugLabel(commandBuffer); + } + return vk->vkEndCommandBuffer(commandBuffer); } @@ -5696,6 +5718,7 @@ class VkDecoderGlobalState::Impl { VkDevice device = VK_NULL_HANDLE; VkCommandPool cmdPool = VK_NULL_HANDLE; VkCommandBuffer boxed = VK_NULL_HANDLE; + DebugUtilsHelper debugUtilsHelper = DebugUtilsHelper::withUtilsDisabled(); // Most recently bound compute pipeline and descriptor sets. We save it here so that we can // restore it after doing emulated texture decompression. |