3
0
Fork 0
forked from suyu/suyu

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

This isn't directly modified.

Also allows rvalues to be used with it.
This commit is contained in:
Lioncash 2022-11-28 19:15:24 -05:00
parent 3020f72b0c
commit ae74f46e78
3 changed files with 3 additions and 4 deletions

View file

@ -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);

View file

@ -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

View file

@ -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);
} }
} }