Browse Source

[vk, qcom] TimelineSemaphore syncs to GPUTick.

eds-true-adreno-fixes
CamilleLaVey 3 weeks ago
committed by Caio Oliveira
parent
commit
4e6c978574
No known key found for this signature in database GPG Key ID: AAAE6C7FD4186B0C
  1. 3
      src/video_core/renderer_opengl/gl_fence_manager.h
  2. 5
      src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
  3. 1
      src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp
  4. 17
      src/video_core/vulkan_common/vulkan_device.cpp

3
src/video_core/renderer_opengl/gl_fence_manager.h

@ -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

5
src/video_core/renderer_vulkan/vk_pipeline_cache.cpp

@ -309,9 +309,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
// 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) { if (max_core_threads <= free_cores) {
return 1ULL; return 1ULL;
} }

1
src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp

@ -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; });

17
src/video_core/vulkan_common/vulkan_device.cpp

@ -978,13 +978,20 @@ bool Device::ShouldBoostClocks() const {
} }
bool Device::HasTimelineSemaphore() 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; 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…
Cancel
Save