diff options
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/command_classes/host1x.cpp | 29 | ||||
| -rw-r--r-- | src/video_core/gpu.cpp | 48 | ||||
| -rw-r--r-- | src/video_core/gpu.h | 9 | ||||
| -rw-r--r-- | src/video_core/host1x/syncpoint_manager.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 4 |
6 files changed, 4 insertions, 94 deletions
diff --git a/src/video_core/command_classes/host1x.cpp b/src/video_core/command_classes/host1x.cpp deleted file mode 100644 index 11855fe10..000000000 --- a/src/video_core/command_classes/host1x.cpp +++ /dev/null | |||
| @@ -1,29 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "common/assert.h" | ||
| 5 | #include "video_core/command_classes/host1x.h" | ||
| 6 | #include "video_core/gpu.h" | ||
| 7 | |||
| 8 | Tegra::Host1x::Host1x(GPU& gpu_) : gpu(gpu_) {} | ||
| 9 | |||
| 10 | Tegra::Host1x::~Host1x() = default; | ||
| 11 | |||
| 12 | void Tegra::Host1x::ProcessMethod(Method method, u32 argument) { | ||
| 13 | switch (method) { | ||
| 14 | case Method::LoadSyncptPayload32: | ||
| 15 | syncpoint_value = argument; | ||
| 16 | break; | ||
| 17 | case Method::WaitSyncpt: | ||
| 18 | case Method::WaitSyncpt32: | ||
| 19 | Execute(argument); | ||
| 20 | break; | ||
| 21 | default: | ||
| 22 | UNIMPLEMENTED_MSG("Host1x method 0x{:X}", static_cast<u32>(method)); | ||
| 23 | break; | ||
| 24 | } | ||
| 25 | } | ||
| 26 | |||
| 27 | void Tegra::Host1x::Execute(u32 data) { | ||
| 28 | gpu.WaitFence(data, syncpoint_value); | ||
| 29 | } | ||
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index e05c9a357..a1d19b1c8 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | #include "core/core.h" | 14 | #include "core/core.h" |
| 15 | #include "core/core_timing.h" | 15 | #include "core/core_timing.h" |
| 16 | #include "core/frontend/emu_window.h" | 16 | #include "core/frontend/emu_window.h" |
| 17 | #include "core/hardware_interrupt_manager.h" | ||
| 18 | #include "core/hle/service/nvdrv/nvdata.h" | 17 | #include "core/hle/service/nvdrv/nvdata.h" |
| 19 | #include "core/perf_stats.h" | 18 | #include "core/perf_stats.h" |
| 20 | #include "video_core/cdma_pusher.h" | 19 | #include "video_core/cdma_pusher.h" |
| @@ -36,8 +35,6 @@ | |||
| 36 | 35 | ||
| 37 | namespace Tegra { | 36 | namespace Tegra { |
| 38 | 37 | ||
| 39 | MICROPROFILE_DEFINE(GPU_wait, "GPU", "Wait for the GPU", MP_RGB(128, 128, 192)); | ||
| 40 | |||
| 41 | struct GPU::Impl { | 38 | struct GPU::Impl { |
| 42 | explicit Impl(GPU& gpu_, Core::System& system_, bool is_async_, bool use_nvdec_) | 39 | explicit Impl(GPU& gpu_, Core::System& system_, bool is_async_, bool use_nvdec_) |
| 43 | : gpu{gpu_}, system{system_}, host1x{system.Host1x()}, use_nvdec{use_nvdec_}, | 40 | : gpu{gpu_}, system{system_}, host1x{system.Host1x()}, use_nvdec{use_nvdec_}, |
| @@ -197,30 +194,6 @@ struct GPU::Impl { | |||
| 197 | return *shader_notify; | 194 | return *shader_notify; |
| 198 | } | 195 | } |
| 199 | 196 | ||
| 200 | /// Allows the CPU/NvFlinger to wait on the GPU before presenting a frame. | ||
| 201 | void WaitFence(u32 syncpoint_id, u32 value) { | ||
| 202 | if (syncpoint_id == UINT32_MAX) { | ||
| 203 | return; | ||
| 204 | } | ||
| 205 | MICROPROFILE_SCOPE(GPU_wait); | ||
| 206 | host1x.GetSyncpointManager().WaitHost(syncpoint_id, value); | ||
| 207 | } | ||
| 208 | |||
| 209 | void IncrementSyncPoint(u32 syncpoint_id) { | ||
| 210 | host1x.GetSyncpointManager().IncrementHost(syncpoint_id); | ||
| 211 | } | ||
| 212 | |||
| 213 | [[nodiscard]] u32 GetSyncpointValue(u32 syncpoint_id) const { | ||
| 214 | return host1x.GetSyncpointManager().GetHostSyncpointValue(syncpoint_id); | ||
| 215 | } | ||
| 216 | |||
| 217 | void RegisterSyncptInterrupt(u32 syncpoint_id, u32 value) { | ||
| 218 | auto& syncpoint_manager = host1x.GetSyncpointManager(); | ||
| 219 | syncpoint_manager.RegisterHostAction(syncpoint_id, value, [this, syncpoint_id, value]() { | ||
| 220 | TriggerCpuInterrupt(syncpoint_id, value); | ||
| 221 | }); | ||
| 222 | } | ||
| 223 | |||
| 224 | [[nodiscard]] u64 GetTicks() const { | 197 | [[nodiscard]] u64 GetTicks() const { |
| 225 | // This values were reversed engineered by fincs from NVN | 198 | // This values were reversed engineered by fincs from NVN |
| 226 | // The gpu clock is reported in units of 385/625 nanoseconds | 199 | // The gpu clock is reported in units of 385/625 nanoseconds |
| @@ -322,11 +295,6 @@ struct GPU::Impl { | |||
| 322 | gpu_thread.FlushAndInvalidateRegion(addr, size); | 295 | gpu_thread.FlushAndInvalidateRegion(addr, size); |
| 323 | } | 296 | } |
| 324 | 297 | ||
| 325 | void TriggerCpuInterrupt(u32 syncpoint_id, u32 value) const { | ||
| 326 | auto& interrupt_manager = system.InterruptManager(); | ||
| 327 | interrupt_manager.GPUInterruptSyncpt(syncpoint_id, value); | ||
| 328 | } | ||
| 329 | |||
| 330 | void RequestSwapBuffers(const Tegra::FramebufferConfig* framebuffer, | 298 | void RequestSwapBuffers(const Tegra::FramebufferConfig* framebuffer, |
| 331 | Service::Nvidia::NvFence* fences, size_t num_fences) { | 299 | Service::Nvidia::NvFence* fences, size_t num_fences) { |
| 332 | size_t current_request_counter{}; | 300 | size_t current_request_counter{}; |
| @@ -524,22 +492,6 @@ void GPU::RequestSwapBuffers(const Tegra::FramebufferConfig* framebuffer, | |||
| 524 | impl->RequestSwapBuffers(framebuffer, fences, num_fences); | 492 | impl->RequestSwapBuffers(framebuffer, fences, num_fences); |
| 525 | } | 493 | } |
| 526 | 494 | ||
| 527 | void GPU::WaitFence(u32 syncpoint_id, u32 value) { | ||
| 528 | impl->WaitFence(syncpoint_id, value); | ||
| 529 | } | ||
| 530 | |||
| 531 | void GPU::IncrementSyncPoint(u32 syncpoint_id) { | ||
| 532 | impl->IncrementSyncPoint(syncpoint_id); | ||
| 533 | } | ||
| 534 | |||
| 535 | u32 GPU::GetSyncpointValue(u32 syncpoint_id) const { | ||
| 536 | return impl->GetSyncpointValue(syncpoint_id); | ||
| 537 | } | ||
| 538 | |||
| 539 | void GPU::RegisterSyncptInterrupt(u32 syncpoint_id, u32 value) { | ||
| 540 | impl->RegisterSyncptInterrupt(syncpoint_id, value); | ||
| 541 | } | ||
| 542 | |||
| 543 | u64 GPU::GetTicks() const { | 495 | u64 GPU::GetTicks() const { |
| 544 | return impl->GetTicks(); | 496 | return impl->GetTicks(); |
| 545 | } | 497 | } |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index f04edf5c4..655373b33 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -171,15 +171,6 @@ public: | |||
| 171 | /// Returns a const reference to the shader notifier. | 171 | /// Returns a const reference to the shader notifier. |
| 172 | [[nodiscard]] const VideoCore::ShaderNotify& ShaderNotify() const; | 172 | [[nodiscard]] const VideoCore::ShaderNotify& ShaderNotify() const; |
| 173 | 173 | ||
| 174 | /// Allows the CPU/NvFlinger to wait on the GPU before presenting a frame. | ||
| 175 | void WaitFence(u32 syncpoint_id, u32 value); | ||
| 176 | |||
| 177 | void IncrementSyncPoint(u32 syncpoint_id); | ||
| 178 | |||
| 179 | [[nodiscard]] u32 GetSyncpointValue(u32 syncpoint_id) const; | ||
| 180 | |||
| 181 | void RegisterSyncptInterrupt(u32 syncpoint_id, u32 value); | ||
| 182 | |||
| 183 | [[nodiscard]] u64 GetTicks() const; | 174 | [[nodiscard]] u64 GetTicks() const; |
| 184 | 175 | ||
| 185 | [[nodiscard]] bool IsAsync() const; | 176 | [[nodiscard]] bool IsAsync() const; |
diff --git a/src/video_core/host1x/syncpoint_manager.cpp b/src/video_core/host1x/syncpoint_manager.cpp index c606b8bd0..825bd551e 100644 --- a/src/video_core/host1x/syncpoint_manager.cpp +++ b/src/video_core/host1x/syncpoint_manager.cpp | |||
| @@ -2,12 +2,15 @@ | |||
| 2 | // Licensed under GPLv3 or any later version | 2 | // Licensed under GPLv3 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/microprofile.h" | ||
| 5 | #include "video_core/host1x/syncpoint_manager.h" | 6 | #include "video_core/host1x/syncpoint_manager.h" |
| 6 | 7 | ||
| 7 | namespace Tegra { | 8 | namespace Tegra { |
| 8 | 9 | ||
| 9 | namespace Host1x { | 10 | namespace Host1x { |
| 10 | 11 | ||
| 12 | MICROPROFILE_DEFINE(GPU_wait, "GPU", "Wait for the GPU", MP_RGB(128, 128, 192)); | ||
| 13 | |||
| 11 | SyncpointManager::ActionHandle SyncpointManager::RegisterAction( | 14 | SyncpointManager::ActionHandle SyncpointManager::RegisterAction( |
| 12 | std::atomic<u32>& syncpoint, std::list<RegisteredAction>& action_storage, u32 expected_value, | 15 | std::atomic<u32>& syncpoint, std::list<RegisteredAction>& action_storage, u32 expected_value, |
| 13 | std::function<void(void)>& action) { | 16 | std::function<void(void)>& action) { |
| @@ -58,6 +61,7 @@ void SyncpointManager::WaitGuest(u32 syncpoint_id, u32 expected_value) { | |||
| 58 | } | 61 | } |
| 59 | 62 | ||
| 60 | void SyncpointManager::WaitHost(u32 syncpoint_id, u32 expected_value) { | 63 | void SyncpointManager::WaitHost(u32 syncpoint_id, u32 expected_value) { |
| 64 | MICROPROFILE_SCOPE(GPU_wait); | ||
| 61 | Wait(syncpoints_host[syncpoint_id], wait_host_cv, expected_value); | 65 | Wait(syncpoints_host[syncpoint_id], wait_host_cv, expected_value); |
| 62 | } | 66 | } |
| 63 | 67 | ||
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index f745fbf56..b572950a6 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -396,10 +396,6 @@ void RasterizerOpenGL::SignalSemaphore(GPUVAddr addr, u32 value) { | |||
| 396 | } | 396 | } |
| 397 | 397 | ||
| 398 | void RasterizerOpenGL::SignalSyncPoint(u32 value) { | 398 | void RasterizerOpenGL::SignalSyncPoint(u32 value) { |
| 399 | if (!gpu.IsAsync()) { | ||
| 400 | gpu.IncrementSyncPoint(value); | ||
| 401 | return; | ||
| 402 | } | ||
| 403 | fence_manager.SignalSyncPoint(value); | 399 | fence_manager.SignalSyncPoint(value); |
| 404 | } | 400 | } |
| 405 | 401 | ||
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 50fdf5e18..a95f68231 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -458,10 +458,6 @@ void RasterizerVulkan::SignalSemaphore(GPUVAddr addr, u32 value) { | |||
| 458 | } | 458 | } |
| 459 | 459 | ||
| 460 | void RasterizerVulkan::SignalSyncPoint(u32 value) { | 460 | void RasterizerVulkan::SignalSyncPoint(u32 value) { |
| 461 | if (!gpu.IsAsync()) { | ||
| 462 | gpu.IncrementSyncPoint(value); | ||
| 463 | return; | ||
| 464 | } | ||
| 465 | fence_manager.SignalSyncPoint(value); | 461 | fence_manager.SignalSyncPoint(value); |
| 466 | } | 462 | } |
| 467 | 463 | ||