src/libANGLE/renderer/vulkan/SyncVk.cpp


Log

Author Commit Date CI Message
Jamie Madill f10bf6bf 2019-09-26T10:27:18 Vulkan: Implement multi-threaded GL. The main component of this change is to make vk::BufferHelper, vk::ImageHelper and vk::SyncHelper use a common path. We introduce a new "vk::SharedGarbage" helper class that stores small lists of garbage from individual objects like an ImageHelper or BufferHelper. The SharedGarbage is stored in the RendererVk with the ResourceUse of the helper object. The ResourceUse tells RendererVk when it is safe to destroy the GarbageObjects. New "onGraphAccess" commands are added in a few places to enable the common garbage collection path. A couple Context-only resources like default attributes now are referenced where they were not before. Also reorganizes some functions so we can add a few helpful ASSERTs to our graph dependencies. Added "updateCurrentAccessNodes" for this. Also adds a "RendererScoped" helper to replace many uses of "ContextScoped". The multithreading EGL tests mostly pass but have some remaining flakiness so cannot yet be enabled. Bug: angleproject:2464 Change-Id: Ia3e3ae8848d731abf3f21ebe04c33e381e130be0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1808444 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 33ffed01 2019-09-26T10:19:35 Vulkan: Clean up garbage APIs. Instead of dumping resources to a context, we use the release APIs consistently. Refactoring/cleanup change only. Should have very litte impact on runtime behaviour. Bug: angleproject:2464 Change-Id: I2dc7f8316c466f7ccfad50a7b792ba0ee7bc2e49 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1804883 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>
Shahbaz Youssefi 57ad1e12 2019-08-23T14:53:26 Vulkan: Introduce ContextScoped Scoped is changed to DeviceScoped and a ContextScoped class is added. The former destroys objects at the end of scope, and the latter releases them. Bug: angleproject:3757 Change-Id: Ia0bbded53e94af9c8c72c77d07306d6724c6c409 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1769060 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 83c24aa8 2019-08-21T12:28:18 Vulkan: Reference Context fences in FenceSyncVk. A particular test waits on a fence that was created in another Context. Then it immediately destroys all other resources. This triggered a bug where the VkEvent corresponding to the FenceSync was deleted while it was still in use by a command buffer. Fix this by referencing the other submit fence of the second ContextVk in the FenceSync class. Bug: angleproject:2464 Change-Id: I4ef096bf760aa8943db08d491006c68e36db993b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1757505 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang 69e46a18 2019-07-03T14:43:32 GL: Implement EGL_ANDROID_native_fence_sync This extension allows Chrome to use ANGLE on newer Android devices. BUG=angleproject:3643 Change-Id: I5456d61749399ca2bbc11cc5e98b9120f8702406 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1687121 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Michael Spang ab6a59b2 2019-05-21T21:26:26 Vulkan: Submit semaphores from glWaitSemaphoreEXT & glSignalSemaphoreEXT Implement submission of client semaphores passed to glWaitSemaphoreEXT & glSignalSemaphoreEXT. This also relaxes the expectation that we will not flush() if there are no commands. Signaling semaphores in particular requires queue submission irrespective of whether there are any command buffers to submit. If there are neither commands nor semaphores, we can still skip queue submission. WebGL runs in Chrome with ANGLE & Vulkan interop as of this patch, albeit with incorrect synchronization due to texture barriers not being implemented yet. Quite a few flags are needed to try this: GN args: angle_vulkan_conformant_configs_only=true chrome \ --enable-features=UseSkiaRenderer,UiGpuRasterization \ --enable-gpu-rasterization \ --enable-oop-rasterization \ --enable-vulkan \ --use-gl=angle \ --use-angle=vulkan Bug: angleproject:3289 Change-Id: I3d49c230a2fbf0cd2a2b943b05ded0e4604cc313 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1623815 Commit-Queue: Michael Spang <spang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang e0956a16 2019-05-06T10:34:27 Vulkan: Rename getSubmitFence to getNextSubmitFence. Now that getLastSubmittedFence exists, the new name is more specific. BUG=angleproject:2464 Change-Id: I0bce1387b95b7b7b739e311d37e35e7d162d8f2d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1595435 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@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>
Geoff Lang e755a537 2019-04-10T09:58:21 Vulkan: Add a new garbage type gated by fences. This allows Vulkan EGL objects such as EGL Syncs and EGL Images to give their garbage to the renderer before destroying. BUG=angleproject:2464 Change-Id: I59b8e1080e4292bd0856e59a928750c7e77a372e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1562522 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 892d1805 2019-03-27T14:21:34 Vulkan: Have the WindowSurfaceVk own the submit semaphores. Chaining of submit semaphores is only needed for window surfaces because they are required for the first usage of the swap chain image and final present of the image. Move ownership of the submit semaphores from RendererVk to WindowSurfaceVk and update all calls to finish and flush to be piped through a ContextVk which tracks the currently bound window surface. BUG=angleproject:2464 Change-Id: I4b3083124d7910a5dee297afc219e3a3f28057f2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1542257 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 9049d321 2019-03-27T14:08:44 Vulkan: Pass the current context to egl Sync operations. The EGL_KHR_fence_sync spec says that if a flush is needed before waiting on the sync, it's done on the current context for the current thread. This helps simplify the multithreading design, we don't need to worry about flusing on a context that may no longer exist or is executing on a different thread. It does allow infinite waits because the context with the fence is never flushed but the spec allows this. BUG=angleproject:2464 Change-Id: I8bf2f93c408fee2dae95caa5bb9c76ba67687931 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1542256 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 20ae6814 2019-02-27T17:11:58 Vulkan: Decouple EGLSync from renderer serial To support future work where RendererVk functionality is moved to ContextVk. Given multiple contexts, EGLSync can no longer rely on a single serial as it can be used in multiple contexts. Instead, the fence corresponding to the submission in which the EGLSync object signals is kept so it can be waited on. Introduces a `vk::Shared` class that includes a ref-counted reference to a Vulkan object (vk::Fence in this case). This is specially made to `destroy()` object when reference count reaches zero. Bug: angleproject:2464 Change-Id: I68c8229eea8df77974e28fcc2a9563dae5d204f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1493131 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill (use @chromium please) <jmadill@google.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill c09ae15c 2019-02-01T14:16:32 Enable -Wextra-semi and -Wextra-semi-stmt. This will prevent users from accidentally making semicolon errors in the future. Bug: chromium:926235 Change-Id: I79a6fa376fb1ad8f0fcf1b65b1f572a035d1f4e9 Reviewed-on: https://chromium-review.googlesource.com/c/1446493 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 82fddcb1 2019-01-18T14:27:43 Vulkan: Implement GLsync and EGLSync fence syncs That is required in GLES 3 for GLsync and EGL_KHR_fence_sync and EGL_KHR_wait_sync (or EGL 1.5) for EGLSync. The two constructs (GLsync and EGLSync) have similar semantics and share the implementation on the Vulkan backend. The implementation of a fence sync object is achieved through the combined use of a vkEvent and the implicit vkFence inserted at the end of every submission. Imagine the following command buffer: glDraw : Draw glCreateSync: Set Event <-- insertion of fence sync glDraw : Draw : Signal Fence <-- implicit fence at the end of submission glFlush : Submit Assume the serial S is associated to this submission. The following hold: - If event is set, the fence sync is signaled - If S is already finished, the fence sync is signaled - If client is waiting on the sync and S is not yet flushed, there will be a deadlock (unless multi-threaded and another thread performs the flush). The event is used to implement server waits (glWaitSync), as vkEvent is the only entity the GPU can signal and wait on within the command buffer. The wait is inserted in the command graph without incurring a flush, i.e. the wait can be within the same command buffer as event set. The event however does not support CPU waits (glClientWaitSync). vkFence is the only entity the CPU can wait on. For client wait therefore, the following algorithm is used: - If the event is already set, there's no wait -> already signaled - If timeout is zero, there's no wait -> timeout expired - If S is not flushed, flush it to ensure forward progress. - Wait until S is finished -> condition satisfied / timeout expired. Bug: angleproject:2466 Change-Id: I678995a6139dd9533fa8ad361a3d292b202c52a4 Reviewed-on: https://chromium-review.googlesource.com/c/1422552 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7c985f5c 2018-11-29T18:16:17 Make angle::Result an enum. This moves away from a class type to a value type. This should improve performance when using angle::Result as a return value. Previously the generated code would return a pointer instead of a value. Improves performance in the most targeted microbenchmark by 10%. In more realistic scanarios it will have a smaller improvement. Also simplifies the class implementation and usage. Includes some unrelated code generation changes. Bug: angleproject:2491 Change-Id: Ifcf86870bf1c00a2f73c39ea6e4f05ca705050aa Reviewed-on: https://chromium-review.googlesource.com/c/1356139 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill b8eec4a4 2018-10-18T17:34:38 Use angle::Result in front-end (Part 7) Refactors the gl::FenceNV and gl::Sync classes. Bug: angleproject:2491 Change-Id: I0fe73d1ccf5407f460e173a3061735b330a88511 Reviewed-on: https://chromium-review.googlesource.com/c/1289712 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill a0691b77 2018-07-25T10:41:22 Pass Context to Fence Impl methods. This is needed for the error refactoring and also for the Vulkan implementation. Bug: angleproject:2738 Change-Id: I4e1bed7f67ef17feb5554b5838a2ed5feb22bba0 Reviewed-on: https://chromium-review.googlesource.com/1150091 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 70b5bb00 2017-08-28T13:32:37 Rename gl::FenceSync to gl::Sync. The spec refers to Sync objects, FenceSyncs being a subtype. The motivation for this fix is to clear up the FenceSync_ entry point for auto-generation. BUG=angleproject:1309 Change-Id: I94c440476d701628575e7a3eea68b6dd110f41c3 Reviewed-on: https://chromium-review.googlesource.com/636516 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>