Thierry wrote:
I took a quick look at the specs and the MQ1132 seem quite straightforward to program.
I am really surprised to hear that the "accelerated" blit is using pseudo-DMA (the FIFO). I always assumed that the chip was capable of true DMA (unattended blit from system to video). Otherwise, what is the point of having such a chip in the first place? (Considering that both the StrongARM and XScale processors have built-in LCD controllers.)
I will investigate some more during the week-end and report back my findings.
Could you provide us with details on the FIFO registers? How does the FIFO work?
Thierry
ya, i was very surprised as well. In my mind, this really is pretty half-baked. They seem to have the hardware such that you can connect the Arm/XScale DMA to their FIFO, set them up and let it rip. This could be quite fast (at least the CPU should be free), however, keep in mind that for chained DMA, the ARM Core must fetch the 4 word descriptor for each go... and since the MQ FIFO seemingly can only do 16 words at a time, the ARM core is going to be quite busy just fetching descriptors. (if you do the math, that is 2400 descriptors for a 320x240x16bit display)
I am working on this right now and while I have an image comming up, it stops after about 10 or so frames. Unfortunately the image is distorted enough that I can't read the FPS.
Anyway,
the FIFO lives at 0xc00 offset. This is a physical address of 0x14040c00. On my PPC, this is a virtual address of 0x9e040c00. The first 16 words (64 bytes) appear to be the Graphics Engine Command FIFO. (not that I can actually *find* any commands that one might send to the Graphics Engine) The next 16 words are the Graphics Engine Source FIFO. While I haven't tried, it would seem to follow that the next 16 words are the GE Dst FIFO (ie; where you would get data from VRAM)
The following code will BLT using the CPU to cram data into the FIFO.
DWORD *mqControl=(DWORD *)0x9e040000;
DWORD width=240;
DWORD height=320;
DWORD drawCommand=(12) | //ROP2
(2<<8) | //BLT command
(0<<11) | //X Direction
(0<<12) | //Y Direction
(1<<13) | //Source memory is system memory
(0<<14) | //color source
(0<<15) | //must be 1?
(0<<16) | //disable trans
(0<<17) | //trans polarity
(0<<18) | //mono trans disabled
(0<<19) | //mono trans polarity
(0<<20) | //line format
(0<<23) | //source is data from FIFO
(0<<24) | //source stride = dst stride
(1<<25) | //ROP code is ROP2
(0<<26) | //clipping disabled
(1<<27) | //start command after XY dest write
(0<<30) | //pattern data comes from pattern register
(0<<31); //trans compare is source data
DWORD bltWH= (width) | //source/dst width
(height<<16) | //source/dst height
(1<<31); //start in upper left
DWORD srcXY=0<<16;
DWORD dstXY=0<<16; //0,0 destination
mqControl[0x228/4]=(width*2)|(1<<30);
mqControl[0x224/4]=(width*2);
mqControl[0x200/4]=drawCommand;
mqControl[0x204/4]=bltWH;
mqControl[0x20c/4]=srcXY;
mqControl[0x208/4]=dstXY;
DWORD count=0;
DWORD *fifo=&mqControl[0xc00/4+16];
while(count<(240*320/2))
{
mqControl[((0xc00/4)+16)+(count&0xf)]=*(src++);
count++;
}
(eh, i just did a preview, and that code is not very readable.... the tabs didn't make it through. maybe someone can show me how to post code in a nice fashion)
Hopefully I can get the DMA->FIFO approach working well enough to at least read the FPS text and thus see if there is enough speed up to warrant more research. Of course, the overall FPS of my test may not improve, however, the actual CPU usage might drop. Not real sure how I am going to rig my test to show that. A 30fps max rate of update would be fine is the CPU was 90% free to do other work.
Cheers,
rcp