PocketMatrix forums

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

Mobile DirectDraw: Video Memory Issues

Hey,

I have been looking into the Windows Mobile implementation of DirectDraw a bit, and have some questions. Maybe someone here can help me out a bit.

1. Available video memory (dwVidMemTotal)

Most of my devices only report back a few hundred kb of total video memory. My HTC 7500 as an example reports back 196608 bytes of video memory = 192 kb. Considering that the screen is 600 kb (640x480x2), 192 kb is really nothing. Changing bitmap cache settings does not change this.

Does anyone know of any device that has more available video ram for DirectDraw to try out? Or is this some odd limitation with DirectDraw Mobile?

2. Cannot create surfaces in video memory

Well, even if 192 kb of video memory is not much, at least it could be used for something good, right? Wrong. If I create my surfaces with DDSD_CAPS and my dwCaps set to DDSCAPS_VIDEOMEMORY CreateSurface() fails with DDERR_INVALIDCAPS. The interesting thing is that this is on an actual device where GetCaps() returns that DDSCAPS_VIDEOMEMORY is indeed a valid flag to use!

So, my second question is: Is it possible at all to create offscreen surfaces in video memory using DirectDraw mobile? Because on two of my devices that reports that they support video surfaces it is apparently not possible.

I'm thankful for any replies you might have. I have searched the forums and all over the Internet but it appears not many try to call CreateSurface on mobile devices to create surfaces in video memory.

Sincerely
Johan
What does dwVidMemFree report?

Regarding issue 2, if you make the same call to CreateSurface and use DDSCAPS_SYSTEMMEMORY instead of DDSCAPS_VIDEOMEMORY, does the call succeed?

If you don't specify a memory pool flag and the surface is created successfully, what does GetSurfaceDesc report for the memory pool of that new surface?
Hi Digby,

Thanks for taking the time to reply.

dwVidMemFree is always same as dwVidMemTotal on the devices I have tried. Most HTC devices seem to report back 196608 bytes free vidmem and 196608 bytes total vidmem. Using GetCaps on most HTC devices shows that they should support DDSCAPS_VIDEOMEMORY. But using that flag causes CreateSurface to fail.

I just tried DDSCAPS_SYSTEMMEMORY and it does not give an error back. Not specifying pool makes the surface go to system memory by default (e.g. GetSurfaceCaps has the systemmemory flag set).

I have tested mostly on HTC units, and it might be that their unit simply has an erraneous DirectDraw implementation that reports back that it should support video memory but fails when trying to create something in there... Maybe it's related to the htcclassaction.org in some way...

I just find it interesting in that the displays get higher and higher resolution (like 800x480 on the XPERIA), and there appears to be so few units that support basic video acceleration for 2D blits.

Sincerely
Johan
I've toyed with DirectX Mobile quite a bit and have run into the problems your encountering.

1) From what I've come to understand is that most devices have JUST enough video memory to house the primary surface. Sometimes the device has a bit of extra video ram left which is why the free vidmem amount is so small.

2) Creating surfaces in video memory generally doesn't seem to work as there isn't ever enough room there to create a big surface. Maybe small ones that are <= to the free vid mem size.

3) As for hardware blitting, that only seems to work when you can do it from video memory TO video memory. Although some devices take advantage of onboard DMA channels to get it from sys memory to vid memory whilst bypassing the CPU.

I've come to the conclusion that DirectX Mobile is broken and isn't much use to me. I've had WAY better success using PocketHAL and my own blit routines.