diff options
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/nvflinger/buffer_queue.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/nvflinger/buffer_queue.h | 7 | ||||
| -rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.cpp | 12 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 9 |
7 files changed, 25 insertions, 23 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 59bc9e0af..dd5cd9ced 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <cinttypes> | 6 | #include <cinttypes> |
| 7 | #include <optional> | ||
| 7 | #include <vector> | 8 | #include <vector> |
| 8 | 9 | ||
| 9 | #include <boost/optional.hpp> | ||
| 10 | #include <boost/range/algorithm_ext/erase.hpp> | 10 | #include <boost/range/algorithm_ext/erase.hpp> |
| 11 | 11 | ||
| 12 | #include "common/assert.h" | 12 | #include "common/assert.h" |
| @@ -94,7 +94,7 @@ void Thread::CancelWakeupTimer() { | |||
| 94 | CoreTiming::UnscheduleEventThreadsafe(kernel.ThreadWakeupCallbackEventType(), callback_handle); | 94 | CoreTiming::UnscheduleEventThreadsafe(kernel.ThreadWakeupCallbackEventType(), callback_handle); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | static boost::optional<s32> GetNextProcessorId(u64 mask) { | 97 | static std::optional<s32> GetNextProcessorId(u64 mask) { |
| 98 | for (s32 index = 0; index < Core::NUM_CPU_CORES; ++index) { | 98 | for (s32 index = 0; index < Core::NUM_CPU_CORES; ++index) { |
| 99 | if (mask & (1ULL << index)) { | 99 | if (mask & (1ULL << index)) { |
| 100 | if (!Core::System::GetInstance().Scheduler(index).GetCurrentThread()) { | 100 | if (!Core::System::GetInstance().Scheduler(index).GetCurrentThread()) { |
| @@ -142,7 +142,7 @@ void Thread::ResumeFromWait() { | |||
| 142 | 142 | ||
| 143 | status = ThreadStatus::Ready; | 143 | status = ThreadStatus::Ready; |
| 144 | 144 | ||
| 145 | boost::optional<s32> new_processor_id = GetNextProcessorId(affinity_mask); | 145 | std::optional<s32> new_processor_id = GetNextProcessorId(affinity_mask); |
| 146 | if (!new_processor_id) { | 146 | if (!new_processor_id) { |
| 147 | new_processor_id = processor_id; | 147 | new_processor_id = processor_id; |
| 148 | } | 148 | } |
| @@ -369,7 +369,7 @@ void Thread::ChangeCore(u32 core, u64 mask) { | |||
| 369 | return; | 369 | return; |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | boost::optional<s32> new_processor_id{GetNextProcessorId(affinity_mask)}; | 372 | std::optional<s32> new_processor_id{GetNextProcessorId(affinity_mask)}; |
| 373 | 373 | ||
| 374 | if (!new_processor_id) { | 374 | if (!new_processor_id) { |
| 375 | new_processor_id = processor_id; | 375 | new_processor_id = processor_id; |
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 3cac1b4ff..c08394e4c 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp | |||
| @@ -195,7 +195,7 @@ std::size_t ProfileManager::GetOpenUserCount() const { | |||
| 195 | 195 | ||
| 196 | /// Checks if a user id exists in our profile manager | 196 | /// Checks if a user id exists in our profile manager |
| 197 | bool ProfileManager::UserExists(UUID uuid) const { | 197 | bool ProfileManager::UserExists(UUID uuid) const { |
| 198 | return GetUserIndex(uuid) != std::nullopt; | 198 | return GetUserIndex(uuid).has_value(); |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | bool ProfileManager::UserExistsIndex(std::size_t index) const { | 201 | bool ProfileManager::UserExistsIndex(std::size_t index) const { |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 59aafd616..ac3ff9f20 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -743,7 +743,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { | |||
| 743 | 743 | ||
| 744 | Account::ProfileManager profile_manager{}; | 744 | Account::ProfileManager profile_manager{}; |
| 745 | const auto uuid = profile_manager.GetUser(Settings::values.current_user); | 745 | const auto uuid = profile_manager.GetUser(Settings::values.current_user); |
| 746 | ASSERT(uuid != std::nullopt); | 746 | ASSERT(uuid); |
| 747 | params.current_user = uuid->uuid; | 747 | params.current_user = uuid->uuid; |
| 748 | 748 | ||
| 749 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 749 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp index fd98d541d..630ebbfc7 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue.cpp | |||
| @@ -31,7 +31,7 @@ void BufferQueue::SetPreallocatedBuffer(u32 slot, const IGBPBuffer& igbp_buffer) | |||
| 31 | buffer_wait_event->Signal(); | 31 | buffer_wait_event->Signal(); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | boost::optional<u32> BufferQueue::DequeueBuffer(u32 width, u32 height) { | 34 | std::optional<u32> BufferQueue::DequeueBuffer(u32 width, u32 height) { |
| 35 | auto itr = std::find_if(queue.begin(), queue.end(), [&](const Buffer& buffer) { | 35 | auto itr = std::find_if(queue.begin(), queue.end(), [&](const Buffer& buffer) { |
| 36 | // Only consider free buffers. Buffers become free once again after they've been Acquired | 36 | // Only consider free buffers. Buffers become free once again after they've been Acquired |
| 37 | // and Released by the compositor, see the NVFlinger::Compose method. | 37 | // and Released by the compositor, see the NVFlinger::Compose method. |
| @@ -44,7 +44,7 @@ boost::optional<u32> BufferQueue::DequeueBuffer(u32 width, u32 height) { | |||
| 44 | }); | 44 | }); |
| 45 | 45 | ||
| 46 | if (itr == queue.end()) { | 46 | if (itr == queue.end()) { |
| 47 | return boost::none; | 47 | return {}; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | itr->status = Buffer::Status::Dequeued; | 50 | itr->status = Buffer::Status::Dequeued; |
| @@ -70,12 +70,12 @@ void BufferQueue::QueueBuffer(u32 slot, BufferTransformFlags transform, | |||
| 70 | itr->crop_rect = crop_rect; | 70 | itr->crop_rect = crop_rect; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | boost::optional<const BufferQueue::Buffer&> BufferQueue::AcquireBuffer() { | 73 | std::optional<std::reference_wrapper<const BufferQueue::Buffer>> BufferQueue::AcquireBuffer() { |
| 74 | auto itr = std::find_if(queue.begin(), queue.end(), [](const Buffer& buffer) { | 74 | auto itr = std::find_if(queue.begin(), queue.end(), [](const Buffer& buffer) { |
| 75 | return buffer.status == Buffer::Status::Queued; | 75 | return buffer.status == Buffer::Status::Queued; |
| 76 | }); | 76 | }); |
| 77 | if (itr == queue.end()) | 77 | if (itr == queue.end()) |
| 78 | return boost::none; | 78 | return {}; |
| 79 | itr->status = Buffer::Status::Acquired; | 79 | itr->status = Buffer::Status::Acquired; |
| 80 | return *itr; | 80 | return *itr; |
| 81 | } | 81 | } |
diff --git a/src/core/hle/service/nvflinger/buffer_queue.h b/src/core/hle/service/nvflinger/buffer_queue.h index 50b767732..2fe81a560 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.h +++ b/src/core/hle/service/nvflinger/buffer_queue.h | |||
| @@ -4,8 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <optional> | ||
| 7 | #include <vector> | 8 | #include <vector> |
| 8 | #include <boost/optional.hpp> | 9 | |
| 9 | #include "common/common_funcs.h" | 10 | #include "common/common_funcs.h" |
| 10 | #include "common/math_util.h" | 11 | #include "common/math_util.h" |
| 11 | #include "common/swap.h" | 12 | #include "common/swap.h" |
| @@ -73,11 +74,11 @@ public: | |||
| 73 | }; | 74 | }; |
| 74 | 75 | ||
| 75 | void SetPreallocatedBuffer(u32 slot, const IGBPBuffer& igbp_buffer); | 76 | void SetPreallocatedBuffer(u32 slot, const IGBPBuffer& igbp_buffer); |
| 76 | boost::optional<u32> DequeueBuffer(u32 width, u32 height); | 77 | std::optional<u32> DequeueBuffer(u32 width, u32 height); |
| 77 | const IGBPBuffer& RequestBuffer(u32 slot) const; | 78 | const IGBPBuffer& RequestBuffer(u32 slot) const; |
| 78 | void QueueBuffer(u32 slot, BufferTransformFlags transform, | 79 | void QueueBuffer(u32 slot, BufferTransformFlags transform, |
| 79 | const MathUtil::Rectangle<int>& crop_rect); | 80 | const MathUtil::Rectangle<int>& crop_rect); |
| 80 | boost::optional<const Buffer&> AcquireBuffer(); | 81 | std::optional<std::reference_wrapper<const Buffer>> AcquireBuffer(); |
| 81 | void ReleaseBuffer(u32 slot); | 82 | void ReleaseBuffer(u32 slot); |
| 82 | u32 Query(QueryType type); | 83 | u32 Query(QueryType type); |
| 83 | 84 | ||
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index d47b6f659..214e6d1b3 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <boost/optional.hpp> | 6 | #include <optional> |
| 7 | 7 | ||
| 8 | #include "common/alignment.h" | 8 | #include "common/alignment.h" |
| 9 | #include "common/assert.h" | 9 | #include "common/assert.h" |
| @@ -134,7 +134,7 @@ void NVFlinger::Compose() { | |||
| 134 | 134 | ||
| 135 | MicroProfileFlip(); | 135 | MicroProfileFlip(); |
| 136 | 136 | ||
| 137 | if (buffer == boost::none) { | 137 | if (!buffer) { |
| 138 | auto& system_instance = Core::System::GetInstance(); | 138 | auto& system_instance = Core::System::GetInstance(); |
| 139 | 139 | ||
| 140 | // There was no queued buffer to draw, render previous frame | 140 | // There was no queued buffer to draw, render previous frame |
| @@ -143,7 +143,7 @@ void NVFlinger::Compose() { | |||
| 143 | continue; | 143 | continue; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | auto& igbp_buffer = buffer->igbp_buffer; | 146 | auto& igbp_buffer = buffer->get().igbp_buffer; |
| 147 | 147 | ||
| 148 | // Now send the buffer to the GPU for drawing. | 148 | // Now send the buffer to the GPU for drawing. |
| 149 | // TODO(Subv): Support more than just disp0. The display device selection is probably based | 149 | // TODO(Subv): Support more than just disp0. The display device selection is probably based |
| @@ -152,10 +152,10 @@ void NVFlinger::Compose() { | |||
| 152 | ASSERT(nvdisp); | 152 | ASSERT(nvdisp); |
| 153 | 153 | ||
| 154 | nvdisp->flip(igbp_buffer.gpu_buffer_id, igbp_buffer.offset, igbp_buffer.format, | 154 | nvdisp->flip(igbp_buffer.gpu_buffer_id, igbp_buffer.offset, igbp_buffer.format, |
| 155 | igbp_buffer.width, igbp_buffer.height, igbp_buffer.stride, buffer->transform, | 155 | igbp_buffer.width, igbp_buffer.height, igbp_buffer.stride, |
| 156 | buffer->crop_rect); | 156 | buffer->get().transform, buffer->get().crop_rect); |
| 157 | 157 | ||
| 158 | buffer_queue->ReleaseBuffer(buffer->slot); | 158 | buffer_queue->ReleaseBuffer(buffer->get().slot); |
| 159 | } | 159 | } |
| 160 | } | 160 | } |
| 161 | 161 | ||
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 184537daa..d764b2406 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -6,9 +6,10 @@ | |||
| 6 | #include <array> | 6 | #include <array> |
| 7 | #include <cstring> | 7 | #include <cstring> |
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <optional> | ||
| 9 | #include <type_traits> | 10 | #include <type_traits> |
| 10 | #include <utility> | 11 | #include <utility> |
| 11 | #include <boost/optional.hpp> | 12 | |
| 12 | #include "common/alignment.h" | 13 | #include "common/alignment.h" |
| 13 | #include "common/assert.h" | 14 | #include "common/assert.h" |
| 14 | #include "common/common_funcs.h" | 15 | #include "common/common_funcs.h" |
| @@ -506,9 +507,9 @@ private: | |||
| 506 | IGBPDequeueBufferRequestParcel request{ctx.ReadBuffer()}; | 507 | IGBPDequeueBufferRequestParcel request{ctx.ReadBuffer()}; |
| 507 | const u32 width{request.data.width}; | 508 | const u32 width{request.data.width}; |
| 508 | const u32 height{request.data.height}; | 509 | const u32 height{request.data.height}; |
| 509 | boost::optional<u32> slot = buffer_queue->DequeueBuffer(width, height); | 510 | std::optional<u32> slot = buffer_queue->DequeueBuffer(width, height); |
| 510 | 511 | ||
| 511 | if (slot != boost::none) { | 512 | if (slot) { |
| 512 | // Buffer is available | 513 | // Buffer is available |
| 513 | IGBPDequeueBufferResponseParcel response{*slot}; | 514 | IGBPDequeueBufferResponseParcel response{*slot}; |
| 514 | ctx.WriteBuffer(response.Serialize()); | 515 | ctx.WriteBuffer(response.Serialize()); |
| @@ -520,7 +521,7 @@ private: | |||
| 520 | Kernel::ThreadWakeupReason reason) { | 521 | Kernel::ThreadWakeupReason reason) { |
| 521 | // Repeat TransactParcel DequeueBuffer when a buffer is available | 522 | // Repeat TransactParcel DequeueBuffer when a buffer is available |
| 522 | auto buffer_queue = nv_flinger->GetBufferQueue(id); | 523 | auto buffer_queue = nv_flinger->GetBufferQueue(id); |
| 523 | boost::optional<u32> slot = buffer_queue->DequeueBuffer(width, height); | 524 | std::optional<u32> slot = buffer_queue->DequeueBuffer(width, height); |
| 524 | IGBPDequeueBufferResponseParcel response{*slot}; | 525 | IGBPDequeueBufferResponseParcel response{*slot}; |
| 525 | ctx.WriteBuffer(response.Serialize()); | 526 | ctx.WriteBuffer(response.Serialize()); |
| 526 | IPC::ResponseBuilder rb{ctx, 2}; | 527 | IPC::ResponseBuilder rb{ctx, 2}; |