NVDRV: Further refactors and eliminate old code.

This commit is contained in:
Fernando Sahmkow
2022-01-30 23:13:46 +01:00
parent 2931101e6f
commit 920429fde7
18 changed files with 12 additions and 242 deletions

View File

@@ -77,12 +77,9 @@ NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>&
return NvResult::NotImplemented;
}
void nvhost_ctrl::OnOpen(DeviceFD fd) {
events_interface.RegisterForSignal(this);
}
void nvhost_ctrl::OnClose(DeviceFD fd) {
events_interface.UnregisterForSignal(this);
}
void nvhost_ctrl::OnOpen(DeviceFD fd) {}
void nvhost_ctrl::OnClose(DeviceFD fd) {}
NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) {
IocGetConfigParams params{};
@@ -395,21 +392,4 @@ u32 nvhost_ctrl::FindFreeNvEvent(u32 syncpoint_id) {
return 0;
}
void nvhost_ctrl::SignalNvEvent(u32 syncpoint_id, u32 value) {
u64 signal_mask = events_mask;
while (signal_mask != 0) {
const u64 event_id = std::countr_zero(signal_mask);
signal_mask &= ~(1ULL << event_id);
auto& event = events[event_id];
if (event.assigned_syncpt != syncpoint_id || event.assigned_value != value) {
continue;
}
if (event.status.exchange(EventState::Signalling, std::memory_order_acq_rel) ==
EventState::Waiting) {
event.kevent->GetWritableEvent().Signal();
}
event.status.store(EventState::Signalled, std::memory_order_release);
}
}
} // namespace Service::Nvidia::Devices

View File

@@ -56,8 +56,6 @@ public:
};
static_assert(sizeof(SyncpointEventValue) == sizeof(u32));
void SignalNvEvent(u32 syncpoint_id, u32 value);
private:
struct InternalEvent {
// Mask representing registered events

View File

@@ -14,6 +14,7 @@
#include "video_core/control/channel_state.h"
#include "video_core/engines/puller.h"
#include "video_core/gpu.h"
#include "video_core/host1x/host1x.h"
namespace Service::Nvidia::Devices {
namespace {
@@ -31,7 +32,8 @@ nvhost_gpu::nvhost_gpu(Core::System& system_, EventInterface& events_interface_,
syncpoint_manager{core_.GetSyncpointManager()}, nvmap{core.GetNvMapFile()},
channel_state{system.GPU().AllocateChannel()} {
channel_fence.id = syncpoint_manager.AllocateSyncpoint();
channel_fence.value = system_.GPU().GetSyncpointValue(channel_fence.id);
channel_fence.value =
system_.Host1x().GetSyncpointManager().GetGuestSyncpointValue(channel_fence.id);
sm_exception_breakpoint_int_report_event =
events_interface.CreateEvent("GpuChannelSMExceptionBreakpointInt");
sm_exception_breakpoint_pause_report_event =
@@ -189,7 +191,8 @@ NvResult nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8
}
system.GPU().InitChannel(*channel_state);
channel_fence.value = system.GPU().GetSyncpointValue(channel_fence.id);
channel_fence.value =
system.Host1x().GetSyncpointManager().GetGuestSyncpointValue(channel_fence.id);
params.fence_out = channel_fence;