1
1
Fork 0
forked from suyu/suyu

nvflinger/buffer_queue: Remove use of a global system accessor

This commit is contained in:
Lioncash 2019-10-12 09:17:56 -04:00
parent b41692b69b
commit 574440d59f
3 changed files with 8 additions and 4 deletions

View file

@ -14,8 +14,8 @@
namespace Service::NVFlinger { namespace Service::NVFlinger {
BufferQueue::BufferQueue(u32 id, u64 layer_id) : id(id), layer_id(layer_id) { BufferQueue::BufferQueue(Kernel::KernelCore& kernel, u32 id, u64 layer_id)
auto& kernel = Core::System::GetInstance().Kernel(); : id(id), layer_id(layer_id) {
buffer_wait_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, buffer_wait_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual,
"BufferQueue NativeHandle"); "BufferQueue NativeHandle");
} }

View file

@ -15,6 +15,10 @@
#include "core/hle/kernel/writable_event.h" #include "core/hle/kernel/writable_event.h"
#include "core/hle/service/nvdrv/nvdata.h" #include "core/hle/service/nvdrv/nvdata.h"
namespace Kernel {
class KernelCore;
}
namespace Service::NVFlinger { namespace Service::NVFlinger {
struct IGBPBuffer { struct IGBPBuffer {
@ -44,7 +48,7 @@ public:
NativeWindowFormat = 2, NativeWindowFormat = 2,
}; };
BufferQueue(u32 id, u64 layer_id); explicit BufferQueue(Kernel::KernelCore& kernel, u32 id, u64 layer_id);
~BufferQueue(); ~BufferQueue();
enum class BufferTransformFlags : u32 { enum class BufferTransformFlags : u32 {

View file

@ -83,7 +83,7 @@ std::optional<u64> NVFlinger::CreateLayer(u64 display_id) {
const u64 layer_id = next_layer_id++; const u64 layer_id = next_layer_id++;
const u32 buffer_queue_id = next_buffer_queue_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()); display->CreateLayer(layer_id, buffer_queues.back());
return layer_id; return layer_id;
} }