From 2e8d6fe9a0c07538397682e1cb25992bfd15676d Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 10 Apr 2021 02:34:26 -0700 Subject: [PATCH] hle: kernel: Migrate KReadableEvent and KWritableEvent to KAutoObject. --- src/core/hle/kernel/handle_table.cpp | 4 +- src/core/hle/kernel/k_event.cpp | 17 ++--- src/core/hle/kernel/k_event.h | 37 +++++----- src/core/hle/kernel/k_readable_event.cpp | 15 ++-- src/core/hle/kernel/k_readable_event.h | 43 ++++++----- src/core/hle/kernel/k_writable_event.cpp | 18 +++-- src/core/hle/kernel/k_writable_event.h | 34 +++++---- src/core/hle/kernel/kernel.h | 4 ++ src/core/hle/kernel/svc.cpp | 72 +++++++++---------- src/core/hle/service/am/am.cpp | 24 +++---- src/core/hle/service/am/am.h | 4 +- src/core/hle/service/am/applets/applets.cpp | 22 +++--- src/core/hle/service/am/applets/applets.h | 8 +-- src/core/hle/service/audio/audout_u.cpp | 2 +- src/core/hle/service/audio/audren_u.cpp | 4 +- src/core/hle/service/bcat/backend/backend.cpp | 8 +-- src/core/hle/service/bcat/backend/backend.h | 4 +- src/core/hle/service/bcat/module.cpp | 10 ++- src/core/hle/service/hid/controllers/npad.cpp | 9 ++- src/core/hle/service/hid/controllers/npad.h | 2 +- src/core/hle/service/nfp/nfp.cpp | 10 +-- src/core/hle/service/nfp/nfp.h | 2 +- src/core/hle/service/nim/nim.cpp | 4 +- .../hle/service/nvdrv/devices/nvhost_ctrl.cpp | 6 +- src/core/hle/service/nvdrv/interface.cpp | 6 +- src/core/hle/service/nvdrv/nvdrv.cpp | 8 +-- src/core/hle/service/nvdrv/nvdrv.h | 4 +- .../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 +- src/core/hle/service/ptm/psm.cpp | 6 +- .../hle/service/vi/display/vi_display.cpp | 4 +- src/core/hle/service/vi/display/vi_display.h | 2 +- src/core/hle/service/vi/vi.cpp | 6 +- 35 files changed, 219 insertions(+), 204 deletions(-) diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp index 58c49460f4..cc3210ef2c 100644 --- a/src/core/hle/kernel/handle_table.cpp +++ b/src/core/hle/kernel/handle_table.cpp @@ -54,7 +54,9 @@ ResultVal HandleTable::Create(Object* obj) { case HandleType::SharedMemory: case HandleType::Thread: case HandleType::Event: - case HandleType::Process: { + case HandleType::Process: + case HandleType::ReadableEvent: + case HandleType::WritableEvent: { Handle handle{}; Add(&handle, reinterpret_cast(obj), {}); return MakeResult(handle); diff --git a/src/core/hle/kernel/k_event.cpp b/src/core/hle/kernel/k_event.cpp index 4020e5325f..fdec0c36f8 100644 --- a/src/core/hle/kernel/k_event.cpp +++ b/src/core/hle/kernel/k_event.cpp @@ -3,14 +3,13 @@ // Refer to the license.txt file included. #include "core/hle/kernel/k_event.h" -#include "core/hle/kernel/k_readable_event.h" #include "core/hle/kernel/k_resource_limit.h" -#include "core/hle/kernel/k_writable_event.h" #include "core/hle/kernel/process.h" namespace Kernel { -KEvent::KEvent(KernelCore& kernel) : KAutoObjectWithSlabHeapAndContainer{kernel} {} +KEvent::KEvent(KernelCore& kernel) + : KAutoObjectWithSlabHeapAndContainer{kernel}, readable_event{kernel}, writable_event{kernel} {} KEvent::~KEvent() = default; @@ -21,17 +20,13 @@ void KEvent::Initialize(std::string&& name_) { // writable events are closed this object will be destroyed. Open(); - //// Create our sub events. - //KAutoObject::Create(readable_event.get()); - //KAutoObject::Create(writable_event.get()); - // Create our sub events. - readable_event = std::make_shared(kernel, name_ + ":Readable"); - writable_event = std::make_shared(kernel, name_ + ":Writable"); + KAutoObject::Create(std::addressof(readable_event)); + KAutoObject::Create(std::addressof(writable_event)); // Initialize our sub sessions. - readable_event->Initialize(this); - writable_event->Initialize(this); + readable_event.Initialize(this, name_ + ":Readable"); + writable_event.Initialize(this, name_ + ":Writable"); // Set our owner process. owner = kernel.CurrentProcess(); diff --git a/src/core/hle/kernel/k_event.h b/src/core/hle/kernel/k_event.h index 97ec0ea9c7..2c48a0499e 100644 --- a/src/core/hle/kernel/k_event.h +++ b/src/core/hle/kernel/k_event.h @@ -4,6 +4,8 @@ #pragma once +#include "core/hle/kernel/k_readable_event.h" +#include "core/hle/kernel/k_writable_event.h" #include "core/hle/kernel/slab_helpers.h" namespace Kernel { @@ -27,12 +29,27 @@ public: virtual bool IsInitialized() const override { return initialized; } + virtual uintptr_t GetPostDestroyArgument() const override { return reinterpret_cast(owner); } static void PostDestroy(uintptr_t arg); + virtual Process* GetOwner() const override { + return owner; + } + + KReadableEvent& GetReadableEvent() { + return readable_event; + } + + KWritableEvent& GetWritableEvent() { + return writable_event; + } + + // DEPRECATED + std::string GetTypeName() const override { return "KEvent"; } @@ -42,25 +59,9 @@ public: return HANDLE_TYPE; } - KReadableEvent* GetReadableEvent() { - return readable_event.get(); - } - - std::shared_ptr& GetWritableEvent() { - return writable_event; - } - - const std::shared_ptr& GetReadableEvent() const { - return readable_event; - } - - const std::shared_ptr& GetWritableEvent() const { - return writable_event; - } - private: - std::shared_ptr readable_event; - std::shared_ptr writable_event; + KReadableEvent readable_event; + KWritableEvent writable_event; Process* owner{}; bool initialized{}; }; diff --git a/src/core/hle/kernel/k_readable_event.cpp b/src/core/hle/kernel/k_readable_event.cpp index 4b4d34857b..8fef4bb009 100644 --- a/src/core/hle/kernel/k_readable_event.cpp +++ b/src/core/hle/kernel/k_readable_event.cpp @@ -2,21 +2,18 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include #include "common/assert.h" -#include "common/common_funcs.h" -#include "common/logging/log.h" +#include "core/hle/kernel/k_event.h" #include "core/hle/kernel/k_readable_event.h" #include "core/hle/kernel/k_scheduler.h" #include "core/hle/kernel/k_thread.h" #include "core/hle/kernel/kernel.h" -#include "core/hle/kernel/object.h" #include "core/hle/kernel/svc_results.h" namespace Kernel { -KReadableEvent::KReadableEvent(KernelCore& kernel, std::string&& name) - : KSynchronizationObject{kernel, std::move(name)} {} +KReadableEvent::KReadableEvent(KernelCore& kernel) : KSynchronizationObject{kernel} {} + KReadableEvent::~KReadableEvent() = default; bool KReadableEvent::IsSignaled() const { @@ -25,6 +22,12 @@ bool KReadableEvent::IsSignaled() const { return is_signaled; } +void KReadableEvent::Destroy() { + if (parent) { + parent->Close(); + } +} + ResultCode KReadableEvent::Signal() { KScopedSchedulerLock lk{kernel}; diff --git a/src/core/hle/kernel/k_readable_event.h b/src/core/hle/kernel/k_readable_event.h index e6f0fd9002..4c22f0584e 100644 --- a/src/core/hle/kernel/k_readable_event.h +++ b/src/core/hle/kernel/k_readable_event.h @@ -4,8 +4,10 @@ #pragma once +#include "core/hle/kernel/k_auto_object.h" #include "core/hle/kernel/k_synchronization_object.h" #include "core/hle/kernel/object.h" +#include "core/hle/kernel/slab_helpers.h" #include "core/hle/result.h" namespace Kernel { @@ -13,11 +15,32 @@ namespace Kernel { class KernelCore; class KEvent; -class KReadableEvent final : public KSynchronizationObject { +class KReadableEvent : public KSynchronizationObject { + KERNEL_AUTOOBJECT_TRAITS(KReadableEvent, KSynchronizationObject); + public: - explicit KReadableEvent(KernelCore& kernel, std::string&& name); + explicit KReadableEvent(KernelCore& kernel); ~KReadableEvent() override; + void Initialize(KEvent* parent_, std::string&& name_) { + is_signaled = false; + parent = parent_; + name = std::move(name_); + } + + constexpr KEvent* GetParent() const { + return parent; + } + + virtual bool IsSignaled() const override; + virtual void Destroy() override; + + ResultCode Signal(); + ResultCode Clear(); + ResultCode Reset(); + + // DEPRECATED + std::string GetTypeName() const override { return "KReadableEvent"; } @@ -27,22 +50,6 @@ public: return HANDLE_TYPE; } - KEvent* GetParent() const { - return parent; - } - - void Initialize(KEvent* parent_) { - is_signaled = false; - parent = parent_; - } - - bool IsSignaled() const override; - void Finalize() override {} - - ResultCode Signal(); - ResultCode Clear(); - ResultCode Reset(); - private: bool is_signaled{}; KEvent* parent{}; diff --git a/src/core/hle/kernel/k_writable_event.cpp b/src/core/hle/kernel/k_writable_event.cpp index 25c52edb26..a430e06615 100644 --- a/src/core/hle/kernel/k_writable_event.cpp +++ b/src/core/hle/kernel/k_writable_event.cpp @@ -8,20 +8,28 @@ namespace Kernel { -KWritableEvent::KWritableEvent(KernelCore& kernel, std::string&& name) - : Object{kernel, std::move(name)} {} +KWritableEvent::KWritableEvent(KernelCore& kernel) : KAutoObjectWithSlabHeapAndContainer{kernel} {} + KWritableEvent::~KWritableEvent() = default; -void KWritableEvent::Initialize(KEvent* parent_) { +void KWritableEvent::Initialize(KEvent* parent_, std::string&& name_) { parent = parent_; + name = std::move(name_); + parent->GetReadableEvent().Open(); } ResultCode KWritableEvent::Signal() { - return parent->GetReadableEvent()->Signal(); + return parent->GetReadableEvent().Signal(); } ResultCode KWritableEvent::Clear() { - return parent->GetReadableEvent()->Clear(); + return parent->GetReadableEvent().Clear(); +} + +void KWritableEvent::Destroy() { + // Close our references. + parent->GetReadableEvent().Close(); + parent->Close(); } } // namespace Kernel diff --git a/src/core/hle/kernel/k_writable_event.h b/src/core/hle/kernel/k_writable_event.h index 518f5448db..7cf43f77e2 100644 --- a/src/core/hle/kernel/k_writable_event.h +++ b/src/core/hle/kernel/k_writable_event.h @@ -4,7 +4,9 @@ #pragma once +#include "core/hle/kernel/k_auto_object.h" #include "core/hle/kernel/object.h" +#include "core/hle/kernel/slab_helpers.h" #include "core/hle/result.h" namespace Kernel { @@ -12,11 +14,28 @@ namespace Kernel { class KernelCore; class KEvent; -class KWritableEvent final : public Object { +class KWritableEvent final + : public KAutoObjectWithSlabHeapAndContainer { + KERNEL_AUTOOBJECT_TRAITS(KWritableEvent, KAutoObject); + public: - explicit KWritableEvent(KernelCore& kernel, std::string&& name); + explicit KWritableEvent(KernelCore& kernel); ~KWritableEvent() override; + virtual void Destroy() override; + + static void PostDestroy([[maybe_unused]] uintptr_t arg) {} + + void Initialize(KEvent* parent_, std::string&& name_); + ResultCode Signal(); + ResultCode Clear(); + + constexpr KEvent* GetParent() const { + return parent; + } + + // DEPRECATED + std::string GetTypeName() const override { return "KWritableEvent"; } @@ -26,17 +45,6 @@ public: return HANDLE_TYPE; } - void Initialize(KEvent* parent_); - - void Finalize() override {} - - ResultCode Signal(); - ResultCode Clear(); - - KEvent* GetParent() const { - return parent; - } - private: KEvent* parent{}; }; diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index e494fe9f39..850436eb3e 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -40,6 +40,7 @@ class KResourceLimit; class KScheduler; class KSharedMemory; class KThread; +class KWritableEvent; class PhysicalCore; class Process; class ServiceThread; @@ -269,6 +270,8 @@ public: return slab_heap_container->shared_memory; } else if constexpr (std::is_same_v) { return slab_heap_container->linked_list_node; + } else if constexpr (std::is_same_v) { + return slab_heap_container->writeable_event; } } @@ -308,6 +311,7 @@ private: KSlabHeap event; KSlabHeap shared_memory; KSlabHeap linked_list_node; + KSlabHeap writeable_event; }; std::unique_ptr slab_heap_container; diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 8050359be5..c6334f91cf 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -1745,16 +1745,16 @@ static ResultCode ResetSignal(Core::System& system, Handle handle) { // Try to reset as readable event. { - auto readable_event = handle_table.Get(handle); - if (readable_event) { + KScopedAutoObject readable_event = handle_table.GetObject(handle); + if (readable_event.IsNotNull()) { return readable_event->Reset(); } } // Try to reset as process. { - auto process = handle_table.Get(handle); - if (process) { + KScopedAutoObject process = handle_table.GetObject(handle); + if (process.IsNotNull()) { return process->Reset(); } } @@ -1885,27 +1885,12 @@ static ResultCode SetThreadCoreMask32(Core::System& system, Handle thread_handle static ResultCode SignalEvent(Core::System& system, Handle event_handle) { LOG_DEBUG(Kernel_SVC, "called, event_handle=0x{:08X}", event_handle); - auto& kernel = system.Kernel(); // Get the current handle table. - const HandleTable& handle_table = kernel.CurrentProcess()->GetHandleTable(); - - // Reserve a new event from the process resource limit. - KScopedResourceReservation event_reservation(kernel.CurrentProcess(), - LimitableResource::Events); - if (!event_reservation.Succeeded()) { - LOG_ERROR(Kernel, "Could not reserve a new event"); - return ResultResourceLimitedExceeded; - } + const HandleTable& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); // Get the writable event. - auto writable_event = handle_table.Get(event_handle); - if (!writable_event) { - LOG_ERROR(Kernel_SVC, "Invalid event handle provided (handle={:08X})", event_handle); - return ResultInvalidHandle; - } - - // Commit the successfuly reservation. - event_reservation.Commit(); + KScopedAutoObject writable_event = handle_table.GetObject(event_handle); + R_UNLESS(writable_event.IsNotNull(), ResultInvalidHandle); return writable_event->Signal(); } @@ -1922,16 +1907,16 @@ static ResultCode ClearEvent(Core::System& system, Handle event_handle) { // Try to clear the writable event. { - auto writable_event = handle_table.Get(event_handle); - if (writable_event) { + KScopedAutoObject writable_event = handle_table.GetObject(event_handle); + if (writable_event.IsNotNull()) { return writable_event->Clear(); } } // Try to clear the readable event. { - auto readable_event = handle_table.Get(event_handle); - if (readable_event) { + KScopedAutoObject readable_event = handle_table.GetObject(event_handle); + if (readable_event.IsNotNull()) { return readable_event->Clear(); } } @@ -1950,7 +1935,12 @@ static ResultCode CreateEvent(Core::System& system, Handle* out_write, Handle* o // Get the kernel reference and handle table. auto& kernel = system.Kernel(); - HandleTable& handle_table = kernel.CurrentProcess()->GetHandleTable(); + auto& handle_table = kernel.CurrentProcess()->GetHandleTable(); + + // Reserve a new event from the process resource limit + KScopedResourceReservation event_reservation(kernel.CurrentProcess(), + LimitableResource::Events); + R_UNLESS(event_reservation.Succeeded(), ResultResourceLimitedExceeded); // Create a new event. KEvent* event = KEvent::Create(kernel); @@ -1959,22 +1949,26 @@ static ResultCode CreateEvent(Core::System& system, Handle* out_write, Handle* o // Initialize the event. event->Initialize("CreateEvent"); - // Add the writable event to the handle table. - const auto write_create_result = handle_table.Create(event->GetWritableEvent().get()); - if (write_create_result.Failed()) { - return write_create_result.Code(); - } - *out_write = *write_create_result; + // Commit the thread reservation. + event_reservation.Commit(); + + // Ensure that we clean up the event (and its only references are handle table) on function end. + SCOPE_EXIT({ + event->GetWritableEvent().Close(); + event->GetReadableEvent().Close(); + }); + + // Register the event. + KEvent::Register(kernel, event); // Add the writable event to the handle table. - auto handle_guard = SCOPE_GUARD({ handle_table.Remove(*write_create_result); }); + R_TRY(handle_table.Add(out_write, std::addressof(event->GetWritableEvent()))); + + // Add the writable event to the handle table. + auto handle_guard = SCOPE_GUARD({ handle_table.Remove(*out_write); }); // Add the readable event to the handle table. - const auto read_create_result = handle_table.Create(event->GetReadableEvent()); - if (read_create_result.Failed()) { - return read_create_result.Code(); - } - *out_read = *read_create_result; + R_TRY(handle_table.Add(out_read, std::addressof(event->GetReadableEvent()))); // We succeeded. handle_guard.Cancel(); diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index c1982e996a..937020a6eb 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -320,7 +320,7 @@ ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nv Kernel::KAutoObject::Create(std::addressof(accumulated_suspended_tick_changed_event)); accumulated_suspended_tick_changed_event.Initialize( "ISelfController:AccumulatedSuspendedTickChangedEvent"); - accumulated_suspended_tick_changed_event.GetWritableEvent()->Signal(); + accumulated_suspended_tick_changed_event.GetWritableEvent().Signal(); } ISelfController::~ISelfController() = default; @@ -379,7 +379,7 @@ void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) { void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); - launchable_event.GetWritableEvent()->Signal(); + launchable_event.GetWritableEvent().Signal(); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); @@ -592,28 +592,28 @@ AppletMessageQueue::AppletMessageQueue(Kernel::KernelCore& kernel) AppletMessageQueue::~AppletMessageQueue() = default; -Kernel::KReadableEvent* AppletMessageQueue::GetMessageReceiveEvent() const { - return on_new_message.GetReadableEvent().get(); +Kernel::KReadableEvent& AppletMessageQueue::GetMessageReceiveEvent() { + return on_new_message.GetReadableEvent(); } -Kernel::KReadableEvent* AppletMessageQueue::GetOperationModeChangedEvent() const { - return on_operation_mode_changed.GetReadableEvent().get(); +Kernel::KReadableEvent& AppletMessageQueue::GetOperationModeChangedEvent() { + return on_operation_mode_changed.GetReadableEvent(); } void AppletMessageQueue::PushMessage(AppletMessage msg) { messages.push(msg); - on_new_message.GetWritableEvent()->Signal(); + on_new_message.GetWritableEvent().Signal(); } AppletMessageQueue::AppletMessage AppletMessageQueue::PopMessage() { if (messages.empty()) { - on_new_message.GetWritableEvent()->Clear(); + on_new_message.GetWritableEvent().Clear(); return AppletMessage::NoMessage; } auto msg = messages.front(); messages.pop(); if (messages.empty()) { - on_new_message.GetWritableEvent()->Clear(); + on_new_message.GetWritableEvent().Clear(); } return msg; } @@ -633,7 +633,7 @@ void AppletMessageQueue::FocusStateChanged() { void AppletMessageQueue::OperationModeChanged() { PushMessage(AppletMessage::OperationModeChanged); PushMessage(AppletMessage::PerformanceModeChanged); - on_operation_mode_changed.GetWritableEvent()->Signal(); + on_operation_mode_changed.GetWritableEvent().Signal(); } ICommonStateGetter::ICommonStateGetter(Core::System& system_, @@ -930,11 +930,9 @@ private: void GetAppletStateChangedEvent(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); - const auto event = applet->GetBroker().GetStateChangedEvent(); - IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(event); + rb.PushCopyObjects(applet->GetBroker().GetStateChangedEvent()); } void IsCompleted(Kernel::HLERequestContext& ctx) { diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 8f6017c4e0..fbac7b2cf9 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -56,8 +56,8 @@ public: explicit AppletMessageQueue(Kernel::KernelCore& kernel); ~AppletMessageQueue(); - Kernel::KReadableEvent* GetMessageReceiveEvent() const; - Kernel::KReadableEvent* GetOperationModeChangedEvent() const; + Kernel::KReadableEvent& GetMessageReceiveEvent(); + Kernel::KReadableEvent& GetOperationModeChangedEvent(); void PushMessage(AppletMessage msg); AppletMessage PopMessage(); std::size_t GetMessageCount() const; diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/applets/applets.cpp index 6cceff0646..cf8ad7598b 100644 --- a/src/core/hle/service/am/applets/applets.cpp +++ b/src/core/hle/service/am/applets/applets.cpp @@ -66,7 +66,7 @@ std::shared_ptr AppletDataBroker::PopNormalDataToGame() { auto out = std::move(out_channel.front()); out_channel.pop_front(); - pop_out_data_event.GetWritableEvent()->Clear(); + pop_out_data_event.GetWritableEvent().Clear(); return out; } @@ -85,7 +85,7 @@ std::shared_ptr AppletDataBroker::PopInteractiveDataToGame() { auto out = std::move(out_interactive_channel.front()); out_interactive_channel.pop_front(); - pop_interactive_out_data_event.GetWritableEvent()->Clear(); + pop_interactive_out_data_event.GetWritableEvent().Clear(); return out; } @@ -104,7 +104,7 @@ void AppletDataBroker::PushNormalDataFromGame(std::shared_ptr&& storag void AppletDataBroker::PushNormalDataFromApplet(std::shared_ptr&& storage) { out_channel.emplace_back(std::move(storage)); - pop_out_data_event.GetWritableEvent()->Signal(); + pop_out_data_event.GetWritableEvent().Signal(); } void AppletDataBroker::PushInteractiveDataFromGame(std::shared_ptr&& storage) { @@ -113,11 +113,11 @@ void AppletDataBroker::PushInteractiveDataFromGame(std::shared_ptr&& s void AppletDataBroker::PushInteractiveDataFromApplet(std::shared_ptr&& storage) { out_interactive_channel.emplace_back(std::move(storage)); - pop_interactive_out_data_event.GetWritableEvent()->Signal(); + pop_interactive_out_data_event.GetWritableEvent().Signal(); } void AppletDataBroker::SignalStateChanged() { - state_changed_event.GetWritableEvent()->Signal(); + state_changed_event.GetWritableEvent().Signal(); switch (applet_mode) { case LibraryAppletMode::AllForeground: @@ -141,16 +141,16 @@ void AppletDataBroker::SignalStateChanged() { } } -Kernel::KReadableEvent* AppletDataBroker::GetNormalDataEvent() const { - return pop_out_data_event.GetReadableEvent().get(); +Kernel::KReadableEvent& AppletDataBroker::GetNormalDataEvent() { + return pop_out_data_event.GetReadableEvent(); } -Kernel::KReadableEvent* AppletDataBroker::GetInteractiveDataEvent() const { - return pop_interactive_out_data_event.GetReadableEvent().get(); +Kernel::KReadableEvent& AppletDataBroker::GetInteractiveDataEvent() { + return pop_interactive_out_data_event.GetReadableEvent(); } -Kernel::KReadableEvent* AppletDataBroker::GetStateChangedEvent() const { - return state_changed_event.GetReadableEvent().get(); +Kernel::KReadableEvent& AppletDataBroker::GetStateChangedEvent() { + return state_changed_event.GetReadableEvent(); } Applet::Applet(Core::System& system_, LibraryAppletMode applet_mode_) diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h index 327843a98c..229dc7a1ea 100644 --- a/src/core/hle/service/am/applets/applets.h +++ b/src/core/hle/service/am/applets/applets.h @@ -96,11 +96,11 @@ public: void PushInteractiveDataFromGame(std::shared_ptr&& storage); void PushInteractiveDataFromApplet(std::shared_ptr&& storage); - void SignalStateChanged() const; + void SignalStateChanged(); - Kernel::KReadableEvent* GetNormalDataEvent() const; - Kernel::KReadableEvent* GetInteractiveDataEvent() const; - Kernel::KReadableEvent* GetStateChangedEvent() const; + Kernel::KReadableEvent& GetNormalDataEvent(); + Kernel::KReadableEvent& GetInteractiveDataEvent(); + Kernel::KReadableEvent& GetStateChangedEvent(); private: Core::System& system; diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index 5a7d73b485..e1ae726f53 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp @@ -73,7 +73,7 @@ public: stream = audio_core.OpenStream(system.CoreTiming(), audio_params.sample_rate, audio_params.channel_count, std::move(unique_name), [this] { const auto guard = LockService(); - buffer_event.GetWritableEvent()->Signal(); + buffer_event.GetWritableEvent().Signal(); }); } diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index b0a362f521..513bd37306 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -55,7 +55,7 @@ public: system.CoreTiming(), system.Memory(), audren_params, [this]() { const auto guard = LockService(); - system_event.GetWritableEvent()->Signal(); + system_event.GetWritableEvent().Signal(); }, instance_number); } @@ -289,7 +289,7 @@ private: void QueryAudioDeviceSystemEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_Audio, "(STUBBED) called"); - buffer_event.GetWritableEvent()->Signal(); + buffer_event.GetWritableEvent().Signal(); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); diff --git a/src/core/hle/service/bcat/backend/backend.cpp b/src/core/hle/service/bcat/backend/backend.cpp index 8def52b318..0e935bfa6f 100644 --- a/src/core/hle/service/bcat/backend/backend.cpp +++ b/src/core/hle/service/bcat/backend/backend.cpp @@ -19,7 +19,7 @@ ProgressServiceBackend::ProgressServiceBackend(Kernel::KernelCore& kernel, update_event.Initialize("ProgressServiceBackend:UpdateEvent:" + std::string(event_name)); } -std::shared_ptr ProgressServiceBackend::GetEvent() const { +Kernel::KReadableEvent& ProgressServiceBackend::GetEvent() { return update_event.GetReadableEvent(); } @@ -85,12 +85,12 @@ void ProgressServiceBackend::FinishDownload(ResultCode result) { SignalUpdate(); } -void ProgressServiceBackend::SignalUpdate() const { +void ProgressServiceBackend::SignalUpdate() { if (need_hle_lock) { std::lock_guard lock(HLE::g_hle_lock); - update_event.GetWritableEvent()->Signal(); + update_event.GetWritableEvent().Signal(); } else { - update_event.GetWritableEvent()->Signal(); + update_event.GetWritableEvent().Signal(); } } diff --git a/src/core/hle/service/bcat/backend/backend.h b/src/core/hle/service/bcat/backend/backend.h index baa4d576a7..f591a362ad 100644 --- a/src/core/hle/service/bcat/backend/backend.h +++ b/src/core/hle/service/bcat/backend/backend.h @@ -99,10 +99,10 @@ public: private: explicit ProgressServiceBackend(Kernel::KernelCore& kernel, std::string_view event_name); - std::shared_ptr GetEvent() const; + Kernel::KReadableEvent& GetEvent(); DeliveryCacheProgressImpl& GetImpl(); - void SignalUpdate() const; + void SignalUpdate(); DeliveryCacheProgressImpl impl{}; Kernel::KEvent update_event; diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp index 8473b716ba..05635a2a53 100644 --- a/src/core/hle/service/bcat/module.cpp +++ b/src/core/hle/service/bcat/module.cpp @@ -88,11 +88,9 @@ struct DeliveryCacheDirectoryEntry { class IDeliveryCacheProgressService final : public ServiceFramework { public: - explicit IDeliveryCacheProgressService(Core::System& system_, - std::shared_ptr event_, + explicit IDeliveryCacheProgressService(Core::System& system_, Kernel::KReadableEvent& event_, const DeliveryCacheProgressImpl& impl_) - : ServiceFramework{system_, "IDeliveryCacheProgressService"}, event{std::move(event_)}, - impl{impl_} { + : ServiceFramework{system_, "IDeliveryCacheProgressService"}, event{event_}, impl{impl_} { // clang-format off static const FunctionInfo functions[] = { {0, &IDeliveryCacheProgressService::GetEvent, "GetEvent"}, @@ -109,7 +107,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(event.get()); + rb.PushCopyObjects(event); } void GetImpl(Kernel::HLERequestContext& ctx) { @@ -121,7 +119,7 @@ private: rb.Push(RESULT_SUCCESS); } - std::shared_ptr event; + Kernel::KReadableEvent& event; const DeliveryCacheProgressImpl& impl; }; diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 77768ca7d8..7acad37988 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -159,7 +159,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) { const auto controller_type = connected_controllers[controller_idx].type; auto& controller = shared_memory_entries[controller_idx]; if (controller_type == NPadControllerType::None) { - styleset_changed_events[controller_idx]->GetWritableEvent()->Signal(); + styleset_changed_events[controller_idx]->GetWritableEvent().Signal(); return; } controller.style_set.raw = 0; // Zero out @@ -959,13 +959,12 @@ bool Controller_NPad::IsVibrationDeviceMounted(const DeviceHandle& vibration_dev return vibration_devices_mounted[npad_index][device_index]; } -Kernel::KReadableEvent* Controller_NPad::GetStyleSetChangedEvent(u32 npad_id) const { - const auto& styleset_event = styleset_changed_events[NPadIdToIndex(npad_id)]; - return styleset_event->GetReadableEvent(); +Kernel::KReadableEvent& Controller_NPad::GetStyleSetChangedEvent(u32 npad_id) { + return styleset_changed_events[NPadIdToIndex(npad_id)]->GetReadableEvent(); } void Controller_NPad::SignalStyleSetChangedEvent(u32 npad_id) const { - styleset_changed_events[NPadIdToIndex(npad_id)]->GetWritableEvent()->Signal(); + styleset_changed_events[NPadIdToIndex(npad_id)]->GetWritableEvent().Signal(); } void Controller_NPad::AddNewControllerAt(NPadControllerType controller, std::size_t npad_index) { diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index b3de272b6c..b0f575561e 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -199,7 +199,7 @@ public: bool IsVibrationDeviceMounted(const DeviceHandle& vibration_device_handle) const; - Kernel::KReadableEvent* GetStyleSetChangedEvent(u32 npad_id) const; + Kernel::KReadableEvent& GetStyleSetChangedEvent(u32 npad_id); void SignalStyleSetChangedEvent(u32 npad_id) const; // Adds a new controller at an index. diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index d1cf01390a..d25b20ab50 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp @@ -175,7 +175,7 @@ private: switch (device_state) { case DeviceState::TagFound: case DeviceState::TagNearby: - deactivate_event.GetWritableEvent()->Signal(); + deactivate_event.GetWritableEvent().Signal(); device_state = DeviceState::Initialized; break; case DeviceState::SearchingForTag: @@ -318,7 +318,7 @@ private: const u32 npad_id{0}; // Player 1 controller State state{State::NonInitialized}; DeviceState device_state{DeviceState::Initialized}; - const Module::Interface& nfp_interface; + Module::Interface& nfp_interface; Kernel::KEvent deactivate_event; Kernel::KEvent availability_change_event; }; @@ -338,12 +338,12 @@ bool Module::Interface::LoadAmiibo(const std::vector& buffer) { } std::memcpy(&amiibo, buffer.data(), sizeof(amiibo)); - nfc_tag_load.GetWritableEvent()->Signal(); + nfc_tag_load.GetWritableEvent().Signal(); return true; } -Kernel::KReadableEvent* Module::Interface::GetNFCEvent() const { - return nfc_tag_load.GetReadableEvent().get(); +Kernel::KReadableEvent& Module::Interface::GetNFCEvent() { + return nfc_tag_load.GetReadableEvent(); } const Module::Interface::AmiiboFile& Module::Interface::GetAmiiboBuffer() const { diff --git a/src/core/hle/service/nfp/nfp.h b/src/core/hle/service/nfp/nfp.h index 4bca2192c1..5e4e49bc63 100644 --- a/src/core/hle/service/nfp/nfp.h +++ b/src/core/hle/service/nfp/nfp.h @@ -39,7 +39,7 @@ public: void CreateUserInterface(Kernel::HLERequestContext& ctx); bool LoadAmiibo(const std::vector& buffer); - Kernel::KReadableEvent* GetNFCEvent() const; + Kernel::KReadableEvent& GetNFCEvent(); const AmiiboFile& GetAmiiboBuffer() const; private: diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp index 4a22625627..420a5a0750 100644 --- a/src/core/hle/service/nim/nim.cpp +++ b/src/core/hle/service/nim/nim.cpp @@ -323,7 +323,7 @@ private: void StartTask(Kernel::HLERequestContext& ctx) { // No need to connect to the internet, just finish the task straight away. LOG_DEBUG(Service_NIM, "called"); - finished_event.GetWritableEvent()->Signal(); + finished_event.GetWritableEvent().Signal(); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } @@ -345,7 +345,7 @@ private: void Cancel(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NIM, "called"); - finished_event.GetWritableEvent()->Clear(); + finished_event.GetWritableEvent().Clear(); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index e99da24ab6..775e763303 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp @@ -108,14 +108,14 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector& input, std::vector // This is mostly to take into account unimplemented features. As synced // gpu is always synced. if (!gpu.IsAsync()) { - event.event->GetWritableEvent()->Signal(); + event.event->GetWritableEvent().Signal(); return NvResult::Success; } auto lock = gpu.LockSync(); const u32 current_syncpoint_value = event.fence.value; const s32 diff = current_syncpoint_value - params.threshold; if (diff >= 0) { - event.event->GetWritableEvent()->Signal(); + event.event->GetWritableEvent().Signal(); params.value = current_syncpoint_value; std::memcpy(output.data(), ¶ms, sizeof(params)); return NvResult::Success; @@ -142,7 +142,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector& input, std::vector params.value = ((params.syncpt_id & 0xfff) << 16) | 0x10000000; } params.value |= event_id; - event.event->GetWritableEvent()->Clear(); + event.event->GetWritableEvent().Clear(); gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value); std::memcpy(output.data(), ¶ms, sizeof(params)); return NvResult::Timeout; diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index 8e359040fd..dc9b9341f8 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -187,9 +187,9 @@ void NVDRV::QueryEvent(Kernel::HLERequestContext& ctx) { if (event_id < MaxNvEvents) { IPC::ResponseBuilder rb{ctx, 3, 1}; rb.Push(RESULT_SUCCESS); - auto event = nvdrv->GetEvent(event_id); - event->Clear(); - rb.PushCopyObjects(event.get()); + auto& event = nvdrv->GetEvent(event_id); + event.Clear(); + rb.PushCopyObjects(event); rb.PushEnum(NvResult::Success); } else { IPC::ResponseBuilder rb{ctx, 3}; diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index 2fbf61cd65..74796dce1c 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp @@ -176,16 +176,16 @@ void Module::SignalSyncpt(const u32 syncpoint_id, const u32 value) { if (events_interface.assigned_syncpt[i] == syncpoint_id && events_interface.assigned_value[i] == value) { events_interface.LiberateEvent(i); - events_interface.events[i].event->GetWritableEvent()->Signal(); + events_interface.events[i].event->GetWritableEvent().Signal(); } } } -std::shared_ptr Module::GetEvent(const u32 event_id) const { - return SharedFrom(events_interface.events[event_id].event->GetReadableEvent()); +Kernel::KReadableEvent& Module::GetEvent(const u32 event_id) { + return events_interface.events[event_id].event->GetReadableEvent(); } -std::shared_ptr Module::GetEventWriteable(const u32 event_id) const { +Kernel::KWritableEvent& Module::GetEventWriteable(const u32 event_id) { return events_interface.events[event_id].event->GetWritableEvent(); } diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index ea5dbbdf99..a43ceb7ae5 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h @@ -136,9 +136,9 @@ public: void SignalSyncpt(const u32 syncpoint_id, const u32 value); - std::shared_ptr GetEvent(u32 event_id) const; + Kernel::KReadableEvent& GetEvent(u32 event_id); - std::shared_ptr GetEventWriteable(u32 event_id) const; + Kernel::KWritableEvent& GetEventWriteable(u32 event_id); private: /// Manages syncpoints on the host diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp index 95e5a5e7ff..0b6e7430b1 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 0d2010ad51..044e51d08e 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 c90e4d0835..7fb9133c7a 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 d51b905c1c..1c0aa8ec44 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); diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cpp index 2659ab7d5d..bb7af92171 100644 --- a/src/core/hle/service/ptm/psm.cpp +++ b/src/core/hle/service/ptm/psm.cpp @@ -41,19 +41,19 @@ public: void SignalChargerTypeChanged() { if (should_signal && should_signal_charger_type) { - state_change_event.GetWritableEvent()->Signal(); + state_change_event.GetWritableEvent().Signal(); } } void SignalPowerSupplyChanged() { if (should_signal && should_signal_power_supply) { - state_change_event.GetWritableEvent()->Signal(); + state_change_event.GetWritableEvent().Signal(); } } void SignalBatteryVoltageStateChanged() { if (should_signal && should_signal_battery_voltage) { - state_change_event.GetWritableEvent()->Signal(); + state_change_event.GetWritableEvent().Signal(); } } diff --git a/src/core/hle/service/vi/display/vi_display.cpp b/src/core/hle/service/vi/display/vi_display.cpp index 7c52b6aa74..becbd36c17 100644 --- a/src/core/hle/service/vi/display/vi_display.cpp +++ b/src/core/hle/service/vi/display/vi_display.cpp @@ -33,12 +33,12 @@ const Layer& Display::GetLayer(std::size_t index) const { return *layers.at(index); } -std::shared_ptr Display::GetVSyncEvent() const { +Kernel::KReadableEvent& Display::GetVSyncEvent() { return vsync_event.GetReadableEvent(); } void Display::SignalVSyncEvent() { - vsync_event.GetWritableEvent()->Signal(); + vsync_event.GetWritableEvent().Signal(); } void Display::CreateLayer(u64 layer_id, NVFlinger::BufferQueue& buffer_queue) { diff --git a/src/core/hle/service/vi/display/vi_display.h b/src/core/hle/service/vi/display/vi_display.h index e990d6809f..a09d982bc7 100644 --- a/src/core/hle/service/vi/display/vi_display.h +++ b/src/core/hle/service/vi/display/vi_display.h @@ -59,7 +59,7 @@ public: const Layer& GetLayer(std::size_t index) const; /// Gets the readable vsync event. - std::shared_ptr GetVSyncEvent() const; + Kernel::KReadableEvent& GetVSyncEvent(); /// Signals the internal vsync event. void SignalVSyncEvent(); diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 6e507bfb86..32e47a43ee 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -669,12 +669,10 @@ private: LOG_WARNING(Service_VI, "(STUBBED) called id={}, unknown={:08X}", id, unknown); - const auto& buffer_queue = *nv_flinger.FindBufferQueue(id); - // TODO(Subv): Find out what this actually is. IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(buffer_queue.GetBufferWaitEvent().get()); + rb.PushCopyObjects(nv_flinger.FindBufferQueue(id)->GetBufferWaitEvent()); } NVFlinger::NVFlinger& nv_flinger; @@ -1209,7 +1207,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(vsync_event.get()); + rb.PushCopyObjects(vsync_event); } void ConvertScalingMode(Kernel::HLERequestContext& ctx) {