Compare commits

..

9 Commits

Author SHA1 Message Date
yuzubot
801088fdee Android 250 2024-02-16 00:56:56 +00:00
yuzubot
4d360d1580 Merge yuzu-emu#13026 2024-02-16 00:56:56 +00:00
yuzubot
8bc10d9526 Merge yuzu-emu#13016 2024-02-16 00:56:56 +00:00
yuzubot
9758340bca Merge yuzu-emu#13011 2024-02-16 00:56:56 +00:00
yuzubot
4d10e9813e Merge yuzu-emu#13006 2024-02-16 00:56:56 +00:00
yuzubot
b6191660a6 Merge yuzu-emu#13000 2024-02-16 00:56:56 +00:00
yuzubot
5c9026e39f Merge yuzu-emu#12749 2024-02-16 00:56:56 +00:00
yuzubot
06f099a8ea Merge yuzu-emu#12461 2024-02-16 00:56:56 +00:00
yuzubot
fead4c4c43 Merge yuzu-emu#10529 2024-02-16 00:56:56 +00:00
5 changed files with 34 additions and 44 deletions

View File

@@ -5,7 +5,8 @@
| [12749](https://github.com/yuzu-emu/yuzu//pull/12749) | [`aad4b0d6f`](https://github.com/yuzu-emu/yuzu//pull/12749/files) | general: workarounds for SMMU syncing issues | [liamwhite](https://github.com/liamwhite/) | Yes |
| [13000](https://github.com/yuzu-emu/yuzu//pull/13000) | [`461eaca7e`](https://github.com/yuzu-emu/yuzu//pull/13000/files) | device_memory_manager: skip unregistered interfaces on invalidate | [liamwhite](https://github.com/liamwhite/) | Yes |
| [13006](https://github.com/yuzu-emu/yuzu//pull/13006) | [`3067bfd12`](https://github.com/yuzu-emu/yuzu//pull/13006/files) | buffer_cache: use mapped range with large vertex buffer size | [liamwhite](https://github.com/liamwhite/) | Yes |
| [13017](https://github.com/yuzu-emu/yuzu//pull/13017) | [`af4248256`](https://github.com/yuzu-emu/yuzu//pull/13017/files) | kernel: add and enable system suspend type | [liamwhite](https://github.com/liamwhite/) | Yes |
| [13011](https://github.com/yuzu-emu/yuzu//pull/13011) | [`1842df1da`](https://github.com/yuzu-emu/yuzu//pull/13011/files) | vi: rewrite for new IPC | [liamwhite](https://github.com/liamwhite/) | Yes |
| [13016](https://github.com/yuzu-emu/yuzu//pull/13016) | [`caf16982d`](https://github.com/yuzu-emu/yuzu//pull/13016/files) | service: set: Migrate ISystemSettingsServer to new IPC | [german77](https://github.com/german77/) | Yes |
| [13026](https://github.com/yuzu-emu/yuzu//pull/13026) | [`462ea921e`](https://github.com/yuzu-emu/yuzu//pull/13026/files) | shader_recompiler: fix non-const offset for arrayed image types | [liamwhite](https://github.com/liamwhite/) | Yes |

View File

@@ -242,7 +242,7 @@ struct System::Impl {
void Run() {
std::unique_lock<std::mutex> lk(suspend_guard);
kernel.SuspendEmulation(false);
kernel.SuspendApplication(false);
core_timing.SyncPause(false);
is_paused.store(false, std::memory_order_relaxed);
}
@@ -251,7 +251,7 @@ struct System::Impl {
std::unique_lock<std::mutex> lk(suspend_guard);
core_timing.SyncPause(true);
kernel.SuspendEmulation(true);
kernel.SuspendApplication(true);
is_paused.store(true, std::memory_order_relaxed);
}
@@ -261,7 +261,7 @@ struct System::Impl {
std::unique_lock<std::mutex> StallApplication() {
std::unique_lock<std::mutex> lk(suspend_guard);
kernel.SuspendEmulation(true);
kernel.SuspendApplication(true);
core_timing.SyncPause(true);
return lk;
}
@@ -269,7 +269,7 @@ struct System::Impl {
void UnstallApplication() {
if (!IsPaused()) {
core_timing.SyncPause(false);
kernel.SuspendEmulation(false);
kernel.SuspendApplication(false);
}
}
@@ -459,7 +459,7 @@ struct System::Impl {
}
Network::CancelPendingSocketOperations();
kernel.SuspendEmulation(true);
kernel.SuspendApplication(true);
if (services) {
services->KillNVNFlinger();
}

View File

@@ -66,7 +66,6 @@ enum class SuspendType : u32 {
Debug = 2,
Backtrace = 3,
Init = 4,
System = 5,
Count,
};
@@ -85,9 +84,8 @@ enum class ThreadState : u16 {
DebugSuspended = (1 << (2 + SuspendShift)),
BacktraceSuspended = (1 << (3 + SuspendShift)),
InitSuspended = (1 << (4 + SuspendShift)),
SystemSuspended = (1 << (5 + SuspendShift)),
SuspendFlagMask = ((1 << 6) - 1) << SuspendShift,
SuspendFlagMask = ((1 << 5) - 1) << SuspendShift,
};
DECLARE_ENUM_FLAG_OPERATORS(ThreadState);

View File

@@ -1204,48 +1204,39 @@ const Kernel::KSharedMemory& KernelCore::GetHidBusSharedMem() const {
return *impl->hidbus_shared_mem;
}
void KernelCore::SuspendEmulation(bool suspended) {
void KernelCore::SuspendApplication(bool suspended) {
const bool should_suspend{exception_exited || suspended};
auto processes = GetProcessList();
const auto activity =
should_suspend ? Svc::ProcessActivity::Paused : Svc::ProcessActivity::Runnable;
for (auto& process : processes) {
KScopedLightLock ll{process->GetListLock()};
for (auto& thread : process->GetThreadList()) {
if (should_suspend) {
thread.RequestSuspend(SuspendType::System);
} else {
thread.Resume(SuspendType::System);
}
}
}
if (!should_suspend) {
// Get the application process.
KScopedAutoObject<KProcess> process = ApplicationProcess();
if (process.IsNull()) {
return;
}
// Set the new activity.
process->SetActivity(activity);
// Wait for process execution to stop.
// KernelCore::SuspendEmulation must be called from locked context,
// or we could race another call, interfering with waiting.
const auto TryWait = [&]() {
bool must_wait{should_suspend};
// KernelCore::SuspendApplication must be called from locked context,
// or we could race another call to SetActivity, interfering with waiting.
while (must_wait) {
KScopedSchedulerLock sl{*this};
for (auto& process : processes) {
for (auto i = 0; i < static_cast<s32>(Core::Hardware::NUM_CPU_CORES); ++i) {
if (Scheduler(i).GetSchedulerCurrentThread()->GetOwnerProcess() ==
process.GetPointerUnsafe()) {
// A thread has not finished running yet.
// Continue waiting.
return false;
}
// Assume that all threads have finished running.
must_wait = false;
for (auto i = 0; i < static_cast<s32>(Core::Hardware::NUM_CPU_CORES); ++i) {
if (Scheduler(i).GetSchedulerCurrentThread()->GetOwnerProcess() ==
process.GetPointerUnsafe()) {
// A thread has not finished running yet.
// Continue waiting.
must_wait = true;
}
}
return true;
};
while (!TryWait()) {
// ...
}
}
@@ -1269,7 +1260,7 @@ bool KernelCore::IsShuttingDown() const {
void KernelCore::ExceptionalExitApplication() {
exception_exited = true;
SuspendEmulation(true);
SuspendApplication(true);
}
void KernelCore::EnterSVCProfile() {

View File

@@ -258,8 +258,8 @@ public:
/// Gets the shared memory object for HIDBus services.
const Kernel::KSharedMemory& GetHidBusSharedMem() const;
/// Suspend/unsuspend emulated processes.
void SuspendEmulation(bool suspend);
/// Suspend/unsuspend application process.
void SuspendApplication(bool suspend);
/// Exceptional exit application process.
void ExceptionalExitApplication();