Welcome to MSDN Blogs Sign in | Join | Help

Windows Mobile Team Blog

The Official Windows Mobile Team Blog
Have you migrated to DirectDraw yet?

When we released Windows Mobile 5.0, we marked GAPI as deprecated in the SDK docs.  Deprecated means that we won’t be updating the API and that it may be removed in future releases of Windows Mobile.  GAPI was superseded by DDraw which is a more complete and robust way of accessing the screen for graphics.

 

Caveat : We know DirectDraw doesn’t provide input, for the purposes of this discussion, we’re talking only about accessing the screen for drawing.

 

If you’re using GAPI and haven’t yet migrated to DirectDraw (or Direct3D Mobile), please take a moment to add a comment letting us know why you haven’t yet made the switch.  Is DirectDraw/Direct3D Mobile missing something you need?  Do you need documentation to help migrate from GAPI to DDraw?  Does GAPI work “well enough” so you don’t need to migrate?  If GAPI is “good enough” what might make you migrate to DirectDraw?

 

We’d also love to hear from you if you’ve already made the switch from GAPI to DirectDraw!  What was the experience like?  What went well?  What could have gone better?

Posted: Monday, August 13, 2007 5:18 PM by msaffitz
Filed under:

Comments

zebrum said:

Theres no managed wrapper for directdraw like there is for direct3d. So I'm still using a gapi wrapper. If one was made available by MS I would switch to using it.

# August 13, 2007 1:24 PM

Sila Kayo said:

I have migrated from GAPI to DirectDraw, and the process was straightforward.

I also think that instead of totally removing GAPI, Microsoft should keep it as part of Windows Mobile, and just reimplement it on top of DirectDraw.

# August 13, 2007 1:40 PM

Dave said:

We use GETRAWFRAMEBUFFER rather than GAPI or DirectDraw.  The reason is simple -- GETRAWFRAMEBUFFER is considerably faster.  The performance of DirectDraw is unacceptable for our purposes according to a simple benchmark of just flipping images on the screen as fast as possible.  

# August 13, 2007 8:09 PM

DJ said:

I still target PPC 2003 - which doesn't support DirectDraw! I use PocketHAL library - its quicker, supports PPC 2002 and greater, and supports Symbian OS.

# August 14, 2007 3:40 AM

jamespr said:

Dave

What is your application?  There are a lot of DDraw/GAPI apps out there that get very good framerates.  Is there something unusual about your app that requires faster than normal performance?

Also, can you describe what you mean by "flipping images on the screen" and also tell us how you're getting your benchmark?

GETRAWFRAMEBUFFER is only supported on certain devices and will be supported by fewer and fewer devices in the future.  I'd recommend shifting to DDraw for this reason.

James

# August 14, 2007 4:54 PM

Marty said:

I'm just looking into WM development and I would like to use DirectDraw, I was surprised at the low quality of the C++ samples. "F12 to quit" indeed!

If you want people to start using DirectDraw, I think a little more effort needs to be expended on the samples.

Personally, I would like to see a nice complete game that demonstrated all the best practices and efficient programming techniques that Microsoft recommends for Windows Mobile devices.

# August 14, 2007 11:33 PM

Sludge said:

My experience is that DirectDraw still has some issues, that's why I prefer using GETRAWFRAMEBUFFER or GAPI (when GETRAWFRAMEBUFFER is not available).

Here are two of my most important issues with DirectDraw:

When opening a fullscreen application, there is no way to receive focus change events. For example on the HTC Touch, screen elements aren't drawn correctly when a phonecall comes in, or the volume buttons are used. Because no focus change events are received, I can't minimize the window when such an event happens.

DirectDraw is considerable slower when you have a custom graphics engine (with a lot of features like alpha blending and surface rotation). For example, I create a custom backbuffer surface in system memory (just a memory buffer, no DirectDraw surface), lock the primary DirectDraw surface and use memcpy to display it on the screen, then I unlock the primary surface. When using DirectDraw I get 37fps and with GETRAWFRAMEBUFFER I get 45fps. This is tested on a Dell Axim x50v.

Any suggestions to work around these issues are appreciated.

# August 17, 2007 3:42 AM

asdf said:

when you got a h.264 video to decode real-time, the performance is so important that ddraw can even not be considered a bit

# August 18, 2007 6:11 AM

Larry Bank said:

I recently dropped support for PPC2000/PPC2002, but I still have to support PPC2003 and SP2003.  I have written reliable code which tries first to use GETRAWFRAMEBUFFER and if that doesn't work, falls back to GAPI.  The best way to to migrate all apps to DDraw is to fix the performance issues mentioned above and publish wrapper code in C/C++ which provides the DDraw features on PPC2003/SP2003.

# August 18, 2007 11:06 AM

Patrick Tsai said:

Our experience is that GETRAWFRAMEBUFFER is faster than DirectDraw. Can somebody explain why DirectDraw is slower?

# August 18, 2007 11:07 AM

Twain said:

I'm very interested in the answers/comments posed by the developers who have tried DirectDraw.  Will you be posting your answers here?

I notice that many of the new APIs Microsoft introduces has few to zero C++ examples.  I know Microsoft wishes everyone would just move to C# as a development environment, but it doesn't always make business sense to the developers...

# August 20, 2007 3:47 PM

Dave said:

James,

Our application is a video player so it involves flipping screen-sized images (possibly with scaling) at a frame rate of 24-30 FPS while doing a lot of simultaneous processing including H.264 video decoding, AAC audio decoding, error correction, etc..  Minimizing the rendering time is vital because every extra cycle we can squeeze out can be used to improve the user experience.

We did benchmarking by slightly modifying the Ddex3 sample that ships with the WM5 SDK and also by porting over DirectDraw code from the desktop version of our player.  Both of these tests showed that the DirectDraw performance on various Dell and HTC devices wasn't even close to the performance with GETRAWFRAMEBUFFER.    

I would've loved to use DirectDraw, particularly if it let us share code with the desktop player and if it had some nice features like highly optimized color space conversion and hardware acceleration on devices that support it, but the poor performance made it unacceptable.  

I haven't repeated the benchmarking on the latest generation of WM5 devices or on any WM6 devices.  Do you know if DirectDraw performance has been greatly improved in newer versions?  

# August 20, 2007 6:31 PM

Thierry Tremblay said:

I am the author of PocketHAL and there are at least two reasons not to use DirectDraw/Direct3D Mobile:

1) It is slower then GETRAWFRAMEBUFFER

2) When using DD/D3DM, you never receive focus change messages (WM_ACTIVATE, WM_ACTIVATEAPP). In fact, you don't receive any message when losing focus. This means that even for devices that don't support GETRAWFRAMEBUFFER, DD/D3DM isn't an acceptable alternative.

# August 21, 2007 7:28 PM

Carlos said:

I've switched our application from GAPI to DDraw.

I did it because some phones lie when they inform their screen size and report 176x220.

The process was very complicated due to the problems with the focus change events.

I have only found problems with DDraw. None of the examples worked in the couple of phones I had at that time (I have not tested recently).

# August 22, 2007 6:55 AM

Thierry Tremblay said:

Carlos, how did you manage to work around the problems with the focus change events?

# August 22, 2007 12:29 PM

Harry said:

I inherited an application which was written for PPC2003.  I must convert it to WM6.  It uses the functions GXBeginDraw() and GXEndDraw() which are no longer supported.  How can I switch over to use DDraw?  Are there any tutorials/web sites available as I am new to this?  Thanks

# August 29, 2007 10:13 AM

jamespr said:

Folks

Sorry for my hiatus from this thread.  If I summarize the issues I've heard with DDraw, in rough order of priority they are :

1. Poor performance

2. Difficulty handling focus changes

3. Inadequate documentation/samples

I'll be taking this feedback to the development team to see how we can move forward on these issues.  Thanks for your input!

# August 29, 2007 4:25 PM

Kzinti said:

It isn't difficult to handle focus changes, it's impossible. You do not receive any WM_ messages!

# August 29, 2007 11:18 PM

Carlos said:

Thierry, we have a bad solution (well, no solution). When the user press ok, windows or call buttons, we minimize the application.

I'm thinking about letting the user choose GAPI or DDraw, but it's something that most people won't understand.

# August 30, 2007 6:07 AM

GernotFrisch said:

Nope. And I won't unless I'm forced to. Never touch a (fast) running system.

We're using GETRAWFREMBUFFER for 2003 and GAPI for older devices. If 2008 won't support it, we'd have to switch, but so far it stays unchanged.

# September 1, 2007 3:26 AM

Nikos said:

I use all of them...

DirectDraw is the default mode if found on the device. If not GAPI is used provided the (GAPI) screen size matches the device screen size. If it doesn't I use GETRAWFREMBUFFER to access the frame buffer.

In all cases the performance is more or less the same.  

I still use GAPI for input though. I cannot see what else I could do.

# September 1, 2007 5:21 AM

Thomas said:

It's nonsense to remove GAPI support in future versions of WM because there exist thousands of old applications which are using only GAPI for the fast screen access.

You should keep future versions backward compatible.

# September 2, 2007 6:56 AM

Andrew said:

Still using GETRAWFRAMEBUFFER buffer for our video rendering application.  

We found problems with accessing the primary surface on the HTC TyTn when different screen rotations were used.  Secondary surfaces handled the rotation properly and the primary surface appeared to (returning correct dimensions).  However when locking the primary surface it was actually in the default rotation.  Could have worked around this but it didn't seem worth the effort when GETRAWFRAMEBUFFER works fine.

# September 11, 2007 5:58 AM

Shimaro said:

Can you provide link to good samples of developing DirectDraw Windows Mobile applications? Maybe in C#? MS examples are very poor and only in C++.

# October 2, 2007 7:21 AM

Tuan said:

You could benchmark the issue about focus change on HTC Touch, even with the TouchFlo program. When you launched the TouchFlo Desktop, and then launch other program from the Desktop, and come back to Desktop again, the program launched didn't move, or close. IT'S A VERY BAD USEr EXPERIENCE, and stressing.

I will began to dev for WM6, using DDraw to blit, but all remarks made me hesitate(not for poor performance, but about this focus changes issues). Thx to fix this pb as soon as possible.

I'm going to dev on HTCTouch, dis someone have any docs about the TouchFlo API ? Did it include on WM6 or is it a real pluys from HTC? If there are not API, could i re-code it, and unable the TouchFlo one ?

Thx

# October 9, 2007 4:50 AM

wayne said:

what shell i do if no GAPI any more...

i feel direct interfaces are too much complex for new commer.

i just going through mobilinux with framebuffer and mmap...

the GAPI is just what i want.

get the video buffer, then let me handle the next right ?

i don't need those wrappers, i'v done it already.

# November 27, 2007 11:38 PM

Baro said:

I think there should be two interfaces.

First one should be like GETRAWDISPLAYBUFFER. Developer can access the pysical buffer for speed and/or dpi aware applications.

Second one should be DDraw/D3D. DDraw a little slower, because of emulation layer.

Somehow GAPI is deprecared. But new interfaces should be a standart.

And of course our old friend GDI is still with us for new commer. :)

Baro

# December 8, 2007 5:56 AM

Gordon Stone said:

What does MS recommend to use for handling input if they are going to eliminate GAPI from the mix?

# December 20, 2007 1:59 PM

Fred Di Sano said:

I've used DirectDraw and it was painful. Crap performance for starters. Using PocketHAL and my own ARM optimized blitting calls, I'm blowing DDraw out of the water!

A DirectInput type API would be VERY much welcomed or at least keep GAPI in there. Getting input via the message pump is kind of clunky and in some cases (like on various HTC devices) it slows down the app!

I've used D3D Mobile with 3D accelerated devices and it's not bad! Performance could be better but it's a good start. The API reference is just horrible though. Open up the .CHM help file and try to view Direct3D related stuff and you'll find lots of broken links! Luckily, the MSDN web site has this info.

I won't be writing any games in .OVERHEAD as I refuse to sacrifice what little power I already have.

Get those 3D drivers up to speed guys!

# January 4, 2008 1:40 PM

Rambalac said:

The main reason of DD fault is MS weakness. They dont make OEMs to emplement drivers for new hardware. For example my Sharp EM-ONEa with "super-duper-fast" NVidia GoForce 5500 is slower than ASUS A716 i bought 3 years earlier even with drawing in 320x240 part of screen (EM-ONE with DD and A716 with FB). When you turn screen on EM-ONE it becomes 2x slower, though GoForce5500 can do 90,270 turn in hardware.

Almost all OEMs, instead of making drivers for DD and D3D for hardware they are using, are just using software driver they got from MS, of course it's not total fault of MS but as the owner of WM they could change the situation at least

The main example, FOR ALL THOSE YEARS NOONE SAW ANY Direct3D HARDWARE ACCELERATED WM DEVICE. This time only OpenGL ES has some chances

# February 14, 2008 12:33 AM

Rockman said:

We need GAPI on Windows Mobile 7, 8, ...

It's cool and simple to use.Don't remove it, thanks!

# March 21, 2008 5:56 AM

Nick said:

We migrated to DirectDraw to improve the performance of our graphics rendering application on WM5 and WM6. The performance increase was worth having but now we are stuck with an issue where if the user clicks on the start button the start menu is drawn and then our app overwrites part of the start menu. It seems like the start menu behaves differently to, say, the volume icon which does the right thing. As an added bonus it does not happen on all devices. With GAPI we had no such issues.

# April 9, 2008 2:52 PM

Rodrigo said:

Can you publish the IDL/TBL files for DirectDraw?

# April 15, 2008 10:29 AM

Yael said:

why Direct3D Mobile not support child windows?

i need this option.

# June 18, 2008 2:09 AM

Wil said:

I quickly skimmed the available drawing APIs in Windows Mobile and found DirectDraw rather slow, at least when running on the device emulator.

This would've been acceptable until I came accross GAPIDraw (http://www.gapidraw.com/) where all the sample ran SMOOTHLY with at least 30 fps on the emulator! And, as a nice bonus, it automagically handles lost contexts.

One problem with it is that it's commercial the license may be too much for an indie or startup developer (even though the terms are very, very good for a graphics engine). This, paired with the poor performance of the DirectDraw API may make it unappealing to develop games for Windows Mobile.

Oh yeah, and it would be great if the emulator could get descent hardware acceleration software emulation for DirectDraw and Direct3D. Apple's iPhone emulator has great performance even when using OpenGL.

# June 24, 2008 1:15 PM

andrew said:

hey i'm new to window mobile/ce programming

i think a FAQ is needed ;)

btw GAPI do not do LineTo, do DirectDraw do that?

# August 5, 2008 3:36 AM

NuShrike said:

Unlike GAPI, why migrate to DirectDraw when Microsoft basically told OEMs to NOT bother shipping hardware-accelerated DirectDraw/Direct3D Mobile drivers?

If it hasn't been noticed, recent devices, especially from HTC, are graphically slower than devices produced in 2005 and mainly due to this switch-over letting the OEMs implement drivers.  Most OEMs have neither the care nor skill to do so.

It's very analogous to the days of any-OS before Microsoft standardized it.  Is Microsoft proud it seeded chaos back in?

# August 11, 2008 6:08 PM

NuShrike said:

It's also come to light that MS is allowing OEMs to ship reference drivers (Don Couch) that are supposed to be only used in CETK and not a production release.

We're talking about reference drivers that render in seconds/minutes per frame that are only useful for the "golden image" testing.

Until MS cracks the whip on itself and OEMs, DD/D3D Mobile will be a perennial failure.

# August 13, 2008 5:32 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker