diff options
| author | 2024-01-06 23:58:04 -0500 | |
|---|---|---|
| committer | 2024-01-07 21:47:41 -0500 | |
| commit | ea710e652398f0646aeb1a1cdf78cee9691440e8 (patch) | |
| tree | c2f6495907b42ade4416c51c2781734d4a3e4313 | |
| parent | vi: fix name of nvnflinger (diff) | |
| download | yuzu-ea710e652398f0646aeb1a1cdf78cee9691440e8.tar.gz yuzu-ea710e652398f0646aeb1a1cdf78cee9691440e8.tar.xz yuzu-ea710e652398f0646aeb1a1cdf78cee9691440e8.zip | |
vi: connect vsync event handle lifetime to application display service interface
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/nvnflinger/nvnflinger.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/vi/display/vi_display.cpp | 13 | ||||
| -rw-r--r-- | src/core/hle/service/vi/display/vi_display.h | 12 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 7 |
4 files changed, 11 insertions, 24 deletions
diff --git a/src/core/hle/service/nvnflinger/nvnflinger.cpp b/src/core/hle/service/nvnflinger/nvnflinger.cpp index aa8aaa2d9..0469110e8 100644 --- a/src/core/hle/service/nvnflinger/nvnflinger.cpp +++ b/src/core/hle/service/nvnflinger/nvnflinger.cpp | |||
| @@ -223,7 +223,8 @@ Result Nvnflinger::FindVsyncEvent(Kernel::KReadableEvent** out_vsync_event, u64 | |||
| 223 | return VI::ResultNotFound; | 223 | return VI::ResultNotFound; |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | return display->GetVSyncEvent(out_vsync_event); | 226 | *out_vsync_event = display->GetVSyncEvent(); |
| 227 | return ResultSuccess; | ||
| 227 | } | 228 | } |
| 228 | 229 | ||
| 229 | VI::Display* Nvnflinger::FindDisplay(u64 display_id) { | 230 | VI::Display* Nvnflinger::FindDisplay(u64 display_id) { |
diff --git a/src/core/hle/service/vi/display/vi_display.cpp b/src/core/hle/service/vi/display/vi_display.cpp index 71ce9be50..e2d9cd98a 100644 --- a/src/core/hle/service/vi/display/vi_display.cpp +++ b/src/core/hle/service/vi/display/vi_display.cpp | |||
| @@ -71,18 +71,7 @@ size_t Display::GetNumLayers() const { | |||
| 71 | return std::ranges::count_if(layers, [](auto& l) { return l->IsOpen(); }); | 71 | return std::ranges::count_if(layers, [](auto& l) { return l->IsOpen(); }); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | Result Display::GetVSyncEvent(Kernel::KReadableEvent** out_vsync_event) { | 74 | Kernel::KReadableEvent* Display::GetVSyncEvent() { |
| 75 | if (got_vsync_event) { | ||
| 76 | return ResultPermissionDenied; | ||
| 77 | } | ||
| 78 | |||
| 79 | got_vsync_event = true; | ||
| 80 | |||
| 81 | *out_vsync_event = GetVSyncEventUnchecked(); | ||
| 82 | return ResultSuccess; | ||
| 83 | } | ||
| 84 | |||
| 85 | Kernel::KReadableEvent* Display::GetVSyncEventUnchecked() { | ||
| 86 | return &vsync_event->GetReadableEvent(); | 75 | return &vsync_event->GetReadableEvent(); |
| 87 | } | 76 | } |
| 88 | 77 | ||
diff --git a/src/core/hle/service/vi/display/vi_display.h b/src/core/hle/service/vi/display/vi_display.h index 1d9360b96..7e68ee79b 100644 --- a/src/core/hle/service/vi/display/vi_display.h +++ b/src/core/hle/service/vi/display/vi_display.h | |||
| @@ -74,16 +74,8 @@ public: | |||
| 74 | 74 | ||
| 75 | std::size_t GetNumLayers() const; | 75 | std::size_t GetNumLayers() const; |
| 76 | 76 | ||
| 77 | /** | ||
| 78 | * Gets the internal vsync event. | ||
| 79 | * | ||
| 80 | * @returns The internal Vsync event if it has not yet been retrieved, | ||
| 81 | * VI::ResultPermissionDenied otherwise. | ||
| 82 | */ | ||
| 83 | [[nodiscard]] Result GetVSyncEvent(Kernel::KReadableEvent** out_vsync_event); | ||
| 84 | |||
| 85 | /// Gets the internal vsync event. | 77 | /// Gets the internal vsync event. |
| 86 | Kernel::KReadableEvent* GetVSyncEventUnchecked(); | 78 | Kernel::KReadableEvent* GetVSyncEvent(); |
| 87 | 79 | ||
| 88 | /// Signals the internal vsync event. | 80 | /// Signals the internal vsync event. |
| 89 | void SignalVSyncEvent(); | 81 | void SignalVSyncEvent(); |
| @@ -104,7 +96,6 @@ public: | |||
| 104 | /// Resets the display for a new connection. | 96 | /// Resets the display for a new connection. |
| 105 | void Reset() { | 97 | void Reset() { |
| 106 | layers.clear(); | 98 | layers.clear(); |
| 107 | got_vsync_event = false; | ||
| 108 | } | 99 | } |
| 109 | 100 | ||
| 110 | /// Attempts to find a layer with the given ID. | 101 | /// Attempts to find a layer with the given ID. |
| @@ -133,7 +124,6 @@ private: | |||
| 133 | 124 | ||
| 134 | std::vector<std::unique_ptr<Layer>> layers; | 125 | std::vector<std::unique_ptr<Layer>> layers; |
| 135 | Kernel::KEvent* vsync_event{}; | 126 | Kernel::KEvent* vsync_event{}; |
| 136 | bool got_vsync_event{false}; | ||
| 137 | }; | 127 | }; |
| 138 | 128 | ||
| 139 | } // namespace Service::VI | 129 | } // namespace Service::VI |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 29471abfe..39d5be90d 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -808,6 +808,12 @@ private: | |||
| 808 | rb.Push(result); | 808 | rb.Push(result); |
| 809 | return; | 809 | return; |
| 810 | } | 810 | } |
| 811 | if (vsync_event_fetched) { | ||
| 812 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 813 | rb.Push(VI::ResultPermissionDenied); | ||
| 814 | return; | ||
| 815 | } | ||
| 816 | vsync_event_fetched = true; | ||
| 811 | 817 | ||
| 812 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 818 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 813 | rb.Push(ResultSuccess); | 819 | rb.Push(ResultSuccess); |
| @@ -901,6 +907,7 @@ private: | |||
| 901 | 907 | ||
| 902 | Nvnflinger::Nvnflinger& nvnflinger; | 908 | Nvnflinger::Nvnflinger& nvnflinger; |
| 903 | Nvnflinger::HosBinderDriverServer& hos_binder_driver_server; | 909 | Nvnflinger::HosBinderDriverServer& hos_binder_driver_server; |
| 910 | bool vsync_event_fetched{false}; | ||
| 904 | }; | 911 | }; |
| 905 | 912 | ||
| 906 | static bool IsValidServiceAccess(Permission permission, Policy policy) { | 913 | static bool IsValidServiceAccess(Permission permission, Policy policy) { |