Browse Source
[vk] KeepAliveTick in Scheduler
eds-true-adreno-fixes-pre-0.1.0
CamilleLaVey
2 months ago
committed by
Caio Oliveira
No known key found for this signature in database
GPG Key ID: AAAE6C7FD4186B0C
3 changed files with
20 additions and
0 deletions
-
src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
-
src/video_core/renderer_vulkan/vk_scheduler.cpp
-
src/video_core/renderer_vulkan/vk_scheduler.h
|
|
|
@ -715,6 +715,7 @@ GraphicsPipeline* PipelineCache::BuiltPipeline(GraphicsPipeline* pipeline) const |
|
|
|
if (draw_state.index_buffer.count <= 6 || draw_state.vertex_buffer.count <= 6) { |
|
|
|
return pipeline; |
|
|
|
} |
|
|
|
scheduler.KeepAliveTick(); |
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -4,6 +4,7 @@ |
|
|
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
#include <memory>
|
|
|
|
#include <mutex>
|
|
|
|
#include <thread>
|
|
|
|
@ -78,6 +79,14 @@ void Scheduler::WaitWorker() { |
|
|
|
std::scoped_lock el{execution_mutex}; |
|
|
|
} |
|
|
|
|
|
|
|
void Scheduler::KeepAliveTick() { |
|
|
|
const auto now = Clock::now(); |
|
|
|
if (now - last_submission_time < KEEPALIVE_INTERVAL) { |
|
|
|
return; |
|
|
|
} |
|
|
|
Flush(); |
|
|
|
} |
|
|
|
|
|
|
|
void Scheduler::DispatchWork() { |
|
|
|
if (chunk->Empty()) { |
|
|
|
return; |
|
|
|
@ -271,6 +280,7 @@ u64 Scheduler::SubmitExecution(VkSemaphore signal_semaphore, VkSemaphore wait_se |
|
|
|
}); |
|
|
|
chunk->MarkSubmit(); |
|
|
|
DispatchWork(); |
|
|
|
last_submission_time = Clock::now(); |
|
|
|
return signal_value; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -6,6 +6,7 @@ |
|
|
|
|
|
|
|
#pragma once |
|
|
|
|
|
|
|
#include <chrono> |
|
|
|
#include <condition_variable> |
|
|
|
#include <cstddef> |
|
|
|
#include <functional> |
|
|
|
@ -52,6 +53,9 @@ public: |
|
|
|
/// safe to touch worker resources. |
|
|
|
void WaitWorker(); |
|
|
|
|
|
|
|
/// Submits a tiny chunk of work if recent GPU submissions are stale. |
|
|
|
void KeepAliveTick(); |
|
|
|
|
|
|
|
/// Sends currently recorded work to the worker thread. |
|
|
|
void DispatchWork(); |
|
|
|
|
|
|
|
@ -128,6 +132,8 @@ public: |
|
|
|
std::mutex submit_mutex; |
|
|
|
|
|
|
|
private: |
|
|
|
using Clock = std::chrono::steady_clock; |
|
|
|
|
|
|
|
class Command { |
|
|
|
public: |
|
|
|
virtual ~Command() = default; |
|
|
|
@ -250,6 +256,9 @@ private: |
|
|
|
|
|
|
|
State state; |
|
|
|
|
|
|
|
Clock::time_point last_submission_time{Clock::time_point::min()}; |
|
|
|
static constexpr std::chrono::milliseconds KEEPALIVE_INTERVAL{4}; |
|
|
|
|
|
|
|
u32 num_renderpass_images = 0; |
|
|
|
std::array<VkImage, 9> renderpass_images{}; |
|
|
|
std::array<VkImageSubresourceRange, 9> renderpass_image_ranges{}; |
|
|
|
|