mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Allocate ge list ids using round robin.
Even if you enqueue and then dequeue 0, you don't get it again right away.
This commit is contained in:
parent
927f292230
commit
e7bd716c71
2 changed files with 19 additions and 12 deletions
|
@ -15,6 +15,7 @@
|
|||
#include "Core/HLE/sceGe.h"
|
||||
|
||||
GPUCommon::GPUCommon() :
|
||||
nextListID(0),
|
||||
currentList(NULL),
|
||||
isbreak(false),
|
||||
drawCompleteTicks(0),
|
||||
|
@ -202,8 +203,7 @@ u32 GPUCommon::EnqueueList(u32 listpc, u32 stall, int subIntrBase, PSPPointer<Ps
|
|||
}
|
||||
|
||||
u64 currentTicks = CoreTiming::GetTicks();
|
||||
for (int i = 0; i < DisplayListMaxCount; ++i)
|
||||
{
|
||||
for (int i = 0; i < DisplayListMaxCount; ++i) {
|
||||
if (dls[i].state != PSP_GE_DL_STATE_NONE && dls[i].state != PSP_GE_DL_STATE_COMPLETED) {
|
||||
if (dls[i].pc == listpc && !oldCompatibility) {
|
||||
ERROR_LOG(G3D, "sceGeListEnqueue: can't enqueue, list address %08X already used", listpc);
|
||||
|
@ -214,26 +214,31 @@ u32 GPUCommon::EnqueueList(u32 listpc, u32 stall, int subIntrBase, PSPPointer<Ps
|
|||
// return 0x80000021;
|
||||
//}
|
||||
}
|
||||
if (dls[i].state == PSP_GE_DL_STATE_NONE && !dls[i].pendingInterrupt)
|
||||
{
|
||||
// Prefer a list that isn't used
|
||||
id = i;
|
||||
}
|
||||
for (int i = 0; i < DisplayListMaxCount; ++i) {
|
||||
int possibleID = (i + nextListID) % DisplayListMaxCount;
|
||||
auto possibleList = dls[possibleID];
|
||||
if (possibleList.pendingInterrupt) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (possibleList.state == PSP_GE_DL_STATE_NONE) {
|
||||
id = possibleID;
|
||||
break;
|
||||
}
|
||||
if (id < 0 && dls[i].state == PSP_GE_DL_STATE_COMPLETED && !dls[i].pendingInterrupt && dls[i].waitTicks < currentTicks)
|
||||
{
|
||||
id = i;
|
||||
if (possibleList.state == PSP_GE_DL_STATE_COMPLETED && possibleList.waitTicks < currentTicks) {
|
||||
id = possibleID;
|
||||
}
|
||||
}
|
||||
if (id < 0)
|
||||
{
|
||||
if (id < 0) {
|
||||
ERROR_LOG_REPORT(G3D, "No DL ID available to enqueue");
|
||||
for(auto it = dlQueue.begin(); it != dlQueue.end(); ++it) {
|
||||
for (auto it = dlQueue.begin(); it != dlQueue.end(); ++it) {
|
||||
DisplayList &dl = dls[*it];
|
||||
DEBUG_LOG(G3D, "DisplayList %d status %d pc %08x stall %08x", *it, dl.state, dl.pc, dl.stall);
|
||||
}
|
||||
return SCE_KERNEL_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nextListID = id + 1;
|
||||
|
||||
DisplayList &dl = dls[id];
|
||||
dl.id = id;
|
||||
|
@ -380,6 +385,7 @@ u32 GPUCommon::Break(int mode) {
|
|||
dls[i].signal = PSP_GE_SIGNAL_NONE;
|
||||
}
|
||||
|
||||
nextListID = 0;
|
||||
currentList = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ protected:
|
|||
|
||||
typedef std::list<int> DisplayListQueue;
|
||||
|
||||
int nextListID;
|
||||
DisplayList dls[DisplayListMaxCount];
|
||||
DisplayList *currentList;
|
||||
DisplayListQueue dlQueue;
|
||||
|
|
Loading…
Add table
Reference in a new issue