diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 14 | ||||
-rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp | 17 | ||||
-rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h | 13 | ||||
-rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.h | 2 | ||||
-rw-r--r-- | src/core/hle/service/time/time_manager.cpp | 13 | ||||
-rw-r--r-- | src/core/hle/service/vi/vi.cpp | 12 |
6 files changed, 43 insertions, 28 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index 8b4867ca7..f9b82b504 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp @@ -92,6 +92,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector if (syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) { params.value = syncpoint_manager.GetSyncpointMin(params.syncpt_id); std::memcpy(output.data(), ¶ms, sizeof(params)); + events_interface.failed[event_id] = false; return NvResult::Success; } @@ -99,6 +100,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) { params.value = new_value; std::memcpy(output.data(), ¶ms, sizeof(params)); + events_interface.failed[event_id] = false; return NvResult::Success; } @@ -117,6 +119,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector event.event->GetWritableEvent().Signal(); params.value = current_syncpoint_value; std::memcpy(output.data(), ¶ms, sizeof(params)); + events_interface.failed[event_id] = false; return NvResult::Success; } const u32 target_value = current_syncpoint_value - diff; @@ -146,6 +149,16 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector } params.value |= event_id; event.event->GetWritableEvent().Clear(); + if (events_interface.failed[event_id]) { + { + auto lk = system.StallCPU(); + gpu.WaitFence(params.syncpt_id, target_value); + system.UnstallCPU(); + } + std::memcpy(output.data(), ¶ms, sizeof(params)); + events_interface.failed[event_id] = false; + return NvResult::Success; + } gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value); std::memcpy(output.data(), ¶ms, sizeof(params)); return NvResult::Timeout; @@ -201,6 +214,7 @@ NvResult nvhost_ctrl::IocCtrlClearEventWait(const std::vector<u8>& input, std::v if (events_interface.status[event_id] == EventState::Waiting) { events_interface.LiberateEvent(event_id); } + events_interface.failed[event_id] = true; syncpoint_manager.RefreshSyncpoint(events_interface.events[event_id].fence.id); diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp index 845de724d..e61261f98 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp @@ -69,8 +69,7 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u std::vector<Reloc> relocs(params.relocation_count); std::vector<u32> reloc_shifts(params.relocation_count); std::vector<SyncptIncr> syncpt_increments(params.syncpoint_count); - std::vector<SyncptIncr> wait_checks(params.syncpoint_count); - std::vector<Fence> fences(params.fence_count); + std::vector<u32> fence_thresholds(params.fence_count); // Slice input into their respective buffers std::size_t offset = sizeof(IoctlSubmit); @@ -78,15 +77,13 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u offset += SliceVectors(input, relocs, params.relocation_count, offset); offset += SliceVectors(input, reloc_shifts, params.relocation_count, offset); offset += SliceVectors(input, syncpt_increments, params.syncpoint_count, offset); - offset += SliceVectors(input, wait_checks, params.syncpoint_count, offset); - offset += SliceVectors(input, fences, params.fence_count, offset); + offset += SliceVectors(input, fence_thresholds, params.fence_count, offset); auto& gpu = system.GPU(); if (gpu.UseNvdec()) { for (std::size_t i = 0; i < syncpt_increments.size(); i++) { const SyncptIncr& syncpt_incr = syncpt_increments[i]; - fences[i].id = syncpt_incr.id; - fences[i].value = + fence_thresholds[i] = syncpoint_manager.IncreaseSyncpoint(syncpt_incr.id, syncpt_incr.increments); } } @@ -98,11 +95,6 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u cmdlist.size() * sizeof(u32)); gpu.PushCommandBuffer(cmdlist); } - if (gpu.UseNvdec()) { - fences[0].value = syncpoint_manager.IncreaseSyncpoint(fences[0].id, 1); - Tegra::ChCommandHeaderList cmdlist{{(4 << 28) | fences[0].id}}; - gpu.PushCommandBuffer(cmdlist); - } std::memcpy(output.data(), ¶ms, sizeof(IoctlSubmit)); // Some games expect command_buffers to be written back offset = sizeof(IoctlSubmit); @@ -110,8 +102,7 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u offset += WriteVectors(output, relocs, offset); offset += WriteVectors(output, reloc_shifts, offset); offset += WriteVectors(output, syncpt_increments, offset); - offset += WriteVectors(output, wait_checks, offset); - offset += WriteVectors(output, fences, offset); + offset += WriteVectors(output, fence_thresholds, offset); return NvResult::Success; } diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h index af59f00d2..ae4199b79 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h @@ -56,19 +56,16 @@ protected: s32 target{}; s32 target_offset{}; }; - static_assert(sizeof(Reloc) == 0x10, "CommandBuffer has incorrect size"); + static_assert(sizeof(Reloc) == 0x10, "Reloc has incorrect size"); struct SyncptIncr { u32 id{}; u32 increments{}; + u32 unk0{}; + u32 unk1{}; + u32 unk2{}; }; - static_assert(sizeof(SyncptIncr) == 0x8, "CommandBuffer has incorrect size"); - - struct Fence { - u32 id{}; - u32 value{}; - }; - static_assert(sizeof(Fence) == 0x8, "CommandBuffer has incorrect size"); + static_assert(sizeof(SyncptIncr) == 0x14, "SyncptIncr has incorrect size"); struct IoctlGetSyncpoint { // Input diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index e2a1dde5b..a5af5b785 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h @@ -49,6 +49,8 @@ struct EventInterface { std::array<EventState, MaxNvEvents> status{}; // Tells if an NVEvent is registered or not std::array<bool, MaxNvEvents> registered{}; + // Tells the NVEvent that it has failed. + std::array<bool, MaxNvEvents> failed{}; // When an NVEvent is waiting on GPU interrupt, this is the sync_point // associated with it. std::array<u32, MaxNvEvents> assigned_syncpt{}; diff --git a/src/core/hle/service/time/time_manager.cpp b/src/core/hle/service/time/time_manager.cpp index 4bbc606a1..9c4c960ef 100644 --- a/src/core/hle/service/time/time_manager.cpp +++ b/src/core/hle/service/time/time_manager.cpp @@ -13,18 +13,19 @@ #include "core/hle/service/time/time_manager.h" namespace Service::Time { - +namespace { constexpr Clock::TimeSpanType standard_network_clock_accuracy{0x0009356907420000ULL}; -static std::chrono::seconds GetSecondsSinceEpoch() { - return std::chrono::duration_cast<std::chrono::seconds>( - std::chrono::system_clock::now().time_since_epoch()) + +s64 GetSecondsSinceEpoch() { + const auto time_since_epoch = std::chrono::system_clock::now().time_since_epoch(); + return std::chrono::duration_cast<std::chrono::seconds>(time_since_epoch).count() + Settings::values.custom_rtc_differential; } -static s64 GetExternalRtcValue() { - return GetSecondsSinceEpoch().count() + TimeManager::GetExternalTimeZoneOffset(); +s64 GetExternalRtcValue() { + return GetSecondsSinceEpoch() + TimeManager::GetExternalTimeZoneOffset(); } +} // Anonymous namespace struct TimeManager::Impl final { explicit Impl(Core::System& system) diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index be3d52d54..439e7e472 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -524,7 +524,9 @@ private: Disconnect = 11, AllocateBuffers = 13, - SetPreallocatedBuffer = 14 + SetPreallocatedBuffer = 14, + + GetBufferHistory = 17 }; void TransactParcel(Kernel::HLERequestContext& ctx) { @@ -641,6 +643,14 @@ private: ctx.WriteBuffer(response.Serialize()); break; } + case TransactionId::GetBufferHistory: { + LOG_WARNING(Service_VI, "(STUBBED) called, transaction=GetBufferHistory"); + [[maybe_unused]] const auto buffer = ctx.ReadBuffer(); + + IGBPEmptyResponseParcel response{}; + ctx.WriteBuffer(response.Serialize()); + break; + } default: ASSERT_MSG(false, "Unimplemented"); } |