From 2cdfbbc07d74548527fbefd738f860ce66f52e34 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 26 Oct 2022 21:35:19 -0400 Subject: nvnflinger: release queued handles immediately on disconnection --- src/core/hle/service/nvflinger/buffer_queue_producer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/core/hle/service/nvflinger/buffer_queue_producer.cpp') diff --git a/src/core/hle/service/nvflinger/buffer_queue_producer.cpp b/src/core/hle/service/nvflinger/buffer_queue_producer.cpp index 77ddbb6ef..41ba44b21 100644 --- a/src/core/hle/service/nvflinger/buffer_queue_producer.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue_producer.cpp @@ -742,6 +742,13 @@ Status BufferQueueProducer::Disconnect(NativeWindowApi api) { return Status::NoError; } + // HACK: We are not Android. Remove handle for items in queue, and clear queue. + // Allows synchronous destruction of nvmap handles. + for (auto& item : core->queue) { + nvmap.FreeHandle(item.graphic_buffer->BufferId(), true); + } + core->queue.clear(); + switch (api) { case NativeWindowApi::Egl: case NativeWindowApi::Cpu: -- cgit v1.2.3