summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/vi
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2024-01-18 00:45:39 +0100
committerLiam <byteslice@airmail.cc>2024-01-18 00:45:39 +0100
commitce895807499ef664f244eb9f435b076484f54d7c (patch)
tree8116615f60e1bac3bccd34a32b3c1c03ff37b237 /src/core/hle/service/vi
parentMerge pull request #12689 from liamwhite/remove-format (diff)
downloadyuzu-ce895807499ef664f244eb9f435b076484f54d7c.tar
yuzu-ce895807499ef664f244eb9f435b076484f54d7c.tar.gz
yuzu-ce895807499ef664f244eb9f435b076484f54d7c.tar.bz2
yuzu-ce895807499ef664f244eb9f435b076484f54d7c.tar.lz
yuzu-ce895807499ef664f244eb9f435b076484f54d7c.tar.xz
yuzu-ce895807499ef664f244eb9f435b076484f54d7c.tar.zst
yuzu-ce895807499ef664f244eb9f435b076484f54d7c.zip
Diffstat (limited to 'src/core/hle/service/vi')
-rw-r--r--src/core/hle/service/vi/display/vi_display.cpp11
-rw-r--r--src/core/hle/service/vi/display/vi_display.h3
2 files changed, 14 insertions, 0 deletions
diff --git a/src/core/hle/service/vi/display/vi_display.cpp b/src/core/hle/service/vi/display/vi_display.cpp
index e2d9cd98a..725311c53 100644
--- a/src/core/hle/service/vi/display/vi_display.cpp
+++ b/src/core/hle/service/vi/display/vi_display.cpp
@@ -91,6 +91,10 @@ void Display::CreateLayer(u64 layer_id, u32 binder_id,
layers.emplace_back(std::make_unique<Layer>(layer_id, binder_id, *core, *producer,
std::move(buffer_item_consumer)));
+ if (is_abandoned) {
+ this->FindLayer(layer_id)->GetConsumer().Abandon();
+ }
+
hos_binder_driver_server.RegisterProducer(std::move(producer));
}
@@ -103,6 +107,13 @@ void Display::DestroyLayer(u64 layer_id) {
[layer_id](const auto& layer) { return layer->GetLayerId() == layer_id; });
}
+void Display::Abandon() {
+ for (auto& layer : layers) {
+ layer->GetConsumer().Abandon();
+ }
+ is_abandoned = true;
+}
+
Layer* Display::FindLayer(u64 layer_id) {
const auto itr =
std::find_if(layers.begin(), layers.end(), [layer_id](const std::unique_ptr<Layer>& layer) {
diff --git a/src/core/hle/service/vi/display/vi_display.h b/src/core/hle/service/vi/display/vi_display.h
index 7e68ee79b..8eb8a5155 100644
--- a/src/core/hle/service/vi/display/vi_display.h
+++ b/src/core/hle/service/vi/display/vi_display.h
@@ -98,6 +98,8 @@ public:
layers.clear();
}
+ void Abandon();
+
/// Attempts to find a layer with the given ID.
///
/// @param layer_id The layer ID.
@@ -124,6 +126,7 @@ private:
std::vector<std::unique_ptr<Layer>> layers;
Kernel::KEvent* vsync_event{};
+ bool is_abandoned{};
};
} // namespace Service::VI