[TEST] Hunting down recursive mutex 4

This commit is contained in:
CamilleLaVey
2026-07-17 02:32:14 -04:00
parent 933f79af95
commit 84490a7d6f
6 changed files with 8 additions and 10 deletions
@@ -594,7 +594,7 @@ abstract class SettingsItem(
IntSetting.ANDROID_PIPELINE_WORKERS,
titleId = R.string.pipeline_worker_cores,
descriptionId = R.string.pipeline_worker_cores_description,
min = 4,
min = 1,
max = 8,
units = "cores"
)
@@ -147,7 +147,7 @@ namespace AndroidSettings {
&show_performance_overlay};
Settings::Setting<s32> pipeline_worker_count{linkage, 4, "pipeline_worker_count",
Settings::Setting<s32> pipeline_worker_count{linkage, 0, "pipeline_worker_count",
Settings::Category::Android,
Settings::Specialization::Default,
true,
@@ -321,7 +321,7 @@ public:
} while (channel_state->has_deleted_buffers);
}
std::mutex mutex;
std::recursive_mutex mutex;
Runtime& runtime;
bool any_buffer_uploaded = false;
@@ -716,7 +716,7 @@ void RasterizerOpenGL::AccelerateInlineToMemory(GPUVAddr address, size_t copy_si
}
gpu_memory->WriteBlockUnsafe(address, memory.data(), copy_size);
{
std::scoped_lock lock{buffer_cache.mutex};
std::unique_lock<std::recursive_mutex> lock{buffer_cache.mutex};
if (!buffer_cache.InlineMemory(*cpu_addr, copy_size, memory)) {
buffer_cache.WriteMemory(*cpu_addr, copy_size);
}
@@ -305,12 +305,10 @@ size_t GetTotalPipelineWorkers() {
std::max<size_t>(static_cast<size_t>(std::thread::hardware_concurrency()), 2ULL) - 1ULL;
#ifdef __ANDROID__
const int configured = AndroidSettings::values.pipeline_worker_count.GetValue();
const int clamped = std::clamp(configured, 4, 8);
const size_t desired = static_cast<size_t>(clamped);
if (desired == 0) {
return 1ULL;
if (configured <= 0) {
return max_core_threads;
}
return std::min(max_core_threads, desired);
return std::min<size_t>(max_core_threads, static_cast<size_t>(configured));
#else
return max_core_threads;
#endif
@@ -925,7 +925,7 @@ void RasterizerVulkan::AccelerateInlineToMemory(GPUVAddr address, size_t copy_si
}
gpu_memory->WriteBlockUnsafe(address, memory.data(), copy_size);
{
std::scoped_lock lock{buffer_cache.mutex};
std::unique_lock<std::recursive_mutex> lock{buffer_cache.mutex};
if (!buffer_cache.InlineMemory(*cpu_addr, copy_size, memory)) {
buffer_cache.WriteMemory(*cpu_addr, copy_size);
}