early-access version 2372
This commit is contained in:
parent
349ec14ec3
commit
6d636a7410
7 changed files with 40 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 2370.
|
This is the source code for early-access 2372.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -317,6 +317,8 @@ struct System::Impl {
|
||||||
is_powered_on = false;
|
is_powered_on = false;
|
||||||
exit_lock = false;
|
exit_lock = false;
|
||||||
|
|
||||||
|
gpu_core->NotifyShutdown();
|
||||||
|
|
||||||
services.reset();
|
services.reset();
|
||||||
service_manager.reset();
|
service_manager.reset();
|
||||||
cheat_engine.reset();
|
cheat_engine.reset();
|
||||||
|
|
|
@ -186,6 +186,10 @@ u32 BufferQueue::Query(QueryType type) {
|
||||||
case QueryType::NativeWindowWidth:
|
case QueryType::NativeWindowWidth:
|
||||||
case QueryType::NativeWindowHeight:
|
case QueryType::NativeWindowHeight:
|
||||||
break;
|
break;
|
||||||
|
case QueryType::NativeWindowMinUndequeuedBuffers:
|
||||||
|
return 0;
|
||||||
|
case QueryType::NativeWindowConsumerUsageBits:
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
UNIMPLEMENTED_MSG("Unimplemented query type={}", type);
|
UNIMPLEMENTED_MSG("Unimplemented query type={}", type);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -57,6 +57,11 @@ public:
|
||||||
NativeWindowWidth = 0,
|
NativeWindowWidth = 0,
|
||||||
NativeWindowHeight = 1,
|
NativeWindowHeight = 1,
|
||||||
NativeWindowFormat = 2,
|
NativeWindowFormat = 2,
|
||||||
|
/// The minimum number of buffers that must remain un-dequeued after a buffer has been
|
||||||
|
/// queued
|
||||||
|
NativeWindowMinUndequeuedBuffers = 3,
|
||||||
|
/// The consumer gralloc usage bits currently set by the consumer
|
||||||
|
NativeWindowConsumerUsageBits = 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit BufferQueue(Kernel::KernelCore& kernel, u32 id_, u64 layer_id_,
|
explicit BufferQueue(Kernel::KernelCore& kernel, u32 id_, u64 layer_id_,
|
||||||
|
|
|
@ -100,9 +100,6 @@ std::optional<u64> NVFlinger::OpenDisplay(std::string_view name) {
|
||||||
|
|
||||||
LOG_DEBUG(Service, "Opening \"{}\" display", name);
|
LOG_DEBUG(Service, "Opening \"{}\" display", name);
|
||||||
|
|
||||||
// TODO(Subv): Currently we only support the Default display.
|
|
||||||
ASSERT(name == "Default");
|
|
||||||
|
|
||||||
const auto itr =
|
const auto itr =
|
||||||
std::find_if(displays.begin(), displays.end(),
|
std::find_if(displays.begin(), displays.end(),
|
||||||
[&](const VI::Display& display) { return display.GetName() == name; });
|
[&](const VI::Display& display) { return display.GetName() == name; });
|
||||||
|
@ -266,11 +263,10 @@ void NVFlinger::Compose() {
|
||||||
|
|
||||||
auto& gpu = system.GPU();
|
auto& gpu = system.GPU();
|
||||||
const auto& multi_fence = buffer->get().multi_fence;
|
const auto& multi_fence = buffer->get().multi_fence;
|
||||||
const auto stop_token = vsync_thread.get_stop_token();
|
|
||||||
guard->unlock();
|
guard->unlock();
|
||||||
for (u32 fence_id = 0; fence_id < multi_fence.num_fences; fence_id++) {
|
for (u32 fence_id = 0; fence_id < multi_fence.num_fences; fence_id++) {
|
||||||
const auto& fence = multi_fence.fences[fence_id];
|
const auto& fence = multi_fence.fences[fence_id];
|
||||||
gpu.WaitFence(fence.id, fence.value, stop_token);
|
gpu.WaitFence(fence.id, fence.value);
|
||||||
}
|
}
|
||||||
guard->lock();
|
guard->lock();
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include "core/frontend/emu_window.h"
|
#include "core/frontend/emu_window.h"
|
||||||
#include "core/hardware_interrupt_manager.h"
|
#include "core/hardware_interrupt_manager.h"
|
||||||
#include "core/hle/service/nvdrv/nvdata.h"
|
#include "core/hle/service/nvdrv/nvdata.h"
|
||||||
#include "core/hle/service/nvflinger/buffer_queue.h"
|
|
||||||
#include "core/perf_stats.h"
|
#include "core/perf_stats.h"
|
||||||
#include "video_core/cdma_pusher.h"
|
#include "video_core/cdma_pusher.h"
|
||||||
#include "video_core/dma_pusher.h"
|
#include "video_core/dma_pusher.h"
|
||||||
|
@ -206,7 +205,7 @@ struct GPU::Impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Allows the CPU/NvFlinger to wait on the GPU before presenting a frame.
|
/// Allows the CPU/NvFlinger to wait on the GPU before presenting a frame.
|
||||||
void WaitFence(u32 syncpoint_id, u32 value, std::stop_token stop_token = {}) {
|
void WaitFence(u32 syncpoint_id, u32 value) {
|
||||||
// Synced GPU, is always in sync
|
// Synced GPU, is always in sync
|
||||||
if (!is_async) {
|
if (!is_async) {
|
||||||
return;
|
return;
|
||||||
|
@ -218,8 +217,13 @@ struct GPU::Impl {
|
||||||
}
|
}
|
||||||
MICROPROFILE_SCOPE(GPU_wait);
|
MICROPROFILE_SCOPE(GPU_wait);
|
||||||
std::unique_lock lock{sync_mutex};
|
std::unique_lock lock{sync_mutex};
|
||||||
sync_cv.wait(lock, stop_token,
|
sync_cv.wait(lock, [=, this] {
|
||||||
[=, this] { return syncpoints.at(syncpoint_id).load() >= value; });
|
if (shutting_down.load(std::memory_order_relaxed)) {
|
||||||
|
// We're shutting down, ensure no threads continue to wait for the next syncpoint
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return syncpoints.at(syncpoint_id).load() >= value;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void IncrementSyncPoint(u32 syncpoint_id) {
|
void IncrementSyncPoint(u32 syncpoint_id) {
|
||||||
|
@ -307,6 +311,12 @@ struct GPU::Impl {
|
||||||
cpu_context->MakeCurrent();
|
cpu_context->MakeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NotifyShutdown() {
|
||||||
|
std::unique_lock lk{sync_mutex};
|
||||||
|
shutting_down.store(true, std::memory_order::relaxed);
|
||||||
|
sync_cv.notify_all();
|
||||||
|
}
|
||||||
|
|
||||||
/// Obtain the CPU Context
|
/// Obtain the CPU Context
|
||||||
void ObtainContext() {
|
void ObtainContext() {
|
||||||
cpu_context->MakeCurrent();
|
cpu_context->MakeCurrent();
|
||||||
|
@ -665,6 +675,8 @@ struct GPU::Impl {
|
||||||
std::unique_ptr<Engines::KeplerMemory> kepler_memory;
|
std::unique_ptr<Engines::KeplerMemory> kepler_memory;
|
||||||
/// Shader build notifier
|
/// Shader build notifier
|
||||||
std::unique_ptr<VideoCore::ShaderNotify> shader_notify;
|
std::unique_ptr<VideoCore::ShaderNotify> shader_notify;
|
||||||
|
/// When true, we are about to shut down emulation session, so terminate outstanding tasks
|
||||||
|
std::atomic_bool shutting_down{};
|
||||||
|
|
||||||
std::array<std::atomic<u32>, Service::Nvidia::MaxSyncPoints> syncpoints{};
|
std::array<std::atomic<u32>, Service::Nvidia::MaxSyncPoints> syncpoints{};
|
||||||
|
|
||||||
|
@ -673,7 +685,7 @@ struct GPU::Impl {
|
||||||
std::mutex sync_mutex;
|
std::mutex sync_mutex;
|
||||||
std::mutex device_mutex;
|
std::mutex device_mutex;
|
||||||
|
|
||||||
std::condition_variable_any sync_cv;
|
std::condition_variable sync_cv;
|
||||||
|
|
||||||
struct FlushRequest {
|
struct FlushRequest {
|
||||||
explicit FlushRequest(u64 fence_, VAddr addr_, std::size_t size_)
|
explicit FlushRequest(u64 fence_, VAddr addr_, std::size_t size_)
|
||||||
|
@ -812,8 +824,8 @@ const VideoCore::ShaderNotify& GPU::ShaderNotify() const {
|
||||||
return impl->ShaderNotify();
|
return impl->ShaderNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU::WaitFence(u32 syncpoint_id, u32 value, std::stop_token stop_token) {
|
void GPU::WaitFence(u32 syncpoint_id, u32 value) {
|
||||||
impl->WaitFence(syncpoint_id, value, stop_token);
|
impl->WaitFence(syncpoint_id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU::IncrementSyncPoint(u32 syncpoint_id) {
|
void GPU::IncrementSyncPoint(u32 syncpoint_id) {
|
||||||
|
@ -852,6 +864,10 @@ void GPU::Start() {
|
||||||
impl->Start();
|
impl->Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GPU::NotifyShutdown() {
|
||||||
|
impl->NotifyShutdown();
|
||||||
|
}
|
||||||
|
|
||||||
void GPU::ObtainContext() {
|
void GPU::ObtainContext() {
|
||||||
impl->ObtainContext();
|
impl->ObtainContext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stop_token>
|
|
||||||
|
|
||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
@ -210,7 +209,7 @@ public:
|
||||||
[[nodiscard]] const VideoCore::ShaderNotify& ShaderNotify() const;
|
[[nodiscard]] const VideoCore::ShaderNotify& ShaderNotify() const;
|
||||||
|
|
||||||
/// Allows the CPU/NvFlinger to wait on the GPU before presenting a frame.
|
/// Allows the CPU/NvFlinger to wait on the GPU before presenting a frame.
|
||||||
void WaitFence(u32 syncpoint_id, u32 value, std::stop_token stop_token = {});
|
void WaitFence(u32 syncpoint_id, u32 value);
|
||||||
|
|
||||||
void IncrementSyncPoint(u32 syncpoint_id);
|
void IncrementSyncPoint(u32 syncpoint_id);
|
||||||
|
|
||||||
|
@ -233,6 +232,9 @@ public:
|
||||||
/// core timing events.
|
/// core timing events.
|
||||||
void Start();
|
void Start();
|
||||||
|
|
||||||
|
/// Performs any additional necessary steps to shutdown GPU emulation.
|
||||||
|
void NotifyShutdown();
|
||||||
|
|
||||||
/// Obtain the CPU Context
|
/// Obtain the CPU Context
|
||||||
void ObtainContext();
|
void ObtainContext();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue