second step in dlist optimizations: test the hashes only when the cpu could change the contents of the dlist, this is after it been processed, or at frame finish.

this is marcos idea so the credits go to him.
please test the broken games in my last commits to see if this solve all the issues.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7114 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado 2011-02-08 12:00:41 +00:00
parent 8c41d31651
commit 00c35451f6
3 changed files with 19 additions and 16 deletions

View File

@ -83,6 +83,7 @@
#include "HW/ProcessorInterface.h"
#include "HW/GPFifo.h"
#include "HW/Memmap.h"
#include "DLCache.h"
namespace CommandProcessor
{
@ -826,6 +827,7 @@ void AbortFrame()
PixelEngine::ResetSetToken();
PixelEngine::ResetSetFinish();
fifo.bFF_GPReadEnable = true;
IncrementCheckContextId();
}
void SetOverflowStatusFromGatherPipe()
@ -858,8 +860,11 @@ void SetStatus()
{
if (!fifo.bFF_Breakpoint)
{
INFO_LOG(COMMANDPROCESSOR, "Hit breakpoint at %i", fifo.CPReadPointer);
fifo.bFF_Breakpoint = true;
fifo.bFF_Breakpoint = true;
IncrementCheckContextId();
}
}
else
{

View File

@ -49,10 +49,6 @@ using namespace Gen;
namespace DLCache
{
// Currently just recompiles the DLs themselves, doesn't bother with the vertex data.
// The speed boost is pretty small. The real big boost will come when we also store
// vertex arrays in the cached DLs.
enum DisplayListPass {
DLPASS_ANALYZE,
DLPASS_COMPILE,
@ -578,7 +574,7 @@ void CompileAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl)
numVertices);
u8* EndAddress = VertexManager::s_pCurBufferPointer;
u32 Vdatasize = (u32)(EndAddress - StartAddress);
if (size > 0)
if (size > 0 && numVertices > 0)
{
// Compile
ReferencedDataRegion* NewRegion = new ReferencedDataRegion;
@ -735,17 +731,17 @@ bool HandleDisplayList(u32 address, u32 size)
break;
case DLCache::DLPASS_RUN:
{
// Every N draws, check hash
bool DlistChanged = false;
if (dl.check != CheckContextId)
{
dl.check = CheckContextId;
if (dl.dl_hash != GetHash64(Memory::GetPointer(address), size, 0) || !dl.CheckRegions())
{
dl.uncachable = true;
dl.check = 60;
dl.ClearRegions();
return false;
}
DlistChanged = !dl.CheckRegions() || dl.dl_hash != GetHash64(Memory::GetPointer(address), size, 0);
}
if (DlistChanged)
{
dl.uncachable = true;
dl.ClearRegions();
return false;
}
dl.frame_count= frameCount;
u8 *old_datareader = g_pVideoData;

View File

@ -30,7 +30,7 @@
#include "PixelEngine.h"
#include "CommandProcessor.h"
#include "HW/ProcessorInterface.h"
#include "DLCache.h"
namespace PixelEngine
{
@ -324,7 +324,6 @@ void UpdateTokenInterrupt(bool active)
void UpdateFinishInterrupt(bool active)
{
if(interruptSetFinish != active)
{
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_FINISH, active);
@ -346,6 +345,7 @@ void SetToken_OnMainThread(u64 userdata, int cyclesLate)
INFO_LOG(PIXELENGINE, "VIDEO Plugin raises INT_CAUSE_PE_TOKEN (btw, token: %04x)", CommandProcessor::fifo.PEToken);
UpdateInterrupts();
CommandProcessor::interruptTokenWaiting = false;
IncrementCheckContextId();
//}
//else
// LOGV(PIXELENGINE, 1, "VIDEO Plugin wrote token: %i", CommandProcessor::fifo.PEToken);
@ -380,6 +380,7 @@ void SetToken(const u16 _token, const int _bSetTokenAcknowledge)
// 4-byte padded.
Common::AtomicStore(*(volatile u32*)&CommandProcessor::fifo.PEToken, _token);
}
IncrementCheckContextId();
}
// SetFinish
@ -390,6 +391,7 @@ void SetFinish()
CommandProcessor::interruptFinishWaiting = true;
CoreTiming::ScheduleEvent_Threadsafe(0, et_SetFinishOnMainThread, 0);
INFO_LOG(PIXELENGINE, "VIDEO Set Finish");
IncrementCheckContextId();
}
//This function is used in CommandProcessor when write CTRL_REGISTER and the new fifo is attached.