diff options
author | bunnei <bunneidev@gmail.com> | 2021-04-04 09:56:09 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-05-06 01:40:50 +0200 |
commit | addc0bf0379e075786048921bede6e089552a6db (patch) | |
tree | 7fa8819b52db29e1b354410441dd8f2438e2ed4a /src/core/hle/service/nvflinger | |
parent | hle: kernel: Migrate KSharedMemory to KAutoObject. (diff) | |
download | yuzu-addc0bf0379e075786048921bede6e089552a6db.tar yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.gz yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.bz2 yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.lz yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.xz yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.zst yuzu-addc0bf0379e075786048921bede6e089552a6db.zip |
Diffstat (limited to 'src/core/hle/service/nvflinger')
-rw-r--r-- | src/core/hle/service/nvflinger/buffer_queue.cpp | 18 | ||||
-rw-r--r-- | src/core/hle/service/nvflinger/buffer_queue.h | 3 | ||||
-rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.h | 5 |
4 files changed, 15 insertions, 15 deletions
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp index f783ae54f..8ddb1f908 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue.cpp @@ -7,7 +7,6 @@ #include "common/assert.h" #include "common/logging/log.h" #include "core/core.h" -#include "core/hle/kernel/k_event.h" #include "core/hle/kernel/k_writable_event.h" #include "core/hle/kernel/kernel.h" #include "core/hle/service/nvflinger/buffer_queue.h" @@ -15,9 +14,8 @@ namespace Service::NVFlinger { BufferQueue::BufferQueue(Kernel::KernelCore& kernel, u32 id, u64 layer_id) - : id(id), layer_id(layer_id) { - buffer_wait_event = Kernel::KEvent::Create(kernel, "BufferQueue:WaitEvent"); - buffer_wait_event->Initialize(); + : id(id), layer_id(layer_id), buffer_wait_event{kernel} { + buffer_wait_event.Initialize("BufferQueue:WaitEvent"); } BufferQueue::~BufferQueue() = default; @@ -42,7 +40,7 @@ void BufferQueue::SetPreallocatedBuffer(u32 slot, const IGBPBuffer& igbp_buffer) .multi_fence = {}, }; - buffer_wait_event->GetWritableEvent()->Signal(); + buffer_wait_event.GetWritableEvent()->Signal(); } std::optional<std::pair<u32, Service::Nvidia::MultiFence*>> BufferQueue::DequeueBuffer(u32 width, @@ -120,7 +118,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<std::reference_wrapper<const BufferQueue::Buffer>> BufferQueue::AcquireBuffer() { @@ -155,7 +153,7 @@ void BufferQueue::ReleaseBuffer(u32 slot) { } free_buffers_condition.notify_one(); - buffer_wait_event->GetWritableEvent()->Signal(); + buffer_wait_event.GetWritableEvent()->Signal(); } void BufferQueue::Connect() { @@ -170,7 +168,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(); } @@ -190,11 +188,11 @@ u32 BufferQueue::Query(QueryType type) { } std::shared_ptr<Kernel::KWritableEvent> BufferQueue::GetWritableBufferWaitEvent() const { - return buffer_wait_event->GetWritableEvent(); + return buffer_wait_event.GetWritableEvent(); } std::shared_ptr<Kernel::KReadableEvent> BufferQueue::GetBufferWaitEvent() const { - return SharedFrom(buffer_wait_event->GetReadableEvent()); + return buffer_wait_event.GetReadableEvent(); } } // namespace Service::NVFlinger diff --git a/src/core/hle/service/nvflinger/buffer_queue.h b/src/core/hle/service/nvflinger/buffer_queue.h index 9a21c7426..0d2010ad5 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.h +++ b/src/core/hle/service/nvflinger/buffer_queue.h @@ -13,6 +13,7 @@ #include "common/common_funcs.h" #include "common/math_util.h" #include "common/swap.h" +#include "core/hle/kernel/k_event.h" #include "core/hle/kernel/k_readable_event.h" #include "core/hle/kernel/object.h" #include "core/hle/service/nvdrv/nvdata.h" @@ -130,7 +131,7 @@ private: std::list<u32> free_buffers; std::array<Buffer, buffer_slots> buffers; std::list<u32> queue_sequence; - std::shared_ptr<Kernel::KEvent> buffer_wait_event; + Kernel::KEvent buffer_wait_event; std::mutex free_buffers_mutex; std::condition_variable free_buffers_condition; diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index c43593e7f..c90e4d083 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -165,8 +165,8 @@ std::optional<u32> NVFlinger::FindBufferQueueId(u64 display_id, u64 layer_id) co return layer->GetBufferQueue().GetId(); } -std::shared_ptr<Kernel::KReadableEvent> NVFlinger::FindVsyncEvent(u64 display_id) const { - const auto lock_guard = Lock(); +std::shared_ptr<Kernel::KReadableEvent> NVFlinger::FindVsyncEvent(u64 display_id) { + const auto lock_guard = Lock(); auto* const display = FindDisplay(display_id); if (display == nullptr) { diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h index 6fe2c7f2a..d51b905c1 100644 --- a/src/core/hle/service/nvflinger/nvflinger.h +++ b/src/core/hle/service/nvflinger/nvflinger.h @@ -5,6 +5,7 @@ #pragma once #include <atomic> +#include <list> #include <memory> #include <mutex> #include <optional> @@ -72,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<Kernel::KReadableEvent> FindVsyncEvent(u64 display_id) const; + [[nodiscard]] std::shared_ptr<Kernel::KReadableEvent> FindVsyncEvent(u64 display_id); /// Obtains a buffer queue identified by the ID. [[nodiscard]] BufferQueue* FindBufferQueue(u32 id); @@ -106,7 +107,7 @@ private: std::shared_ptr<Nvidia::Module> nvdrv; - std::vector<VI::Display> displays; + std::list<VI::Display> displays; std::vector<std::unique_ptr<BufferQueue>> buffer_queues; /// Id to use for the next layer that is created, this counter is shared among all displays. |