Browse Source
Merge pull request #2592 from FernandoS27/sync1
Merge pull request #2592 from FernandoS27/sync1
Implement GPU Synchronization Mechanisms & Correct NVFlingernce_cpp
committed by
GitHub
44 changed files with 732 additions and 229 deletions
-
3src/core/CMakeLists.txt
-
12src/core/core.cpp
-
10src/core/core.h
-
30src/core/hardware_interrupt_manager.cpp
-
31src/core/hardware_interrupt_manager.h
-
13src/core/hle/service/nvdrv/devices/nvdevice.h
-
11src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
-
5src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
-
15src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
-
5src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
-
152src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
-
15src/core/hle/service/nvdrv/devices/nvhost_ctrl.h
-
7src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp
-
5src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h
-
44src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
-
41src/core/hle/service/nvdrv/devices/nvhost_gpu.h
-
5src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
-
5src/core/hle/service/nvdrv/devices/nvhost_nvdec.h
-
5src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp
-
5src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h
-
5src/core/hle/service/nvdrv/devices/nvhost_vic.cpp
-
5src/core/hle/service/nvdrv/devices/nvhost_vic.h
-
5src/core/hle/service/nvdrv/devices/nvmap.cpp
-
5src/core/hle/service/nvdrv/devices/nvmap.h
-
48src/core/hle/service/nvdrv/interface.cpp
-
4src/core/hle/service/nvdrv/interface.h
-
48src/core/hle/service/nvdrv/nvdata.h
-
59src/core/hle/service/nvdrv/nvdrv.cpp
-
88src/core/hle/service/nvdrv/nvdrv.h
-
23src/core/hle/service/nvflinger/buffer_queue.cpp
-
11src/core/hle/service/nvflinger/buffer_queue.h
-
23src/core/hle/service/nvflinger/nvflinger.cpp
-
4src/core/hle/service/nvflinger/nvflinger.h
-
2src/core/hle/service/service.cpp
-
48src/core/hle/service/vi/vi.cpp
-
5src/video_core/engines/maxwell_3d.cpp
-
48src/video_core/gpu.cpp
-
34src/video_core/gpu.h
-
9src/video_core/gpu_asynch.cpp
-
3src/video_core/gpu_asynch.h
-
2src/video_core/gpu_synch.cpp
-
4src/video_core/gpu_synch.h
-
27src/video_core/gpu_thread.cpp
-
32src/video_core/gpu_thread.h
@ -0,0 +1,30 @@ |
|||
// Copyright 2019 Yuzu Emulator Project
|
|||
// Licensed under GPLv2 or any later version
|
|||
// Refer to the license.txt file included.
|
|||
|
|||
#include "core/core.h"
|
|||
#include "core/core_timing.h"
|
|||
#include "core/hardware_interrupt_manager.h"
|
|||
#include "core/hle/service/nvdrv/interface.h"
|
|||
#include "core/hle/service/sm/sm.h"
|
|||
|
|||
namespace Core::Hardware { |
|||
|
|||
InterruptManager::InterruptManager(Core::System& system_in) : system(system_in) { |
|||
gpu_interrupt_event = |
|||
system.CoreTiming().RegisterEvent("GPUInterrupt", [this](u64 message, s64) { |
|||
auto nvdrv = system.ServiceManager().GetService<Service::Nvidia::NVDRV>("nvdrv"); |
|||
const u32 syncpt = static_cast<u32>(message >> 32); |
|||
const u32 value = static_cast<u32>(message); |
|||
nvdrv->SignalGPUInterruptSyncpt(syncpt, value); |
|||
}); |
|||
} |
|||
|
|||
InterruptManager::~InterruptManager() = default; |
|||
|
|||
void InterruptManager::GPUInterruptSyncpt(const u32 syncpoint_id, const u32 value) { |
|||
const u64 msg = (static_cast<u64>(syncpoint_id) << 32ULL) | value; |
|||
system.CoreTiming().ScheduleEvent(10, gpu_interrupt_event, msg); |
|||
} |
|||
|
|||
} // namespace Core::Hardware
|
|||
@ -0,0 +1,31 @@ |
|||
// Copyright 2019 Yuzu Emulator Project |
|||
// Licensed under GPLv2 or any later version |
|||
// Refer to the license.txt file included. |
|||
|
|||
#pragma once |
|||
|
|||
#include "common/common_types.h" |
|||
|
|||
namespace Core { |
|||
class System; |
|||
} |
|||
|
|||
namespace Core::Timing { |
|||
struct EventType; |
|||
} |
|||
|
|||
namespace Core::Hardware { |
|||
|
|||
class InterruptManager { |
|||
public: |
|||
explicit InterruptManager(Core::System& system); |
|||
~InterruptManager(); |
|||
|
|||
void GPUInterruptSyncpt(u32 syncpoint_id, u32 value); |
|||
|
|||
private: |
|||
Core::System& system; |
|||
Core::Timing::EventType* gpu_interrupt_event{}; |
|||
}; |
|||
|
|||
} // namespace Core::Hardware |
|||
@ -0,0 +1,48 @@ |
|||
#pragma once |
|||
|
|||
#include <array> |
|||
#include "common/common_types.h" |
|||
|
|||
namespace Service::Nvidia { |
|||
|
|||
constexpr u32 MaxSyncPoints = 192; |
|||
constexpr u32 MaxNvEvents = 64; |
|||
|
|||
struct Fence { |
|||
s32 id; |
|||
u32 value; |
|||
}; |
|||
|
|||
static_assert(sizeof(Fence) == 8, "Fence has wrong size"); |
|||
|
|||
struct MultiFence { |
|||
u32 num_fences; |
|||
std::array<Fence, 4> fences; |
|||
}; |
|||
|
|||
enum NvResult : u32 { |
|||
Success = 0, |
|||
BadParameter = 4, |
|||
Timeout = 5, |
|||
ResourceError = 15, |
|||
}; |
|||
|
|||
enum class EventState { |
|||
Free = 0, |
|||
Registered = 1, |
|||
Waiting = 2, |
|||
Busy = 3, |
|||
}; |
|||
|
|||
struct IoctlCtrl { |
|||
// First call done to the servioce for services that call itself again after a call. |
|||
bool fresh_call{true}; |
|||
// Tells the Ioctl Wrapper that it must delay the IPC response and send the thread to sleep |
|||
bool must_delay{}; |
|||
// Timeout for the delay |
|||
s64 timeout{}; |
|||
// NV Event Id |
|||
s32 event_id{-1}; |
|||
}; |
|||
|
|||
} // namespace Service::Nvidia |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue