forked from ShuriZma/suyu
hle: kernel: Migrate KReadableEvent and KWritableEvent to KAutoObject.
This commit is contained in:
parent
eba3bb9d21
commit
2e8d6fe9a0
|
@ -54,7 +54,9 @@ ResultVal<Handle> 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<KAutoObject*>(obj), {});
|
||||
return MakeResult<Handle>(handle);
|
||||
|
|
|
@ -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<KReadableEvent>(kernel, name_ + ":Readable");
|
||||
writable_event = std::make_shared<KWritableEvent>(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();
|
||||
|
|
|
@ -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<uintptr_t>(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<KWritableEvent>& GetWritableEvent() {
|
||||
return writable_event;
|
||||
}
|
||||
|
||||
const std::shared_ptr<KReadableEvent>& GetReadableEvent() const {
|
||||
return readable_event;
|
||||
}
|
||||
|
||||
const std::shared_ptr<KWritableEvent>& GetWritableEvent() const {
|
||||
return writable_event;
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<KReadableEvent> readable_event;
|
||||
std::shared_ptr<KWritableEvent> writable_event;
|
||||
KReadableEvent readable_event;
|
||||
KWritableEvent writable_event;
|
||||
Process* owner{};
|
||||
bool initialized{};
|
||||
};
|
||||
|
|
|
@ -2,21 +2,18 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#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};
|
||||
|
||||
|
|
|
@ -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{};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<KWritableEvent, KAutoObjectWithList> {
|
||||
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{};
|
||||
};
|
||||
|
|
|
@ -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<T, KLinkedListNode>) {
|
||||
return slab_heap_container->linked_list_node;
|
||||
} else if constexpr (std::is_same_v<T, KWritableEvent>) {
|
||||
return slab_heap_container->writeable_event;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -308,6 +311,7 @@ private:
|
|||
KSlabHeap<KEvent> event;
|
||||
KSlabHeap<KSharedMemory> shared_memory;
|
||||
KSlabHeap<KLinkedListNode> linked_list_node;
|
||||
KSlabHeap<KWritableEvent> writeable_event;
|
||||
};
|
||||
|
||||
std::unique_ptr<SlabHeapContainer> slab_heap_container;
|
||||
|
|
|
@ -1745,16 +1745,16 @@ static ResultCode ResetSignal(Core::System& system, Handle handle) {
|
|||
|
||||
// Try to reset as readable event.
|
||||
{
|
||||
auto readable_event = handle_table.Get<KReadableEvent>(handle);
|
||||
if (readable_event) {
|
||||
KScopedAutoObject readable_event = handle_table.GetObject<KReadableEvent>(handle);
|
||||
if (readable_event.IsNotNull()) {
|
||||
return readable_event->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
// Try to reset as process.
|
||||
{
|
||||
auto process = handle_table.Get<Process>(handle);
|
||||
if (process) {
|
||||
KScopedAutoObject process = handle_table.GetObject<Process>(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<KWritableEvent>(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<KWritableEvent>(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<KWritableEvent>(event_handle);
|
||||
if (writable_event) {
|
||||
KScopedAutoObject writable_event = handle_table.GetObject<KWritableEvent>(event_handle);
|
||||
if (writable_event.IsNotNull()) {
|
||||
return writable_event->Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Try to clear the readable event.
|
||||
{
|
||||
auto readable_event = handle_table.Get<KReadableEvent>(event_handle);
|
||||
if (readable_event) {
|
||||
KScopedAutoObject readable_event = handle_table.GetObject<KReadableEvent>(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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -66,7 +66,7 @@ std::shared_ptr<IStorage> 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<IStorage> 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<IStorage>&& storag
|
|||
|
||||
void AppletDataBroker::PushNormalDataFromApplet(std::shared_ptr<IStorage>&& 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<IStorage>&& storage) {
|
||||
|
@ -113,11 +113,11 @@ void AppletDataBroker::PushInteractiveDataFromGame(std::shared_ptr<IStorage>&& s
|
|||
|
||||
void AppletDataBroker::PushInteractiveDataFromApplet(std::shared_ptr<IStorage>&& 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_)
|
||||
|
|
|
@ -96,11 +96,11 @@ public:
|
|||
void PushInteractiveDataFromGame(std::shared_ptr<IStorage>&& storage);
|
||||
void PushInteractiveDataFromApplet(std::shared_ptr<IStorage>&& 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;
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -19,7 +19,7 @@ ProgressServiceBackend::ProgressServiceBackend(Kernel::KernelCore& kernel,
|
|||
update_event.Initialize("ProgressServiceBackend:UpdateEvent:" + std::string(event_name));
|
||||
}
|
||||
|
||||
std::shared_ptr<Kernel::KReadableEvent> 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,10 +99,10 @@ public:
|
|||
private:
|
||||
explicit ProgressServiceBackend(Kernel::KernelCore& kernel, std::string_view event_name);
|
||||
|
||||
std::shared_ptr<Kernel::KReadableEvent> GetEvent() const;
|
||||
Kernel::KReadableEvent& GetEvent();
|
||||
DeliveryCacheProgressImpl& GetImpl();
|
||||
|
||||
void SignalUpdate() const;
|
||||
void SignalUpdate();
|
||||
|
||||
DeliveryCacheProgressImpl impl{};
|
||||
Kernel::KEvent update_event;
|
||||
|
|
|
@ -88,11 +88,9 @@ struct DeliveryCacheDirectoryEntry {
|
|||
|
||||
class IDeliveryCacheProgressService final : public ServiceFramework<IDeliveryCacheProgressService> {
|
||||
public:
|
||||
explicit IDeliveryCacheProgressService(Core::System& system_,
|
||||
std::shared_ptr<Kernel::KReadableEvent> 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<Kernel::KReadableEvent> event;
|
||||
Kernel::KReadableEvent& event;
|
||||
const DeliveryCacheProgressImpl& impl;
|
||||
};
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<u8>& 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 {
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
void CreateUserInterface(Kernel::HLERequestContext& ctx);
|
||||
bool LoadAmiibo(const std::vector<u8>& buffer);
|
||||
Kernel::KReadableEvent* GetNFCEvent() const;
|
||||
Kernel::KReadableEvent& GetNFCEvent();
|
||||
const AmiiboFile& GetAmiiboBuffer() const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -108,14 +108,14 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& 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<u8>& 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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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<Kernel::KReadableEvent> 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<Kernel::KWritableEvent> Module::GetEventWriteable(const u32 event_id) const {
|
||||
Kernel::KWritableEvent& Module::GetEventWriteable(const u32 event_id) {
|
||||
return events_interface.events[event_id].event->GetWritableEvent();
|
||||
}
|
||||
|
||||
|
|
|
@ -136,9 +136,9 @@ public:
|
|||
|
||||
void SignalSyncpt(const u32 syncpoint_id, const u32 value);
|
||||
|
||||
std::shared_ptr<Kernel::KReadableEvent> GetEvent(u32 event_id) const;
|
||||
Kernel::KReadableEvent& GetEvent(u32 event_id);
|
||||
|
||||
std::shared_ptr<Kernel::KWritableEvent> GetEventWriteable(u32 event_id) const;
|
||||
Kernel::KWritableEvent& GetEventWriteable(u32 event_id);
|
||||
|
||||
private:
|
||||
/// Manages syncpoints on the host
|
||||
|
|
|
@ -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<std::pair<u32, Service::Nvidia::MultiFence*>> 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<std::reference_wrapper<const BufferQueue::Buffer>> 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<Kernel::KWritableEvent> BufferQueue::GetWritableBufferWaitEvent() const {
|
||||
Kernel::KWritableEvent& BufferQueue::GetWritableBufferWaitEvent() {
|
||||
return buffer_wait_event.GetWritableEvent();
|
||||
}
|
||||
|
||||
std::shared_ptr<Kernel::KReadableEvent> BufferQueue::GetBufferWaitEvent() const {
|
||||
Kernel::KReadableEvent& BufferQueue::GetBufferWaitEvent() {
|
||||
return buffer_wait_event.GetReadableEvent();
|
||||
}
|
||||
|
||||
|
|
|
@ -117,9 +117,9 @@ public:
|
|||
return is_connect;
|
||||
}
|
||||
|
||||
std::shared_ptr<Kernel::KWritableEvent> GetWritableBufferWaitEvent() const;
|
||||
Kernel::KWritableEvent& GetWritableBufferWaitEvent();
|
||||
|
||||
std::shared_ptr<Kernel::KReadableEvent> GetBufferWaitEvent() const;
|
||||
Kernel::KReadableEvent& GetBufferWaitEvent();
|
||||
|
||||
private:
|
||||
BufferQueue(const BufferQueue&) = delete;
|
||||
|
|
|
@ -165,7 +165,7 @@ 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) {
|
||||
Kernel::KReadableEvent* NVFlinger::FindVsyncEvent(u64 display_id) {
|
||||
const auto lock_guard = Lock();
|
||||
auto* const display = FindDisplay(display_id);
|
||||
|
||||
|
@ -173,7 +173,7 @@ std::shared_ptr<Kernel::KReadableEvent> NVFlinger::FindVsyncEvent(u64 display_id
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return display->GetVSyncEvent();
|
||||
return &display->GetVSyncEvent();
|
||||
}
|
||||
|
||||
BufferQueue* NVFlinger::FindBufferQueue(u32 id) {
|
||||
|
|
|
@ -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<Kernel::KReadableEvent> FindVsyncEvent(u64 display_id);
|
||||
[[nodiscard]] Kernel::KReadableEvent* FindVsyncEvent(u64 display_id);
|
||||
|
||||
/// Obtains a buffer queue identified by the ID.
|
||||
[[nodiscard]] BufferQueue* FindBufferQueue(u32 id);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,12 +33,12 @@ const Layer& Display::GetLayer(std::size_t index) const {
|
|||
return *layers.at(index);
|
||||
}
|
||||
|
||||
std::shared_ptr<Kernel::KReadableEvent> 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) {
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
const Layer& GetLayer(std::size_t index) const;
|
||||
|
||||
/// Gets the readable vsync event.
|
||||
std::shared_ptr<Kernel::KReadableEvent> GetVSyncEvent() const;
|
||||
Kernel::KReadableEvent& GetVSyncEvent();
|
||||
|
||||
/// Signals the internal vsync event.
|
||||
void SignalVSyncEvent();
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue