summaryrefslogtreecommitdiffstats
path: root/src/video_core/gpu_thread.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-02-20 16:55:32 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-04-22 17:36:17 +0200
commit1fb516cd979ed0dbf8fa7cb4f6a334932dfb6434 (patch)
tree123d3f3e906e1af35c4bbced2d9029bc93fb4653 /src/video_core/gpu_thread.cpp
parentFenceManager: Manage syncpoints and rename fences to semaphores. (diff)
downloadyuzu-1fb516cd979ed0dbf8fa7cb4f6a334932dfb6434.tar
yuzu-1fb516cd979ed0dbf8fa7cb4f6a334932dfb6434.tar.gz
yuzu-1fb516cd979ed0dbf8fa7cb4f6a334932dfb6434.tar.bz2
yuzu-1fb516cd979ed0dbf8fa7cb4f6a334932dfb6434.tar.lz
yuzu-1fb516cd979ed0dbf8fa7cb4f6a334932dfb6434.tar.xz
yuzu-1fb516cd979ed0dbf8fa7cb4f6a334932dfb6434.tar.zst
yuzu-1fb516cd979ed0dbf8fa7cb4f6a334932dfb6434.zip
Diffstat (limited to 'src/video_core/gpu_thread.cpp')
-rw-r--r--src/video_core/gpu_thread.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp
index 3e2be00e9..9460364a3 100644
--- a/src/video_core/gpu_thread.cpp
+++ b/src/video_core/gpu_thread.cpp
@@ -15,8 +15,9 @@
namespace VideoCommon::GPUThread {
/// Runs the GPU thread
-static void RunThread(VideoCore::RendererBase& renderer, Core::Frontend::GraphicsContext& context,
- Tegra::DmaPusher& dma_pusher, SynchState& state) {
+static void RunThread(Core::System& system, VideoCore::RendererBase& renderer,
+ Core::Frontend::GraphicsContext& context, Tegra::DmaPusher& dma_pusher,
+ SynchState& state) {
MicroProfileOnThreadCreate("GpuThread");
// Wait for first GPU command before acquiring the window context
@@ -40,6 +41,8 @@ static void RunThread(VideoCore::RendererBase& renderer, Core::Frontend::Graphic
renderer.SwapBuffers(data->framebuffer ? &*data->framebuffer : nullptr);
} else if (const auto data = std::get_if<OnCommandListEndCommand>(&next.data)) {
renderer.Rasterizer().ReleaseFences();
+ } else if (const auto data = std::get_if<GPUTickCommand>(&next.data)) {
+ system.GPU().TickWork();
} else if (const auto data = std::get_if<FlushRegionCommand>(&next.data)) {
renderer.Rasterizer().FlushRegion(data->addr, data->size);
} else if (const auto data = std::get_if<InvalidateRegionCommand>(&next.data)) {
@@ -68,8 +71,8 @@ ThreadManager::~ThreadManager() {
void ThreadManager::StartThread(VideoCore::RendererBase& renderer,
Core::Frontend::GraphicsContext& context,
Tegra::DmaPusher& dma_pusher) {
- thread = std::thread{RunThread, std::ref(renderer), std::ref(context), std::ref(dma_pusher),
- std::ref(state)};
+ thread = std::thread{RunThread, std::ref(system), std::ref(renderer),
+ std::ref(context), std::ref(dma_pusher), std::ref(state)};
}
void ThreadManager::SubmitList(Tegra::CommandList&& entries) {
@@ -85,8 +88,10 @@ void ThreadManager::FlushRegion(VAddr addr, u64 size) {
return;
}
if (system.Renderer().Rasterizer().MustFlushRegion(addr, size)) {
- u64 fence = PushCommand(FlushRegionCommand(addr, size));
- while (fence > state.signaled_fence.load(std::memory_order_relaxed)) {
+ auto& gpu = system.GPU();
+ u64 fence = gpu.RequestFlush(addr, size);
+ PushCommand(GPUTickCommand());
+ while (fence > gpu.CurrentFlushRequestFence()) {
}
}
}