mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-22 07:58:56 +02:00
[vk, qcom] TimelineSemaphore syncs to GPUTick.
This commit is contained in:
parent
d2253d401c
commit
2ed2a02ce8
4 changed files with 18 additions and 8 deletions
|
|
@ -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-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -318,9 +318,8 @@ size_t GetTotalPipelineWorkers() {
|
||||||
const size_t max_core_threads =
|
const size_t max_core_threads =
|
||||||
std::max<size_t>(static_cast<size_t>(std::thread::hardware_concurrency()), 2ULL) - 1ULL;
|
std::max<size_t>(static_cast<size_t>(std::thread::hardware_concurrency()), 2ULL) - 1ULL;
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
// Leave at least one core free on Android. Previously we reserved two, but
|
// Leave at least two cores free on Android to reduce thermal pressure.
|
||||||
// shipping builds benefit from one extra compilation worker.
|
constexpr size_t free_cores = 2ULL;
|
||||||
constexpr size_t free_cores = 1ULL;
|
|
||||||
if (max_core_threads <= free_cores) {
|
if (max_core_threads <= free_cores) {
|
||||||
return 1ULL;
|
return 1ULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,7 @@ StagingBufferRef StagingBufferPool::GetStreamBuffer(size_t size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StagingBufferPool::AreRegionsActive(size_t region_begin, size_t region_end) const {
|
bool StagingBufferPool::AreRegionsActive(size_t region_begin, size_t region_end) const {
|
||||||
|
scheduler.GetMasterSemaphore().Refresh();
|
||||||
const u64 gpu_tick = scheduler.GetMasterSemaphore().KnownGpuTick();
|
const u64 gpu_tick = scheduler.GetMasterSemaphore().KnownGpuTick();
|
||||||
return std::any_of(sync_ticks.begin() + region_begin, sync_ticks.begin() + region_end,
|
return std::any_of(sync_ticks.begin() + region_begin, sync_ticks.begin() + region_end,
|
||||||
[gpu_tick](u64 sync_tick) { return gpu_tick < sync_tick; });
|
[gpu_tick](u64 sync_tick) { return gpu_tick < sync_tick; });
|
||||||
|
|
|
||||||
|
|
@ -1003,13 +1003,20 @@ bool Device::ShouldBoostClocks() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Device::HasTimelineSemaphore() const {
|
bool Device::HasTimelineSemaphore() const {
|
||||||
if (GetDriverID() == VK_DRIVER_ID_QUALCOMM_PROPRIETARY ||
|
const VkDriverIdKHR driver_id = GetDriverID();
|
||||||
GetDriverID() == VK_DRIVER_ID_MESA_TURNIP) {
|
if (driver_id == 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).
|
|
||||||
return false;
|
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;
|
return features.timeline_semaphore.timelineSemaphore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue