PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

XScale blitting

I have conducted some tests yesterday and the GAPI performances of the iPAQ 2200 are pretty lame. Where I get 101 FPS on my Maestro (ARM-206), I get 51 FPS on my HP2210.

I would guess it uses some video chip (MediaQ or something else). I will have to investigate further to determine if this is indeed the case.

Anyone has experiences to share about using GAPI efficiently on the XScale device? I couldn't find much on the net. The only thing I found was to use "ldrd/strd" instead of your usual "LDM/STM" instructions.
Thierry: I believe the 2200s use the MediaQ chip. But how come the 2210 is much faster than most devices out there in games? I don't understand.
>>But how come the 2210 is much faster than most devices out there in games? I don't understand.

Because a game consists of more than just a full screen blit each frame.
Digby wrote:
>>But how come the 2210 is much faster than most devices out there in games? I don't understand.

Because a game consists of more than just a full screen blit each frame.


=)
sponge wrote:
Thierry: I believe the 2200s use the MediaQ chip. But how come the 2210 is much faster than most devices out there in games? I don't understand.


I know people believe that. I need to know if this is the case. I haven't found any evidence supporting this.
I have encountered the same problems on the Dell Axim X5 (XScale + MediaQ).

A simple memcpy RAM->VIDEO RAM (adr returned by GAPI) is ~5ms on a std ARM architecture, this value jump to 20ms on the Axim...

Those inacceptable performances are not an Xscale problem since a memcpy RAM->RAM is not really slower on the same Axim (about 2ms).
StephC wrote:
I have encountered the same problems on the Dell Axim X5 (XScale + MediaQ).
(...)
Those inacceptable performances are not an Xscale problem since a memcpy RAM->RAM is not really slower on the same Axim (about 2ms).


Indeed. So it does look like the 2215 has a MediaQ or some other video controller. The good news is that the MediaQ chip seem quite straightforward to program (and specs are available). Thanks for your feedback.
The specs on HP's website state that the device has a separate video controller onboard.

Given HP's previous relationship with MediaQ with their iPaq 5400 devices, it's a good bet that this "separate video controller" in the newer devices is also a MediaQ chip.

20 msecs is pretty high. My e740 with the ATI W100 is 20% faster than that and it has a 16 bit memory bus and a PXA-250.
uh ?

specs are available ? can you give a link or some info ?

please... I haven't found anything concerning this chip...
StephC wrote:
uh ?

specs are available ? can you give a link or some info ?

please... I haven't found anything concerning this chip...


Err.. www.mediaq.com
Go to the 1100 chip serie, select download specs. You will have to register the first time.
I've already got those pdf, but I haven't found any useful infos in them...

(the mediaq ref for the axim is : mq1132)
okay, the only useful pdf was corrupted the firt time I downloaded it...

Thanks you.
rcp · 17 Jul 2003, 06:13 UTC — Dell Axim problems
We are seeing that same type speed problems when writting to video memory. As others have noted, the speed hit is extreme. We go to drastic extremes to not update the video ram if the pixel hasn't changed. We found it is actually *several* times faster to check the contents of the new framebuffer against and old one (all in local RAM) and only update the pixels in the screen memory that have actually changed. Logic says this would be slower, but it is far from the case.

We have tried running DMA chains to update the screen in a hope that the CPU would be free to do other work. This was only mildly successful as it seems the DMA either bogs the bus down too much or the CPU isn't fully released. ie; it was faster, but not by much.

Is anyone out there able to verfiy that the MediaQ controller is used on the Dell Axim. In addition, has anyone programmed it directly?

tia!
blackrob · 17 Jul 2003, 10:59 UTC — Dell Axim problems
rcp wrote:
Is anyone out there able to verfiy that the MediaQ controller is used on the Dell Axim. In addition, has anyone programmed it directly?
tia!


Yes the Axim does use the MediaQ chip. The MediaQ docs are not 'user friendly' - they are very low level and take quite a while to get in to.

I've seen a tare free blit implemented for MediaQ that while limited to 30fps had very little cpu overhead. I didn't write it and it's used in a commercial product so I can't share it, but it does use chained DMA.
Dan East · 17 Jul 2003, 13:23 UTC — Dell Axim problems
rcp wrote:
We found it is actually *several* times faster to check the contents of the new framebuffer against and old one (all in local RAM) and only update the pixels in the screen memory that have actually changed. Logic says this would be slower, but it is far from the case.


Are you using something higher-level like dirty rects, or are you talking about a crude per-pixel test?

Dan East
I think this may be useful for everyone to share ideas, results and source code concerning the MediaQ problem...
Have any of you tried to contact MediaQ and ask them for suggestions on how to mitigate the slow write speed to the memory returned by GAPI?
Dan:
Both. We have a high level dirty rect type approach that can eliminate large areas. However, we also do a pixel by pixel approach on the other areas as we found that it actually still makes an improvement. Basically, writting to video memory is just that slow.

Digby and others:
I download the MediaQ docs and found them quite straightforward. Except for the fact that they neglected to cover the FIFO register definitions, everything you need is in there. I was able to setup a system memory to display memory BitBlt and bang the pixels into the FIFO. Unfortunately, since the BitBlt requires you to send the data to the FIFO, this is actually slower than just writting to the display memory. My test program runs at 45fps when writting to display memory and about 33fps when banging the FIFO for the BitBlt. I imagine that if I setup a chained DMA to write to the FIFO, that this would probably speed things up. Unfortunately, the FIFO depth is only 64 bytes, so there will be a good bit of overhead in any method writting to the FIFO. I'll try this next.

I did do some display memory to display memory BLTs and I found them to be wicked fast (like nearly free). The BLT function support full ROP and transparency (not blending, just yes or no) so there is probably something useful that can be done with this. I can imagine keeping some static object just offscreen and BLT them onscreen as needed. Since a 320x240 screen only takes about 60% of the available RAM, there could be some interesting potential here (given that nothing *else* is using that RAM).

What I don't understand is why the Window's BLT is so slow. If the MediaQ will do a BLT using chained DMA to the FIFO, then it should be much faster. There are only two possibilities in my mind... 1) The display driver doesn't use the MediaQ features, or 2) Chained DMA to the FIFO is slow. I honestly can't imagine that the display driver isn't optimized for the chip since MediaQ provides a reference driver. In addition, I have a hard time believing that the DMA/FIFO method would be slow. Of course, experience tells me not to be surprised by anything. ;)

I would be interested in putting a small test program out that does nothing but BLT a screen using direct write to display memory (memcpy). It would be interesting to get some fps numbers from different devices. The only two devices I have both have the MediaQ 1132... so I'd like to see what some device do that either don't have a external video controller or that have a different one.

Thanks for all the input. This looks like a great forum. If noone minds, I think I'll stick around. ;)

Cheers,

rcp
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
Regarding slow GDI blits, in order to see a VRAM-to-VRAM blit you'll need to create the bitmap selected into your offscreen memory DC using CreateCompatibleBitmap. Otherwise, the bitmap will be in system RAM and, well, you already know how slow that is on your hardware.
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
rcp · 18 Jul 2003, 04:38 UTC — DMA->FIFO update
OK, I now have the DMA->FIFO working on the MQ1132. Here is what I found.

320x240x16bit BLT, 46fps

This is the same speed as doing a memcpy to the address returned from BeginDraw... so not any speed increase. However, the real question is how much the CPU has been offloaded.

I am still working out a good test for this, but here is what I've tried so far.

Assuming that if the DMA->FIFO BLT was taking 0% of the CPU time we should be able to Sleep(33) and see a frame rate of 30fps. Of course, that doesn't happen, but it is not too far off.

DMA->FIFO BLT, Sleep(33) = 27fps

A Sleep(30) actually is what we need for 30fps. In theory, this means the BLT is taking about 3ms. I see a bunch of you jumping up and down saying NO!! You are right, just because we Sleep(30) *doesn't* mean the CPU was idle, it just means it was somewhere else. In fact, it could be very busy and not really available to us. I need to work on a routine that can do some memory moves, vertex processing etc, and see how much of the theoretical 30ms is actually available.

Cheers,
rcp
rcp wrote:
(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)


Just put [ code ] //my source code [ /code ] blocks around your code (without the spaces in the brackets).

Dan East
I can confirm that the HP2210 is using a MQ LCD controller. Now I am unsure which one.

The MQ1132 "manual" states that it has a PCI devide ID of 0x120. My device is returning 0x188. The PCI vendor ID is 'MQ' as expected.

The MQ2100 and MQ9000 "manuals" don't describe their device IDs.

It could be that 0x188 is just a revision to the MQ1132. Anyone knows?
Thierry,

MediaQ also makes an 1168 and 1188 series. I thought I'd heard once that the 1188 is being used in the new iPaqs, but I have no data to back that up.

Pam
PAM: Thanks, I didn't notice there was other variants of the MQ 11xx chip: the 1168 and 1188. One of them even has enough memory for true double buffering (320K). Unfortunately, the only programming document available is for the 1132.


I would expect the chips to be fully compatible with the 1132 though. If this is the case, I will be happy.
Thierry,

For whatever it is worth, the information I have is that the Device ID for the 1132 is indeed 0x120, the 1168 is 0x122 and the 1178/88 is 0x188.

Pam
Thanks PAM. This means the HP 2200 has a MQ 1178/88. How did you come by that info? I am curious because more info might be available?
StephC · 06 Aug 2003, 18:36 UTC — DMA->FIFO update
rcp wrote:
OK, I now have the DMA->FIFO working on the MQ1132. Here is what I found.


Could you explain more about the setup of the DMA->FIFO ?

I have never programmed DMA on thoses devices and this seem a little obscure to me.
Ok, maybe I'm blind but I can't find any document on mediaq.com related to programming. I went through all the datasheets, product briefs, driver adaption notes and evaluation kit guides there are..
Johan wrote:
Ok, maybe I'm blind but I can't find any document on mediaq.com related to programming. I went through all the datasheets, product briefs, driver adaption notes and evaluation kit guides there are..


Can Anyone send me a useful document about it. I can not find it either.

Has anyone used it successfuly (eg.: to speedup your game)

If so, then was it used for vram->vram blitting, or the ram->vram blitter worked well?
I have just checked this forum, but I still do not know, a ram->vram blitter will leave the CPU almost free?
Or will it put a big load on the memory bus, so all you can do in the meantime is to add registers to each other at high speed ? :-)


Thanks,
G.
ya, you bog down the bus and are left to play with registers. Probably not what you wanted to hear. You can an overall speedup, but not 2x or so. If the OEM's would write their device drivers correctly, then you could use a standard GDI BLT and things would be much better. (still not 2x) I am afraid you are going to have to make do with what we have for now and wait for better hardware in the future.
bofw3 · 04 Nov 2003, 17:08 UTC — Dell Axim problems
rcp wrote:
We have tried running DMA chains to update the screen in a hope that the CPU would be free to do other work. This was only mildly successful as it seems the DMA either bogs the bus down too much or the CPU isn't fully released. ie; it was faster, but not by much.


Can you give some pointers how can I setup such a DMA chain? I searched hi&lo in this forum and in the Internet and haven't find any info on that. I really want to try something like a DMA transfer between system RAM and video RAM, even if the performance increase is not much.
The XScale docs cover this very well. Unfortunately, you can only do this on the kernel side of WinCE. Basically, you need to write a new device driver. A slightly less intensive solution would be to write a DMA driver on the kernel side and use it from the user side to do your BLTs.

This is not trivial stuff... it involves gettings your hands very dirty and using the WinCE DDK to build a driver. On the positive side, it is very straightforward and you should find samples in the DDK.

I never completed this because the speed increase was not worth writting a DMA driver to install on other peoples PPC. I am sure that reliablity, given some of the different PPC configurations, was sure to be low.

We probably will end up doing this, but not this year.

Best of luck!

-rcp
rcp wrote:
The XScale docs cover this very well. Unfortunately, you can only do this on the kernel side of WinCE. Basically, you need to write a new device driver. A slightly less intensive solution would be to write a DMA driver on the kernel side and use it from the user side to do your BLTs.


Thanks, I know that path, I was hopping that there was a easier solution, but thanks anyway...

BC
Sorry for bringing up this years old thread, but it's pretty much the only alive page which contains "mq2100" and "datasheet". :?

I'm trying to port linux to my Mitac phone mio8390,
which is using a MediaQ MQ2100 chip.
As you know the datatsheets are
removed from the website by nvidia,
so I would like to ask if anyone knows anything about this?