diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/time/clock_types.h | 8 | ||||
| -rw-r--r-- | src/core/hle/service/time/time.cpp | 37 | ||||
| -rw-r--r-- | src/core/hle/service/time/time.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/time/time_manager.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/time/time_zone_manager.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/time/time_zone_types.h | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/renderer_vulkan.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_buffer_cache.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_swapchain.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_swapchain.h | 2 |
10 files changed, 49 insertions, 27 deletions
diff --git a/src/core/hle/service/time/clock_types.h b/src/core/hle/service/time/clock_types.h index b78892223..a9cfe3eb0 100644 --- a/src/core/hle/service/time/clock_types.h +++ b/src/core/hle/service/time/clock_types.h | |||
| @@ -12,6 +12,12 @@ | |||
| 12 | 12 | ||
| 13 | namespace Service::Time::Clock { | 13 | namespace Service::Time::Clock { |
| 14 | 14 | ||
| 15 | enum class TimeType : u8 { | ||
| 16 | UserSystemClock, | ||
| 17 | NetworkSystemClock, | ||
| 18 | LocalSystemClock, | ||
| 19 | }; | ||
| 20 | |||
| 15 | /// https://switchbrew.org/wiki/Glue_services#SteadyClockTimePoint | 21 | /// https://switchbrew.org/wiki/Glue_services#SteadyClockTimePoint |
| 16 | struct SteadyClockTimePoint { | 22 | struct SteadyClockTimePoint { |
| 17 | s64 time_point; | 23 | s64 time_point; |
| @@ -84,7 +90,7 @@ struct ClockSnapshot { | |||
| 84 | SteadyClockTimePoint steady_clock_time_point; | 90 | SteadyClockTimePoint steady_clock_time_point; |
| 85 | TimeZone::LocationName location_name; | 91 | TimeZone::LocationName location_name; |
| 86 | u8 is_automatic_correction_enabled; | 92 | u8 is_automatic_correction_enabled; |
| 87 | u8 type; | 93 | TimeType type; |
| 88 | INSERT_PADDING_BYTES_NOINIT(0x2); | 94 | INSERT_PADDING_BYTES_NOINIT(0x2); |
| 89 | 95 | ||
| 90 | static ResultCode GetCurrentTime(s64& current_time, | 96 | static ResultCode GetCurrentTime(s64& current_time, |
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index f6ff39789..63e0247de 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp | |||
| @@ -122,14 +122,16 @@ private: | |||
| 122 | 122 | ||
| 123 | ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( | 123 | ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( |
| 124 | Kernel::KThread* thread, Clock::SystemClockContext user_context, | 124 | Kernel::KThread* thread, Clock::SystemClockContext user_context, |
| 125 | Clock::SystemClockContext network_context, u8 type, Clock::ClockSnapshot& clock_snapshot) { | 125 | Clock::SystemClockContext network_context, Clock::TimeType type, |
| 126 | Clock::ClockSnapshot& clock_snapshot) { | ||
| 126 | 127 | ||
| 127 | auto& time_manager{system.GetTimeManager()}; | 128 | auto& time_manager{system.GetTimeManager()}; |
| 128 | 129 | ||
| 130 | clock_snapshot.steady_clock_time_point = | ||
| 131 | time_manager.GetStandardSteadyClockCore().GetCurrentTimePoint(system); | ||
| 129 | clock_snapshot.is_automatic_correction_enabled = | 132 | clock_snapshot.is_automatic_correction_enabled = |
| 130 | time_manager.GetStandardUserSystemClockCore().IsAutomaticCorrectionEnabled(); | 133 | time_manager.GetStandardUserSystemClockCore().IsAutomaticCorrectionEnabled(); |
| 131 | clock_snapshot.user_context = user_context; | 134 | clock_snapshot.type = type; |
| 132 | clock_snapshot.network_context = network_context; | ||
| 133 | 135 | ||
| 134 | if (const ResultCode result{ | 136 | if (const ResultCode result{ |
| 135 | time_manager.GetTimeZoneContentManager().GetTimeZoneManager().GetDeviceLocationName( | 137 | time_manager.GetTimeZoneContentManager().GetTimeZoneManager().GetDeviceLocationName( |
| @@ -138,12 +140,11 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( | |||
| 138 | return result; | 140 | return result; |
| 139 | } | 141 | } |
| 140 | 142 | ||
| 141 | const auto current_time_point{ | 143 | clock_snapshot.user_context = user_context; |
| 142 | time_manager.GetStandardSteadyClockCore().GetCurrentTimePoint(system)}; | ||
| 143 | clock_snapshot.steady_clock_time_point = current_time_point; | ||
| 144 | 144 | ||
| 145 | if (const ResultCode result{Clock::ClockSnapshot::GetCurrentTime( | 145 | if (const ResultCode result{Clock::ClockSnapshot::GetCurrentTime( |
| 146 | clock_snapshot.user_time, current_time_point, clock_snapshot.user_context)}; | 146 | clock_snapshot.user_time, clock_snapshot.steady_clock_time_point, |
| 147 | clock_snapshot.user_context)}; | ||
| 147 | result != RESULT_SUCCESS) { | 148 | result != RESULT_SUCCESS) { |
| 148 | return result; | 149 | return result; |
| 149 | } | 150 | } |
| @@ -157,9 +158,12 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( | |||
| 157 | } | 158 | } |
| 158 | 159 | ||
| 159 | clock_snapshot.user_calendar_time = userCalendarInfo.time; | 160 | clock_snapshot.user_calendar_time = userCalendarInfo.time; |
| 160 | clock_snapshot.user_calendar_additional_time = userCalendarInfo.additiona_info; | 161 | clock_snapshot.user_calendar_additional_time = userCalendarInfo.additional_info; |
| 161 | 162 | ||
| 162 | if (Clock::ClockSnapshot::GetCurrentTime(clock_snapshot.network_time, current_time_point, | 163 | clock_snapshot.network_context = network_context; |
| 164 | |||
| 165 | if (Clock::ClockSnapshot::GetCurrentTime(clock_snapshot.network_time, | ||
| 166 | clock_snapshot.steady_clock_time_point, | ||
| 163 | clock_snapshot.network_context) != RESULT_SUCCESS) { | 167 | clock_snapshot.network_context) != RESULT_SUCCESS) { |
| 164 | clock_snapshot.network_time = 0; | 168 | clock_snapshot.network_time = 0; |
| 165 | } | 169 | } |
| @@ -173,8 +177,7 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( | |||
| 173 | } | 177 | } |
| 174 | 178 | ||
| 175 | clock_snapshot.network_calendar_time = networkCalendarInfo.time; | 179 | clock_snapshot.network_calendar_time = networkCalendarInfo.time; |
| 176 | clock_snapshot.network_calendar_additional_time = networkCalendarInfo.additiona_info; | 180 | clock_snapshot.network_calendar_additional_time = networkCalendarInfo.additional_info; |
| 177 | clock_snapshot.type = type; | ||
| 178 | 181 | ||
| 179 | return RESULT_SUCCESS; | 182 | return RESULT_SUCCESS; |
| 180 | } | 183 | } |
| @@ -257,9 +260,10 @@ void Module::Interface::CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERe | |||
| 257 | } | 260 | } |
| 258 | 261 | ||
| 259 | void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { | 262 | void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { |
| 260 | LOG_DEBUG(Service_Time, "called"); | ||
| 261 | IPC::RequestParser rp{ctx}; | 263 | IPC::RequestParser rp{ctx}; |
| 262 | const auto type{rp.PopRaw<u8>()}; | 264 | const auto type{rp.PopEnum<Clock::TimeType>()}; |
| 265 | |||
| 266 | LOG_DEBUG(Service_Time, "called, type={}", type); | ||
| 263 | 267 | ||
| 264 | Clock::SystemClockContext user_context{}; | 268 | Clock::SystemClockContext user_context{}; |
| 265 | if (const ResultCode result{ | 269 | if (const ResultCode result{ |
| @@ -270,6 +274,7 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { | |||
| 270 | rb.Push(result); | 274 | rb.Push(result); |
| 271 | return; | 275 | return; |
| 272 | } | 276 | } |
| 277 | |||
| 273 | Clock::SystemClockContext network_context{}; | 278 | Clock::SystemClockContext network_context{}; |
| 274 | if (const ResultCode result{ | 279 | if (const ResultCode result{ |
| 275 | system.GetTimeManager().GetStandardNetworkSystemClockCore().GetClockContext( | 280 | system.GetTimeManager().GetStandardNetworkSystemClockCore().GetClockContext( |
| @@ -295,14 +300,16 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { | |||
| 295 | } | 300 | } |
| 296 | 301 | ||
| 297 | void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx) { | 302 | void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx) { |
| 298 | LOG_DEBUG(Service_Time, "called"); | ||
| 299 | IPC::RequestParser rp{ctx}; | 303 | IPC::RequestParser rp{ctx}; |
| 300 | const auto type{rp.PopRaw<u8>()}; | 304 | const auto type{rp.PopEnum<Clock::TimeType>()}; |
| 305 | |||
| 301 | rp.AlignWithPadding(); | 306 | rp.AlignWithPadding(); |
| 302 | 307 | ||
| 303 | const Clock::SystemClockContext user_context{rp.PopRaw<Clock::SystemClockContext>()}; | 308 | const Clock::SystemClockContext user_context{rp.PopRaw<Clock::SystemClockContext>()}; |
| 304 | const Clock::SystemClockContext network_context{rp.PopRaw<Clock::SystemClockContext>()}; | 309 | const Clock::SystemClockContext network_context{rp.PopRaw<Clock::SystemClockContext>()}; |
| 305 | 310 | ||
| 311 | LOG_DEBUG(Service_Time, "called, type={}", type); | ||
| 312 | |||
| 306 | Clock::ClockSnapshot clock_snapshot{}; | 313 | Clock::ClockSnapshot clock_snapshot{}; |
| 307 | if (const ResultCode result{GetClockSnapshotFromSystemClockContextInternal( | 314 | if (const ResultCode result{GetClockSnapshotFromSystemClockContextInternal( |
| 308 | &ctx.GetThread(), user_context, network_context, type, clock_snapshot)}; | 315 | &ctx.GetThread(), user_context, network_context, type, clock_snapshot)}; |
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h index 4154c7ee9..ce9c479c6 100644 --- a/src/core/hle/service/time/time.h +++ b/src/core/hle/service/time/time.h | |||
| @@ -40,7 +40,7 @@ public: | |||
| 40 | private: | 40 | private: |
| 41 | ResultCode GetClockSnapshotFromSystemClockContextInternal( | 41 | ResultCode GetClockSnapshotFromSystemClockContextInternal( |
| 42 | Kernel::KThread* thread, Clock::SystemClockContext user_context, | 42 | Kernel::KThread* thread, Clock::SystemClockContext user_context, |
| 43 | Clock::SystemClockContext network_context, u8 type, | 43 | Clock::SystemClockContext network_context, Clock::TimeType type, |
| 44 | Clock::ClockSnapshot& cloc_snapshot); | 44 | Clock::ClockSnapshot& cloc_snapshot); |
| 45 | 45 | ||
| 46 | protected: | 46 | protected: |
diff --git a/src/core/hle/service/time/time_manager.cpp b/src/core/hle/service/time/time_manager.cpp index 1f7309f6b..51becd074 100644 --- a/src/core/hle/service/time/time_manager.cpp +++ b/src/core/hle/service/time/time_manager.cpp | |||
| @@ -44,7 +44,11 @@ struct TimeManager::Impl final { | |||
| 44 | const auto system_time{Clock::TimeSpanType::FromSeconds(GetExternalRtcValue())}; | 44 | const auto system_time{Clock::TimeSpanType::FromSeconds(GetExternalRtcValue())}; |
| 45 | SetupStandardSteadyClock(system, Common::UUID::Generate(), system_time, {}, {}); | 45 | SetupStandardSteadyClock(system, Common::UUID::Generate(), system_time, {}, {}); |
| 46 | SetupStandardLocalSystemClock(system, {}, system_time.ToSeconds()); | 46 | SetupStandardLocalSystemClock(system, {}, system_time.ToSeconds()); |
| 47 | SetupStandardNetworkSystemClock({}, standard_network_clock_accuracy); | 47 | |
| 48 | Clock::SystemClockContext clock_context{}; | ||
| 49 | standard_local_system_clock_core.GetClockContext(system, clock_context); | ||
| 50 | |||
| 51 | SetupStandardNetworkSystemClock(clock_context, standard_network_clock_accuracy); | ||
| 48 | SetupStandardUserSystemClock(system, {}, Clock::SteadyClockTimePoint::GetRandom()); | 52 | SetupStandardUserSystemClock(system, {}, Clock::SteadyClockTimePoint::GetRandom()); |
| 49 | SetupEphemeralNetworkSystemClock(); | 53 | SetupEphemeralNetworkSystemClock(); |
| 50 | } | 54 | } |
diff --git a/src/core/hle/service/time/time_zone_manager.cpp b/src/core/hle/service/time/time_zone_manager.cpp index bdf0439f2..3032ca193 100644 --- a/src/core/hle/service/time/time_zone_manager.cpp +++ b/src/core/hle/service/time/time_zone_manager.cpp | |||
| @@ -818,7 +818,7 @@ static ResultCode ToCalendarTimeInternal(const TimeZoneRule& rules, s64 time, | |||
| 818 | static ResultCode ToCalendarTimeImpl(const TimeZoneRule& rules, s64 time, CalendarInfo& calendar) { | 818 | static ResultCode ToCalendarTimeImpl(const TimeZoneRule& rules, s64 time, CalendarInfo& calendar) { |
| 819 | CalendarTimeInternal calendar_time{}; | 819 | CalendarTimeInternal calendar_time{}; |
| 820 | const ResultCode result{ | 820 | const ResultCode result{ |
| 821 | ToCalendarTimeInternal(rules, time, calendar_time, calendar.additiona_info)}; | 821 | ToCalendarTimeInternal(rules, time, calendar_time, calendar.additional_info)}; |
| 822 | calendar.time.year = static_cast<s16>(calendar_time.year); | 822 | calendar.time.year = static_cast<s16>(calendar_time.year); |
| 823 | 823 | ||
| 824 | // Internal impl. uses 0-indexed month | 824 | // Internal impl. uses 0-indexed month |
diff --git a/src/core/hle/service/time/time_zone_types.h b/src/core/hle/service/time/time_zone_types.h index 4a57e036d..d39103253 100644 --- a/src/core/hle/service/time/time_zone_types.h +++ b/src/core/hle/service/time/time_zone_types.h | |||
| @@ -66,8 +66,8 @@ struct CalendarTime { | |||
| 66 | static_assert(sizeof(CalendarTime) == 0x8, "CalendarTime is incorrect size"); | 66 | static_assert(sizeof(CalendarTime) == 0x8, "CalendarTime is incorrect size"); |
| 67 | 67 | ||
| 68 | struct CalendarInfo { | 68 | struct CalendarInfo { |
| 69 | CalendarTime time{}; | 69 | CalendarTime time; |
| 70 | CalendarAdditionalInfo additiona_info{}; | 70 | CalendarAdditionalInfo additional_info; |
| 71 | }; | 71 | }; |
| 72 | static_assert(sizeof(CalendarInfo) == 0x20, "CalendarInfo is incorrect size"); | 72 | static_assert(sizeof(CalendarInfo) == 0x20, "CalendarInfo is incorrect size"); |
| 73 | 73 | ||
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index 1cc720ddd..14e5f36e2 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp | |||
| @@ -143,7 +143,10 @@ void RendererVulkan::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { | |||
| 143 | 143 | ||
| 144 | scheduler.WaitWorker(); | 144 | scheduler.WaitWorker(); |
| 145 | 145 | ||
| 146 | swapchain.AcquireNextImage(); | 146 | while (!swapchain.AcquireNextImage()) { |
| 147 | swapchain.Create(layout.width, layout.height, is_srgb); | ||
| 148 | blit_screen.Recreate(); | ||
| 149 | } | ||
| 147 | const VkSemaphore render_semaphore = blit_screen.Draw(*framebuffer, use_accelerated); | 150 | const VkSemaphore render_semaphore = blit_screen.Draw(*framebuffer, use_accelerated); |
| 148 | 151 | ||
| 149 | scheduler.Flush(render_semaphore); | 152 | scheduler.Flush(render_semaphore); |
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp index 668633e7b..8cb65e588 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp | |||
| @@ -176,7 +176,7 @@ void BufferCacheRuntime::BindVertexBuffer(u32 index, VkBuffer buffer, u32 offset | |||
| 176 | u32 stride) { | 176 | u32 stride) { |
| 177 | if (device.IsExtExtendedDynamicStateSupported()) { | 177 | if (device.IsExtExtendedDynamicStateSupported()) { |
| 178 | scheduler.Record([index, buffer, offset, size, stride](vk::CommandBuffer cmdbuf) { | 178 | scheduler.Record([index, buffer, offset, size, stride](vk::CommandBuffer cmdbuf) { |
| 179 | const VkDeviceSize vk_offset = offset; | 179 | const VkDeviceSize vk_offset = buffer != VK_NULL_HANDLE ? offset : 0; |
| 180 | const VkDeviceSize vk_size = buffer != VK_NULL_HANDLE ? size : VK_WHOLE_SIZE; | 180 | const VkDeviceSize vk_size = buffer != VK_NULL_HANDLE ? size : VK_WHOLE_SIZE; |
| 181 | const VkDeviceSize vk_stride = stride; | 181 | const VkDeviceSize vk_stride = stride; |
| 182 | cmdbuf.BindVertexBuffers2EXT(index, 1, &buffer, &vk_offset, &vk_size, &vk_stride); | 182 | cmdbuf.BindVertexBuffers2EXT(index, 1, &buffer, &vk_offset, &vk_size, &vk_stride); |
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index 0b63bd6c8..dfd5c65ba 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp | |||
| @@ -82,11 +82,13 @@ void VKSwapchain::Create(u32 width, u32 height, bool srgb) { | |||
| 82 | resource_ticks.resize(image_count); | 82 | resource_ticks.resize(image_count); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | void VKSwapchain::AcquireNextImage() { | 85 | bool VKSwapchain::AcquireNextImage() { |
| 86 | device.GetLogical().AcquireNextImageKHR(*swapchain, std::numeric_limits<u64>::max(), | 86 | const VkResult result = |
| 87 | *present_semaphores[frame_index], {}, &image_index); | 87 | device.GetLogical().AcquireNextImageKHR(*swapchain, std::numeric_limits<u64>::max(), |
| 88 | *present_semaphores[frame_index], {}, &image_index); | ||
| 88 | 89 | ||
| 89 | scheduler.Wait(resource_ticks[image_index]); | 90 | scheduler.Wait(resource_ticks[image_index]); |
| 91 | return result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR; | ||
| 90 | } | 92 | } |
| 91 | 93 | ||
| 92 | bool VKSwapchain::Present(VkSemaphore render_semaphore) { | 94 | bool VKSwapchain::Present(VkSemaphore render_semaphore) { |
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.h b/src/video_core/renderer_vulkan/vk_swapchain.h index a728511e0..adc8d27cf 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.h +++ b/src/video_core/renderer_vulkan/vk_swapchain.h | |||
| @@ -28,7 +28,7 @@ public: | |||
| 28 | void Create(u32 width, u32 height, bool srgb); | 28 | void Create(u32 width, u32 height, bool srgb); |
| 29 | 29 | ||
| 30 | /// Acquires the next image in the swapchain, waits as needed. | 30 | /// Acquires the next image in the swapchain, waits as needed. |
| 31 | void AcquireNextImage(); | 31 | bool AcquireNextImage(); |
| 32 | 32 | ||
| 33 | /// Presents the rendered image to the swapchain. Returns true when the swapchains had to be | 33 | /// Presents the rendered image to the swapchain. Returns true when the swapchains had to be |
| 34 | /// recreated. Takes responsability for the ownership of fence. | 34 | /// recreated. Takes responsability for the ownership of fence. |