yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

NvHostChannels: improve hack for supporting multiple channels.

This commit is contained in:
Fernando Sahmkow 2022-07-01 02:18:33 +02:00
parent c2b7de66b3
commit d97d409647
2 changed files with 11 additions and 2 deletions

View File

@ -47,15 +47,21 @@ std::size_t WriteVectors(std::vector<u8>& dst, const std::vector<T>& src, std::s
} // Anonymous namespace } // Anonymous namespace
std::unordered_map<DeviceFD, u32> nvhost_nvdec_common::fd_to_id{}; std::unordered_map<DeviceFD, u32> nvhost_nvdec_common::fd_to_id{};
std::deque<u32> nvhost_nvdec_common::syncpts_accumulated{};
nvhost_nvdec_common::nvhost_nvdec_common(Core::System& system_, NvCore::Container& core_, nvhost_nvdec_common::nvhost_nvdec_common(Core::System& system_, NvCore::Container& core_,
NvCore::ChannelType channel_type_) NvCore::ChannelType channel_type_)
: nvdevice{system_}, core{core_}, syncpoint_manager{core.GetSyncpointManager()}, : nvdevice{system_}, core{core_}, syncpoint_manager{core.GetSyncpointManager()},
nvmap{core.GetNvMapFile()}, channel_type{channel_type_} { nvmap{core.GetNvMapFile()}, channel_type{channel_type_} {
if (syncpts_accumulated.empty()) {
channel_syncpoint = syncpoint_manager.AllocateSyncpoint(false); channel_syncpoint = syncpoint_manager.AllocateSyncpoint(false);
} else {
channel_syncpoint = syncpts_accumulated.front();
syncpts_accumulated.pop_front();
}
} }
nvhost_nvdec_common::~nvhost_nvdec_common() { nvhost_nvdec_common::~nvhost_nvdec_common() {
syncpoint_manager.FreeSyncpoint(channel_syncpoint); syncpts_accumulated.push_back(channel_syncpoint);
} }
NvResult nvhost_nvdec_common::SetNVMAPfd(const std::vector<u8>& input) { NvResult nvhost_nvdec_common::SetNVMAPfd(const std::vector<u8>& input) {

View File

@ -3,6 +3,7 @@
#pragma once #pragma once
#include <deque>
#include <vector> #include <vector>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/swap.h" #include "common/swap.h"
@ -127,6 +128,8 @@ protected:
NvCore::NvMap& nvmap; NvCore::NvMap& nvmap;
NvCore::ChannelType channel_type; NvCore::ChannelType channel_type;
std::array<u32, MaxSyncPoints> device_syncpoints{}; std::array<u32, MaxSyncPoints> device_syncpoints{};
static std::deque<u32> syncpts_accumulated;
}; };
}; // namespace Devices }; // namespace Devices
} // namespace Service::Nvidia } // namespace Service::Nvidia