diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/nvnflinger/nvnflinger.cpp | 12 | ||||
| -rw-r--r-- | src/core/hle/service/nvnflinger/nvnflinger.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/vi/layer/vi_layer.h | 9 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 14 |
4 files changed, 27 insertions, 12 deletions
diff --git a/src/core/hle/service/nvnflinger/nvnflinger.cpp b/src/core/hle/service/nvnflinger/nvnflinger.cpp index e05ff66ff..af6591370 100644 --- a/src/core/hle/service/nvnflinger/nvnflinger.cpp +++ b/src/core/hle/service/nvnflinger/nvnflinger.cpp | |||
| @@ -174,24 +174,28 @@ void Nvnflinger::CreateLayerAtId(VI::Display& display, u64 layer_id) { | |||
| 174 | display.CreateLayer(layer_id, buffer_id, nvdrv->container); | 174 | display.CreateLayer(layer_id, buffer_id, nvdrv->container); |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | void Nvnflinger::OpenLayer(u64 layer_id) { | 177 | bool Nvnflinger::OpenLayer(u64 layer_id) { |
| 178 | const auto lock_guard = Lock(); | 178 | const auto lock_guard = Lock(); |
| 179 | 179 | ||
| 180 | for (auto& display : displays) { | 180 | for (auto& display : displays) { |
| 181 | if (auto* layer = display.FindLayer(layer_id); layer) { | 181 | if (auto* layer = display.FindLayer(layer_id); layer) { |
| 182 | layer->Open(); | 182 | return layer->Open(); |
| 183 | } | 183 | } |
| 184 | } | 184 | } |
| 185 | |||
| 186 | return false; | ||
| 185 | } | 187 | } |
| 186 | 188 | ||
| 187 | void Nvnflinger::CloseLayer(u64 layer_id) { | 189 | bool Nvnflinger::CloseLayer(u64 layer_id) { |
| 188 | const auto lock_guard = Lock(); | 190 | const auto lock_guard = Lock(); |
| 189 | 191 | ||
| 190 | for (auto& display : displays) { | 192 | for (auto& display : displays) { |
| 191 | if (auto* layer = display.FindLayer(layer_id); layer) { | 193 | if (auto* layer = display.FindLayer(layer_id); layer) { |
| 192 | layer->Close(); | 194 | return layer->Close(); |
| 193 | } | 195 | } |
| 194 | } | 196 | } |
| 197 | |||
| 198 | return false; | ||
| 195 | } | 199 | } |
| 196 | 200 | ||
| 197 | void Nvnflinger::DestroyLayer(u64 layer_id) { | 201 | void Nvnflinger::DestroyLayer(u64 layer_id) { |
diff --git a/src/core/hle/service/nvnflinger/nvnflinger.h b/src/core/hle/service/nvnflinger/nvnflinger.h index 871285764..a60e0ae6b 100644 --- a/src/core/hle/service/nvnflinger/nvnflinger.h +++ b/src/core/hle/service/nvnflinger/nvnflinger.h | |||
| @@ -74,10 +74,10 @@ public: | |||
| 74 | [[nodiscard]] std::optional<u64> CreateLayer(u64 display_id); | 74 | [[nodiscard]] std::optional<u64> CreateLayer(u64 display_id); |
| 75 | 75 | ||
| 76 | /// Opens a layer on all displays for the given layer ID. | 76 | /// Opens a layer on all displays for the given layer ID. |
| 77 | void OpenLayer(u64 layer_id); | 77 | bool OpenLayer(u64 layer_id); |
| 78 | 78 | ||
| 79 | /// Closes a layer on all displays for the given layer ID. | 79 | /// Closes a layer on all displays for the given layer ID. |
| 80 | void CloseLayer(u64 layer_id); | 80 | bool CloseLayer(u64 layer_id); |
| 81 | 81 | ||
| 82 | /// Destroys the given layer ID. | 82 | /// Destroys the given layer ID. |
| 83 | void DestroyLayer(u64 layer_id); | 83 | void DestroyLayer(u64 layer_id); |
diff --git a/src/core/hle/service/vi/layer/vi_layer.h b/src/core/hle/service/vi/layer/vi_layer.h index 295005e23..f95e2dc71 100644 --- a/src/core/hle/service/vi/layer/vi_layer.h +++ b/src/core/hle/service/vi/layer/vi_layer.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <memory> | 6 | #include <memory> |
| 7 | #include <utility> | ||
| 7 | 8 | ||
| 8 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 9 | 10 | ||
| @@ -75,12 +76,12 @@ public: | |||
| 75 | return open; | 76 | return open; |
| 76 | } | 77 | } |
| 77 | 78 | ||
| 78 | void Close() { | 79 | bool Close() { |
| 79 | open = false; | 80 | return std::exchange(open, false); |
| 80 | } | 81 | } |
| 81 | 82 | ||
| 82 | void Open() { | 83 | bool Open() { |
| 83 | open = true; | 84 | return !std::exchange(open, true); |
| 84 | } | 85 | } |
| 85 | 86 | ||
| 86 | private: | 87 | private: |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 39d5be90d..bfcc27ddc 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -719,7 +719,12 @@ private: | |||
| 719 | return; | 719 | return; |
| 720 | } | 720 | } |
| 721 | 721 | ||
| 722 | nvnflinger.OpenLayer(layer_id); | 722 | if (!nvnflinger.OpenLayer(layer_id)) { |
| 723 | LOG_WARNING(Service_VI, "Tried to open layer which was already open"); | ||
| 724 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 725 | rb.Push(ResultOperationFailed); | ||
| 726 | return; | ||
| 727 | } | ||
| 723 | 728 | ||
| 724 | android::OutputParcel parcel; | 729 | android::OutputParcel parcel; |
| 725 | parcel.WriteInterface(NativeWindow{*buffer_queue_id}); | 730 | parcel.WriteInterface(NativeWindow{*buffer_queue_id}); |
| @@ -737,7 +742,12 @@ private: | |||
| 737 | 742 | ||
| 738 | LOG_DEBUG(Service_VI, "called. layer_id=0x{:016X}", layer_id); | 743 | LOG_DEBUG(Service_VI, "called. layer_id=0x{:016X}", layer_id); |
| 739 | 744 | ||
| 740 | nvnflinger.CloseLayer(layer_id); | 745 | if (!nvnflinger.CloseLayer(layer_id)) { |
| 746 | LOG_WARNING(Service_VI, "Tried to close layer which was not open"); | ||
| 747 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 748 | rb.Push(ResultOperationFailed); | ||
| 749 | return; | ||
| 750 | } | ||
| 741 | 751 | ||
| 742 | IPC::ResponseBuilder rb{ctx, 2}; | 752 | IPC::ResponseBuilder rb{ctx, 2}; |
| 743 | rb.Push(ResultSuccess); | 753 | rb.Push(ResultSuccess); |