PocketMatrix forums

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

GAPI / Developer experts: I need some help here

Hi,

I have gotten reports from a user with a Palmax @migo device that ALL GapiDraw applications and demos flicker on it. After lots of email discussions I received some video files highlighting the issue:

http://www.gapidraw.com/MOV00104.MPG
http://www.gapidraw.com/MOV00105.MPG

The camera isn't that fast, but what you can see is:
(1) The background (FillRect) is stable and does not flicker
(2) The rotated IPAQ (Blt) is stable and does not flicker
(3) The rest of the items flicker

The buffer is reported by GAPI as a DRAM buffer, and GapiDraw does use it as its background buffer.

I have thought of several occurences to this issue:
(a) Drawings on every other frame fails. This hypothesis however fails since the rotating ipaq does not flicker
(b) The DRAM buffer is copied asynchronously a couple of ms AFTER GXEndDraw/GXBeginDraw is called. This however seems very odd.

I changed the z-order in the application to draw the rotating IPAQ LAST, and here is the resulting video from that:

http://www.gapidraw.com/MOV00104b.MPG

As you can see, the IPAQ now also flickers. The buttons however flicker less.

Right now I am out of ideas. Anyone here that have any clue on what is going on?
It doesnt make sense that this would be happening with page flipping. I would have to agree with your b idea. It looks as if the draw is being prempted by the screen refresh, Personally I don't have an amigo or I'd look into running a tests. Is it possible the amigo hardware doesnt handle the Gapi gxbegindraw and gxenddraw correctly? I have heard of instances where some machines dont even need it, maybe the amigo just ignores it. I was wondering, how fast does the amigo refresh? If the fps were reduced would it flicker less(syncing up with the hardware refresh)?
Kzinti · 01 May 2003, 21:21 UTC — GAPI / Developer experts: I need some help here
sbl wrote:
Right now I am out of ideas. Anyone here that have any clue on what is going on?


It seems that you are updating the display at the same time as the LCD is refreshing.

Two possibilities:

1) The refresh (blit from backbuffer to video) is not synched to the refresh, in which case there isn't much you can do.

2) It is not using a DRAM buffer. Did you try creating your own? (Ignoring the value returned by GXIsDRAMBuffer). Perhaps there is no DRAM buffer there.

What is puzzling is that your flickering seems to follow the selected orientation, which doesn't make any sense as the refresh of the LCD sure doesn't change orientation.
Thierry: Thanks for the input.. Thinking of it, your suggestion (2) must be the case where the @migo assumes applications don't use GXEndDraw/GXBeginDraw and possibly reports the display as a DRAM buffer. Maybe they didn't think anyone bothered to check this...

I'll dig up the SPI_GETOEMINFO information for the device so we can add it to the list of bad GAPI applications.

I agree that it's very strange that it follows the orientation of the sample application...
sbl wrote:
I'll dig up the SPI_GETOEMINFO information for the device so we can add it to the list of bad GAPI applications.


I hate GAPI so much... It's such a lame API.
Thierry, the refresh is always the same direction in the video (left-to-right in portrait orientation).

Johan, you might try changing the contents of the buffer returned by GXBeginDraw, and then never call GXEndDraw and see if your changes end up on the screen. That would indicate that screen refresh is being updated asynchronously, or you're actually drawing to the primary surface (no DRAM buffer, as Thierry suggested).

Have you tried other non-GapiDraw games on this device? Do they exhibit the same artifacts?

In the end, it doesn't matter which API you use, if the driver or hardware on the device is screwy (as in this case), your app is still going to have problems. I'll be one of the first to say GAPI has its share of problems, but this doesn't seem to one of them. The majority of problems that I've run into have been due to dumb choices made by the OEM when adding GAPI support to their device.
Digby: Thanks for the input. Right now I am a bit tired after having worked really intense on GapiDraw 2.0, so I think I'll go for the easy solution and simply view the buffer returned from the @migo as volatile (and use my own backbuffer which is copied to the @migo buffer at regular FPS updates).

Other non-GapiDraw games works fins on this device. My guess is that they follow the stupid Microsoft recommendation to only call GXBeginDraw at application startup, and then GXEndDraw att application shutdown.. With such a recommendation it is no wonder we have the numerous issues we face currently...
Digby wrote:
In the end, it doesn't matter which API you use, if the driver or hardware on the device is screwy (as in this case), your app is still going to have problems. I'll be one of the first to say GAPI has its share of problems, but this doesn't seem to one of them. The majority of problems that I've run into have been due to dumb choices made by the OEM when adding GAPI support to their device.


My grips with GAPI are:

1) Adding "Synch to refresh" functionality is up to the OEM. Since this usually means lower frame rate, they don't implement it. The only exception I know is the Casios E-105/E-115/E-125. But that's just a side effect of the way the video chip works (DMA transfer is synched).

2) Microsoft is not enforcing vendors to properly implement GAPI.

Implementing sync-to-refresh is trivial when you have access to the video chip specifications. Implementing proper double-buffering is dependent on that feature. Yet, they just won't do it.

So I've got double buffering through GAPI on the E-125. If I want it on the iPAQ devices, I need to write my own low-level code to access the video controller. Devices I don't know? Well I don't know what will happen on them. That's not really useful as an API.

I am not pointing fingers, I am just saying that having an API that behaves differently on every device is pretty useless. To solve this, I would need access to the video controller specs... After I don't know how many queries, I've never received an answer from any vendor. That's one reason I just gave up on PocketFrog... It felt like loosing my time.
The OEM string is "Compal P6C" .. How wonderful.

Using the approach treating the display as direct worked wonders.. The DMA flag is apparantly incorrect. I'll release a new GapiDraw 1.04b and incorporate the fix into the current 2.0 build as well...
Thierry, I don't even think GAPI can rightly be called an API. I don't know, I guess I can't really explain it, but when the term API is mentioned, I just have this nagging feeling that GAPI doesn't fit the bill at all.

In any case, let's point fingers, it's fun... The biggest culprit is the OEM's who aren't implementing the spec intelligently. Sure, we could blame MS for not enforcing things, but if the people implementing used half their brain they would do things intelligently, as I think is generally true of the E-125 implementation for example.

It's ironic... MS has left the spec so open to interpretation that people can do stupid things. How many times do we complain about MS giving people TOO MUCH freedom?!?

In addition, I think we all know that MS would prefer if no games ever ran on a PocketPC anyway... They want to sell to the corporate market, games are an afterthought, at best. If that wasn't the case, wouldn't we have even a very basic DirectX implementation in ROM of new devices by now? I frankly predict we'll never see that, it's just contrary to how they want PocketPC's to be thought of I believe.
MeumSimulacrum (m) · 02 May 2003, 01:34 UTC
Now, my experience with an E-125 was not positive at all. Specifically, the 565 RGB values seem to be flipped to BGR....which is frankly STUPID.
Hmmm... are you sure about the bit flipping? Even though I'm not using my own graphics library, I did write my own last year and I don't recall having that problem.
fzammetti wrote:
It's ironic... MS has left the spec so open to interpretation that people can do stupid things. How many times do we complain about MS giving people TOO MUCH freedom?!?


I've never seen such a thing as a "GAPI Spec". All I know about is the documentation. Is there actually a spec out there?
MeumSimulacrum (m) wrote:
Now, my experience with an E-125 was not positive at all. Specifically, the 565 RGB values seem to be flipped to BGR....which is frankly STUPID.


I have a E-125 and I've never seen anything like this?
Thierry, I guess I'm calling the documentation a spec. I'm probably assigning to much structural meaning to what's out there.
GAPI is just a (very simple) interface for querying hardware. It doesn't require that the hardware be constrained to any particular specification. Simply put, it is a step above hardcoding pointers to the display addresses of various devices, as was done with Palm-Sized PC (CE 2.11) devices.

Dan East
MeumSimulacrum (m) · 02 May 2003, 04:24 UTC
ruh-roh...thierry and zamm...

It must have just been my ppc...I have never seen it on any other device. I'll be honest, I searched high and low...and thought that it might be the way I was reading the file (similarly to Intel flipping DWORDS when dropping them to a file).

Anyway, I had to do 2 or 3 shifts to fix it in memory...but I don't use that device anymore, and like I said...never seen it anywhere else.