src/libANGLE/renderer/vulkan/CommandQueue.h


Log

Author Commit Date CI Message
Sungyong Choi 1622d4ad 2025-08-13T07:22:13 Fix -Wparentheses in unlockAndRelease Add parentheses around (valid && owns_lock()) to clarify the intended grouping and silence GCC -Wparentheses warning. BUG: angleproject:438226513 Change-Id: I0d4f3e0153c277c96ec85f255f844bab085f9550 Signed-off-by: Sungyong Choi <sywow.choi@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6845478 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi bbf92d12 2025-03-21T12:43:14 Vulkan: Add workaround flag for extra submit fence This change is a workaround for some devices exhibiting a device-lost error related to the fence usage in the command batches when working with EGL sync objects, such as a cycle similar to below: - <Some GL work> - eglCreateSyncKHR() - glFlush() - eglDupNativeFenceFDANDROID() - eglDestroySyncKHR() - <More GL work> (The exact point of error and the reason for the device-lost remain unknown.) This change is meant to mitigate such errors on those devices if needed. However, for the rest, the feature will remain disabled. * Added a new feature flag: enableExtraSubmitFence * Modified the usage of mFence in CommandBatch * It is also used when enableExtraSubmitFence is enabled, even if there is an external fence. * When there is an external fence, this object is used to create an empty submission after the primary commands are submitted using the external fence. * Added the config to enable EnableExtraSubmitFence for the following suite: EGLSyncTest Bug: b/384477641 Change-Id: I05f8bdcc804967c4984416af802326d22afd7a46 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6378778 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao e339f91c 2025-03-21T10:22:59 Vulkan: Split asyncCommandBufferResetAndGarbageCleanup into two Right now this one feature flag controls garbage clean up and command buffer reset. If this is enabled, we are seeing command buffer reset some times runs on small core and some times gets blocked by mutex lock inside vulkan driver. This could take quite long while main rendering thread is blocked by ANGLE's CommandPoolAccess lock. This CL splits this feature flag into two separate feature flag: asyncGarbageCleanup controls garbage clean up in the async thread or not. asyncCommandBufferReset controls commandBuffer.reset in the async thread or not. This CL also disables commandBuffer.reset in async thread only on ARM given there is no data shows other GPUs suffer form the same problem. Bug: angleproject:378718508 Change-Id: Ice87b5b91568a0a95e0064da2b70243516ff6753 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6381893 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 2e65d3d4 2025-02-03T16:26:46 Vulkan: Fine-tune submission for multiple RPs This CL aims to fine-tune submission based on a certain command buffer size. This allows us to perform one submission for multiple smaller render passes. * Added mCommandsPendingSubmissionCount to ContextVk. * In ContextVk::syncState(), preferSubmitAtFBOBoundary is only used if the render pass pending command count exceeds the threshold: kMinCommandCountToSubmit * Currently set to 32. * For now, we still submit if the command is a clear (for example glClearBufferfv()). * For now, we also still submit if the command is an invalidate (for example, glInvalidateFramebuffer()). * In ContextVk::flushImpl(), if the pending command count exceeds the threshold (kMinCommandCountToSubmit) and the device is found to be idle, the work is submitted to keep the device busy. * Modified the following unit test from VulkanPerformanceCounterTest: VerifySubmitCounterForSwitchUserFBOToDirtyUserFBO * Since there is now a minimum command count for submission, the number of draw calls has been changed so that the submission is still issued at the new FBO boundary. * After this CL, life_is_strange shows the following improvements: (From the latest measurements) * +19% wall_time * +38% cpu_time Bug: angleproject:42265052 Change-Id: I18452cc1d39ca7e0ac376f6012974b498153cce8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6182927 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Gowtham Tammana 8c0ac979 2024-06-20T16:39:26 Vulkan: Setup compute only queue for OpenCL Select compute only for OpenCL vulkan backend if `angle_enable_cl_compute_only_pipe` is set to true in gn args. And setting it as default for OpenCL. Bug: angleproject:395045928 Change-Id: Ie1a53e629646dbd5ba332dd297a4c8b737070e95 Signed-off-by: Gowtham Tammana <g.tammana@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6244610 Reviewed-by: Austin Annestrand <a.annestrand@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 49ca2e22 2025-02-07T09:58:12 Vulkan: vkQueueWaitIdle on device loss On device loss, a driver bug was encountered when cleaning up resources if vkQueueWaitIdle is not called. Bug: chromium:371512561 Change-Id: Ib0d4f317a15a1788f0cf206842cb1e7bf6936d96 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6244337 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 0f75fc3d 2025-01-20T14:10:41 Vulkan: Transition foreign images to the FOREIGN queue on submit Vulkan's interaction with AHB and dmabuf images is through the FOREIGN queue family. When ANGLE uses these images, it must take ownership of the images by doing a queue family ownership transfer (QFOT) away from the FOREIGN queue family and into the graphics queue family used by the Vulkan backend. Prior to this change, ANGLE would do the QFOT away from FOREIGN once such a foreign image is imported into an EGL image. Afterwards, usage in ANGLE works correctly. What ANGLE did not handle is when a foreign entity wants to use these images _after_ ANGLE has used them. For the above to work correctly, ANGLE must do a QFOT back into FOREIGN before the image can be used by the foreign entity. Unfortunately, EGL does not provide a clear point for this hand-off to happen. ANGLE has no choice then to proactively transition the images back into FOREIGN at some point "just in case". For some native drivers, this hand-off to FOREIGN can be quite frequent. For example, on Android for most vendors there is no actual layout transition between graphics and FOREIGN queue families (the actual data layout is the same), so a cache flush/invalidate at strategic points (such as the end of the command buffer) is sufficient as equivalent to transition to FOREIGN (and another at the beginning of the command buffer as equivalent to transition from FOREIGN). As a layer over Vulkan's formalism, ANGLE is less lucky; it has to enumerate exactly which image is being transitioned to and away from FOREIGN. Transitions away from FOREIGN are in principle easy. As long as the image is marked as being in the FOREIGN queue family, it will automatically transition to the graphics queue family on first use. In this change, when a foreign image is transitioned out of the FOREIGN queue, it's added to a list of images to be transitioned back to FOREIGN at submit time. Once submission is done, the image may or may not actually be used by a foreign entity, but ANGLE cannot know that. The next time the image is used in ANGLE, it is transitioned out of FOREIGN. Verifying correctness with multi-threading is tricky, and relies on GL's requirement that access in one context is followed by a synchronization and rebind in another context before it can be used there. This means that the image's transition to FOREIGN (at the end of one submission) naturally happens before the transition back from FOREIGN (at the beginning of the next submission). Because the set of images to transition is tracked in the context, submissions in other contexts don't interfere with the above logic. The situation can be more complicated with one-off submissions, but fortunately, no such usage of foreign images is present. Another wrinkle is simultaneous usage of the image as read-only in two contexts. According to GL, this is not a hazard and requires no synchronization. However this is broken in ANGLE even for non-foreign images (see http://anglebug.com/42266349), because as what _seems_ like read-only usage of the image from GL's point of view (like sampling from the image), there are associated write operations from Vulkan's point of view (image layout transitions and QFOT). This change does not attempt to address this corner case. Bug: angleproject:42263241 Bug: angleproject:42262454 Bug: angleproject:390443243 Bug: chromium:382527242 Change-Id: Idd4ef1fecfa3fccf1a4063f1bddb08d28b85386b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6184604 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao fbd230f5 2025-01-23T12:59:06 Vulkan: Split ErrorContext into ErrorContext and Context ErrorContext continue to be context for error handling. vk::Context is added to serve as common base class for ContextVk and CLContextVk. Bug: angleproject:390443243 Change-Id: Ifac0b1d2d714ce610693ce60a35459c6c9cddf1a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6191438 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c1214ec2 2025-01-22T14:22:56 Vulkan: Rename Context to ErrorContext In preparation for adding another Context (derived by GL and CL contexts), which includes logic that pertains to command recording (such as barrier tracking). Bug: angleproject:390443243 Change-Id: Idf495b62e63fb9aa901a2f16447fdaf3c2acd90b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6191248 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Igor Nazarov d8a95bf7 2024-12-19T17:35:05 Vulkan: Protect OneOff commands recording with pool mutex Bug: angleproject:384940864 Change-Id: I518c54ae4b0fc5da0e58d330f8c531bc8d65529e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6108843 Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Igor Nazarov 062f1fc1 2024-12-17T22:22:04 Vulkan: Use waitFenceUnlocked to finish one command Batch Using `CommandBatch::waitFence()` in finish one command Batch is no longer necessary, since `mQueueSubmitMutex` remains locked, preventing adding new commands when `kInFlightCommandsLimit` is exceeded. The `Locked` suffix is removed from `finishOneCommandBatchLocked()` since it is now accepts the `lock` (similarly to `waitFenceUnlocked()`) and may temporarily unlock it. Test: angle_end2end_tests --gtest_filter=EGLSyncTest.BlockingOnSubmitCPUThrottling/* Bug: b/362604439 Change-Id: I8f39d7b2e6f1b9ce8ed4aa8875375769211572e7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6098256 Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi bbc0d702 2024-12-27T07:44:01 Vulkan: Add entry points to lock the Vulkan queue ... which can be retrieved via EGL_ANGLE_device_vulkan. Otherwise the application is unable to use the VkQueue that is retrieved out of ANGLE from other threads (such as Chromium's DrDC feature). Bug: chromium:380295059 Change-Id: Ife80f54440777486f72fc61697a68fb0c2b2d0f7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6116046 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 9c67a505 2024-12-11T14:29:59 Vulkan: Rename CommandProcessor.* to CommandQueue.* Bug: angleproject:42262955 Change-Id: I5585309479d8c66e9ddfa41e12a757381ebb80bd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6089885 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com>