From 574440d59fccba286a90f97d90d92dbe148440d3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 12 Oct 2019 09:17:56 -0400 Subject: [PATCH] nvflinger/buffer_queue: Remove use of a global system accessor --- src/core/hle/service/nvflinger/buffer_queue.cpp | 4 ++-- src/core/hle/service/nvflinger/buffer_queue.h | 6 +++++- src/core/hle/service/nvflinger/nvflinger.cpp | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp index e1a07d3ee..55b68eb0c 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue.cpp @@ -14,8 +14,8 @@ namespace Service::NVFlinger { -BufferQueue::BufferQueue(u32 id, u64 layer_id) : id(id), layer_id(layer_id) { - auto& kernel = Core::System::GetInstance().Kernel(); +BufferQueue::BufferQueue(Kernel::KernelCore& kernel, u32 id, u64 layer_id) + : id(id), layer_id(layer_id) { buffer_wait_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, "BufferQueue NativeHandle"); } diff --git a/src/core/hle/service/nvflinger/buffer_queue.h b/src/core/hle/service/nvflinger/buffer_queue.h index 356bedb81..8f9b18547 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.h +++ b/src/core/hle/service/nvflinger/buffer_queue.h @@ -15,6 +15,10 @@ #include "core/hle/kernel/writable_event.h" #include "core/hle/service/nvdrv/nvdata.h" +namespace Kernel { +class KernelCore; +} + namespace Service::NVFlinger { struct IGBPBuffer { @@ -44,7 +48,7 @@ public: NativeWindowFormat = 2, }; - BufferQueue(u32 id, u64 layer_id); + explicit BufferQueue(Kernel::KernelCore& kernel, u32 id, u64 layer_id); ~BufferQueue(); enum class BufferTransformFlags : u32 { diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index 2e4d707b9..368f83f6c 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -83,7 +83,7 @@ std::optional NVFlinger::CreateLayer(u64 display_id) { const u64 layer_id = next_layer_id++; const u32 buffer_queue_id = next_buffer_queue_id++; - buffer_queues.emplace_back(buffer_queue_id, layer_id); + buffer_queues.emplace_back(system.Kernel(), buffer_queue_id, layer_id); display->CreateLayer(layer_id, buffer_queues.back()); return layer_id; }