mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
pprof: workaround for MMSP2 timer glitch, add draw2
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@852 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
b081408f66
commit
25eb407c56
3 changed files with 23 additions and 5 deletions
|
@ -613,11 +613,16 @@ static void DrawDisplayFull(void)
|
||||||
|
|
||||||
PICO_INTERNAL void PicoFrameFull()
|
PICO_INTERNAL void PicoFrameFull()
|
||||||
{
|
{
|
||||||
|
pprof_start(draw);
|
||||||
|
|
||||||
// prepare cram?
|
// prepare cram?
|
||||||
if (PicoPrepareCram) PicoPrepareCram();
|
if (PicoPrepareCram) PicoPrepareCram();
|
||||||
|
|
||||||
// Draw screen:
|
// Draw screen:
|
||||||
BackFillFull(Pico.video.reg[7]);
|
BackFillFull(Pico.video.reg[7]);
|
||||||
if (Pico.video.reg[1]&0x40) DrawDisplayFull();
|
if (Pico.video.reg[1] & 0x40)
|
||||||
|
DrawDisplayFull();
|
||||||
|
|
||||||
|
pprof_end(draw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ PicoDrive : $(OBJS)
|
||||||
$(CC) $(CFLAGS) $^ $(LDFLAGS) -Wl,-Map=PicoDrive.map -o $@
|
$(CC) $(CFLAGS) $^ $(LDFLAGS) -Wl,-Map=PicoDrive.map -o $@
|
||||||
|
|
||||||
pprof: pprof.c
|
pprof: pprof.c
|
||||||
$(CROSS)gcc -O2 -ggdb -DPPROF -DPPROF_TOOL -I../../ -I. $^ -o $@ -lrt
|
$(CROSS)gcc -O2 -ggdb -DPPROF -DPPROF_TOOL -I../../ -I. $^ -o $@
|
||||||
|
|
||||||
%.o : %.asm
|
%.o : %.asm
|
||||||
@echo ">>>" $<
|
@echo ">>>" $<
|
||||||
|
|
|
@ -28,11 +28,14 @@ static __attribute__((always_inline)) inline unsigned int pprof_get_one(void)
|
||||||
__asm__ __volatile__ ("rdtsc" : "=A" (ret));
|
__asm__ __volatile__ ("rdtsc" : "=A" (ret));
|
||||||
return (unsigned int)ret;
|
return (unsigned int)ret;
|
||||||
}
|
}
|
||||||
|
#define unglitch_timer(x)
|
||||||
|
|
||||||
#elif defined(__GP2X__)
|
#elif defined(__GP2X__)
|
||||||
// XXX: MMSP2 only
|
// XXX: MMSP2 only, timer sometimes seems to return lower vals?
|
||||||
extern volatile unsigned long *gp2x_memregl;
|
extern volatile unsigned long *gp2x_memregl;
|
||||||
#define pprof_get_one() (unsigned int)gp2x_memregl[0x0a00 >> 2]
|
#define pprof_get_one() (unsigned int)gp2x_memregl[0x0a00 >> 2]
|
||||||
|
#define unglitch_timer(di) \
|
||||||
|
if ((signed int)(di) < 0) di = 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error no timer
|
#error no timer
|
||||||
|
@ -40,12 +43,22 @@ extern volatile unsigned long *gp2x_memregl;
|
||||||
|
|
||||||
#define pprof_start(point) { \
|
#define pprof_start(point) { \
|
||||||
unsigned int pp_start_##point = pprof_get_one()
|
unsigned int pp_start_##point = pprof_get_one()
|
||||||
|
|
||||||
#define pprof_end(point) \
|
#define pprof_end(point) \
|
||||||
pp_counters->counter[pp_##point] += pprof_get_one() - pp_start_##point; \
|
{ \
|
||||||
|
unsigned int di = pprof_get_one() - pp_start_##point; \
|
||||||
|
unglitch_timer(di); \
|
||||||
|
pp_counters->counter[pp_##point] += di; \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
// subtract for recursive stuff
|
// subtract for recursive stuff
|
||||||
#define pprof_end_sub(point) \
|
#define pprof_end_sub(point) \
|
||||||
pp_counters->counter[pp_##point] -= pprof_get_one() - pp_start_##point; \
|
{ \
|
||||||
|
unsigned int di = pprof_get_one() - pp_start_##point; \
|
||||||
|
unglitch_timer(di); \
|
||||||
|
pp_counters->counter[pp_##point] -= di; \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void pprof_init(void);
|
extern void pprof_init(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue