nvflinger: Mark locals const where applicable

Makes non-mutable state more explicit.
This commit is contained in:
Lioncash 2019-01-29 14:52:14 -05:00
parent f45c25aaba
commit d9f9bb7552

View File

@ -54,8 +54,8 @@ u64 NVFlinger::OpenDisplay(std::string_view name) {
// TODO(Subv): Currently we only support the Default display. // TODO(Subv): Currently we only support the Default display.
ASSERT(name == "Default"); ASSERT(name == "Default");
auto itr = std::find_if(displays.begin(), displays.end(), const auto itr = std::find_if(displays.begin(), displays.end(),
[&](const Display& display) { return display.name == name; }); [&](const Display& display) { return display.name == name; });
ASSERT(itr != displays.end()); ASSERT(itr != displays.end());
@ -67,8 +67,8 @@ u64 NVFlinger::CreateLayer(u64 display_id) {
ASSERT_MSG(display.layers.empty(), "Only one layer is supported per display at the moment"); ASSERT_MSG(display.layers.empty(), "Only one layer is supported per display at the moment");
u64 layer_id = next_layer_id++; const u64 layer_id = next_layer_id++;
u32 buffer_queue_id = next_buffer_queue_id++; const u32 buffer_queue_id = next_buffer_queue_id++;
auto buffer_queue = std::make_shared<BufferQueue>(buffer_queue_id, layer_id); auto buffer_queue = std::make_shared<BufferQueue>(buffer_queue_id, layer_id);
display.layers.emplace_back(layer_id, buffer_queue); display.layers.emplace_back(layer_id, buffer_queue);
buffer_queues.emplace_back(std::move(buffer_queue)); buffer_queues.emplace_back(std::move(buffer_queue));
@ -85,16 +85,16 @@ Kernel::SharedPtr<Kernel::ReadableEvent> NVFlinger::GetVsyncEvent(u64 display_id
} }
std::shared_ptr<BufferQueue> NVFlinger::GetBufferQueue(u32 id) const { std::shared_ptr<BufferQueue> NVFlinger::GetBufferQueue(u32 id) const {
auto itr = std::find_if(buffer_queues.begin(), buffer_queues.end(), const auto itr = std::find_if(buffer_queues.begin(), buffer_queues.end(),
[&](const auto& queue) { return queue->GetId() == id; }); [&](const auto& queue) { return queue->GetId() == id; });
ASSERT(itr != buffer_queues.end()); ASSERT(itr != buffer_queues.end());
return *itr; return *itr;
} }
Display& NVFlinger::GetDisplay(u64 display_id) { Display& NVFlinger::GetDisplay(u64 display_id) {
auto itr = std::find_if(displays.begin(), displays.end(), const auto itr = std::find_if(displays.begin(), displays.end(),
[&](const Display& display) { return display.id == display_id; }); [&](const Display& display) { return display.id == display_id; });
ASSERT(itr != displays.end()); ASSERT(itr != displays.end());
return *itr; return *itr;
@ -103,8 +103,8 @@ Display& NVFlinger::GetDisplay(u64 display_id) {
Layer& NVFlinger::GetLayer(u64 display_id, u64 layer_id) { Layer& NVFlinger::GetLayer(u64 display_id, u64 layer_id) {
auto& display = GetDisplay(display_id); auto& display = GetDisplay(display_id);
auto itr = std::find_if(display.layers.begin(), display.layers.end(), const auto itr = std::find_if(display.layers.begin(), display.layers.end(),
[&](const Layer& layer) { return layer.id == layer_id; }); [&](const Layer& layer) { return layer.id == layer_id; });
ASSERT(itr != display.layers.end()); ASSERT(itr != display.layers.end());
return *itr; return *itr;
@ -139,7 +139,7 @@ void NVFlinger::Compose() {
continue; continue;
} }
auto& igbp_buffer = buffer->get().igbp_buffer; const auto& igbp_buffer = buffer->get().igbp_buffer;
// Now send the buffer to the GPU for drawing. // Now send the buffer to the GPU for drawing.
// TODO(Subv): Support more than just disp0. The display device selection is probably based // TODO(Subv): Support more than just disp0. The display device selection is probably based