summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvflinger
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/nvflinger')
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.cpp14
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.h8
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp10
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.h2
4 files changed, 13 insertions, 21 deletions
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp
index 7b07750b5..fc07d9bb8 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue.cpp
@@ -16,8 +16,8 @@ namespace Service::NVFlinger {
BufferQueue::BufferQueue(u32 id, u64 layer_id) : id(id), layer_id(layer_id) {
auto& kernel = Core::System::GetInstance().Kernel();
- buffer_wait_event = Kernel::WritableEvent::CreateRegisteredEventPair(
- kernel, Kernel::ResetType::Sticky, "BufferQueue NativeHandle");
+ buffer_wait_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Sticky,
+ "BufferQueue NativeHandle");
}
BufferQueue::~BufferQueue() = default;
@@ -31,7 +31,7 @@ void BufferQueue::SetPreallocatedBuffer(u32 slot, const IGBPBuffer& igbp_buffer)
buffer.status = Buffer::Status::Free;
queue.emplace_back(buffer);
- buffer_wait_event->Signal();
+ buffer_wait_event.writable->Signal();
}
std::optional<u32> BufferQueue::DequeueBuffer(u32 width, u32 height) {
@@ -90,7 +90,7 @@ void BufferQueue::ReleaseBuffer(u32 slot) {
ASSERT(itr->status == Buffer::Status::Acquired);
itr->status = Buffer::Status::Free;
- buffer_wait_event->Signal();
+ buffer_wait_event.writable->Signal();
}
u32 BufferQueue::Query(QueryType type) {
@@ -108,13 +108,11 @@ u32 BufferQueue::Query(QueryType type) {
}
Kernel::SharedPtr<Kernel::WritableEvent> BufferQueue::GetWritableBufferWaitEvent() const {
- return buffer_wait_event;
+ return buffer_wait_event.writable;
}
Kernel::SharedPtr<Kernel::ReadableEvent> BufferQueue::GetBufferWaitEvent() const {
- const auto& event{
- Core::System::GetInstance().Kernel().FindNamedEvent("BufferQueue NativeHandle")};
- return event->second;
+ return buffer_wait_event.readable;
}
} // namespace Service::NVFlinger
diff --git a/src/core/hle/service/nvflinger/buffer_queue.h b/src/core/hle/service/nvflinger/buffer_queue.h
index 8b2a2b7de..b171f256c 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.h
+++ b/src/core/hle/service/nvflinger/buffer_queue.h
@@ -11,16 +11,12 @@
#include "common/math_util.h"
#include "common/swap.h"
#include "core/hle/kernel/object.h"
+#include "core/hle/kernel/writable_event.h"
namespace CoreTiming {
struct EventType;
}
-namespace Kernel {
-class ReadableEvent;
-class WritableEvent;
-} // namespace Kernel
-
namespace Service::NVFlinger {
struct IGBPBuffer {
@@ -100,7 +96,7 @@ private:
u64 layer_id;
std::vector<Buffer> queue;
- Kernel::SharedPtr<Kernel::WritableEvent> buffer_wait_event;
+ Kernel::EventPair buffer_wait_event;
};
} // namespace Service::NVFlinger
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index 2a329cb8e..05af2d593 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -87,9 +87,7 @@ u32 NVFlinger::GetBufferQueueId(u64 display_id, u64 layer_id) {
}
Kernel::SharedPtr<Kernel::ReadableEvent> NVFlinger::GetVsyncEvent(u64 display_id) {
- const auto& event{Core::System::GetInstance().Kernel().FindNamedEvent(
- fmt::format("Display VSync Event {}", display_id))};
- return event->second;
+ return GetDisplay(display_id).vsync_event.readable;
}
std::shared_ptr<BufferQueue> NVFlinger::GetBufferQueue(u32 id) const {
@@ -121,7 +119,7 @@ Layer& NVFlinger::GetLayer(u64 display_id, u64 layer_id) {
void NVFlinger::Compose() {
for (auto& display : displays) {
// Trigger vsync for this display at the end of drawing
- SCOPE_EXIT({ display.vsync_event->Signal(); });
+ SCOPE_EXIT({ display.vsync_event.writable->Signal(); });
// Don't do anything for displays without layers.
if (display.layers.empty())
@@ -168,8 +166,8 @@ Layer::~Layer() = default;
Display::Display(u64 id, std::string name) : id(id), name(std::move(name)) {
auto& kernel = Core::System::GetInstance().Kernel();
- vsync_event = Kernel::WritableEvent::CreateRegisteredEventPair(
- kernel, Kernel::ResetType::Pulse, fmt::format("Display VSync Event {}", id));
+ vsync_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Pulse,
+ fmt::format("Display VSync Event {}", id));
}
Display::~Display() = default;
diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h
index 1a9e74f35..9abba555b 100644
--- a/src/core/hle/service/nvflinger/nvflinger.h
+++ b/src/core/hle/service/nvflinger/nvflinger.h
@@ -45,7 +45,7 @@ struct Display {
std::string name;
std::vector<Layer> layers;
- Kernel::SharedPtr<Kernel::WritableEvent> vsync_event;
+ Kernel::EventPair vsync_event;
};
class NVFlinger final {