src/libANGLE/renderer/vulkan/SemaphoreVk.cpp


Log

Author Commit Date CI Message
Sergey Ulanov c670917c 2021-06-02T14:43:03 [Fuchsia] Cleanup vulkan_fuchsia_ext.h Removed defintions of fuchsia-specific vulkan types from vulkan_fuchsia_ext.h . Instead, the types provided by vulkan_fuchsia.h are used now. Also re-enabled vulkan validation on Fuchsia. Bug: chromium:1215736 Change-Id: I795347b7fb61d90033749533cefd42cf180730fb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2934718 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi e354ff1a 2021-03-05T04:07:21 Vulkan: Allow DynamicBuffer suballocation in BufferVk When allocations are made from DynamicBuffer, they suballocate from a possibly larger BufferHelper. In BufferVk, the offset of the suballocation was discarded, which limited the use of DynamicBuffer to a pool of small buffers. This change applies any such offset that may arise from suballocations everywhere, and makes BufferVk use a larger buffer size when the GL_DYNAMIC_* buffer usage hints are provided. Bug: angleproject:5719 Change-Id: I3df3317f7acff1b1b06a5e3e2bb707616a7d0512 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2738650 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
David Reveman 3fd439c2 2021-03-23T21:40:11 [Fuchsia] Add ifndefs to vulkan_fuchsia_ext.h This allows chromium to build with upstream headers that include these extension. The old TEMP enums and structure types are used until drivers have been updated to support upstream header values. Bug: chromium:1191605 Change-Id: I25d2991204ca34956298013138af8f48e0aaefaf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2782765 Commit-Queue: David Reveman <reveman@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9e7f08fc 2020-11-06T16:55:51 Vulkan: Fix incorrect reordering of barriers Take the following situation, a simple copy from image to buffer: ANGLE_TRY(contextVk->onBufferTransferWrite(buffer)); ANGLE_TRY(contextVk->onImageTransferRead(aspectFlags, image)); CommandBuffer &commandBuffer = contextVk->getOutsideRenderPassCommandBuffer(); commandBuffer.copyImageToBuffer(imageHandle, layout, bufferHandle, 1, regions); Both `onBufferTransferWrite` and `onImageTransferRead` may flush either the outsideRP or insideRP command buffers. If buffer is not previously used, but image is used: - onBufferTransferWrite: buffer usage is recorded in outsideRP1 - onImageTransferREad: outsiderRP1 is flushed, outsideRP2 is started - copyImageToBuffer: recorded on outsideRP2, but buffer usage not recorded there - A following command that uses the buffer and requires barrier doesn't close outsideRP2 as it believes it was not used there Bug: angleproject:5319 Change-Id: Ib8994083fbc21969a538cda3784adee57b089415 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2523388 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi d77e85a8 2020-11-03T22:23:18 Vulkan: Store image updates per level This optimization allows iterating only over updates of a certain level or range of levels, instead of having to iterate over every update and filter out the ones matching the desired level(s). Bug: angleproject:4891 Change-Id: Ied04f4b28f05d37b9add61c7f4d54cc328c0be86 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2519095 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 426fa735 2020-10-13T11:51:50 Vulkan: Fix command reordering on release to external When releasing buffer/image to external, the necessary barrier was recorded on the "outside render pass command buffer". However, if the resource was used in the current render pass, that render pass should have closed before this, otherwise the barrier was reordered before it which is incorrect. Bug: chromium:1136367 Bug: chromium:1135792 Bug: angleproject:5002 Change-Id: I237d5e6bb46189a4ce61c2f4602e356955cc87a9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2468456 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Sergey Ulanov 483473ae 2020-09-23T15:52:29 Vulkan: Relax ASSERT in SemaphoreVk::wait() The assert in SemaphoreVk::wait() was verifying that acquired images don't have any staged updates. That assert was failing for images with emulated image formats, which may have staged updates to clear the image after initialization. Bug: chromium:1096746 Change-Id: I74658a8ae48e6c09aa4a859ceb1e2a7099e021c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2427551 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Michael Spang <spang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill eb85c021 2020-08-05T15:07:15 Vulkan: Refactor Context CommandBuffer query. getOutsideRenderPassCommandBuffer returns the command buffer directly since it's now stateless and cannot throw an error. All the RenderPass begin/end and flushing are done by the dependency functions (buffer/ image read/write). Bug: angleproject:4911 Change-Id: I5e7806be9d0e1b5e358524bd485298d660fac942 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2339544 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill 23daea2f 2020-08-06T10:40:00 Vulkan: Rename CommandBuffer get method. This method will no longer end the RenderPass in a following CL. Renaming it in a split CL makes the review diff simple. Bug: angleproject:4911 Change-Id: Id48257884dccb7c86f7de2cc9ca95e651fb68df7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2340788 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Charlie Lao 5891b091 2020-06-01T11:24:37 Vulkan: acquire swapchain image should use COLOR_ATTACHMENT_OUTPUT_BIT The mAcquireImageSemaphore is for achieving the maximum overlap between display engine and rendering engine. We should only need to block when we write to the swapchain image. Work that doesn't touch the visible buffer can proceed. Bug: b/157916459 Change-Id: Ic9a9a1f2a7648ef7f50f99578a0f0d674ae5e66c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2223826 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Michael Spang 11f9c56c 2020-05-11T22:56:18 Vulkan: Tighten up asserts for resource ownership We're not permitted to make accesses to a resource while it's owned by an external instance or API. Add some asserts to verify this. Exempt images on platforms that don't implement external memory barriers. Bug: angleproject:3289 Change-Id: I1de929f6a412bfe5c1b798eaa1dc401bbceb5b7f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2195685 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Michael Spang <spang@chromium.org>
Michael Spang 6067c7d8 2020-05-12T18:18:47 Reland "Vulkan: Add semaphores test to VulkanExternalImageTest" This is a reland of 69e46942563b30be8a79512252e92fcf00c1a522 Original change's description: > Vulkan: Add semaphores test to VulkanExternalImageTest > > Add a more substantial test that uses semaphores to > VulkanExternalImageTest. > > It's still just a clear in GL, which exposed a bug that a staged clear > wasn't be flushed by a call to glSignalSemaphoreEXT. > > Bug: angleproject:3289 > Change-Id: Id938eaf2c8c20cb0ae9fb948fbfcf3448980b577 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2195684 > Commit-Queue: Michael Spang <spang@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> Bug: angleproject:3289 Change-Id: Idce1e8944b72445c92be9ad08d8c5869ca0b7df2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2197735 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Michael Spang <spang@chromium.org>
Michael Spang c4734bf6 2020-05-12T22:15:02 Revert "Vulkan: Add semaphores test to VulkanExternalImageTest" This reverts commit 69e46942563b30be8a79512252e92fcf00c1a522. Reason for revert: Broke the build due to VulkanExternalHelper API change Original change's description: > Vulkan: Add semaphores test to VulkanExternalImageTest > > Add a more substantial test that uses semaphores to > VulkanExternalImageTest. > > It's still just a clear in GL, which exposed a bug that a staged clear > wasn't be flushed by a call to glSignalSemaphoreEXT. > > Bug: angleproject:3289 > Change-Id: Id938eaf2c8c20cb0ae9fb948fbfcf3448980b577 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2195684 > Commit-Queue: Michael Spang <spang@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> TBR=spang@chromium.org,geofflang@chromium.org,jmadill@chromium.org Change-Id: I50b2af80cd0214bd3c317eb5ba211ddc66803d74 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:3289 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2197193 Reviewed-by: Michael Spang <spang@chromium.org> Commit-Queue: Michael Spang <spang@chromium.org>
Michael Spang 69e46942 2020-05-12T01:46:50 Vulkan: Add semaphores test to VulkanExternalImageTest Add a more substantial test that uses semaphores to VulkanExternalImageTest. It's still just a clear in GL, which exposed a bug that a staged clear wasn't be flushed by a call to glSignalSemaphoreEXT. Bug: angleproject:3289 Change-Id: Id938eaf2c8c20cb0ae9fb948fbfcf3448980b577 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2195684 Commit-Queue: Michael Spang <spang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Michael Spang dae210e6 2020-05-04T00:44:16 Fix validation errors & re-enable VulkanExternalImageTest clear tests These tests previously encountered errors attempting to transfer images from VK_QUEUE_FAMILY_EXTERNAL back to itself (this is not valid because one of the queues families in a memory barrier must be the family of the queue that executes the barrier). These invalid transfers were made because our ownership tracking started all resources in the "externally owned" state, with the expectation that the first operation on the resource would be a call to glWaitSemaphoreEXT to acquire ownership. It is far from clear that a call to glWaitSemaphoreEXT is always required to gain ownership of a resource. The EXT_external_objects extension inherits Vulkan's semantics, and what the Vulkan spec says is that the first entity to access a resource implicitly assumes ownership (see 11.7.1 "External Resource Sharing"). Binding a resource to memory does not constitute an access to that resource, or affect its ownership. Allocations should not be accesses, either; they happen at a lower level and the entire discussion about determining initial ownership from first access would serve no purpose if the mere allocation of the underlying memory was sufficient to assume ownership. This patch therefore adjusts the initial queue family ownership of resources created in memory objects to be the ANGLE renderer's queue family, just like a locally allocated image would be. Since this ownership state may not be correct (an external API may have already accessed the image, and assumed ownership) we must relax our assertions to allow a call to glWaitSemaphoreEXT while in this state. For images, this is only permitted while the layout is undefined. An alternative would be to set the initial queue family to a sentinel value that indicates that we don't know, but that would require checking for this value before making any accesses, and only then asserting local ownership. There's no real upside to this; the net effect of the first access rule is that we must effectively assume ownership until proven otherwise. Besides appearing to be the spec's intent, this change simplifies some usage scenarios because a queue submission is not required in the source Vulkan instance in order to allocate resources that will be initially accessed from GL. This seems especially important since there's no mechanism to allocate an external memory object from inside GL. The only downside is that the initial ambiguity in ownership prevents us from diagnosing certain errors, but this limitation is temporary; ownership becomes clear as soon as there is at least one access or at least one synchronization operation affecting the resource. Bug: angleproject:4229 Change-Id: Ibca2bfe373810c55352b1d849d07733d5fcfe5f4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2178946 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill aa09ca69 2020-02-24T13:33:30 Vulkan: Update ContextVk command buffer access methods. Use the following names: - flushAndBeginRenderPass - endRenderPassAndGetCommandBuffer - flushAndGetPrimaryCommandBuffer This clarifies that a flush is part of the method. Bug: angleproject:4029 Change-Id: I6c870761339ea7aa39c83142200781ba39ad6a4b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2068129 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Michael Spang c4197713 2019-06-03T19:23:02 Implement glImportMemoryZirconHandle & glImportSemaphoreZirconHandle Implement import of fuchsia external objects passed by zircon handle. This works exactly the same as with file descriptors. Bug: angleproject:3492 Change-Id: I4d46917dfc5902f00c94550158a9f8073097f0a4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1642334 Commit-Queue: Michael Spang <spang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill c58458e6 2020-02-19T14:51:41 Vulkan: Remove CommandGraph code. Also updates relevant comments to no longer refer to a graph. Bug: angleproject:4029 Change-Id: Ic29716e9ae4926870f902947d49d8fee7af98662 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057804 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Michael Spang e4ba2d87 2020-02-20T16:05:02 Pass ContextVk instead of gl::Context to internal methods Minor cleanup to change funciton signatures of vulkan specific methods in MemoryObjectVk & SemaphoreVk. Bug: angleproject:2475 Change-Id: I230664548004ebc48b559e0f25264ea948ce5a1f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2067500 Commit-Queue: Michael Spang <spang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill efd2a669 2020-02-15T08:45:46 Vulkan: Command graph linearization for SemaphoreVk. This doesn't seem to be tested in the default CQ configuration. Bug: angleproject:4029 Change-Id: If0acd5c78602324433b63498e2de8c16881023de Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057354 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Michael Spang <spang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7d45184d 2020-01-22T08:34:48 Vulkan: Fix naming in CommandGraphResource. Accidentally submitted a patch set without requested changes. This corrects the function names to 'hasRecordedCommands' and 'hasRunningCommands'. Bug: angleproject:4029 Change-Id: I1cf3046052ace304594ef939566b0b36bae822df Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2013924 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 09a2d065 2020-01-17T13:20:20 Vulkan: Clean up naming of ResourceUse checks. Instead of referring to command graphs we can refer to if the resource is in use by "ANGLE" or the "Driver". This will make the methods more consistent when we switch away from the command graph. Bug: angleproject:4029 Change-Id: I3045a4eb2a38234ef331c0662694656065590ae1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2003234 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 9601a548 2019-11-23T23:44:52 Vulkan: implement external semaphore barriers glWaitSemaphoreEXT and glSignalSemaphoreEXT functions optionally request buffer and image barriers to be performed by the implementation. If any barriers are present, a single global memory barrier is inserted to take care of memory accesses. In both functions, buffer and image memory barriers are used to perform queue ownership transfers to ANGLE's queue (glWaitSemaphoreEXT) or the EXTERNAL queue (glSignalSemaphoreEXT). In glWaitSemaphoreEXT, the given layouts are information regarding how the external entity (the caller) has modified the images' layouts, and is used to update ANGLE's internal state tracking. Bug: angleproject:3289 Bug: 1026673 Change-Id: Ic478a8813df727c89413c8ae2adf42b5c1d06069 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1933016 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Michael Spang <spang@chromium.org>
Jamie Madill b540da89 2019-09-19T14:19:12 Vulkan: Use ResourceUse to track object lifetime. With the new resource tracking scheme the CommandGraph, tracking a "Context serial" aka "current" serial is no longer necessary for CommandGraphResources. Serial tracking has been moved to the shared ResourceUse struct that gets updated on a command submission. Thus we don't need to store the serial as a current separate piece of info in BufferHelper/ImageHelper. Will lead to further redesign for the multi-threading support for Vulkan. Bug: angleproject:2464 Change-Id: I1ae4bcc27fcfb93422b4ab4c9682a458e482f295 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1785990 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 3fe8c3a3 2019-07-04T15:49:54 Refactor the wait/signalSemaphore entry points to be on the Semaphore object Convert the texture ID parameters into optimized vectors of Texture objects. BUG=angleproject:3656 Change-Id: Iffe824ade2a919c9771642ae501ff04712ca43ce Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1688505 Reviewed-by: Michael Spang <spang@chromium.org>
Geoff Lang ee244c77 2019-05-06T10:30:18 Vulkan: Move command graph and garbage to ContextVk. To support multithreading, contexts should manage their own command graphs and garbage. This allows safe access to vulkan resources such as command pools without thread synchronization. BUG=angleproject:2464 Change-Id: I930149bc9f0793028761ee05ab50b8c0a4dec98a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1516515 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Michael Spang 6bb193c8 2019-05-22T16:32:21 Vulkan: Implement glImportSemaphoreFdEXT Allow importing file descriptors into semaphores on linux. This can be used to synchronize ANGLE's GL renderer with respect to vulkan composition in chromium. Bug: angleproject:3289 Change-Id: I04ba3bbb2e343baa000ff89c21c03ca36163a713 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1623812 Commit-Queue: Michael Spang <spang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Michael Spang 5093ba67 2019-05-14T17:36:36 Implement resource management for GL_EXT_semaphore This implements glGenSemaphoresEXT, glDeleteSemaphoresEXT, and glIsSemaphoreEXT. It's not possible to do anything useful with them yet. Bug: angleproject:3289 Change-Id: I20ad90dbcd3fc573a4650c8531d6e1b8ccf7ca9b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1623811 Commit-Queue: Michael Spang <spang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>