diff options
| author | 2019-01-30 11:14:05 -0500 | |
|---|---|---|
| committer | 2019-01-30 11:14:08 -0500 | |
| commit | ba14fb42e4a7695c724bcbf05761a20be500d727 (patch) | |
| tree | 2d1af9a41f10f2002db4f9a01a6c4592dba0b57c /src | |
| parent | service/nvflinger: Rename Get prefix on function to Find (diff) | |
| download | yuzu-ba14fb42e4a7695c724bcbf05761a20be500d727.tar.gz yuzu-ba14fb42e4a7695c724bcbf05761a20be500d727.tar.xz yuzu-ba14fb42e4a7695c724bcbf05761a20be500d727.zip | |
service/nvflinger: Make FindBufferQueueId() a const member function
This member function doesn't actually modify instance state, so it can
be const-qualified.
Diffstat (limited to 'src')
| -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) { | |||
| 73 | return layer_id; | 73 | return layer_id; |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | u32 NVFlinger::FindBufferQueueId(u64 display_id, u64 layer_id) { | 76 | u32 NVFlinger::FindBufferQueueId(u64 display_id, u64 layer_id) const { |
| 77 | const auto& layer = FindLayer(display_id, layer_id); | 77 | const auto& layer = FindLayer(display_id, layer_id); |
| 78 | return layer.buffer_queue->GetId(); | 78 | return layer.buffer_queue->GetId(); |
| 79 | } | 79 | } |
| @@ -98,6 +98,14 @@ Display& NVFlinger::FindDisplay(u64 display_id) { | |||
| 98 | return *itr; | 98 | return *itr; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | const Display& NVFlinger::FindDisplay(u64 display_id) const { | ||
| 102 | const auto itr = std::find_if(displays.begin(), displays.end(), | ||
| 103 | [&](const Display& display) { return display.id == display_id; }); | ||
| 104 | |||
| 105 | ASSERT(itr != displays.end()); | ||
| 106 | return *itr; | ||
| 107 | } | ||
| 108 | |||
| 101 | Layer& NVFlinger::FindLayer(u64 display_id, u64 layer_id) { | 109 | Layer& NVFlinger::FindLayer(u64 display_id, u64 layer_id) { |
| 102 | auto& display = FindDisplay(display_id); | 110 | auto& display = FindDisplay(display_id); |
| 103 | 111 | ||
| @@ -108,6 +116,16 @@ Layer& NVFlinger::FindLayer(u64 display_id, u64 layer_id) { | |||
| 108 | return *itr; | 116 | return *itr; |
| 109 | } | 117 | } |
| 110 | 118 | ||
| 119 | const Layer& NVFlinger::FindLayer(u64 display_id, u64 layer_id) const { | ||
| 120 | const auto& display = FindDisplay(display_id); | ||
| 121 | |||
| 122 | const auto itr = std::find_if(display.layers.begin(), display.layers.end(), | ||
| 123 | [&](const Layer& layer) { return layer.id == layer_id; }); | ||
| 124 | |||
| 125 | ASSERT(itr != display.layers.end()); | ||
| 126 | return *itr; | ||
| 127 | } | ||
| 128 | |||
| 111 | void NVFlinger::Compose() { | 129 | void NVFlinger::Compose() { |
| 112 | for (auto& display : displays) { | 130 | for (auto& display : displays) { |
| 113 | // Trigger vsync for this display at the end of drawing | 131 | // 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: | |||
| 64 | u64 CreateLayer(u64 display_id); | 64 | u64 CreateLayer(u64 display_id); |
| 65 | 65 | ||
| 66 | /// Finds the buffer queue ID of the specified layer in the specified display. | 66 | /// Finds the buffer queue ID of the specified layer in the specified display. |
| 67 | u32 FindBufferQueueId(u64 display_id, u64 layer_id); | 67 | u32 FindBufferQueueId(u64 display_id, u64 layer_id) const; |
| 68 | 68 | ||
| 69 | /// Gets the vsync event for the specified display. | 69 | /// Gets the vsync event for the specified display. |
| 70 | Kernel::SharedPtr<Kernel::ReadableEvent> GetVsyncEvent(u64 display_id); | 70 | Kernel::SharedPtr<Kernel::ReadableEvent> GetVsyncEvent(u64 display_id); |
| @@ -80,9 +80,15 @@ private: | |||
| 80 | /// Finds the display identified by the specified ID. | 80 | /// Finds the display identified by the specified ID. |
| 81 | Display& FindDisplay(u64 display_id); | 81 | Display& FindDisplay(u64 display_id); |
| 82 | 82 | ||
| 83 | /// Finds the display identified by the specified ID. | ||
| 84 | const Display& FindDisplay(u64 display_id) const; | ||
| 85 | |||
| 83 | /// Finds the layer identified by the specified ID in the desired display. | 86 | /// Finds the layer identified by the specified ID in the desired display. |
| 84 | Layer& FindLayer(u64 display_id, u64 layer_id); | 87 | Layer& FindLayer(u64 display_id, u64 layer_id); |
| 85 | 88 | ||
| 89 | /// Finds the layer identified by the specified ID in the desired display. | ||
| 90 | const Layer& FindLayer(u64 display_id, u64 layer_id) const; | ||
| 91 | |||
| 86 | std::shared_ptr<Nvidia::Module> nvdrv; | 92 | std::shared_ptr<Nvidia::Module> nvdrv; |
| 87 | 93 | ||
| 88 | std::array<Display, 5> displays{{ | 94 | std::array<Display, 5> displays{{ |