slygamer
Active Member
I'm using Rlyeh's Minimal SDK and I have the blitter working very well (based on paeryn and gfoot's work), but only if I do not specify any optimization level. Even if I use -O1, the app locks up on the first blit. I added a heap of trace statements through the blitter (logging out the file and line number to the serial port), and the extra time those trace statements took allowed the blits to work, but then it died waiting for the vertical blank.
I'm using the serialize trick as mentioned in previous threads to force the write to the blitter status register to be last
but it doesn't seem to help.
Any ideas?
I'm using the serialize trick as mentioned in previous threads to force the write to the blitter status register to be last
Code:
#define WAIT_BLITTER_IDLE { do {} while (blitter->MESGSTATUS & MESGSTATUS_BUSY); }
#define SERIALIZE __asm__ __volatile__ ("" : : :"memory")
...
WAIT_BLITTER_IDLE;
u16 *dest = &(((u16 *)gp2x_physvram[gp2x_physvram[7]])[screenX + (screenY * GP2X_SCREEN_WIDTH)]);
blitter->MESGDSTCTRL = (mode & BLITMODE_MASKED ? MESGDSTCTRL_DSTENB : 0) | MESGDSTCTRL_DSTBPP_16 | FRAC16(screenX);
blitter->MESGDSTADDR = (unsigned long)dest & (~3);
blitter->MESGDSTSTRIDE = GP2X_SCREEN_WIDTH * GP2X_BYTESPERPIXEL;
blitter->MESGSRCCTRL = MESGSRCCTRL_SRCBPP_16 | MESGSRCCTRL_SRCENB | MESGSRCCTRL_INVIDEO | FRAC16(rx);
blitter->MESGSRCADDR = (unsigned long)gp2x_heap_getphys(src) & (~3);
blitter->MESGSRCSTRIDE = image->width * GP2X_BYTESPERPIXEL;
blitter->MESGPATCTRL = 0;
blitter->MESGSIZE = (rh << MESGSIZE_HEIGHT) | (rw);
blitter->MESGCTRL = MESGCTRL_FFCLR | MESGCTRL_YDIR_POS | MESGCTRL_XDIR_POS | SRCCOPY;
SERIALIZE;
// Writing to the status register triggers the blit
blitter->MESGSTATUS = MESGSTATUS_BUSY;
Any ideas?