diff options
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/gpu.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/gpu_thread.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/gpu_thread.h | 19 |
3 files changed, 8 insertions, 26 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 51c63af4a..c61f44619 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -459,7 +459,7 @@ void GPU::ProcessSemaphoreAcquire() { | |||
| 459 | } | 459 | } |
| 460 | 460 | ||
| 461 | void GPU::Start() { | 461 | void GPU::Start() { |
| 462 | gpu_thread.StartThread(*renderer, renderer->Context(), *dma_pusher, *cdma_pusher); | 462 | gpu_thread.StartThread(*renderer, renderer->Context(), *dma_pusher); |
| 463 | cpu_context = renderer->GetRenderWindow().CreateSharedContext(); | 463 | cpu_context = renderer->GetRenderWindow().CreateSharedContext(); |
| 464 | cpu_context->MakeCurrent(); | 464 | cpu_context->MakeCurrent(); |
| 465 | } | 465 | } |
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index eb0e43c0c..99353f15f 100644 --- a/src/video_core/gpu_thread.cpp +++ b/src/video_core/gpu_thread.cpp | |||
| @@ -19,7 +19,7 @@ namespace VideoCommon::GPUThread { | |||
| 19 | /// Runs the GPU thread | 19 | /// Runs the GPU thread |
| 20 | static void RunThread(Core::System& system, VideoCore::RendererBase& renderer, | 20 | static void RunThread(Core::System& system, VideoCore::RendererBase& renderer, |
| 21 | Core::Frontend::GraphicsContext& context, Tegra::DmaPusher& dma_pusher, | 21 | Core::Frontend::GraphicsContext& context, Tegra::DmaPusher& dma_pusher, |
| 22 | SynchState& state, Tegra::CDmaPusher& cdma_pusher) { | 22 | SynchState& state) { |
| 23 | std::string name = "yuzu:GPU"; | 23 | std::string name = "yuzu:GPU"; |
| 24 | MicroProfileOnThreadCreate(name.c_str()); | 24 | MicroProfileOnThreadCreate(name.c_str()); |
| 25 | SCOPE_EXIT({ MicroProfileOnThreadExit(); }); | 25 | SCOPE_EXIT({ MicroProfileOnThreadExit(); }); |
| @@ -46,9 +46,6 @@ static void RunThread(Core::System& system, VideoCore::RendererBase& renderer, | |||
| 46 | if (auto* submit_list = std::get_if<SubmitListCommand>(&next.data)) { | 46 | if (auto* submit_list = std::get_if<SubmitListCommand>(&next.data)) { |
| 47 | dma_pusher.Push(std::move(submit_list->entries)); | 47 | dma_pusher.Push(std::move(submit_list->entries)); |
| 48 | dma_pusher.DispatchCalls(); | 48 | dma_pusher.DispatchCalls(); |
| 49 | } else if (auto* command_list = std::get_if<SubmitChCommandEntries>(&next.data)) { | ||
| 50 | // NVDEC | ||
| 51 | cdma_pusher.ProcessEntries(std::move(command_list->entries)); | ||
| 52 | } else if (const auto* data = std::get_if<SwapBuffersCommand>(&next.data)) { | 49 | } else if (const auto* data = std::get_if<SwapBuffersCommand>(&next.data)) { |
| 53 | renderer.SwapBuffers(data->framebuffer ? &*data->framebuffer : nullptr); | 50 | renderer.SwapBuffers(data->framebuffer ? &*data->framebuffer : nullptr); |
| 54 | } else if (std::holds_alternative<OnCommandListEndCommand>(next.data)) { | 51 | } else if (std::holds_alternative<OnCommandListEndCommand>(next.data)) { |
| @@ -83,20 +80,16 @@ ThreadManager::~ThreadManager() { | |||
| 83 | 80 | ||
| 84 | void ThreadManager::StartThread(VideoCore::RendererBase& renderer, | 81 | void ThreadManager::StartThread(VideoCore::RendererBase& renderer, |
| 85 | Core::Frontend::GraphicsContext& context, | 82 | Core::Frontend::GraphicsContext& context, |
| 86 | Tegra::DmaPusher& dma_pusher, Tegra::CDmaPusher& cdma_pusher) { | 83 | Tegra::DmaPusher& dma_pusher) { |
| 87 | rasterizer = renderer.ReadRasterizer(); | 84 | rasterizer = renderer.ReadRasterizer(); |
| 88 | thread = std::thread(RunThread, std::ref(system), std::ref(renderer), std::ref(context), | 85 | thread = std::thread(RunThread, std::ref(system), std::ref(renderer), std::ref(context), |
| 89 | std::ref(dma_pusher), std::ref(state), std::ref(cdma_pusher)); | 86 | std::ref(dma_pusher), std::ref(state)); |
| 90 | } | 87 | } |
| 91 | 88 | ||
| 92 | void ThreadManager::SubmitList(Tegra::CommandList&& entries) { | 89 | void ThreadManager::SubmitList(Tegra::CommandList&& entries) { |
| 93 | PushCommand(SubmitListCommand(std::move(entries))); | 90 | PushCommand(SubmitListCommand(std::move(entries))); |
| 94 | } | 91 | } |
| 95 | 92 | ||
| 96 | void ThreadManager::SubmitCommandBuffer(Tegra::ChCommandHeaderList&& entries) { | ||
| 97 | PushCommand(SubmitChCommandEntries(std::move(entries))); | ||
| 98 | } | ||
| 99 | |||
| 100 | void ThreadManager::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { | 93 | void ThreadManager::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { |
| 101 | PushCommand(SwapBuffersCommand(framebuffer ? std::make_optional(*framebuffer) : std::nullopt)); | 94 | PushCommand(SwapBuffersCommand(framebuffer ? std::make_optional(*framebuffer) : std::nullopt)); |
| 102 | } | 95 | } |
diff --git a/src/video_core/gpu_thread.h b/src/video_core/gpu_thread.h index 4cd951169..18269e51c 100644 --- a/src/video_core/gpu_thread.h +++ b/src/video_core/gpu_thread.h | |||
| @@ -43,14 +43,6 @@ struct SubmitListCommand final { | |||
| 43 | Tegra::CommandList entries; | 43 | Tegra::CommandList entries; |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | /// Command to signal to the GPU thread that a cdma command list is ready for processing | ||
| 47 | struct SubmitChCommandEntries final { | ||
| 48 | explicit SubmitChCommandEntries(Tegra::ChCommandHeaderList&& entries_) | ||
| 49 | : entries{std::move(entries_)} {} | ||
| 50 | |||
| 51 | Tegra::ChCommandHeaderList entries; | ||
| 52 | }; | ||
| 53 | |||
| 54 | /// Command to signal to the GPU thread that a swap buffers is pending | 46 | /// Command to signal to the GPU thread that a swap buffers is pending |
| 55 | struct SwapBuffersCommand final { | 47 | struct SwapBuffersCommand final { |
| 56 | explicit SwapBuffersCommand(std::optional<const Tegra::FramebufferConfig> framebuffer_) | 48 | explicit SwapBuffersCommand(std::optional<const Tegra::FramebufferConfig> framebuffer_) |
| @@ -91,9 +83,9 @@ struct OnCommandListEndCommand final {}; | |||
| 91 | struct GPUTickCommand final {}; | 83 | struct GPUTickCommand final {}; |
| 92 | 84 | ||
| 93 | using CommandData = | 85 | using CommandData = |
| 94 | std::variant<EndProcessingCommand, SubmitListCommand, SubmitChCommandEntries, | 86 | std::variant<EndProcessingCommand, SubmitListCommand, SwapBuffersCommand, FlushRegionCommand, |
| 95 | SwapBuffersCommand, FlushRegionCommand, InvalidateRegionCommand, | 87 | InvalidateRegionCommand, FlushAndInvalidateRegionCommand, OnCommandListEndCommand, |
| 96 | FlushAndInvalidateRegionCommand, OnCommandListEndCommand, GPUTickCommand>; | 88 | GPUTickCommand>; |
| 97 | 89 | ||
| 98 | struct CommandDataContainer { | 90 | struct CommandDataContainer { |
| 99 | CommandDataContainer() = default; | 91 | CommandDataContainer() = default; |
| @@ -123,14 +115,11 @@ public: | |||
| 123 | 115 | ||
| 124 | /// Creates and starts the GPU thread. | 116 | /// Creates and starts the GPU thread. |
| 125 | void StartThread(VideoCore::RendererBase& renderer, Core::Frontend::GraphicsContext& context, | 117 | void StartThread(VideoCore::RendererBase& renderer, Core::Frontend::GraphicsContext& context, |
| 126 | Tegra::DmaPusher& dma_pusher, Tegra::CDmaPusher& cdma_pusher); | 118 | Tegra::DmaPusher& dma_pusher); |
| 127 | 119 | ||
| 128 | /// Push GPU command entries to be processed | 120 | /// Push GPU command entries to be processed |
| 129 | void SubmitList(Tegra::CommandList&& entries); | 121 | void SubmitList(Tegra::CommandList&& entries); |
| 130 | 122 | ||
| 131 | /// Push GPU CDMA command buffer entries to be processed | ||
| 132 | void SubmitCommandBuffer(Tegra::ChCommandHeaderList&& entries); | ||
| 133 | |||
| 134 | /// Swap buffers (render frame) | 123 | /// Swap buffers (render frame) |
| 135 | void SwapBuffers(const Tegra::FramebufferConfig* framebuffer); | 124 | void SwapBuffers(const Tegra::FramebufferConfig* framebuffer); |
| 136 | 125 | ||