General: Correct rebase, sync gpu and context management.

This commit is contained in:
Fernando Sahmkow 2020-04-03 11:58:43 -04:00
parent bfb5244cf8
commit ad92865497
9 changed files with 45 additions and 32 deletions

View file

@ -151,7 +151,6 @@ struct System::Impl {
cpu_manager.SetMulticore(is_multicore);
cpu_manager.SetAsyncGpu(is_async_gpu);
core_timing.SetMulticore(is_multicore);
cpu_manager.SetRenderWindow(emu_window);
core_timing.Initialize([&system]() { system.RegisterHostThread(); });
kernel.Initialize();
@ -435,7 +434,7 @@ bool System::IsPoweredOn() const {
}
void System::PrepareReschedule() {
//impl->CurrentPhysicalCore().Stop();
// impl->CurrentPhysicalCore().Stop();
}
void System::PrepareReschedule(const u32 core_index) {

View file

@ -9,12 +9,12 @@
#include "core/core.h"
#include "core/core_timing.h"
#include "core/cpu_manager.h"
#include "core/frontend/emu_window.h"
#include "core/gdbstub/gdbstub.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/physical_core.h"
#include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/thread.h"
#include "video_core/gpu.h"
namespace Core {
@ -25,10 +25,6 @@ void CpuManager::ThreadStart(CpuManager& cpu_manager, std::size_t core) {
cpu_manager.RunThread(core);
}
void CpuManager::SetRenderWindow(Core::Frontend::EmuWindow& render_window) {
this->render_window = &render_window;
}
void CpuManager::Initialize() {
running_mode = true;
if (is_multicore) {
@ -354,7 +350,7 @@ void CpuManager::RunThread(std::size_t core) {
data.is_running = false;
data.enter_barrier->Wait();
if (sc_sync_first_use) {
render_window->MakeCurrent();
system.GPU().ObtainContext();
sc_sync_first_use = false;
}
auto& scheduler = system.Kernel().CurrentScheduler();
@ -366,9 +362,6 @@ void CpuManager::RunThread(std::size_t core) {
data.exit_barrier->Wait();
data.is_paused = false;
}
if (sc_sync) {
render_window->DoneCurrent();
}
/// Time to cleanup
data.host_context->Exit();
data.enter_barrier.reset();

View file

@ -16,10 +16,6 @@ class Event;
class Fiber;
} // namespace Common
namespace Core::Frontend {
class EmuWindow;
} // namespace Core::Frontend
namespace Core {
class System;
@ -61,8 +57,6 @@ public:
return current_core.load();
}
void SetRenderWindow(Core::Frontend::EmuWindow& render_window);
private:
static void GuestThreadFunction(void* cpu_manager);
static void GuestRewindFunction(void* cpu_manager);
@ -106,7 +100,6 @@ private:
std::size_t preemption_count{};
std::size_t idle_count{};
static constexpr std::size_t max_cycle_runs = 5;
Core::Frontend::EmuWindow* render_window;
System& system;
};