From a2b0b7e80165e576be1f4ddec4e76345823385c1 Mon Sep 17 00:00:00 2001 From: Maufeat Date: Fri, 25 Jul 2025 01:52:43 +0200 Subject: [PATCH] handle better disconnect --- .../service/nvnflinger/buffer_queue_producer.cpp | 14 ++++++++++++-- .../hle/service/nvnflinger/hos_binder_driver.cpp | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp b/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp index 4317aee1c4..467e4cad60 100644 --- a/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp +++ b/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp @@ -744,6 +744,17 @@ Status BufferQueueProducer::Disconnect(NativeWindowApi api) { return Status::NoError; } + if (core->connected_api == NativeWindowApi::NoConnectedApi) { + LOG_DEBUG(Service_Nvnflinger, "already disconnected (req = {})", api); + return Status::NoError; + } + + if (core->connected_api != api) { + LOG_WARNING(Service_Nvnflinger, + "Disconnect api mismatch (cur = {} req = {}) — forcing disconnect", + core->connected_api, api); + } + switch (api) { case NativeWindowApi::Egl: case NativeWindowApi::Cpu: @@ -770,8 +781,7 @@ Status BufferQueueProducer::Disconnect(NativeWindowApi api) { } } - // Call back without lock held - if (listener != nullptr) { + if (listener) { listener->OnBuffersReleased(); } diff --git a/src/core/hle/service/nvnflinger/hos_binder_driver.cpp b/src/core/hle/service/nvnflinger/hos_binder_driver.cpp index 8ef5d02c2e..d30aa3717d 100644 --- a/src/core/hle/service/nvnflinger/hos_binder_driver.cpp +++ b/src/core/hle/service/nvnflinger/hos_binder_driver.cpp @@ -40,7 +40,7 @@ Result IHOSBinderDriver::TransactParcel(s32 binder_id, u32 transaction_id, } Result IHOSBinderDriver::AdjustRefcount(s32 binder_id, s32 addval, s32 type) { - LOG_WARNING(Service_VI, "(STUBBED) called id={}, addval={}, type={}", binder_id, addval, type); + LOG_DEBUG(Service_VI, "called id={}, addval={}, type={}", binder_id, addval, type); R_UNLESS(type == 0 || type == 1, ResultUnknown); m_server->AdjustRefcount(binder_id, addval, type == 1); R_SUCCEED();