Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinitialize the GE on sceKernelLoadExec() #4667

Merged
merged 1 commit into from
Nov 28, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Core/HLE/sceKernelModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
#include "Core/HLE/sceIo.h"
#include "Core/HLE/KernelWaitHelpers.h"

#include "GPU/GPUState.h"

enum {
PSP_THREAD_ATTR_USER = 0x80000000
};
Expand Down Expand Up @@ -1223,6 +1225,7 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str
//HLE needs to be reset here
HLEShutdown();
HLEInit();
GPU_Reinitialize();
}

__KernelModuleInit();
Expand Down
24 changes: 15 additions & 9 deletions GPU/GPUCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,28 @@
#include "Core/HLE/sceGe.h"

GPUCommon::GPUCommon() :
nextListID(0),
currentList(NULL),
isbreak(false),
drawCompleteTicks(0),
busyTicks(0),
dumpNextFrame_(false),
dumpThisFrame_(false),
interruptsEnabled_(true),
curTickEst_(0)
dumpThisFrame_(false)
{
Reinitialize();
SetThreadEnabled(g_Config.bSeparateCPUThread);
}

void GPUCommon::Reinitialize() {
easy_guard guard(listLock);
memset(dls, 0, sizeof(dls));
for (int i = 0; i < DisplayListMaxCount; ++i) {
dls[i].state = PSP_GE_DL_STATE_NONE;
dls[i].waitTicks = 0;
}
SetThreadEnabled(g_Config.bSeparateCPUThread);

nextListID = 0;
currentList = NULL;
isbreak = false;
drawCompleteTicks = 0;
busyTicks = 0;
interruptsEnabled_ = true;
UpdateTickEstimate(0);
}

void GPUCommon::PopDLQueue() {
Expand Down
1 change: 1 addition & 0 deletions GPU/GPUCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class GPUCommon : public GPUThreadEventQueue, public GPUDebugInterface
public:
GPUCommon();
virtual ~GPUCommon() {}
virtual void Reinitialize();

virtual void InterruptStart(int listid);
virtual void InterruptEnd(int listid);
Expand Down
1 change: 1 addition & 0 deletions GPU/GPUInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ class GPUInterface {

// Initialization
virtual void InitClear() = 0;
virtual void Reinitialize() = 0;

virtual void RunEventsUntil(u64 globalticks) = 0;
virtual void FinishEventLoop() = 0;
Expand Down
6 changes: 6 additions & 0 deletions GPU/GPUState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ void GPU_Shutdown() {
gpuDebug = 0;
}

void GPU_Reinitialize() {
if (gpu) {
gpu->Reinitialize();
}
}

void InitGfxState() {
memset(&gstate, 0, sizeof(gstate));
memset(&gstate_c, 0, sizeof(gstate_c));
Expand Down
1 change: 1 addition & 0 deletions GPU/GPUState.h
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ struct GPUStatistics {

bool GPU_Init();
void GPU_Shutdown();
void GPU_Reinitialize();

void InitGfxState();
void ShutdownGfxState();
Expand Down