summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvnflinger/display.h
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2024-02-19 06:36:53 +0100
committerGitHub <noreply@github.com>2024-02-19 06:36:53 +0100
commit8615509c4054f497fbd6ed9a7adee5a998597905 (patch)
tree293bff8e944c2ca632524e39bbfba33d6475af16 /src/core/hle/service/nvnflinger/display.h
parentMerge pull request #13048 from liamwhite/new-shell (diff)
parentnvnflinger: check for layers before compose (diff)
downloadyuzu-8615509c4054f497fbd6ed9a7adee5a998597905.tar
yuzu-8615509c4054f497fbd6ed9a7adee5a998597905.tar.gz
yuzu-8615509c4054f497fbd6ed9a7adee5a998597905.tar.bz2
yuzu-8615509c4054f497fbd6ed9a7adee5a998597905.tar.lz
yuzu-8615509c4054f497fbd6ed9a7adee5a998597905.tar.xz
yuzu-8615509c4054f497fbd6ed9a7adee5a998597905.tar.zst
yuzu-8615509c4054f497fbd6ed9a7adee5a998597905.zip
Diffstat (limited to 'src/core/hle/service/nvnflinger/display.h')
-rw-r--r--src/core/hle/service/nvnflinger/display.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/core/hle/service/nvnflinger/display.h b/src/core/hle/service/nvnflinger/display.h
new file mode 100644
index 000000000..f27cbf144
--- /dev/null
+++ b/src/core/hle/service/nvnflinger/display.h
@@ -0,0 +1,55 @@
+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <list>
+
+#include "core/hle/service/nvnflinger/buffer_item_consumer.h"
+#include "core/hle/service/nvnflinger/hwc_layer.h"
+
+namespace Service::Nvnflinger {
+
+struct Layer {
+ explicit Layer(std::shared_ptr<android::BufferItemConsumer> buffer_item_consumer_,
+ s32 consumer_id_)
+ : buffer_item_consumer(std::move(buffer_item_consumer_)), consumer_id(consumer_id_),
+ blending(LayerBlending::None), visible(true) {}
+ ~Layer() {
+ buffer_item_consumer->Abandon();
+ }
+
+ std::shared_ptr<android::BufferItemConsumer> buffer_item_consumer;
+ s32 consumer_id;
+ LayerBlending blending;
+ bool visible;
+};
+
+struct LayerStack {
+ std::list<Layer> layers;
+};
+
+struct Display {
+ explicit Display(u64 id_) {
+ id = id_;
+ }
+
+ Layer* FindLayer(s32 consumer_id) {
+ for (auto& layer : stack.layers) {
+ if (layer.consumer_id == consumer_id) {
+ return &layer;
+ }
+ }
+
+ return nullptr;
+ }
+
+ bool HasLayers() {
+ return !stack.layers.empty();
+ }
+
+ u64 id;
+ LayerStack stack;
+};
+
+} // namespace Service::Nvnflinger