summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/vi/display/vi_display.h
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-02-21 16:43:26 +0100
committerLioncash <mathew1800@gmail.com>2019-02-21 18:13:04 +0100
commitfa4dc2cf427ddb464d73d532ba941513828b9b7a (patch)
treede8750cdf516af224c1dae2283e7213e5e088d1d /src/core/hle/service/vi/display/vi_display.h
parentMerge pull request #2125 from ReinUsesLisp/fixup-glstate (diff)
downloadyuzu-fa4dc2cf427ddb464d73d532ba941513828b9b7a.tar
yuzu-fa4dc2cf427ddb464d73d532ba941513828b9b7a.tar.gz
yuzu-fa4dc2cf427ddb464d73d532ba941513828b9b7a.tar.bz2
yuzu-fa4dc2cf427ddb464d73d532ba941513828b9b7a.tar.lz
yuzu-fa4dc2cf427ddb464d73d532ba941513828b9b7a.tar.xz
yuzu-fa4dc2cf427ddb464d73d532ba941513828b9b7a.tar.zst
yuzu-fa4dc2cf427ddb464d73d532ba941513828b9b7a.zip
Diffstat (limited to 'src/core/hle/service/vi/display/vi_display.h')
-rw-r--r--src/core/hle/service/vi/display/vi_display.h72
1 files changed, 71 insertions, 1 deletions
diff --git a/src/core/hle/service/vi/display/vi_display.h b/src/core/hle/service/vi/display/vi_display.h
index df44db306..22b831592 100644
--- a/src/core/hle/service/vi/display/vi_display.h
+++ b/src/core/hle/service/vi/display/vi_display.h
@@ -10,14 +10,84 @@
#include "common/common_types.h"
#include "core/hle/kernel/writable_event.h"
+namespace Service::NVFlinger {
+class BufferQueue;
+}
+
namespace Service::VI {
struct Layer;
-struct Display {
+/// Represents a single display type
+class Display {
+public:
+ /// Constructs a display with a given unique ID and name.
+ ///
+ /// @param id The unique ID for this display.
+ /// @param name The name for this display.
+ ///
Display(u64 id, std::string name);
~Display();
+ Display(const Display&) = delete;
+ Display& operator=(const Display&) = delete;
+
+ Display(Display&&) = default;
+ Display& operator=(Display&&) = default;
+
+ /// Gets the unique ID assigned to this display.
+ u64 GetID() const {
+ return id;
+ }
+
+ /// Gets the name of this display
+ const std::string& GetName() const {
+ return name;
+ }
+
+ /// Whether or not this display has any layers added to it.
+ bool HasLayers() const {
+ return !layers.empty();
+ }
+
+ /// Gets a layer for this display based off an index.
+ Layer& GetLayer(std::size_t index);
+
+ /// Gets a layer for this display based off an index.
+ const Layer& GetLayer(std::size_t index) const;
+
+ /// Gets the readable vsync event.
+ Kernel::SharedPtr<Kernel::ReadableEvent> GetVSyncEvent() const;
+
+ /// Signals the internal vsync event.
+ void SignalVSyncEvent();
+
+ /// Creates and adds a layer to this display with the given ID.
+ ///
+ /// @param id The ID to assign to the created layer.
+ /// @param buffer_queue The buffer queue for the layer instance to use.
+ ///
+ void CreateLayer(u64 id, std::shared_ptr<NVFlinger::BufferQueue> buffer_queue);
+
+ /// Attempts to find a layer with the given ID.
+ ///
+ /// @param id The layer ID.
+ ///
+ /// @returns If found, the Layer instance with the given ID.
+ /// If not found, then nullptr is returned.
+ ///
+ Layer* FindLayer(u64 id);
+
+ /// Attempts to find a layer with the given ID.
+ ///
+ /// @param id The layer ID.
+ ///
+ /// @returns If found, the Layer instance with the given ID.
+ /// If not found, then nullptr is returned.
+ ///
+ const Layer* FindLayer(u64 id) const;
+
+private:
u64 id;
std::string name;