From 2e8d6fe9a0c07538397682e1cb25992bfd15676d Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 10 Apr 2021 02:34:26 -0700 Subject: hle: kernel: Migrate KReadableEvent and KWritableEvent to KAutoObject. --- src/core/hle/service/nvflinger/buffer_queue.cpp | 12 ++++++------ src/core/hle/service/nvflinger/buffer_queue.h | 4 ++-- src/core/hle/service/nvflinger/nvflinger.cpp | 6 +++--- src/core/hle/service/nvflinger/nvflinger.h | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/core/hle/service/nvflinger') diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp index 95e5a5e7f..0b6e7430b 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue.cpp @@ -41,7 +41,7 @@ void BufferQueue::SetPreallocatedBuffer(u32 slot, const IGBPBuffer& igbp_buffer) .multi_fence = {}, }; - buffer_wait_event.GetWritableEvent()->Signal(); + buffer_wait_event.GetWritableEvent().Signal(); } std::optional> BufferQueue::DequeueBuffer(u32 width, @@ -119,7 +119,7 @@ void BufferQueue::CancelBuffer(u32 slot, const Service::Nvidia::MultiFence& mult } free_buffers_condition.notify_one(); - buffer_wait_event.GetWritableEvent()->Signal(); + buffer_wait_event.GetWritableEvent().Signal(); } std::optional> BufferQueue::AcquireBuffer() { @@ -154,7 +154,7 @@ void BufferQueue::ReleaseBuffer(u32 slot) { } free_buffers_condition.notify_one(); - buffer_wait_event.GetWritableEvent()->Signal(); + buffer_wait_event.GetWritableEvent().Signal(); } void BufferQueue::Connect() { @@ -169,7 +169,7 @@ void BufferQueue::Disconnect() { std::unique_lock lock{queue_sequence_mutex}; queue_sequence.clear(); } - buffer_wait_event.GetWritableEvent()->Signal(); + buffer_wait_event.GetWritableEvent().Signal(); is_connect = false; free_buffers_condition.notify_one(); } @@ -188,11 +188,11 @@ u32 BufferQueue::Query(QueryType type) { return 0; } -std::shared_ptr BufferQueue::GetWritableBufferWaitEvent() const { +Kernel::KWritableEvent& BufferQueue::GetWritableBufferWaitEvent() { return buffer_wait_event.GetWritableEvent(); } -std::shared_ptr BufferQueue::GetBufferWaitEvent() const { +Kernel::KReadableEvent& BufferQueue::GetBufferWaitEvent() { return buffer_wait_event.GetReadableEvent(); } diff --git a/src/core/hle/service/nvflinger/buffer_queue.h b/src/core/hle/service/nvflinger/buffer_queue.h index 0d2010ad5..044e51d08 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.h +++ b/src/core/hle/service/nvflinger/buffer_queue.h @@ -117,9 +117,9 @@ public: return is_connect; } - std::shared_ptr GetWritableBufferWaitEvent() const; + Kernel::KWritableEvent& GetWritableBufferWaitEvent(); - std::shared_ptr GetBufferWaitEvent() const; + Kernel::KReadableEvent& GetBufferWaitEvent(); private: BufferQueue(const BufferQueue&) = delete; diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index c90e4d083..7fb9133c7 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -165,15 +165,15 @@ std::optional NVFlinger::FindBufferQueueId(u64 display_id, u64 layer_id) co return layer->GetBufferQueue().GetId(); } -std::shared_ptr NVFlinger::FindVsyncEvent(u64 display_id) { - const auto lock_guard = Lock(); +Kernel::KReadableEvent* NVFlinger::FindVsyncEvent(u64 display_id) { + const auto lock_guard = Lock(); auto* const display = FindDisplay(display_id); if (display == nullptr) { return nullptr; } - return display->GetVSyncEvent(); + return &display->GetVSyncEvent(); } BufferQueue* NVFlinger::FindBufferQueue(u32 id) { diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h index d51b905c1..1c0aa8ec4 100644 --- a/src/core/hle/service/nvflinger/nvflinger.h +++ b/src/core/hle/service/nvflinger/nvflinger.h @@ -73,7 +73,7 @@ public: /// Gets the vsync event for the specified display. /// /// If an invalid display ID is provided, then nullptr is returned. - [[nodiscard]] std::shared_ptr FindVsyncEvent(u64 display_id); + [[nodiscard]] Kernel::KReadableEvent* FindVsyncEvent(u64 display_id); /// Obtains a buffer queue identified by the ID. [[nodiscard]] BufferQueue* FindBufferQueue(u32 id); -- cgit v1.2.3