[vk, qcom] TimelineSemaphore syncs to GPUTick.
This commit is contained in:
committed by
Caio Oliveira
parent
09b897dbf2
commit
4e6c978574
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
||||
@@ -309,9 +309,8 @@ size_t GetTotalPipelineWorkers() {
|
||||
const size_t max_core_threads =
|
||||
std::max<size_t>(static_cast<size_t>(std::thread::hardware_concurrency()), 2ULL) - 1ULL;
|
||||
#ifdef ANDROID
|
||||
// Leave at least one core free on Android. Previously we reserved two, but
|
||||
// shipping builds benefit from one extra compilation worker.
|
||||
constexpr size_t free_cores = 1ULL;
|
||||
// Leave at least two cores free on Android to reduce thermal pressure.
|
||||
constexpr size_t free_cores = 2ULL;
|
||||
if (max_core_threads <= free_cores) {
|
||||
return 1ULL;
|
||||
}
|
||||
|
||||
@@ -147,6 +147,7 @@ StagingBufferRef StagingBufferPool::GetStreamBuffer(size_t size) {
|
||||
}
|
||||
|
||||
bool StagingBufferPool::AreRegionsActive(size_t region_begin, size_t region_end) const {
|
||||
scheduler.GetMasterSemaphore().Refresh();
|
||||
const u64 gpu_tick = scheduler.GetMasterSemaphore().KnownGpuTick();
|
||||
return std::any_of(sync_ticks.begin() + region_begin, sync_ticks.begin() + region_end,
|
||||
[gpu_tick](u64 sync_tick) { return gpu_tick < sync_tick; });
|
||||
|
||||
@@ -978,13 +978,20 @@ bool Device::ShouldBoostClocks() const {
|
||||
}
|
||||
|
||||
bool Device::HasTimelineSemaphore() const {
|
||||
if (GetDriverID() == VK_DRIVER_ID_QUALCOMM_PROPRIETARY ||
|
||||
GetDriverID() == VK_DRIVER_ID_MESA_TURNIP) {
|
||||
// Timeline semaphores do not work properly on all Qualcomm drivers.
|
||||
// They generally work properly with Turnip drivers, but are problematic on some devices
|
||||
// (e.g. ZTE handsets with Snapdragon 870).
|
||||
const VkDriverIdKHR driver_id = GetDriverID();
|
||||
if (driver_id == VK_DRIVER_ID_MESA_TURNIP) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY) {
|
||||
// Drop the variant bits before comparing to the minimum supported timeline build.
|
||||
const u32 driver_version = (GetDriverVersion() << 3) >> 3;
|
||||
constexpr u32 min_timeline_driver = VK_MAKE_API_VERSION(0, 500, 800, 51);
|
||||
if (driver_version < min_timeline_driver) {
|
||||
// Older Qualcomm stacks still need binary fences for stability.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return features.timeline_semaphore.timelineSemaphore;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user