diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.cpp | 13 | ||||
| -rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.h | 3 | ||||
| -rw-r--r-- | src/core/hle/service/vi/display/vi_display.cpp | 17 | ||||
| -rw-r--r-- | src/core/hle/service/vi/display/vi_display.h | 13 |
4 files changed, 30 insertions, 16 deletions
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index 941748970..32d4e360a 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp | |||
| @@ -61,12 +61,13 @@ void NVFlinger::SplitVSync() { | |||
| 61 | } | 61 | } |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | NVFlinger::NVFlinger(Core::System& system_) : system(system_) { | 64 | NVFlinger::NVFlinger(Core::System& system_) |
| 65 | displays.emplace_back(0, "Default", system); | 65 | : system(system_), service_context(system_, "nvflinger") { |
| 66 | displays.emplace_back(1, "External", system); | 66 | displays.emplace_back(0, "Default", service_context, system); |
| 67 | displays.emplace_back(2, "Edid", system); | 67 | displays.emplace_back(1, "External", service_context, system); |
| 68 | displays.emplace_back(3, "Internal", system); | 68 | displays.emplace_back(2, "Edid", service_context, system); |
| 69 | displays.emplace_back(4, "Null", system); | 69 | displays.emplace_back(3, "Internal", service_context, system); |
| 70 | displays.emplace_back(4, "Null", service_context, system); | ||
| 70 | guard = std::make_shared<std::mutex>(); | 71 | guard = std::make_shared<std::mutex>(); |
| 71 | 72 | ||
| 72 | // Schedule the screen composition events | 73 | // Schedule the screen composition events |
diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h index d80fd07ef..6d84cafb4 100644 --- a/src/core/hle/service/nvflinger/nvflinger.h +++ b/src/core/hle/service/nvflinger/nvflinger.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <vector> | 15 | #include <vector> |
| 16 | 16 | ||
| 17 | #include "common/common_types.h" | 17 | #include "common/common_types.h" |
| 18 | #include "core/hle/service/kernel_helpers.h" | ||
| 18 | 19 | ||
| 19 | namespace Common { | 20 | namespace Common { |
| 20 | class Event; | 21 | class Event; |
| @@ -135,6 +136,8 @@ private: | |||
| 135 | std::unique_ptr<std::thread> vsync_thread; | 136 | std::unique_ptr<std::thread> vsync_thread; |
| 136 | std::unique_ptr<Common::Event> wait_event; | 137 | std::unique_ptr<Common::Event> wait_event; |
| 137 | std::atomic<bool> is_running{}; | 138 | std::atomic<bool> is_running{}; |
| 139 | |||
| 140 | KernelHelpers::ServiceContext service_context; | ||
| 138 | }; | 141 | }; |
| 139 | 142 | ||
| 140 | } // namespace Service::NVFlinger | 143 | } // 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 0dd342dbf..b7705c02a 100644 --- a/src/core/hle/service/vi/display/vi_display.cpp +++ b/src/core/hle/service/vi/display/vi_display.cpp | |||
| @@ -12,18 +12,21 @@ | |||
| 12 | #include "core/hle/kernel/k_event.h" | 12 | #include "core/hle/kernel/k_event.h" |
| 13 | #include "core/hle/kernel/k_readable_event.h" | 13 | #include "core/hle/kernel/k_readable_event.h" |
| 14 | #include "core/hle/kernel/k_writable_event.h" | 14 | #include "core/hle/kernel/k_writable_event.h" |
| 15 | #include "core/hle/service/kernel_helpers.h" | ||
| 15 | #include "core/hle/service/vi/display/vi_display.h" | 16 | #include "core/hle/service/vi/display/vi_display.h" |
| 16 | #include "core/hle/service/vi/layer/vi_layer.h" | 17 | #include "core/hle/service/vi/layer/vi_layer.h" |
| 17 | 18 | ||
| 18 | namespace Service::VI { | 19 | namespace Service::VI { |
| 19 | 20 | ||
| 20 | Display::Display(u64 id, std::string name_, Core::System& system) | 21 | Display::Display(u64 id, std::string name_, KernelHelpers::ServiceContext& service_context_, |
| 21 | : display_id{id}, name{std::move(name_)}, vsync_event{system.Kernel()} { | 22 | Core::System& system_) |
| 22 | Kernel::KAutoObject::Create(std::addressof(vsync_event)); | 23 | : display_id{id}, name{std::move(name_)}, service_context{service_context_} { |
| 23 | vsync_event.Initialize(fmt::format("Display VSync Event {}", id)); | 24 | vsync_event = service_context.CreateEvent(fmt::format("Display VSync Event {}", id)); |
| 24 | } | 25 | } |
| 25 | 26 | ||
| 26 | Display::~Display() = default; | 27 | Display::~Display() { |
| 28 | service_context.CloseEvent(vsync_event); | ||
| 29 | } | ||
| 27 | 30 | ||
| 28 | Layer& Display::GetLayer(std::size_t index) { | 31 | Layer& Display::GetLayer(std::size_t index) { |
| 29 | return *layers.at(index); | 32 | return *layers.at(index); |
| @@ -34,11 +37,11 @@ const Layer& Display::GetLayer(std::size_t index) const { | |||
| 34 | } | 37 | } |
| 35 | 38 | ||
| 36 | Kernel::KReadableEvent& Display::GetVSyncEvent() { | 39 | Kernel::KReadableEvent& Display::GetVSyncEvent() { |
| 37 | return vsync_event.GetReadableEvent(); | 40 | return vsync_event->GetReadableEvent(); |
| 38 | } | 41 | } |
| 39 | 42 | ||
| 40 | void Display::SignalVSyncEvent() { | 43 | void Display::SignalVSyncEvent() { |
| 41 | vsync_event.GetWritableEvent().Signal(); | 44 | vsync_event->GetWritableEvent().Signal(); |
| 42 | } | 45 | } |
| 43 | 46 | ||
| 44 | void Display::CreateLayer(u64 layer_id, NVFlinger::BufferQueue& buffer_queue) { | 47 | 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 166f2a4cc..0979fc421 100644 --- a/src/core/hle/service/vi/display/vi_display.h +++ b/src/core/hle/service/vi/display/vi_display.h | |||
| @@ -18,6 +18,9 @@ class KEvent; | |||
| 18 | namespace Service::NVFlinger { | 18 | namespace Service::NVFlinger { |
| 19 | class BufferQueue; | 19 | class BufferQueue; |
| 20 | } | 20 | } |
| 21 | namespace Service::KernelHelpers { | ||
| 22 | class ServiceContext; | ||
| 23 | } // namespace Service::KernelHelpers | ||
| 21 | 24 | ||
| 22 | namespace Service::VI { | 25 | namespace Service::VI { |
| 23 | 26 | ||
| @@ -31,10 +34,13 @@ class Display { | |||
| 31 | public: | 34 | public: |
| 32 | /// Constructs a display with a given unique ID and name. | 35 | /// Constructs a display with a given unique ID and name. |
| 33 | /// | 36 | /// |
| 34 | /// @param id The unique ID for this display. | 37 | /// @param id The unique ID for this display. |
| 38 | /// @param service_context_ The ServiceContext for the owning service. | ||
| 35 | /// @param name_ The name for this display. | 39 | /// @param name_ The name for this display. |
| 40 | /// @param system_ The global system instance. | ||
| 36 | /// | 41 | /// |
| 37 | Display(u64 id, std::string name_, Core::System& system); | 42 | Display(u64 id, std::string name_, KernelHelpers::ServiceContext& service_context_, |
| 43 | Core::System& system_); | ||
| 38 | ~Display(); | 44 | ~Display(); |
| 39 | 45 | ||
| 40 | /// Gets the unique ID assigned to this display. | 46 | /// Gets the unique ID assigned to this display. |
| @@ -98,9 +104,10 @@ public: | |||
| 98 | private: | 104 | private: |
| 99 | u64 display_id; | 105 | u64 display_id; |
| 100 | std::string name; | 106 | std::string name; |
| 107 | KernelHelpers::ServiceContext& service_context; | ||
| 101 | 108 | ||
| 102 | std::vector<std::shared_ptr<Layer>> layers; | 109 | std::vector<std::shared_ptr<Layer>> layers; |
| 103 | Kernel::KEvent vsync_event; | 110 | Kernel::KEvent* vsync_event{}; |
| 104 | }; | 111 | }; |
| 105 | 112 | ||
| 106 | } // namespace Service::VI | 113 | } // namespace Service::VI |