mirror of https://github.com/PCSX2/pcsx2.git
Clean up some Vif debugging code.
git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@428 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
parent
9f00a6ac66
commit
d2aabc8c2e
|
@ -146,4 +146,10 @@ void __Log(const char *fmt, ...);
|
||||||
#define MEMCARDS_LOG 0&&
|
#define MEMCARDS_LOG 0&&
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VIFUNPACKDEBUG
|
||||||
|
#define VIFUNPACK_LOG VIF_LOG
|
||||||
|
#else
|
||||||
|
#define VIFUNPACK_LOG 0&&
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __DEBUG_H__ */
|
#endif /* __DEBUG_H__ */
|
||||||
|
|
|
@ -28,6 +28,13 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <xmmintrin.h>
|
||||||
|
#include <emmintrin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#define VIFUNPACKDEBUG //enable unpack debugging output
|
||||||
|
|
||||||
#define gif ((DMACh*)&PS2MEM_HW[0xA000])
|
#define gif ((DMACh*)&PS2MEM_HW[0xA000])
|
||||||
|
|
||||||
// Extern variables
|
// Extern variables
|
||||||
|
@ -235,8 +242,6 @@ void DummyExecuteVU1Block(void)
|
||||||
VU1.vifRegs->stat &= ~4; // also reset the bit (grandia 3 works)
|
VU1.vifRegs->stat &= ~4; // also reset the bit (grandia 3 works)
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define VIFUNPACKDEBUG //enable unpack debugging output
|
|
||||||
|
|
||||||
static void ProcessMemSkip(int size, unsigned int unpackType, const unsigned int VIFdmanum){
|
static void ProcessMemSkip(int size, unsigned int unpackType, const unsigned int VIFdmanum){
|
||||||
const VIFUnpackFuncTable *unpack;
|
const VIFUnpackFuncTable *unpack;
|
||||||
vifStruct *vif;
|
vifStruct *vif;
|
||||||
|
@ -258,81 +263,55 @@ static void ProcessMemSkip(int size, unsigned int unpackType, const unsigned int
|
||||||
switch(unpackType){
|
switch(unpackType){
|
||||||
case 0x0:
|
case 0x0:
|
||||||
vif->tag.addr += size*4;
|
vif->tag.addr += size*4;
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("Processing S-32 skip, size = %d\n", size);
|
||||||
SysPrintf("Processing S-32 skip, size = %d\n", size);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 0x1:
|
case 0x1:
|
||||||
vif->tag.addr += size*8;
|
vif->tag.addr += size*8;
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("Processing S-16 skip, size = %d\n", size);
|
||||||
SysPrintf("Processing S-16 skip, size = %d\n", size);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 0x2:
|
case 0x2:
|
||||||
vif->tag.addr += size*16;
|
vif->tag.addr += size*16;
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("Processing S-8 skip, size = %d\n", size);
|
||||||
SysPrintf("Processing S-8 skip, size = %d\n", size);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 0x4:
|
case 0x4:
|
||||||
vif->tag.addr += size + ((size / unpack->gsize) * 8);
|
vif->tag.addr += size + ((size / unpack->gsize) * 8);
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("Processing V2-32 skip, size = %d\n", size);
|
||||||
SysPrintf("Processing V2-32 skip, size = %d\n", size);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 0x5:
|
case 0x5:
|
||||||
vif->tag.addr += (size * 2) + ((size / unpack->gsize) * 8);
|
vif->tag.addr += (size * 2) + ((size / unpack->gsize) * 8);
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("Processing V2-16 skip, size = %d\n", size);
|
||||||
SysPrintf("Processing V2-16 skip, size = %d\n", size);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 0x6:
|
case 0x6:
|
||||||
vif->tag.addr += (size * 4) + ((size / unpack->gsize) * 8);
|
vif->tag.addr += (size * 4) + ((size / unpack->gsize) * 8);
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("Processing V2-8 skip, size = %d\n", size);
|
||||||
SysPrintf("Processing V2-8 skip, size = %d\n", size);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 0x8:
|
case 0x8:
|
||||||
vif->tag.addr += size + ((size / unpack->gsize) * 4);
|
vif->tag.addr += size + ((size / unpack->gsize) * 4);
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("Processing V3-32 skip, size = %d\n", size);
|
||||||
SysPrintf("Processing V3-32 skip, size = %d\n", size);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 0x9:
|
case 0x9:
|
||||||
vif->tag.addr += (size * 2) + ((size / unpack->gsize) * 4);
|
vif->tag.addr += (size * 2) + ((size / unpack->gsize) * 4);
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("Processing V3-16 skip, size = %d\n", size);
|
||||||
SysPrintf("Processing V3-16 skip, size = %d\n", size);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 0xA:
|
case 0xA:
|
||||||
vif->tag.addr += (size * 4) + ((size / unpack->gsize) * 4);
|
vif->tag.addr += (size * 4) + ((size / unpack->gsize) * 4);
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("Processing V3-8 skip, size = %d\n", size);
|
||||||
SysPrintf("Processing V3-8 skip, size = %d\n", size);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 0xC:
|
case 0xC:
|
||||||
vif->tag.addr += size;
|
vif->tag.addr += size;
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("Processing V4-32 skip, size = %d, CL = %d, WL = %d\n", size, vif1Regs->cycle.cl, vif1Regs->cycle.wl);
|
||||||
SysPrintf("Processing V4-32 skip, size = %d, CL = %d, WL = %d\n", size, vif1Regs->cycle.cl, vif1Regs->cycle.wl);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 0xD:
|
case 0xD:
|
||||||
vif->tag.addr += size * 2;
|
vif->tag.addr += size * 2;
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("Processing V4-16 skip, size = %d\n", size);
|
||||||
SysPrintf("Processing V4-16 skip, size = %d\n", size);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 0xE:
|
case 0xE:
|
||||||
vif->tag.addr += size * 4;
|
vif->tag.addr += size * 4;
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("Processing V4-8 skip, size = %d\n", size);
|
||||||
SysPrintf("Processing V4-8 skip, size = %d\n", size);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 0xF:
|
case 0xF:
|
||||||
vif->tag.addr += size * 8;
|
vif->tag.addr += size * 8;
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("Processing V4-5 skip, size = %d\n", size);
|
||||||
SysPrintf("Processing V4-5 skip, size = %d\n", size);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SysPrintf("Invalid unpack type %x\n", unpackType);
|
SysPrintf("Invalid unpack type %x\n", unpackType);
|
||||||
|
@ -348,13 +327,6 @@ static void ProcessMemSkip(int size, unsigned int unpackType, const unsigned int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
//#define __MMX__
|
|
||||||
//#define __SSE__
|
|
||||||
#include <xmmintrin.h>
|
|
||||||
#include <emmintrin.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//u32 unpacktotal = 0;
|
//u32 unpacktotal = 0;
|
||||||
|
|
||||||
static void VIFunpack(u32 *data, vifCode *v, int size, const unsigned int VIFdmanum) {
|
static void VIFunpack(u32 *data, vifCode *v, int size, const unsigned int VIFdmanum) {
|
||||||
|
@ -427,14 +399,10 @@ static void VIFunpack(u32 *data, vifCode *v, int size, const unsigned int VIFdma
|
||||||
/*if (v->size != size) {
|
/*if (v->size != size) {
|
||||||
SysPrintf("*PCSX2*: v->size = %d, size = %d mode = %x\n", v->size, size, unpackType);
|
SysPrintf("*PCSX2*: v->size = %d, size = %d mode = %x\n", v->size, size, unpackType);
|
||||||
}*/
|
}*/
|
||||||
#ifdef VIFUNPACKDEBUG
|
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
SysPrintf("*PCSX2*: Unpack %x with size 0!! v->size = %d cl = %d, wl = %d, mode %d mask %x\n", v->cmd, v->size, vifRegs->cycle.cl, vifRegs->cycle.wl, vifRegs->mode, vifRegs->mask);
|
VIFUNPACK_LOG("*PCSX2*: Unpack %x with size 0!! v->size = %d cl = %d, wl = %d, mode %d mask %x\n", v->cmd, v->size, vifRegs->cycle.cl, vifRegs->cycle.wl, vifRegs->mode, vifRegs->mask);
|
||||||
//return;
|
//return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
_mm_prefetch((char*)data+128, _MM_HINT_NTA);
|
_mm_prefetch((char*)data+128, _MM_HINT_NTA);
|
||||||
|
@ -454,9 +422,9 @@ static void VIFunpack(u32 *data, vifCode *v, int size, const unsigned int VIFdma
|
||||||
#endif
|
#endif
|
||||||
if( _vifRegs->offset > 0) {
|
if( _vifRegs->offset > 0) {
|
||||||
int destinc, unpacksize;
|
int destinc, unpacksize;
|
||||||
#ifdef VIFUNPACKDEBUG
|
|
||||||
SysPrintf("aligning packet size = %d offset %d addr %x\n", size, vifRegs->offset, vif->tag.addr);
|
VIFUNPACK_LOG("aligning packet size = %d offset %d addr %x\n", size, vifRegs->offset, vif->tag.addr);
|
||||||
#endif
|
|
||||||
// SSE doesn't handle such small data
|
// SSE doesn't handle such small data
|
||||||
if (v->size != (size>>2))ProcessMemSkip(size, unpackType, VIFdmanum);
|
if (v->size != (size>>2))ProcessMemSkip(size, unpackType, VIFdmanum);
|
||||||
|
|
||||||
|
@ -465,7 +433,8 @@ static void VIFunpack(u32 *data, vifCode *v, int size, const unsigned int VIFdma
|
||||||
SysPrintf("wasnt enough left size/dsize = %x left to write %x\n", (size/ft->dsize), (ft->qsize - vifRegs->offset));
|
SysPrintf("wasnt enough left size/dsize = %x left to write %x\n", (size/ft->dsize), (ft->qsize - vifRegs->offset));
|
||||||
}
|
}
|
||||||
unpacksize = min(((u32)size/(u32)ft->dsize), ((u32)ft->qsize - vifRegs->offset));
|
unpacksize = min(((u32)size/(u32)ft->dsize), ((u32)ft->qsize - vifRegs->offset));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
unpacksize = 0;
|
unpacksize = 0;
|
||||||
SysPrintf("Unpack align offset = 0\n");
|
SysPrintf("Unpack align offset = 0\n");
|
||||||
}
|
}
|
||||||
|
@ -491,9 +460,7 @@ static void VIFunpack(u32 *data, vifCode *v, int size, const unsigned int VIFdma
|
||||||
dest += destinc;
|
dest += destinc;
|
||||||
//vif->tag.addr += destinc << 2;
|
//vif->tag.addr += destinc << 2;
|
||||||
}
|
}
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("aligning packet done size = %d offset %d addr %x\n", size, vifRegs->offset, vif->tag.addr);
|
||||||
SysPrintf("aligning packet done size = %d offset %d addr %x\n", size, vifRegs->offset, vif->tag.addr);
|
|
||||||
#endif
|
|
||||||
//}
|
//}
|
||||||
//skipmeminc += (((vifRegs->cycle.cl - vifRegs->cycle.wl)<<2)*4) * skipped;
|
//skipmeminc += (((vifRegs->cycle.cl - vifRegs->cycle.wl)<<2)*4) * skipped;
|
||||||
} else if (v->size != (size>>2))ProcessMemSkip(size, unpackType, VIFdmanum);
|
} else if (v->size != (size>>2))ProcessMemSkip(size, unpackType, VIFdmanum);
|
||||||
|
@ -702,9 +669,7 @@ static void VIFunpack(u32 *data, vifCode *v, int size, const unsigned int VIFdma
|
||||||
// SSE doesn't handle such small data
|
// SSE doesn't handle such small data
|
||||||
//ft = &VIFfuncTable[ unpackType ];
|
//ft = &VIFfuncTable[ unpackType ];
|
||||||
//func = vif->usn ? ft->funcU : ft->funcS;
|
//func = vif->usn ? ft->funcU : ft->funcS;
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("end with size %x dsize = %x unpacktype %x\n", size, ft->dsize, unpackType);
|
||||||
SysPrintf("end with size %x dsize = %x unpacktype %x\n", size, ft->dsize, unpackType);
|
|
||||||
#endif
|
|
||||||
//while (size >= ft->dsize) {
|
//while (size >= ft->dsize) {
|
||||||
/* unpack one qword */
|
/* unpack one qword */
|
||||||
func(dest, (u32*)cdata, size / ft->dsize);
|
func(dest, (u32*)cdata, size / ft->dsize);
|
||||||
|
@ -712,9 +677,7 @@ static void VIFunpack(u32 *data, vifCode *v, int size, const unsigned int VIFdma
|
||||||
//dest += 1;
|
//dest += 1;
|
||||||
size = 0;
|
size = 0;
|
||||||
//}
|
//}
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("leftover done, size %d, vifnum %d, addr %x\n", size, vifRegs->num, vif->tag.addr);
|
||||||
SysPrintf("leftover done, size %d, vifnum %d, addr %x\n", size, vifRegs->num, vif->tag.addr);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -723,9 +686,7 @@ static void VIFunpack(u32 *data, vifCode *v, int size, const unsigned int VIFdma
|
||||||
|
|
||||||
//ft = &VIFfuncTable[ unpackType ];
|
//ft = &VIFfuncTable[ unpackType ];
|
||||||
//func = vif->usn ? ft->funcU : ft->funcS;
|
//func = vif->usn ? ft->funcU : ft->funcS;
|
||||||
#ifdef VIFUNPACKDEBUG
|
VIFUNPACK_LOG("filling write %d cl %d, wl %d mask %x mode %x unpacktype %x\n", vifRegs->num, vifRegs->cycle.cl, vifRegs->cycle.wl, vifRegs->mask, vifRegs->mode, unpackType);
|
||||||
SysPrintf("filling write %d cl %d, wl %d mask %x mode %x unpacktype %x\n", vifRegs->num, vifRegs->cycle.cl, vifRegs->cycle.wl, vifRegs->mask, vifRegs->mode, unpackType);
|
|
||||||
#endif
|
|
||||||
while (size >= ft->gsize || vifRegs->num > 0) {
|
while (size >= ft->gsize || vifRegs->num > 0) {
|
||||||
if (vif->cl == vifRegs->cycle.wl) {
|
if (vif->cl == vifRegs->cycle.wl) {
|
||||||
vif->cl = 0;
|
vif->cl = 0;
|
||||||
|
|
Loading…
Reference in New Issue