From e2463b76195df5bb2fed0e092da0f41677274241 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Mon, 9 Jan 2023 21:58:25 +0000 Subject: [PATCH] Adjust gpfifo WFI to only do a pipeline barrier --- .../cpp/skyline/gpu/interconnect/command_executor.cpp | 11 +++++++++++ .../cpp/skyline/gpu/interconnect/command_executor.h | 5 +++++ app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.cpp | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp index 46c42bf9..00ee51e7 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp @@ -443,6 +443,17 @@ namespace skyline::gpu::interconnect { slot->nodes.emplace_back(std::in_place_type_t(), std::forward(function)); } + void CommandExecutor::AddFullBarrier() { + AddOutsideRpCommand([](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr &, GPU &) { + commandBuffer.pipelineBarrier( + vk::PipelineStageFlagBits::eAllCommands, vk::PipelineStageFlagBits::eAllCommands, {}, vk::MemoryBarrier{ + .srcAccessMask = vk::AccessFlagBits::eMemoryRead | vk::AccessFlagBits::eMemoryWrite, + .dstAccessMask = vk::AccessFlagBits::eMemoryRead | vk::AccessFlagBits::eMemoryWrite, + }, {}, {} + ); + }); + } + void CommandExecutor::AddClearColorSubpass(TextureView *attachment, const vk::ClearColorValue &value) { bool gotoNext{CreateRenderPassWithSubpass(vk::Rect2D{.extent = attachment->texture->dimensions}, {}, {}, attachment, nullptr)}; if (renderPass->ClearColorAttachment(0, value, gpu)) { diff --git a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h index 70c6ddfd..c1bfd401 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h @@ -284,6 +284,11 @@ namespace skyline::gpu::interconnect { */ void AddOutsideRpCommand(std::function &, GPU &)> &&function); + /** + * @brief Adds a full pipeline barrier to the command buffer + */ + void AddFullBarrier(); + /** * @brief Adds a persistent callback that will be called at the start of Execute in order to flush data required for recording */ diff --git a/app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.cpp b/app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.cpp index 05d2b8a7..ae59d9f4 100644 --- a/app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.cpp +++ b/app/src/main/cpp/skyline/soc/gm20b/engines/gpfifo.cpp @@ -118,7 +118,7 @@ namespace skyline::soc::gm20b::engine { } }) ENGINE_CASE(wfi, { - channelCtx.executor.Submit(); + channelCtx.executor.AddFullBarrier(); }) ENGINE_CASE(setReference, { channelCtx.executor.Submit();