mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-19 04:08:19 -05:00
NVDRV: Further refactors and eliminate old code.
This commit is contained in:
@ -1,29 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "video_core/command_classes/host1x.h"
|
||||
#include "video_core/gpu.h"
|
||||
|
||||
Tegra::Host1x::Host1x(GPU& gpu_) : gpu(gpu_) {}
|
||||
|
||||
Tegra::Host1x::~Host1x() = default;
|
||||
|
||||
void Tegra::Host1x::ProcessMethod(Method method, u32 argument) {
|
||||
switch (method) {
|
||||
case Method::LoadSyncptPayload32:
|
||||
syncpoint_value = argument;
|
||||
break;
|
||||
case Method::WaitSyncpt:
|
||||
case Method::WaitSyncpt32:
|
||||
Execute(argument);
|
||||
break;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Host1x method 0x{:X}", static_cast<u32>(method));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Tegra::Host1x::Execute(u32 data) {
|
||||
gpu.WaitFence(data, syncpoint_value);
|
||||
}
|
@ -14,7 +14,6 @@
|
||||
#include "core/core.h"
|
||||
#include "core/core_timing.h"
|
||||
#include "core/frontend/emu_window.h"
|
||||
#include "core/hardware_interrupt_manager.h"
|
||||
#include "core/hle/service/nvdrv/nvdata.h"
|
||||
#include "core/perf_stats.h"
|
||||
#include "video_core/cdma_pusher.h"
|
||||
@ -36,8 +35,6 @@
|
||||
|
||||
namespace Tegra {
|
||||
|
||||
MICROPROFILE_DEFINE(GPU_wait, "GPU", "Wait for the GPU", MP_RGB(128, 128, 192));
|
||||
|
||||
struct GPU::Impl {
|
||||
explicit Impl(GPU& gpu_, Core::System& system_, bool is_async_, bool use_nvdec_)
|
||||
: gpu{gpu_}, system{system_}, host1x{system.Host1x()}, use_nvdec{use_nvdec_},
|
||||
@ -197,30 +194,6 @@ struct GPU::Impl {
|
||||
return *shader_notify;
|
||||
}
|
||||
|
||||
/// Allows the CPU/NvFlinger to wait on the GPU before presenting a frame.
|
||||
void WaitFence(u32 syncpoint_id, u32 value) {
|
||||
if (syncpoint_id == UINT32_MAX) {
|
||||
return;
|
||||
}
|
||||
MICROPROFILE_SCOPE(GPU_wait);
|
||||
host1x.GetSyncpointManager().WaitHost(syncpoint_id, value);
|
||||
}
|
||||
|
||||
void IncrementSyncPoint(u32 syncpoint_id) {
|
||||
host1x.GetSyncpointManager().IncrementHost(syncpoint_id);
|
||||
}
|
||||
|
||||
[[nodiscard]] u32 GetSyncpointValue(u32 syncpoint_id) const {
|
||||
return host1x.GetSyncpointManager().GetHostSyncpointValue(syncpoint_id);
|
||||
}
|
||||
|
||||
void RegisterSyncptInterrupt(u32 syncpoint_id, u32 value) {
|
||||
auto& syncpoint_manager = host1x.GetSyncpointManager();
|
||||
syncpoint_manager.RegisterHostAction(syncpoint_id, value, [this, syncpoint_id, value]() {
|
||||
TriggerCpuInterrupt(syncpoint_id, value);
|
||||
});
|
||||
}
|
||||
|
||||
[[nodiscard]] u64 GetTicks() const {
|
||||
// This values were reversed engineered by fincs from NVN
|
||||
// The gpu clock is reported in units of 385/625 nanoseconds
|
||||
@ -322,11 +295,6 @@ struct GPU::Impl {
|
||||
gpu_thread.FlushAndInvalidateRegion(addr, size);
|
||||
}
|
||||
|
||||
void TriggerCpuInterrupt(u32 syncpoint_id, u32 value) const {
|
||||
auto& interrupt_manager = system.InterruptManager();
|
||||
interrupt_manager.GPUInterruptSyncpt(syncpoint_id, value);
|
||||
}
|
||||
|
||||
void RequestSwapBuffers(const Tegra::FramebufferConfig* framebuffer,
|
||||
Service::Nvidia::NvFence* fences, size_t num_fences) {
|
||||
size_t current_request_counter{};
|
||||
@ -524,22 +492,6 @@ void GPU::RequestSwapBuffers(const Tegra::FramebufferConfig* framebuffer,
|
||||
impl->RequestSwapBuffers(framebuffer, fences, num_fences);
|
||||
}
|
||||
|
||||
void GPU::WaitFence(u32 syncpoint_id, u32 value) {
|
||||
impl->WaitFence(syncpoint_id, value);
|
||||
}
|
||||
|
||||
void GPU::IncrementSyncPoint(u32 syncpoint_id) {
|
||||
impl->IncrementSyncPoint(syncpoint_id);
|
||||
}
|
||||
|
||||
u32 GPU::GetSyncpointValue(u32 syncpoint_id) const {
|
||||
return impl->GetSyncpointValue(syncpoint_id);
|
||||
}
|
||||
|
||||
void GPU::RegisterSyncptInterrupt(u32 syncpoint_id, u32 value) {
|
||||
impl->RegisterSyncptInterrupt(syncpoint_id, value);
|
||||
}
|
||||
|
||||
u64 GPU::GetTicks() const {
|
||||
return impl->GetTicks();
|
||||
}
|
||||
|
@ -171,15 +171,6 @@ public:
|
||||
/// Returns a const reference to the shader notifier.
|
||||
[[nodiscard]] const VideoCore::ShaderNotify& ShaderNotify() const;
|
||||
|
||||
/// Allows the CPU/NvFlinger to wait on the GPU before presenting a frame.
|
||||
void WaitFence(u32 syncpoint_id, u32 value);
|
||||
|
||||
void IncrementSyncPoint(u32 syncpoint_id);
|
||||
|
||||
[[nodiscard]] u32 GetSyncpointValue(u32 syncpoint_id) const;
|
||||
|
||||
void RegisterSyncptInterrupt(u32 syncpoint_id, u32 value);
|
||||
|
||||
[[nodiscard]] u64 GetTicks() const;
|
||||
|
||||
[[nodiscard]] bool IsAsync() const;
|
||||
|
@ -2,12 +2,15 @@
|
||||
// Licensed under GPLv3 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "common/microprofile.h"
|
||||
#include "video_core/host1x/syncpoint_manager.h"
|
||||
|
||||
namespace Tegra {
|
||||
|
||||
namespace Host1x {
|
||||
|
||||
MICROPROFILE_DEFINE(GPU_wait, "GPU", "Wait for the GPU", MP_RGB(128, 128, 192));
|
||||
|
||||
SyncpointManager::ActionHandle SyncpointManager::RegisterAction(
|
||||
std::atomic<u32>& syncpoint, std::list<RegisteredAction>& action_storage, u32 expected_value,
|
||||
std::function<void(void)>& action) {
|
||||
@ -58,6 +61,7 @@ void SyncpointManager::WaitGuest(u32 syncpoint_id, u32 expected_value) {
|
||||
}
|
||||
|
||||
void SyncpointManager::WaitHost(u32 syncpoint_id, u32 expected_value) {
|
||||
MICROPROFILE_SCOPE(GPU_wait);
|
||||
Wait(syncpoints_host[syncpoint_id], wait_host_cv, expected_value);
|
||||
}
|
||||
|
||||
|
@ -396,10 +396,6 @@ void RasterizerOpenGL::SignalSemaphore(GPUVAddr addr, u32 value) {
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::SignalSyncPoint(u32 value) {
|
||||
if (!gpu.IsAsync()) {
|
||||
gpu.IncrementSyncPoint(value);
|
||||
return;
|
||||
}
|
||||
fence_manager.SignalSyncPoint(value);
|
||||
}
|
||||
|
||||
|
@ -458,10 +458,6 @@ void RasterizerVulkan::SignalSemaphore(GPUVAddr addr, u32 value) {
|
||||
}
|
||||
|
||||
void RasterizerVulkan::SignalSyncPoint(u32 value) {
|
||||
if (!gpu.IsAsync()) {
|
||||
gpu.IncrementSyncPoint(value);
|
||||
return;
|
||||
}
|
||||
fence_manager.SignalSyncPoint(value);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user