From 6053b955525be69eb73a928a7bdd43ba8f5e69a7 Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 26 Oct 2020 22:11:41 -0700 Subject: video_core: gpu: Implement WaitFence and IncrementSyncPoint. --- src/video_core/dma_pusher.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/video_core/dma_pusher.h') diff --git a/src/video_core/dma_pusher.h b/src/video_core/dma_pusher.h index efa90d170..2026b7857 100644 --- a/src/video_core/dma_pusher.h +++ b/src/video_core/dma_pusher.h @@ -27,6 +27,31 @@ enum class SubmissionMode : u32 { IncreaseOnce = 5 }; +// Note that, traditionally, methods are treated as 4-byte addressable locations, and hence +// their numbers are written down multiplied by 4 in Docs. Here we are not multiply by 4. +// So the values you see in docs might be multiplied by 4. +enum class BufferMethods : u32 { + BindObject = 0x0, + Nop = 0x2, + SemaphoreAddressHigh = 0x4, + SemaphoreAddressLow = 0x5, + SemaphoreSequence = 0x6, + SemaphoreTrigger = 0x7, + NotifyIntr = 0x8, + WrcacheFlush = 0x9, + Unk28 = 0xA, + UnkCacheFlush = 0xB, + RefCnt = 0x14, + SemaphoreAcquire = 0x1A, + SemaphoreRelease = 0x1B, + FenceValue = 0x1C, + FenceAction = 0x1D, + WaitForInterrupt = 0x1E, + Unk7c = 0x1F, + Yield = 0x20, + NonPullerMethods = 0x40, +}; + struct CommandListHeader { union { u64 raw; -- cgit v1.2.3 From c64545d07ae57816bc658ca7c45559d0b0d49f89 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 29 Oct 2020 21:13:04 -0700 Subject: video_core: dma_pusher: Add support for prefetched command lists. --- src/video_core/dma_pusher.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/video_core/dma_pusher.h') diff --git a/src/video_core/dma_pusher.h b/src/video_core/dma_pusher.h index 2026b7857..99b30ca0d 100644 --- a/src/video_core/dma_pusher.h +++ b/src/video_core/dma_pusher.h @@ -74,9 +74,26 @@ union CommandHeader { static_assert(std::is_standard_layout_v, "CommandHeader is not standard layout"); static_assert(sizeof(CommandHeader) == sizeof(u32), "CommandHeader has incorrect size!"); +static constexpr CommandHeader BuildCommandHeader(BufferMethods method, u32 arg_count, + SubmissionMode mode) { + CommandHeader result{}; + result.method.Assign(static_cast(method)); + result.arg_count.Assign(arg_count); + result.mode.Assign(mode); + return result; +} + class GPU; -using CommandList = std::vector; +struct CommandList final { + CommandList() = default; + explicit CommandList(std::size_t size) : command_lists(size) {} + explicit CommandList(std::vector&& prefetch_command_list) + : prefetch_command_list{std::move(prefetch_command_list)} {} + + std::vector command_lists; + std::vector prefetch_command_list; +}; /** * The DmaPusher class implements DMA submission to FIFOs, providing an area of memory that the @@ -85,7 +102,7 @@ using CommandList = std::vector; * See https://envytools.readthedocs.io/en/latest/hw/fifo/dma-pusher.html#fifo-dma-pusher for * details on this implementation. */ -class DmaPusher { +class DmaPusher final { public: explicit DmaPusher(Core::System& system, GPU& gpu); ~DmaPusher(); -- cgit v1.2.3 From c6e1c46ac70bf31b54f756f9611b1cf086b63fb0 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 29 Oct 2020 21:13:48 -0700 Subject: video_core: dma_pusher: Add support for integrity checks. - Log corrupted command lists, rather than crash. --- src/video_core/dma_pusher.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/video_core/dma_pusher.h') diff --git a/src/video_core/dma_pusher.h b/src/video_core/dma_pusher.h index 99b30ca0d..8496ba2da 100644 --- a/src/video_core/dma_pusher.h +++ b/src/video_core/dma_pusher.h @@ -91,7 +91,10 @@ struct CommandList final { explicit CommandList(std::vector&& prefetch_command_list) : prefetch_command_list{std::move(prefetch_command_list)} {} + void RefreshIntegrityChecks(GPU& gpu); + std::vector command_lists; + std::vector command_list_hashes; std::vector prefetch_command_list; }; -- cgit v1.2.3 From 6f006d051e1fad075048ea5664e1ef0605e48a46 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 4 Nov 2020 20:41:16 -0500 Subject: General: Fix clang build Allows building on clang to work again --- src/video_core/dma_pusher.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/video_core/dma_pusher.h') diff --git a/src/video_core/dma_pusher.h b/src/video_core/dma_pusher.h index 8496ba2da..9d9a750d9 100644 --- a/src/video_core/dma_pusher.h +++ b/src/video_core/dma_pusher.h @@ -18,6 +18,8 @@ class System; namespace Tegra { +class GPU; + enum class SubmissionMode : u32 { IncreasingOld = 0, Increasing = 1, @@ -74,8 +76,7 @@ union CommandHeader { static_assert(std::is_standard_layout_v, "CommandHeader is not standard layout"); static_assert(sizeof(CommandHeader) == sizeof(u32), "CommandHeader has incorrect size!"); -static constexpr CommandHeader BuildCommandHeader(BufferMethods method, u32 arg_count, - SubmissionMode mode) { +inline CommandHeader BuildCommandHeader(BufferMethods method, u32 arg_count, SubmissionMode mode) { CommandHeader result{}; result.method.Assign(static_cast(method)); result.arg_count.Assign(arg_count); @@ -83,8 +84,6 @@ static constexpr CommandHeader BuildCommandHeader(BufferMethods method, u32 arg_ return result; } -class GPU; - struct CommandList final { CommandList() = default; explicit CommandList(std::size_t size) : command_lists(size) {} -- cgit v1.2.3 From dc5396a4668b564b2d1f4488d10581dd67fc22db Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 7 Nov 2020 00:08:19 -0800 Subject: video_core: dma_pusher: Remove integrity check on command lists. - This seems to cause softlocks in Breath of the Wild. --- src/video_core/dma_pusher.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/video_core/dma_pusher.h') diff --git a/src/video_core/dma_pusher.h b/src/video_core/dma_pusher.h index 9d9a750d9..96ac267f7 100644 --- a/src/video_core/dma_pusher.h +++ b/src/video_core/dma_pusher.h @@ -90,10 +90,7 @@ struct CommandList final { explicit CommandList(std::vector&& prefetch_command_list) : prefetch_command_list{std::move(prefetch_command_list)} {} - void RefreshIntegrityChecks(GPU& gpu); - std::vector command_lists; - std::vector command_list_hashes; std::vector prefetch_command_list; }; -- cgit v1.2.3 From 677a8b208d47d0d2397197ce74c7039a8ea79d20 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 4 Dec 2020 14:39:12 -0500 Subject: video_core: Resolve more variable shadowing scenarios Resolves variable shadowing scenarios up to the end of the OpenGL code to make it nicer to review. The rest will be resolved in a following commit. --- src/video_core/dma_pusher.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/video_core/dma_pusher.h') diff --git a/src/video_core/dma_pusher.h b/src/video_core/dma_pusher.h index 96ac267f7..19f286fa7 100644 --- a/src/video_core/dma_pusher.h +++ b/src/video_core/dma_pusher.h @@ -87,11 +87,11 @@ inline CommandHeader BuildCommandHeader(BufferMethods method, u32 arg_count, Sub struct CommandList final { CommandList() = default; explicit CommandList(std::size_t size) : command_lists(size) {} - explicit CommandList(std::vector&& prefetch_command_list) - : prefetch_command_list{std::move(prefetch_command_list)} {} + explicit CommandList(std::vector&& prefetch_command_list_) + : prefetch_command_list{std::move(prefetch_command_list_)} {} - std::vector command_lists; - std::vector prefetch_command_list; + std::vector command_lists; + std::vector prefetch_command_list; }; /** @@ -103,7 +103,7 @@ struct CommandList final { */ class DmaPusher final { public: - explicit DmaPusher(Core::System& system, GPU& gpu); + explicit DmaPusher(Core::System& system_, GPU& gpu_); ~DmaPusher(); void Push(CommandList&& entries) { @@ -112,7 +112,7 @@ public: void DispatchCalls(); - void BindSubchannel(Tegra::Engines::EngineInterface* engine, u32 subchannel_id) { + void BindSubchannel(Engines::EngineInterface* engine, u32 subchannel_id) { subchannels[subchannel_id] = engine; } @@ -145,7 +145,7 @@ private: bool ib_enable{true}; ///< IB mode enabled - std::array subchannels{}; + std::array subchannels{}; GPU& gpu; Core::System& system; -- cgit v1.2.3