diff options
| author | 2022-04-18 21:07:21 +0200 | |
|---|---|---|
| committer | 2022-10-06 21:00:53 +0200 | |
| commit | 8d774e7415fac1153d8944baa2cc250cc4831107 (patch) | |
| tree | c28efcc3cc27fc399412783b589f7a1f574304c3 /src | |
| parent | Vulkan Texture Cache: Limit render area to the max width/height of the targets. (diff) | |
| download | yuzu-8d774e7415fac1153d8944baa2cc250cc4831107.tar.gz yuzu-8d774e7415fac1153d8944baa2cc250cc4831107.tar.xz yuzu-8d774e7415fac1153d8944baa2cc250cc4831107.zip | |
NvDec: Fix regressions.
Diffstat (limited to 'src')
6 files changed, 31 insertions, 5 deletions
diff --git a/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp b/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp index b34481b48..fc4ff3c2f 100644 --- a/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp +++ b/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp | |||
| @@ -55,6 +55,12 @@ u32 SyncpointManager::AllocateSyncpoint(bool clientManaged) { | |||
| 55 | return ReserveSyncpoint(FindFreeSyncpoint(), clientManaged); | 55 | return ReserveSyncpoint(FindFreeSyncpoint(), clientManaged); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | void SyncpointManager::FreeSyncpoint(u32 id) { | ||
| 59 | std::lock_guard lock(reservation_lock); | ||
| 60 | ASSERT(syncpoints.at(id).reserved); | ||
| 61 | syncpoints.at(id).reserved = false; | ||
| 62 | } | ||
| 63 | |||
| 58 | bool SyncpointManager::IsSyncpointAllocated(u32 id) { | 64 | bool SyncpointManager::IsSyncpointAllocated(u32 id) { |
| 59 | return (id <= SyncpointCount) && syncpoints[id].reserved; | 65 | return (id <= SyncpointCount) && syncpoints[id].reserved; |
| 60 | } | 66 | } |
diff --git a/src/core/hle/service/nvdrv/core/syncpoint_manager.h b/src/core/hle/service/nvdrv/core/syncpoint_manager.h index bfc8ba84b..da456f206 100644 --- a/src/core/hle/service/nvdrv/core/syncpoint_manager.h +++ b/src/core/hle/service/nvdrv/core/syncpoint_manager.h | |||
| @@ -85,6 +85,11 @@ public: | |||
| 85 | u32 UpdateMin(u32 id); | 85 | u32 UpdateMin(u32 id); |
| 86 | 86 | ||
| 87 | /** | 87 | /** |
| 88 | * @brief Frees the usage of a syncpoint. | ||
| 89 | */ | ||
| 90 | void FreeSyncpoint(u32 id); | ||
| 91 | |||
| 92 | /** | ||
| 88 | * @return A fence that will be signalled once this syncpoint hits its maximum value | 93 | * @return A fence that will be signalled once this syncpoint hits its maximum value |
| 89 | */ | 94 | */ |
| 90 | NvFence GetSyncpointFence(u32 id); | 95 | NvFence GetSyncpointFence(u32 id); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index c2cc09993..908e60191 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | |||
| @@ -43,6 +43,7 @@ nvhost_gpu::~nvhost_gpu() { | |||
| 43 | events_interface.FreeEvent(sm_exception_breakpoint_int_report_event); | 43 | events_interface.FreeEvent(sm_exception_breakpoint_int_report_event); |
| 44 | events_interface.FreeEvent(sm_exception_breakpoint_pause_report_event); | 44 | events_interface.FreeEvent(sm_exception_breakpoint_pause_report_event); |
| 45 | events_interface.FreeEvent(error_notifier_event); | 45 | events_interface.FreeEvent(error_notifier_event); |
| 46 | syncpoint_manager.FreeSyncpoint(channel_syncpoint); | ||
| 46 | } | 47 | } |
| 47 | 48 | ||
| 48 | NvResult nvhost_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 49 | NvResult nvhost_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
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 008092dbb..fe83423d5 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp | |||
| @@ -51,8 +51,12 @@ std::unordered_map<DeviceFD, u32> nvhost_nvdec_common::fd_to_id{}; | |||
| 51 | nvhost_nvdec_common::nvhost_nvdec_common(Core::System& system_, NvCore::Container& core_, | 51 | nvhost_nvdec_common::nvhost_nvdec_common(Core::System& system_, NvCore::Container& core_, |
| 52 | NvCore::ChannelType channel_type_) | 52 | NvCore::ChannelType channel_type_) |
| 53 | : nvdevice{system_}, core{core_}, syncpoint_manager{core.GetSyncpointManager()}, | 53 | : nvdevice{system_}, core{core_}, syncpoint_manager{core.GetSyncpointManager()}, |
| 54 | nvmap{core.GetNvMapFile()}, channel_type{channel_type_} {} | 54 | nvmap{core.GetNvMapFile()}, channel_type{channel_type_} { |
| 55 | nvhost_nvdec_common::~nvhost_nvdec_common() = default; | 55 | channel_syncpoint = syncpoint_manager.AllocateSyncpoint(false); |
| 56 | } | ||
| 57 | nvhost_nvdec_common::~nvhost_nvdec_common() { | ||
| 58 | syncpoint_manager.FreeSyncpoint(channel_syncpoint); | ||
| 59 | } | ||
| 56 | 60 | ||
| 57 | NvResult nvhost_nvdec_common::SetNVMAPfd(const std::vector<u8>& input) { | 61 | NvResult nvhost_nvdec_common::SetNVMAPfd(const std::vector<u8>& input) { |
| 58 | IoctlSetNvmapFD params{}; | 62 | IoctlSetNvmapFD params{}; |
| @@ -117,8 +121,8 @@ NvResult nvhost_nvdec_common::GetSyncpoint(const std::vector<u8>& input, std::ve | |||
| 117 | std::memcpy(¶ms, input.data(), sizeof(IoctlGetSyncpoint)); | 121 | std::memcpy(¶ms, input.data(), sizeof(IoctlGetSyncpoint)); |
| 118 | LOG_DEBUG(Service_NVDRV, "called GetSyncpoint, id={}", params.param); | 122 | LOG_DEBUG(Service_NVDRV, "called GetSyncpoint, id={}", params.param); |
| 119 | 123 | ||
| 120 | const u32 id{NvCore::SyncpointManager::channel_syncpoints[static_cast<u32>(channel_type)]}; | 124 | // const u32 id{NvCore::SyncpointManager::channel_syncpoints[static_cast<u32>(channel_type)]}; |
| 121 | params.value = id; | 125 | params.value = channel_syncpoint; |
| 122 | std::memcpy(output.data(), ¶ms, sizeof(IoctlGetSyncpoint)); | 126 | std::memcpy(output.data(), ¶ms, sizeof(IoctlGetSyncpoint)); |
| 123 | 127 | ||
| 124 | return NvResult::Success; | 128 | return NvResult::Success; |
| @@ -176,4 +180,8 @@ Kernel::KEvent* nvhost_nvdec_common::QueryEvent(u32 event_id) { | |||
| 176 | return nullptr; | 180 | return nullptr; |
| 177 | } | 181 | } |
| 178 | 182 | ||
| 183 | void nvhost_nvdec_common::Reset() { | ||
| 184 | fd_to_id.clear(); | ||
| 185 | } | ||
| 186 | |||
| 179 | } // namespace Service::Nvidia::Devices | 187 | } // namespace Service::Nvidia::Devices |
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 51bb7c2cb..4046b0e13 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h | |||
| @@ -24,6 +24,8 @@ public: | |||
| 24 | NvCore::ChannelType channel_type); | 24 | NvCore::ChannelType channel_type); |
| 25 | ~nvhost_nvdec_common() override; | 25 | ~nvhost_nvdec_common() override; |
| 26 | 26 | ||
| 27 | static void Reset(); | ||
| 28 | |||
| 27 | protected: | 29 | protected: |
| 28 | struct IoctlSetNvmapFD { | 30 | struct IoctlSetNvmapFD { |
| 29 | s32_le nvmap_fd{}; | 31 | s32_le nvmap_fd{}; |
| @@ -117,6 +119,7 @@ protected: | |||
| 117 | Kernel::KEvent* QueryEvent(u32 event_id) override; | 119 | Kernel::KEvent* QueryEvent(u32 event_id) override; |
| 118 | 120 | ||
| 119 | static std::unordered_map<DeviceFD, u32> fd_to_id; | 121 | static std::unordered_map<DeviceFD, u32> fd_to_id; |
| 122 | u32 channel_syncpoint; | ||
| 120 | s32_le nvmap_fd{}; | 123 | s32_le nvmap_fd{}; |
| 121 | u32_le submit_timeout{}; | 124 | u32_le submit_timeout{}; |
| 122 | NvCore::Container& core; | 125 | NvCore::Container& core; |
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index 1be51e401..20bf24ec8 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include "core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h" | 18 | #include "core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h" |
| 19 | #include "core/hle/service/nvdrv/devices/nvhost_gpu.h" | 19 | #include "core/hle/service/nvdrv/devices/nvhost_gpu.h" |
| 20 | #include "core/hle/service/nvdrv/devices/nvhost_nvdec.h" | 20 | #include "core/hle/service/nvdrv/devices/nvhost_nvdec.h" |
| 21 | #include "core/hle/service/nvdrv/devices/nvhost_nvdec_common.h" | ||
| 21 | #include "core/hle/service/nvdrv/devices/nvhost_nvjpg.h" | 22 | #include "core/hle/service/nvdrv/devices/nvhost_nvjpg.h" |
| 22 | #include "core/hle/service/nvdrv/devices/nvhost_vic.h" | 23 | #include "core/hle/service/nvdrv/devices/nvhost_vic.h" |
| 23 | #include "core/hle/service/nvdrv/devices/nvmap.h" | 24 | #include "core/hle/service/nvdrv/devices/nvmap.h" |
| @@ -101,7 +102,9 @@ Module::Module(Core::System& system) | |||
| 101 | }; | 102 | }; |
| 102 | } | 103 | } |
| 103 | 104 | ||
| 104 | Module::~Module() = default; | 105 | Module::~Module() { |
| 106 | Devices::nvhost_nvdec_common::Reset(); | ||
| 107 | } | ||
| 105 | 108 | ||
| 106 | NvResult Module::VerifyFD(DeviceFD fd) const { | 109 | NvResult Module::VerifyFD(DeviceFD fd) const { |
| 107 | if (fd < 0) { | 110 | if (fd < 0) { |