From 848bdf8a40aa31f1525e7326225f0f9fc3126d4d Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 30 Oct 2020 23:17:05 -0700 Subject: fixup! hle service: nvdrv: nvhost_gpu: Update to use SyncpointManager and other improvements. --- src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | 13 ++++++++++--- src/core/hle/service/nvdrv/devices/nvhost_gpu.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index 2b9a8722c..152019548 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp @@ -16,7 +16,10 @@ namespace Service::Nvidia::Devices { nvhost_gpu::nvhost_gpu(Core::System& system, std::shared_ptr nvmap_dev, SyncpointManager& syncpoint_manager) - : nvdevice(system), nvmap_dev(std::move(nvmap_dev)), syncpoint_manager{syncpoint_manager} {} + : nvdevice(system), nvmap_dev(std::move(nvmap_dev)), syncpoint_manager{syncpoint_manager} { + channel_fence.id = syncpoint_manager.AllocateSyncpoint(); + channel_fence.value = system.GPU().GetSyncpointValue(channel_fence.id); +} nvhost_gpu::~nvhost_gpu() = default; @@ -129,8 +132,9 @@ u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector& input, std::vector& ou params.num_entries, params.flags, params.unk0, params.unk1, params.unk2, params.unk3); - params.fence_out.id = syncpoint_manager.AllocateSyncpoint(); - params.fence_out.value = syncpoint_manager.RefreshSyncpoint(params.fence_out.id); + channel_fence.value = system.GPU().GetSyncpointValue(channel_fence.id); + + params.fence_out = channel_fence; std::memcpy(output.data(), ¶ms, output.size()); return 0; @@ -194,6 +198,9 @@ u32 nvhost_gpu::SubmitGPFIFOImpl(IoctlSubmitGpfifo& params, std::vector& out params.num_entries, params.flags.raw); auto& gpu = system.GPU(); + + params.fence_out.id = channel_fence.id; + if (params.flags.add_wait.Value() && !syncpoint_manager.IsSyncpointExpired(params.fence_out.id, params.fence_out.value)) { gpu.PushGPUEntries(Tegra::CommandList{BuildWaitCommandList(params.fence_out)}); diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h index 80054510f..a252fc06d 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h @@ -212,6 +212,7 @@ private: std::shared_ptr nvmap_dev; SyncpointManager& syncpoint_manager; + Fence channel_fence; }; } // namespace Service::Nvidia::Devices -- cgit v1.2.3