diff options
| -rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.cpp | 13 | ||||
| -rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.h | 5 | ||||
| -rw-r--r-- | src/core/hle/service/vi/display/vi_display.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 8 |
4 files changed, 28 insertions, 4 deletions
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index dad93b38e..c3af12c90 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp | |||
| @@ -138,6 +138,19 @@ std::optional<u64> NVFlinger::OpenDisplay(std::string_view name) { | |||
| 138 | return itr->GetID(); | 138 | return itr->GetID(); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | bool NVFlinger::CloseDisplay(u64 display_id) { | ||
| 142 | const auto lock_guard = Lock(); | ||
| 143 | auto* const display = FindDisplay(display_id); | ||
| 144 | |||
| 145 | if (display == nullptr) { | ||
| 146 | return false; | ||
| 147 | } | ||
| 148 | |||
| 149 | display->Reset(); | ||
| 150 | |||
| 151 | return true; | ||
| 152 | } | ||
| 153 | |||
| 141 | std::optional<u64> NVFlinger::CreateLayer(u64 display_id) { | 154 | std::optional<u64> NVFlinger::CreateLayer(u64 display_id) { |
| 142 | const auto lock_guard = Lock(); | 155 | const auto lock_guard = Lock(); |
| 143 | auto* const display = FindDisplay(display_id); | 156 | auto* const display = FindDisplay(display_id); |
diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h index b8191c595..460bef976 100644 --- a/src/core/hle/service/nvflinger/nvflinger.h +++ b/src/core/hle/service/nvflinger/nvflinger.h | |||
| @@ -58,6 +58,11 @@ public: | |||
| 58 | /// If an invalid display name is provided, then an empty optional is returned. | 58 | /// If an invalid display name is provided, then an empty optional is returned. |
| 59 | [[nodiscard]] std::optional<u64> OpenDisplay(std::string_view name); | 59 | [[nodiscard]] std::optional<u64> OpenDisplay(std::string_view name); |
| 60 | 60 | ||
| 61 | /// Closes the specified display by its ID. | ||
| 62 | /// | ||
| 63 | /// Returns false if an invalid display ID is provided. | ||
| 64 | [[nodiscard]] bool CloseDisplay(u64 display_id); | ||
| 65 | |||
| 61 | /// Creates a layer on the specified display and returns the layer ID. | 66 | /// Creates a layer on the specified display and returns the layer ID. |
| 62 | /// | 67 | /// |
| 63 | /// If an invalid display ID is specified, then an empty optional is returned. | 68 | /// If an invalid display ID is specified, then an empty optional is returned. |
diff --git a/src/core/hle/service/vi/display/vi_display.h b/src/core/hle/service/vi/display/vi_display.h index 33d5f398c..0b65a65da 100644 --- a/src/core/hle/service/vi/display/vi_display.h +++ b/src/core/hle/service/vi/display/vi_display.h | |||
| @@ -106,6 +106,12 @@ public: | |||
| 106 | /// | 106 | /// |
| 107 | void CloseLayer(u64 layer_id); | 107 | void CloseLayer(u64 layer_id); |
| 108 | 108 | ||
| 109 | /// Resets the display for a new connection. | ||
| 110 | void Reset() { | ||
| 111 | layers.clear(); | ||
| 112 | got_vsync_event = false; | ||
| 113 | } | ||
| 114 | |||
| 109 | /// Attempts to find a layer with the given ID. | 115 | /// Attempts to find a layer with the given ID. |
| 110 | /// | 116 | /// |
| 111 | /// @param layer_id The layer ID. | 117 | /// @param layer_id The layer ID. |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 9c917cacf..bb283e74e 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -324,10 +324,10 @@ private: | |||
| 324 | IPC::RequestParser rp{ctx}; | 324 | IPC::RequestParser rp{ctx}; |
| 325 | const u64 display = rp.Pop<u64>(); | 325 | const u64 display = rp.Pop<u64>(); |
| 326 | 326 | ||
| 327 | LOG_WARNING(Service_VI, "(STUBBED) called. display=0x{:016X}", display); | 327 | const Result rc = nv_flinger.CloseDisplay(display) ? ResultSuccess : ResultUnknown; |
| 328 | 328 | ||
| 329 | IPC::ResponseBuilder rb{ctx, 2}; | 329 | IPC::ResponseBuilder rb{ctx, 2}; |
| 330 | rb.Push(ResultSuccess); | 330 | rb.Push(rc); |
| 331 | } | 331 | } |
| 332 | 332 | ||
| 333 | void CreateManagedLayer(Kernel::HLERequestContext& ctx) { | 333 | void CreateManagedLayer(Kernel::HLERequestContext& ctx) { |
| @@ -508,10 +508,10 @@ private: | |||
| 508 | IPC::RequestParser rp{ctx}; | 508 | IPC::RequestParser rp{ctx}; |
| 509 | const u64 display_id = rp.Pop<u64>(); | 509 | const u64 display_id = rp.Pop<u64>(); |
| 510 | 510 | ||
| 511 | LOG_WARNING(Service_VI, "(STUBBED) called. display_id=0x{:016X}", display_id); | 511 | const Result rc = nv_flinger.CloseDisplay(display_id) ? ResultSuccess : ResultUnknown; |
| 512 | 512 | ||
| 513 | IPC::ResponseBuilder rb{ctx, 2}; | 513 | IPC::ResponseBuilder rb{ctx, 2}; |
| 514 | rb.Push(ResultSuccess); | 514 | rb.Push(rc); |
| 515 | } | 515 | } |
| 516 | 516 | ||
| 517 | // This literally does nothing internally in the actual service itself, | 517 | // This literally does nothing internally in the actual service itself, |