PocketMatrix forums

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

GapiDraw 2.10 screenshot-of-the-day #1

Image

This is not your typical slow "use only for emulation purposes" GDI driver.. This is a turbo-accelerated-mega-superfast implementation.. :) Of course it works equally as well on stationary PCs.

Have a great game but cannot get the WM2003 certification since it the game will only run in fullscreen mode? No worries. Just install GD 2.10 when it's out and you're set...
That looks great Johan! I'm just wondering, do you have to resize the graphics to fit the smaller window or did the new version resized/clipped the full screen app automatically? How does the windowed mode affect performance in terms of FPS?
do you have to resize the graphics to fit the smaller window or did the new version resized/clipped the full screen app automatically?


You create the backbuffer of any size you want and then copy it using a DC blit to the display. The new version does not resize or stretch to fit the display.

How does the windowed mode affect performance in terms of FPS?


The performance is only affected by the time it takes for the final DC blit to the window, and on newer devices this is about the same as doing a full memcpy to the backbuffer. The rest of the game blitting to/from the backbuffer will perform at identical performance as earlier.
That's actually very cool, and I didn't even know about it... I have been considering updating my Electro product to use GD, which would make the file size and load time much better and of course give me some new capabilities... I have been toying with the idea of writing my own GUI widget toolkit, but what the hell, if I can basically use the standard GUI components and use GD for everything else, that's very cool. Even if it gives me nothing more than the menubar that would be a big plus. Thanks Johan!
Johan, can you use windows text boxes and scrolling lists over that?

I ask because for a senior design project we are creating an application which is pretty much a glorified grocery list/database. I would like to make it easily skinnable if possible.
Kzinti · 20 Nov 2003, 03:21 UTC — GapiDraw 2.10 screenshot-of-the-day #1
Johan wrote:
This is not your typical slow "use only for emulation purposes" GDI driver..


What do you call a "typical GDI driver"? I've never heard of such a beast? Or is this a gratuitous poke at PocketFrog's limited desktop support?


Johan wrote:
This is a turbo-accelerated-mega-superfast implementation.. :) Of course it works equally as well on stationary PCs.


And then:

Johan wrote:
The performance is only affected by the time it takes for the final DC blit to the window,


Using a DC to blit a backbuffer to the screen is precisely what is killing the performances with GDI. So what have you done to "turbo-accelerate" it?
Bling! Bling! Alright gentlemen... I want a clean fight, a nice clean fight... No hitting below the belt, no rabbit punches... At the sound of the bell, come out fighting... Now tap gloves and return to your corners and... LET'S GET READY TO RUMBLE!
Johan, can you use windows text boxes and scrolling lists over that?


Yes, you can.. There is no direct access to the frame buffer going on here...

What do you call a "typical GDI driver"? I've never heard of such a beast? Or is this a gratuitous poke at PocketFrog's limited desktop support?


Sorry, I didn't mean to put it that way. My old GapiTools library used GDI for the final blit to display on stationary PCs, and it was only for emulation purposes since it was a quite slow implementation. I guess PocketHAL when run in non-rotated display mode on a Pocket PC will perform the same as GapiDraw using GDI blits to the display.

Using a standard 240x320 PPC display, it is perhaps hard to motivate the need for a rotated image in a GDI window. The effective view area is 240x270 pixels, and rotating it sideways would only reveal 270x240 pixels. There are however right now some developers I have contact with that are targeting the new 640x480 Toshiba and want to use GDI since their applications need Microsoft certification. Using the Toshiba device, a landscape mode of 590x480 is quite the difference. Sure, you may not get 30FPS on it, but it will be possible to do some nice tricks, especially if you overlay the background layer with fast GDI video blits on top.

Since GD still prerotates the surfaces and the backbuffer, the performance of drawing into a GDI window and drawing to a full screen display in rotated mode is not that much different on newer devices. If a library does not use prerotated images and the display is rotated, then on each frame update the entire backbuffer must be copied and rotated into another backbuffer, which then can be copied to the display. Using resolutions up to 590x480, the performance difference is quite an impact.

Using a DC to blit a backbuffer to the screen is precisely what is killing the performances with GDI. So what have you done to "turbo-accelerate" it?


I would say that (a) using a DC to blit the backbuffer to the display, and (b) having to rotate the entire backbuffer in system memory before blitting to the display is what kills GDI performance. On my IPAQ 2210 I get 30FPS in a GDI window while performing a fullscreen rotation, some alpha blends and several blits (all characters are blitted individually as seen in the screenshot).. And I still have around 8ms to do some other cool stuff... :) I would on the contrary say that performance when using GDI blits on newer devices are quite acceptable for many applications.
Also... GapiDraw has always used GDI blits to display when used in the emulator environments.. If you check the version history it says:

GapiDraw 2.0 Internal Changes
-BltFast, AlphabltFast and FillRect was completely rewritten.
-The entire GDI bridge for emulator environments was rewritten.
-Changes has been done to all function calls to support video surfaces.
http://www.gapidraw.com/docs-relhist.asp
(it's also included in the distribution)

I really didn't mean anything by referring to a "typical slow only for emulation purposes GDI driver" but I really think that being able to achieve 30FPS using GDI is quite cool.. And using prerotated surfaces, this same performance can be achieved in any display rotation! I really believe we'll see many applications using GDI in the near future (providing two versions of a game is easy if a developer uses GapiDraw)...

Finally.. The reason I used the term "typical slow" is that the general concensus seems to be that GDI is useless for most work.. Some quotes...

Frank on using GDI for development: "I can't do the desktop release (because GDI simply won't cut it)"
http://www.pocketmatrix.com/forums/view ... i&start=15

PocketHAL GDI Support: "There is two reasons I include a GDI driver: 1) color conversion for for displays that aren't 16 bpp and 2) as a safety net if everything else fails (no GAPI installed for example).
http://www.pocketmatrix.com/forums/view ... i&start=30

I believe that the performance of using GDI on newer devices is perfectly acceptable for many applications.
Wow, I was quoted! I'm so honored! :) (Now I have to go re-read my comments and make sure I wasn't being a total bonehead).

Johan, just to clarify for my own sanity... GDI usage only applies on a desktop, right? I mean, your not saying that we can get 30FPS on any PocketPC device using GDI instead of GAPI, are you?
fzammetti: :D

Johan, just to clarify for my own sanity... GDI usage only applies on a desktop, right? I mean, your not saying that we can get 30FPS on any PocketPC device using GDI instead of GAPI, are you?


GDI applies to both desktop and PPC devices. You won't get 30FPS on all devices of course, but the screenshot on the top of this page was taken using CEZoom.exe from my IPAQ 2210.. 30FPS without breaking a sweat. Adapting an existing GapiDraw game to run in a window is quite simple (an hour or so work) and shipping both windowed and full screen version of the same game should be quite doable.
Oh wow, that's more interesting than I at first thought then :)

From your statement that 30FPS isn't guaranteed on all devices, I take it that GDI is limited performance-wise the same way GAPI is then on some devices. Can I assume that the devices that wouldn't get 30FPS would be the MediaQ-based devices?

When I first read your last reply, I was thinking that if I convert my game to windowed then I could bump the frame rate up, but that's not the case it seems. This is good news none the less. Thanks Johan!
Johan, does that mean that if we play a GDI gapidraw game on the desktop PC, it will not require DirectX anymore? I just want to clarify. Thanks!
From your statement that 30FPS isn't guaranteed on all devices, I take it that GDI is limited performance-wise the same way GAPI is then on some devices. Can I assume that the devices that wouldn't get 30FPS would be the MediaQ-based devices?


The 2210 uses the MediaQ chip. Actually when it come to GDI performance it is quite the opposite to GAPI performance.. Devices with poor GAPI performance (such as MediaQ devices) perform about the same with GDI (since the bottleneck is the video bus). Devices with excellent GAPI performance (such as the older 3600 devices) perform much worse using GDI.

A typical GDI blit to display takes around 20ms.. That leaves around 13ms to do other stuff if you want to reach 30fps.. On newer devices using XScale CPUS that is quite enough time to do lots of cool stuff....

Johan, does that mean that if we play a GDI gapidraw game on the desktop PC, it will not require DirectX anymore? I just want to clarify. Thanks!


Unfortunately I link statically to the DirectX libraries.. So even if your application does not use them, they will still be required...
Why can't you continue to use memcpy (or whatever copy routine of choice you prefer to use) and GAPI when your app runs in a window?

Your back buffer would be created to match the size of the window's client area, then the presentation of your back buffer to the primary surface would offset to the upper left corner of the window's client rect.

The problem you would have to worry about is when various GWES controls popped up over the window's client area that you're clobbering each frame. On the desktop, there are messages sent to your window proc when this sort of thing happens (or if you're *causing* it to happen you'd know about it). If there is something similar for CE, you're golden. When you detect something being drawn over your window, you'd fall back to using a GDI BitBlt to present the back buffer since GDI knows about the clip region of the UI element drawn on top of your window. When this happens, you should probably also drop back to a GetMessage call that will yield instead of your PeekMessage spin loop. You might also want to think about unlocking the buttons so that the user can use them within the control/menu (maybe you don't have to do this?).