diff options
author | Lioncash <mathew1800@gmail.com> | 2019-01-30 17:14:05 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-01-30 17:14:08 +0100 |
commit | ba14fb42e4a7695c724bcbf05761a20be500d727 (patch) | |
tree | 2d1af9a41f10f2002db4f9a01a6c4592dba0b57c /src/core | |
parent | service/nvflinger: Rename Get prefix on function to Find (diff) | |
download | yuzu-ba14fb42e4a7695c724bcbf05761a20be500d727.tar yuzu-ba14fb42e4a7695c724bcbf05761a20be500d727.tar.gz yuzu-ba14fb42e4a7695c724bcbf05761a20be500d727.tar.bz2 yuzu-ba14fb42e4a7695c724bcbf05761a20be500d727.tar.lz yuzu-ba14fb42e4a7695c724bcbf05761a20be500d727.tar.xz yuzu-ba14fb42e4a7695c724bcbf05761a20be500d727.tar.zst yuzu-ba14fb42e4a7695c724bcbf05761a20be500d727.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.cpp | 20 | ||||
-rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.h | 8 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index 8e2e6b670..8dfc0df03 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -73,7 +73,7 @@ u64 NVFlinger::CreateLayer(u64 display_id) { return layer_id; } -u32 NVFlinger::FindBufferQueueId(u64 display_id, u64 layer_id) { +u32 NVFlinger::FindBufferQueueId(u64 display_id, u64 layer_id) const { const auto& layer = FindLayer(display_id, layer_id); return layer.buffer_queue->GetId(); } @@ -98,6 +98,14 @@ Display& NVFlinger::FindDisplay(u64 display_id) { return *itr; } +const Display& NVFlinger::FindDisplay(u64 display_id) const { + const auto itr = std::find_if(displays.begin(), displays.end(), + [&](const Display& display) { return display.id == display_id; }); + + ASSERT(itr != displays.end()); + return *itr; +} + Layer& NVFlinger::FindLayer(u64 display_id, u64 layer_id) { auto& display = FindDisplay(display_id); @@ -108,6 +116,16 @@ Layer& NVFlinger::FindLayer(u64 display_id, u64 layer_id) { return *itr; } +const Layer& NVFlinger::FindLayer(u64 display_id, u64 layer_id) const { + const auto& display = FindDisplay(display_id); + + const auto itr = std::find_if(display.layers.begin(), display.layers.end(), + [&](const Layer& layer) { return layer.id == layer_id; }); + + ASSERT(itr != display.layers.end()); + return *itr; +} + void NVFlinger::Compose() { for (auto& display : displays) { // Trigger vsync for this display at the end of drawing diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h index 8880d8485..83e974ed3 100644 --- a/src/core/hle/service/nvflinger/nvflinger.h +++ b/src/core/hle/service/nvflinger/nvflinger.h @@ -64,7 +64,7 @@ public: 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); + 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); @@ -80,9 +80,15 @@ private: /// Finds the display identified by the specified ID. Display& FindDisplay(u64 display_id); + /// Finds the display identified by the specified ID. + 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); + /// Finds the layer identified by the specified ID in the desired display. + const Layer& FindLayer(u64 display_id, u64 layer_id) const; + std::shared_ptr<Nvidia::Module> nvdrv; std::array<Display, 5> displays{{ |