summaryrefslogtreecommitdiffstats
path: root/src/video_core/gpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/video_core/gpu.cpp35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index c6d54be63..db385076d 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -14,6 +14,7 @@
#include "core/core.h"
#include "core/core_timing.h"
#include "core/frontend/emu_window.h"
+#include "core/frontend/graphics_context.h"
#include "core/hle/service/nvdrv/nvdata.h"
#include "core/perf_stats.h"
#include "video_core/cdma_pusher.h"
@@ -99,7 +100,7 @@ struct GPU::Impl {
/// Signal the ending of command list.
void OnCommandListEnd() {
- gpu_thread.OnCommandListEnd();
+ rasterizer->ReleaseFences();
}
/// Request a host GPU memory flush from the CPU.
@@ -192,18 +193,13 @@ struct GPU::Impl {
}
[[nodiscard]] u64 GetTicks() const {
- // This values were reversed engineered by fincs from NVN
- // The gpu clock is reported in units of 385/625 nanoseconds
- constexpr u64 gpu_ticks_num = 384;
- constexpr u64 gpu_ticks_den = 625;
+ u64 gpu_tick = system.CoreTiming().GetGPUTicks();
- u64 nanoseconds = system.CoreTiming().GetGlobalTimeNs().count();
if (Settings::values.use_fast_gpu_time.GetValue()) {
- nanoseconds /= 256;
+ gpu_tick /= 256;
}
- const u64 nanoseconds_num = nanoseconds / gpu_ticks_den;
- const u64 nanoseconds_rem = nanoseconds % gpu_ticks_den;
- return nanoseconds_num * gpu_ticks_num + (nanoseconds_rem * gpu_ticks_num) / gpu_ticks_den;
+
+ return gpu_tick;
}
[[nodiscard]] bool IsAsync() const {
@@ -283,6 +279,21 @@ struct GPU::Impl {
gpu_thread.FlushRegion(addr, size);
}
+ VideoCore::RasterizerDownloadArea OnCPURead(VAddr addr, u64 size) {
+ auto raster_area = rasterizer->GetFlushArea(addr, size);
+ if (raster_area.preemtive) {
+ return raster_area;
+ }
+ raster_area.preemtive = true;
+ const u64 fence = RequestSyncOperation([this, &raster_area]() {
+ rasterizer->FlushRegion(raster_area.start_address,
+ raster_area.end_address - raster_area.start_address);
+ });
+ gpu_thread.TickGPU();
+ WaitForSyncOperation(fence);
+ return raster_area;
+ }
+
/// Notify rasterizer that any caches of the specified region should be invalidated
void InvalidateRegion(VAddr addr, u64 size) {
gpu_thread.InvalidateRegion(addr, size);
@@ -538,6 +549,10 @@ void GPU::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
impl->SwapBuffers(framebuffer);
}
+VideoCore::RasterizerDownloadArea GPU::OnCPURead(VAddr addr, u64 size) {
+ return impl->OnCPURead(addr, size);
+}
+
void GPU::FlushRegion(VAddr addr, u64 size) {
impl->FlushRegion(addr, size);
}