PocketMatrix forums

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

Jornada 720 GAPI Library

Sergey Chaban · 22 Nov 2002, 08:52 UTC
This is how the demo looks on Jornada720's wide screen:
http://mono.eurosoft.od.ua/wince/files/gl720.jpg

I used my GAPI DLL implementation for 720 to run the demo:
http://mono.eurosoft.od.ua/wince/files/gapi720.zip

I had to change one line in GapiGL.c, namely g_lineSize calculation.
Now it looks like this:
g_lineSize = (gxdp.cBPP >> 3) * (gxdp.ffFormat & kfLandscape ? gxdp.cyHeight : gxdp.cxWidth);
(This probably also has to do with the broken video on LOOX).

Here is the binary (it runs just fine on various iPaqs as well as on 720, but gx.dll is for Jornada only!):
http://mono.eurosoft.od.ua/wince/files/gl720.zip


SC
Conan · 22 Nov 2002, 11:11 UTC — GAPI for Jornada 720
Hello Sergey

Your GAPI for Jornada 720 is of great use to developers who want to support the Jornada 710/720.

If it works like normal GAPI then more people can consider porting to the Jornada HPCs.

I look forward to trying this out.

( ps: PocketFrog already supports J710/720 but most other toolkits don't )
Sergey Chaban · 22 Nov 2002, 18:52 UTC
If it works like normal GAPI then more people can consider porting to the Jornada HPCs.


Well, it is supposed to be a drop-in replacement for gx.dll.
Whether it meets this goal or not is another question :)
Its main feature at the moment is that it comes with the source code and under liberal license (basically free for any use) and supports video hardware acceleratation on J7xx HPCs.
There are basically two libs, one is GAPI implementation (DLL) and another is a static lib that provides access to Jornada's video hardware. The latter may be useful for the graphics libs that already have native support for Jornada to implement things like bitmapped fonts with h/w acceleration. The former is supposed to help with porting stuff to Jornada.
I tried some GapiDraw demos, they start/exit just fine, but there is only back screen with some random pixels on it, so gx.dll still requires some more work (I will add QVGA mode in the next version).

That said, OpenGL demo runs pretty smooth on J720.

SC
That J720 library is really nice... Had I known it existed I probably wouldn't have sold my device. Oh well.

I am a little surprised to see that the blitter uses a linear address for it's source (instead of a physical address). Is this right? Does it work well?
Sergey Chaban · 23 Nov 2002, 17:34 UTC
I am a little surprised to see that the blitter uses a linear address for it's source (instead of a physical address). Is this right? Does it work well?


In fact there is no real DMA, instead transfer is CPU-controlled and goes thru the 16-word FIFO buffer. Only LSB of the source address must be supplied to the chip (for data alignment). So it's not necessary to know source's physical address.
Chip also supports vmem->vmem transfers, unfortunatelly there is not enough vmem on Jornadas (512K) to support two 640x240 buffers in vmem.

SC
This probably should be in its own thread, so I may split it if the conversation continues.

The original documentation for GAPI stated that the programmer should call GXBeginDraw when the app gains activation, and GXEndDraw when it looses activation (as opposed to every frame). However, applications should only do that depending on whether or not the display pointer is pointing to DRAM. So if an application is not caling GXEndDraw every frame then you will run into problems. The only solution that comes to mind is to create a separate thread and blit to the hardware at some predefined FPS. That would not provide optimal output quality for a couple reasons, but it would work. You could perhaps check the bottom row of pixels to see when they change, and blit at that time (in an attempt to synchronize the blit with the app's drawing), but that could run into additional issues (like what direction the app draws to the buffer, or what if that particular line of pixels is for a HUD or other element that is not modified every frame, etc).

Dan East
Sergey Chaban · 23 Nov 2002, 21:21 UTC
This probably should be in its own thread, so I may split it if the conversation continues.


Yes indeed, it would be better to make it a separate thread.

The original documentation for GAPI stated that the programmer should call GXBeginDraw when the app gains activation, and GXEndDraw when it looses activation (as opposed to every frame).


Newer docs appears to be more explicit about this (e.g. Smartphone SDK help), and talk about locking the buffer, and calling GXEndDraw "when a display drawing cycle is finished".

Anyhow, for this particular implementation (gapi720) I'm going to make it configurable with a registry key, so GXBeginDraw either returns pointer to offscreen buffer (and expects GXEndDraw to be called each cycle) or returns direct pointer to video mem. And maybe using refresh thread as you suggested as a third option.


SC
Sergey Chaban wrote:
unfortunatelly there is not enough vmem on Jornadas (512K) to support two 640x240 buffers in vmem.


There is not enough room for 2 buffers, but there is still 212K of video memory available. I assume GDI uses some of it to cache bitmaps (Device Bitmaps). Is there any way to "claim" this memory and use it to allocate video "surfaces"?

If this is the case, are video->video blits faster then host->video transfers?
Kzinti · 23 Nov 2002, 23:30 UTC — GAPI for Jornada 720
Conan wrote:
Your GAPI for Jornada 720 is of great use to developers who want to support the Jornada 710/720.

If it works like normal GAPI then more people can consider porting to the Jornada HPCs.

I look forward to trying this out.


Have you tried this with PocketFrog? If so, are the performances better? (I hope they are). PocketFrog will use GAPI if it's available.
Conan · 24 Nov 2002, 00:05 UTC — Tried with PocketFrog?
Not yet. I have a few hours available for programming tomorrow. If I finish what I need to do I will have a look at thes GAPI implementation.
Sergey Chaban · 24 Nov 2002, 16:19 UTC
I assume GDI uses some of it to cache bitmaps (Device Bitmaps). Is there any way to "claim" this memory and use it to allocate video "surfaces"?


I believe so. In fact if you "scroll" the screen by changing display start address - there is a small cache of bitmaps underneath the visible area.
BTW, there is a sample WinCE driver on Epson's page with source code. Perhaps J720 driver is more or less based on these sources.

Is there any way to "claim" this memory and use it to allocate video "surfaces"?


I think it's possible, at the very least it should be possible to save a copy of this area in the main RAM on startup and restore it on exit.

If this is the case, are video->video blits faster then host->video transfers?


Yes, and vmem buffer supports some other features. But even current implementation is fast enough I believe.
OTOH, for larger vmem it's possible to just change display start address, no need for a blitter at all to implement 2 screen buffers.

SC
Sergey Chaban · 25 Nov 2002, 23:14 UTC
Hello,

Just uploaded update for the library (see my page). Fixed a couple of bugs, and added two new modes - QVGA (240x320 resolution) and direct mem mode (GXBeginDraw returns direct pointer to vmem).
"Minimal" sample from GapiDraw now works in all modes. The rest of the samples still produce black screens :(
GLSample works in all modes except for QVGA/direct_mem combination.
PocketGL demos work, but output is incorrect.

Have fun,
SC
So has anyone tested this GAPI for the Jornada 720?

Is it faster then using a Win32 BitBlt()?
Sergey!!!!!!!!!!!!
You are the man. Using your gx.dll I was able to use RealOne (realplayer) in my Jornada 720. :D

http://www.pc-couselor.com/j720.htm

http://www.pc-counselor.com/ppchpc.htm
Sergey: Please feel free to contact me at johan.sanneblad@home.se I can send you full details about the GAPI implementation in GapiDraw.

One probable reason why the Minimal sample application works, and the rest don't, is that most other samples read video data from the backbuffer (simple: transparent rect, mfc: transparent rects, plasma: direct buffer access, etc). If the "Collision Mask" demo works, then this is indeed the issue.

If GAPI reports isDRAMbuffer, then GapiDraw will use that buffer as a backbuffer for all operations. If not, GapiDraw will use its own memory buffer and copy its contents to the display before each GXEndDraw. If the back buffer is stored in video memory, I think the GAPI implementation should report "is not double buffered" to allow GAPI libraries such as PocketFrog and GapiDraw to use a backbuffer in memory.