Daid
Member
I'm having some problems with the hardware blitter. When the source is just drawn with direct pixel acces some pixels remain in the CPU cache and thus are not drawn by the blitter. Is there any way to force the CPU cache to be writen to memory?
This is my hardware blitter code btw:
This is my hardware blitter code btw:
Code:
int inline BoundBlits(SDL_Surface* Source, SDL_Rect* Src, SDL_Surface* Target, SDL_Rect* Trg)
{
return 0;
}
int HardwareBlit(SDL_Surface* Source, SDL_Rect* Src, SDL_Surface* Target, SDL_Rect* Trg)
{
int SMem = (int)Source->pixels - (int)UpperMem;
int DMem = (int)Target->pixels - (int)UpperMem;
if (SMem < 0 || SMem > 0x2000000)
return 1;
if (DMem < 0 || DMem > 0x2000000)
return 2;
if (BoundBlits(Source, Src, Target, Trg))
return 0;
while(blitter32[MESGSTATUS] & 1);
blitter32[MESGDSTCTRL] = (0 << 5) | (1 << 6) | (Trg->x % 4) * 8;//8BIT destination and enable ROP on destination
blitter32[MESGDSTADDR] = 0x2000000 + DMem + Trg->x + Trg->y * Target->pitch;//Address of destination
blitter32[MESGDSTSTRIDE] = Target->pitch;//Pitch of destination
blitter32[MESGSRCCTRL] = (1 << 8) | (1 << 7) | (0 << 5) | (Src->x % 4) * 8;//8BIT source and enable ROP on source, source in framebuffer
blitter32[MESGSRCADDR] = 0x2000000 + SMem + Src->x + Src->y * Source->pitch;//Address of source
blitter32[MESGSRCSTRIDE] = Source->pitch;//Pitch of source
blitter32[MESGPATCTRL] = 0;//Nothing with patern
blitter32[MESGSIZE] = (Src->h << 16) | (Src->w << 0);//Size
blitter32[MESGCTRL] = (1 << 10) | (1 << 9) | (1 << 8) | 0xCC;//Clear source input FIFO, possitive X,Y, copy ROP
mb();//Make sure the run is done last
blitter32[MESGSTATUS] = 0x1;//Run
return 0;
}
int HardwareBlitTrans(SDL_Surface* Source, SDL_Rect* Src, SDL_Surface* Target, SDL_Rect* Trg)
{
int SMem = (int)Source->pixels - (int)UpperMem;
int DMem = (int)Target->pixels - (int)UpperMem;
if (SMem < 0 || SMem > 0x2000000)
return 1;
if (DMem < 0 || DMem > 0x2000000)
return 2;
if (BoundBlits(Source, Src, Target, Trg))
return 0;
while(blitter32[MESGSTATUS] & 1);
blitter32[MESGDSTCTRL] = (0 << 5) | (1 << 6) | (Trg->x % 4) * 8;//8BIT destination and enable ROP on destination
blitter32[MESGDSTADDR] = 0x2000000 + DMem + Trg->x + Trg->y * Target->pitch;//Address of destination
blitter32[MESGDSTSTRIDE] = Target->pitch;//Pitch of destination
blitter32[MESGSRCCTRL] = (1 << 8) | (1 << 7) | (0 << 5) | (Src->x % 4) * 8;//8BIT source and enable ROP on source, source in framebuffer
blitter32[MESGSRCADDR] = 0x2000000 + SMem + Src->x + Src->y * Source->pitch;//Address of source
blitter32[MESGSRCSTRIDE] = Source->pitch;//Pitch of source
blitter32[MESGPATCTRL] = 0;//Nothing with patern
blitter32[MESGSIZE] = (Src->h << 16) | (Src->w << 0);//Size
blitter32[MESGCTRL] = (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | 0xCC;//Transparency, Clear source input FIFO, possitive X,Y, copy ROP
mb();//Make sure the run is done last
blitter32[MESGSTATUS] = 0x1;//Run
return 0;
}