summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvnflinger/buffer_queue_consumer.cpp
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-11-18 02:41:23 +0100
committerGitHub <noreply@github.com>2023-11-18 02:41:23 +0100
commit6c64d5aff29c004fbc6c7fd4657e8868144d5283 (patch)
tree5c283caec0d5f680b8d609b1375259a5ae5a5a3d /src/core/hle/service/nvnflinger/buffer_queue_consumer.cpp
parentMerge pull request #12055 from german77/activate (diff)
parentnvnflinger: implement consumer abandonment (diff)
downloadyuzu-6c64d5aff29c004fbc6c7fd4657e8868144d5283.tar
yuzu-6c64d5aff29c004fbc6c7fd4657e8868144d5283.tar.gz
yuzu-6c64d5aff29c004fbc6c7fd4657e8868144d5283.tar.bz2
yuzu-6c64d5aff29c004fbc6c7fd4657e8868144d5283.tar.lz
yuzu-6c64d5aff29c004fbc6c7fd4657e8868144d5283.tar.xz
yuzu-6c64d5aff29c004fbc6c7fd4657e8868144d5283.tar.zst
yuzu-6c64d5aff29c004fbc6c7fd4657e8868144d5283.zip
Diffstat (limited to 'src/core/hle/service/nvnflinger/buffer_queue_consumer.cpp')
-rw-r--r--src/core/hle/service/nvnflinger/buffer_queue_consumer.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/hle/service/nvnflinger/buffer_queue_consumer.cpp b/src/core/hle/service/nvnflinger/buffer_queue_consumer.cpp
index 51291539d..215c1ea80 100644
--- a/src/core/hle/service/nvnflinger/buffer_queue_consumer.cpp
+++ b/src/core/hle/service/nvnflinger/buffer_queue_consumer.cpp
@@ -175,6 +175,25 @@ Status BufferQueueConsumer::Connect(std::shared_ptr<IConsumerListener> consumer_
return Status::NoError;
}
+Status BufferQueueConsumer::Disconnect() {
+ LOG_DEBUG(Service_Nvnflinger, "called");
+
+ std::scoped_lock lock{core->mutex};
+
+ if (core->consumer_listener == nullptr) {
+ LOG_ERROR(Service_Nvnflinger, "no consumer is connected");
+ return Status::BadValue;
+ }
+
+ core->is_abandoned = true;
+ core->consumer_listener = nullptr;
+ core->queue.clear();
+ core->FreeAllBuffersLocked();
+ core->SignalDequeueCondition();
+
+ return Status::NoError;
+}
+
Status BufferQueueConsumer::GetReleasedBuffers(u64* out_slot_mask) {
if (out_slot_mask == nullptr) {
LOG_ERROR(Service_Nvnflinger, "out_slot_mask may not be nullptr");