summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-08-26 05:59:28 +0200
committerGitHub <noreply@github.com>2021-08-26 05:59:28 +0200
commit0c8594b2251cf600afc3a89ecf1114eb3a25f700 (patch)
treed6f7d065cd8e2f00c85b9749076ef303a705c864 /src/core/hle/service
parentMerge pull request #6919 from ameerj/vk-int8-capability (diff)
downloadyuzu-0c8594b2251cf600afc3a89ecf1114eb3a25f700.tar
yuzu-0c8594b2251cf600afc3a89ecf1114eb3a25f700.tar.gz
yuzu-0c8594b2251cf600afc3a89ecf1114eb3a25f700.tar.bz2
yuzu-0c8594b2251cf600afc3a89ecf1114eb3a25f700.tar.lz
yuzu-0c8594b2251cf600afc3a89ecf1114eb3a25f700.tar.xz
yuzu-0c8594b2251cf600afc3a89ecf1114eb3a25f700.tar.zst
yuzu-0c8594b2251cf600afc3a89ecf1114eb3a25f700.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.cpp25
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.h11
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp15
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.h3
-rw-r--r--src/core/hle/service/vi/display/vi_display.cpp17
-rw-r--r--src/core/hle/service/vi/display/vi_display.h13
6 files changed, 30 insertions, 54 deletions
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp
index b4c3a6099..59ddf6298 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue.cpp
@@ -9,20 +9,17 @@
#include "core/core.h"
#include "core/hle/kernel/k_writable_event.h"
#include "core/hle/kernel/kernel.h"
-#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/nvflinger/buffer_queue.h"
namespace Service::NVFlinger {
-BufferQueue::BufferQueue(Kernel::KernelCore& kernel, u32 id_, u64 layer_id_,
- KernelHelpers::ServiceContext& service_context_)
- : id(id_), layer_id(layer_id_), service_context{service_context_} {
- buffer_wait_event = service_context.CreateEvent("BufferQueue:WaitEvent");
+BufferQueue::BufferQueue(Kernel::KernelCore& kernel, u32 id_, u64 layer_id_)
+ : id(id_), layer_id(layer_id_), buffer_wait_event{kernel} {
+ Kernel::KAutoObject::Create(std::addressof(buffer_wait_event));
+ buffer_wait_event.Initialize("BufferQueue:WaitEvent");
}
-BufferQueue::~BufferQueue() {
- service_context.CloseEvent(buffer_wait_event);
-}
+BufferQueue::~BufferQueue() = default;
void BufferQueue::SetPreallocatedBuffer(u32 slot, const IGBPBuffer& igbp_buffer) {
ASSERT(slot < buffer_slots);
@@ -44,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,
@@ -122,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() {
@@ -157,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() {
@@ -172,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();
}
@@ -192,11 +189,11 @@ u32 BufferQueue::Query(QueryType type) {
}
Kernel::KWritableEvent& BufferQueue::GetWritableBufferWaitEvent() {
- return buffer_wait_event->GetWritableEvent();
+ return buffer_wait_event.GetWritableEvent();
}
Kernel::KReadableEvent& BufferQueue::GetBufferWaitEvent() {
- return 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 759247eb0..61e337ac5 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.h
+++ b/src/core/hle/service/nvflinger/buffer_queue.h
@@ -24,10 +24,6 @@ class KReadableEvent;
class KWritableEvent;
} // namespace Kernel
-namespace Service::KernelHelpers {
-class ServiceContext;
-} // namespace Service::KernelHelpers
-
namespace Service::NVFlinger {
constexpr u32 buffer_slots = 0x40;
@@ -58,8 +54,7 @@ public:
NativeWindowFormat = 2,
};
- explicit BufferQueue(Kernel::KernelCore& kernel, u32 id_, u64 layer_id_,
- KernelHelpers::ServiceContext& service_context_);
+ explicit BufferQueue(Kernel::KernelCore& kernel, u32 id_, u64 layer_id_);
~BufferQueue();
enum class BufferTransformFlags : u32 {
@@ -135,14 +130,12 @@ private:
std::list<u32> free_buffers;
std::array<Buffer, buffer_slots> buffers;
std::list<u32> queue_sequence;
- Kernel::KEvent* buffer_wait_event{};
+ Kernel::KEvent buffer_wait_event;
std::mutex free_buffers_mutex;
std::condition_variable free_buffers_condition;
std::mutex queue_sequence_mutex;
-
- KernelHelpers::ServiceContext& service_context;
};
} // namespace Service::NVFlinger
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index 00bff8caf..941748970 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -61,13 +61,12 @@ void NVFlinger::SplitVSync() {
}
}
-NVFlinger::NVFlinger(Core::System& system_)
- : system(system_), service_context(system_, "nvflinger") {
- displays.emplace_back(0, "Default", service_context, system);
- displays.emplace_back(1, "External", service_context, system);
- displays.emplace_back(2, "Edid", service_context, system);
- displays.emplace_back(3, "Internal", service_context, system);
- displays.emplace_back(4, "Null", service_context, system);
+NVFlinger::NVFlinger(Core::System& system_) : system(system_) {
+ displays.emplace_back(0, "Default", system);
+ displays.emplace_back(1, "External", system);
+ displays.emplace_back(2, "Edid", system);
+ displays.emplace_back(3, "Internal", system);
+ displays.emplace_back(4, "Null", system);
guard = std::make_shared<std::mutex>();
// Schedule the screen composition events
@@ -147,7 +146,7 @@ std::optional<u64> NVFlinger::CreateLayer(u64 display_id) {
void NVFlinger::CreateLayerAtId(VI::Display& display, u64 layer_id) {
const u32 buffer_queue_id = next_buffer_queue_id++;
buffer_queues.emplace_back(
- std::make_unique<BufferQueue>(system.Kernel(), buffer_queue_id, layer_id, service_context));
+ std::make_unique<BufferQueue>(system.Kernel(), buffer_queue_id, layer_id));
display.CreateLayer(layer_id, *buffer_queues.back());
}
diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h
index 6d84cafb4..d80fd07ef 100644
--- a/src/core/hle/service/nvflinger/nvflinger.h
+++ b/src/core/hle/service/nvflinger/nvflinger.h
@@ -15,7 +15,6 @@
#include <vector>
#include "common/common_types.h"
-#include "core/hle/service/kernel_helpers.h"
namespace Common {
class Event;
@@ -136,8 +135,6 @@ private:
std::unique_ptr<std::thread> vsync_thread;
std::unique_ptr<Common::Event> wait_event;
std::atomic<bool> is_running{};
-
- KernelHelpers::ServiceContext service_context;
};
} // namespace Service::NVFlinger
diff --git a/src/core/hle/service/vi/display/vi_display.cpp b/src/core/hle/service/vi/display/vi_display.cpp
index b7705c02a..0dd342dbf 100644
--- a/src/core/hle/service/vi/display/vi_display.cpp
+++ b/src/core/hle/service/vi/display/vi_display.cpp
@@ -12,21 +12,18 @@
#include "core/hle/kernel/k_event.h"
#include "core/hle/kernel/k_readable_event.h"
#include "core/hle/kernel/k_writable_event.h"
-#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/vi/display/vi_display.h"
#include "core/hle/service/vi/layer/vi_layer.h"
namespace Service::VI {
-Display::Display(u64 id, std::string name_, KernelHelpers::ServiceContext& service_context_,
- Core::System& system_)
- : display_id{id}, name{std::move(name_)}, service_context{service_context_} {
- vsync_event = service_context.CreateEvent(fmt::format("Display VSync Event {}", id));
+Display::Display(u64 id, std::string name_, Core::System& system)
+ : display_id{id}, name{std::move(name_)}, vsync_event{system.Kernel()} {
+ Kernel::KAutoObject::Create(std::addressof(vsync_event));
+ vsync_event.Initialize(fmt::format("Display VSync Event {}", id));
}
-Display::~Display() {
- service_context.CloseEvent(vsync_event);
-}
+Display::~Display() = default;
Layer& Display::GetLayer(std::size_t index) {
return *layers.at(index);
@@ -37,11 +34,11 @@ const Layer& Display::GetLayer(std::size_t index) const {
}
Kernel::KReadableEvent& Display::GetVSyncEvent() {
- return vsync_event->GetReadableEvent();
+ 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 0979fc421..166f2a4cc 100644
--- a/src/core/hle/service/vi/display/vi_display.h
+++ b/src/core/hle/service/vi/display/vi_display.h
@@ -18,9 +18,6 @@ class KEvent;
namespace Service::NVFlinger {
class BufferQueue;
}
-namespace Service::KernelHelpers {
-class ServiceContext;
-} // namespace Service::KernelHelpers
namespace Service::VI {
@@ -34,13 +31,10 @@ class Display {
public:
/// Constructs a display with a given unique ID and name.
///
- /// @param id The unique ID for this display.
- /// @param service_context_ The ServiceContext for the owning service.
+ /// @param id The unique ID for this display.
/// @param name_ The name for this display.
- /// @param system_ The global system instance.
///
- Display(u64 id, std::string name_, KernelHelpers::ServiceContext& service_context_,
- Core::System& system_);
+ Display(u64 id, std::string name_, Core::System& system);
~Display();
/// Gets the unique ID assigned to this display.
@@ -104,10 +98,9 @@ public:
private:
u64 display_id;
std::string name;
- KernelHelpers::ServiceContext& service_context;
std::vector<std::shared_ptr<Layer>> layers;
- Kernel::KEvent* vsync_event{};
+ Kernel::KEvent vsync_event;
};
} // namespace Service::VI