diff options
| author | bunnei <bunneidev@gmail.com> | 2019-02-06 12:33:13 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-06 12:33:13 -0500 |
| commit | 40cd299f01d7c77b98ceaad2867aafacca42131d (patch) | |
| tree | 7aceb397364134a44d44875ce79503c4b0993622 /src/core/hle/service/nvflinger/nvflinger.h | |
| parent | 67c1f312517ae29b8e833216b3bda070e59a90ca (diff) | |
| parent | ef073ff117752274f374443756652fdda9c44773 (diff) | |
Merge pull request #2087 from lioncash/const
service/nvflinger, service/vi: Improve error case handling
Diffstat (limited to 'src/core/hle/service/nvflinger/nvflinger.h')
| -rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h index 83e974ed3..4c55e99f4 100644 --- a/src/core/hle/service/nvflinger/nvflinger.h +++ b/src/core/hle/service/nvflinger/nvflinger.h @@ -6,6 +6,7 @@ #include <array> #include <memory> +#include <optional> #include <string> #include <string_view> #include <vector> @@ -58,16 +59,24 @@ public: void SetNVDrvInstance(std::shared_ptr<Nvidia::Module> instance); /// Opens the specified display and returns the ID. - u64 OpenDisplay(std::string_view name); + /// + /// If an invalid display name is provided, then an empty optional is returned. + std::optional<u64> OpenDisplay(std::string_view name); /// Creates a layer on the specified display and returns the layer ID. - u64 CreateLayer(u64 display_id); + /// + /// If an invalid display ID is specified, then an empty optional is returned. + std::optional<u64> CreateLayer(u64 display_id); /// Finds the buffer queue ID of the specified layer in the specified display. - u32 FindBufferQueueId(u64 display_id, u64 layer_id) const; + /// + /// If an invalid display ID or layer ID is provided, then an empty optional is returned. + std::optional<u32> FindBufferQueueId(u64 display_id, u64 layer_id) const; /// Gets the vsync event for the specified display. - Kernel::SharedPtr<Kernel::ReadableEvent> GetVsyncEvent(u64 display_id); + /// + /// If an invalid display ID is provided, then nullptr is returned. + Kernel::SharedPtr<Kernel::ReadableEvent> FindVsyncEvent(u64 display_id) const; /// Obtains a buffer queue identified by the ID. std::shared_ptr<BufferQueue> FindBufferQueue(u32 id) const; @@ -78,16 +87,16 @@ public: private: /// Finds the display identified by the specified ID. - Display& FindDisplay(u64 display_id); + Display* FindDisplay(u64 display_id); /// Finds the display identified by the specified ID. - const Display& FindDisplay(u64 display_id) const; + const Display* FindDisplay(u64 display_id) const; /// Finds the layer identified by the specified ID in the desired display. - Layer& FindLayer(u64 display_id, u64 layer_id); + Layer* FindLayer(u64 display_id, u64 layer_id); /// Finds the layer identified by the specified ID in the desired display. - const Layer& FindLayer(u64 display_id, u64 layer_id) const; + const Layer* FindLayer(u64 display_id, u64 layer_id) const; std::shared_ptr<Nvidia::Module> nvdrv; |
