buffer_item_consumer: Pass fence by const-ref in ReleaseBuffer()

This isn't directly modified.

Also allows rvalues to be used with it.
master
Lioncash 2022-11-28 19:15:24 +07:00
parent 3020f72b0c
commit ae74f46e78
3 changed files with 3 additions and 4 deletions

@ -39,7 +39,7 @@ Status BufferItemConsumer::AcquireBuffer(BufferItem* item, std::chrono::nanoseco
return Status::NoError; return Status::NoError;
} }
Status BufferItemConsumer::ReleaseBuffer(const BufferItem& item, Fence& release_fence) { Status BufferItemConsumer::ReleaseBuffer(const BufferItem& item, const Fence& release_fence) {
std::scoped_lock lock{mutex}; std::scoped_lock lock{mutex};
if (const auto status = AddReleaseFenceLocked(item.buf, item.graphic_buffer, release_fence); if (const auto status = AddReleaseFenceLocked(item.buf, item.graphic_buffer, release_fence);

@ -22,7 +22,7 @@ public:
explicit BufferItemConsumer(std::unique_ptr<BufferQueueConsumer> consumer); explicit BufferItemConsumer(std::unique_ptr<BufferQueueConsumer> consumer);
Status AcquireBuffer(BufferItem* item, std::chrono::nanoseconds present_when, Status AcquireBuffer(BufferItem* item, std::chrono::nanoseconds present_when,
bool wait_for_fence = true); bool wait_for_fence = true);
Status ReleaseBuffer(const BufferItem& item, Fence& release_fence); Status ReleaseBuffer(const BufferItem& item, const Fence& release_fence);
}; };
} // namespace Service::android } // namespace Service::android

@ -307,8 +307,7 @@ void NVFlinger::Compose() {
swap_interval = buffer.swap_interval; swap_interval = buffer.swap_interval;
auto fence = android::Fence::NoFence(); layer.GetConsumer().ReleaseBuffer(buffer, android::Fence::NoFence());
layer.GetConsumer().ReleaseBuffer(buffer, fence);
} }
} }