From ae74f46e787e426610b9d9523db9e9981fede18c Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Mon, 28 Nov 2022 19:15:24 -0500
Subject: [PATCH] buffer_item_consumer: Pass fence by const-ref in
 ReleaseBuffer()

This isn't directly modified.

Also allows rvalues to be used with it.
---
 src/core/hle/service/nvflinger/buffer_item_consumer.cpp | 2 +-
 src/core/hle/service/nvflinger/buffer_item_consumer.h   | 2 +-
 src/core/hle/service/nvflinger/nvflinger.cpp            | 3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/core/hle/service/nvflinger/buffer_item_consumer.cpp b/src/core/hle/service/nvflinger/buffer_item_consumer.cpp
index 6d2c92a2c..152bb5bdf 100644
--- a/src/core/hle/service/nvflinger/buffer_item_consumer.cpp
+++ b/src/core/hle/service/nvflinger/buffer_item_consumer.cpp
@@ -39,7 +39,7 @@ Status BufferItemConsumer::AcquireBuffer(BufferItem* item, std::chrono::nanoseco
     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};
 
     if (const auto status = AddReleaseFenceLocked(item.buf, item.graphic_buffer, release_fence);
diff --git a/src/core/hle/service/nvflinger/buffer_item_consumer.h b/src/core/hle/service/nvflinger/buffer_item_consumer.h
index 69046233d..a5c655d9e 100644
--- a/src/core/hle/service/nvflinger/buffer_item_consumer.h
+++ b/src/core/hle/service/nvflinger/buffer_item_consumer.h
@@ -22,7 +22,7 @@ public:
     explicit BufferItemConsumer(std::unique_ptr<BufferQueueConsumer> consumer);
     Status AcquireBuffer(BufferItem* item, std::chrono::nanoseconds present_when,
                          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
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index c3af12c90..d1cbadde4 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -307,8 +307,7 @@ void NVFlinger::Compose() {
 
         swap_interval = buffer.swap_interval;
 
-        auto fence = android::Fence::NoFence();
-        layer.GetConsumer().ReleaseBuffer(buffer, fence);
+        layer.GetConsumer().ReleaseBuffer(buffer, android::Fence::NoFence());
     }
 }