diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2022-11-29 14:26:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-29 14:26:25 +0100 |
commit | a7f1fa7bfcf1a2e6ca087a14ea4d524f63e711db (patch) | |
tree | cbad20d396d0786fd2f7abcb6aac9a378be7955b /src/core | |
parent | Merge pull request #9343 from lioncash/bounds (diff) | |
parent | buffer_item_consumer: Pass fence by const-ref in ReleaseBuffer() (diff) | |
download | yuzu-a7f1fa7bfcf1a2e6ca087a14ea4d524f63e711db.tar yuzu-a7f1fa7bfcf1a2e6ca087a14ea4d524f63e711db.tar.gz yuzu-a7f1fa7bfcf1a2e6ca087a14ea4d524f63e711db.tar.bz2 yuzu-a7f1fa7bfcf1a2e6ca087a14ea4d524f63e711db.tar.lz yuzu-a7f1fa7bfcf1a2e6ca087a14ea4d524f63e711db.tar.xz yuzu-a7f1fa7bfcf1a2e6ca087a14ea4d524f63e711db.tar.zst yuzu-a7f1fa7bfcf1a2e6ca087a14ea4d524f63e711db.zip |
Diffstat (limited to 'src/core')
6 files changed, 15 insertions, 16 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/buffer_queue_consumer.cpp b/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp index 1ce67c771..0767e548d 100644 --- a/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp @@ -169,7 +169,7 @@ Status BufferQueueConsumer::Connect(std::shared_ptr<IConsumerListener> consumer_ return Status::NoInit; } - core->consumer_listener = consumer_listener; + core->consumer_listener = std::move(consumer_listener); core->consumer_controlled_by_app = controlled_by_app; return Status::NoError; diff --git a/src/core/hle/service/nvflinger/consumer_base.cpp b/src/core/hle/service/nvflinger/consumer_base.cpp index 5b9995854..982531e2d 100644 --- a/src/core/hle/service/nvflinger/consumer_base.cpp +++ b/src/core/hle/service/nvflinger/consumer_base.cpp @@ -83,7 +83,7 @@ Status ConsumerBase::AcquireBufferLocked(BufferItem* item, std::chrono::nanoseco } Status ConsumerBase::AddReleaseFenceLocked(s32 slot, - const std::shared_ptr<GraphicBuffer> graphic_buffer, + const std::shared_ptr<GraphicBuffer>& graphic_buffer, const Fence& fence) { LOG_DEBUG(Service_NVFlinger, "slot={}", slot); @@ -100,7 +100,7 @@ Status ConsumerBase::AddReleaseFenceLocked(s32 slot, } Status ConsumerBase::ReleaseBufferLocked(s32 slot, - const std::shared_ptr<GraphicBuffer> graphic_buffer) { + const std::shared_ptr<GraphicBuffer>& graphic_buffer) { // If consumer no longer tracks this graphic_buffer (we received a new // buffer on the same slot), the buffer producer is definitely no longer // tracking it. @@ -121,7 +121,7 @@ Status ConsumerBase::ReleaseBufferLocked(s32 slot, } bool ConsumerBase::StillTracking(s32 slot, - const std::shared_ptr<GraphicBuffer> graphic_buffer) const { + const std::shared_ptr<GraphicBuffer>& graphic_buffer) const { if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) { return false; } diff --git a/src/core/hle/service/nvflinger/consumer_base.h b/src/core/hle/service/nvflinger/consumer_base.h index 90ba07f45..9a8a5f6bb 100644 --- a/src/core/hle/service/nvflinger/consumer_base.h +++ b/src/core/hle/service/nvflinger/consumer_base.h @@ -27,18 +27,18 @@ public: protected: explicit ConsumerBase(std::unique_ptr<BufferQueueConsumer> consumer_); - virtual ~ConsumerBase(); + ~ConsumerBase() override; - virtual void OnFrameAvailable(const BufferItem& item) override; - virtual void OnFrameReplaced(const BufferItem& item) override; - virtual void OnBuffersReleased() override; - virtual void OnSidebandStreamChanged() override; + void OnFrameAvailable(const BufferItem& item) override; + void OnFrameReplaced(const BufferItem& item) override; + void OnBuffersReleased() override; + void OnSidebandStreamChanged() override; void FreeBufferLocked(s32 slot_index); Status AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when); - Status ReleaseBufferLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer); - bool StillTracking(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer) const; - Status AddReleaseFenceLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer, + Status ReleaseBufferLocked(s32 slot, const std::shared_ptr<GraphicBuffer>& graphic_buffer); + bool StillTracking(s32 slot, const std::shared_ptr<GraphicBuffer>& graphic_buffer) const; + Status AddReleaseFenceLocked(s32 slot, const std::shared_ptr<GraphicBuffer>& graphic_buffer, const Fence& fence); struct Slot final { 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()); } } |