gp2x flickers on

Previous topic - Next topic

heliuse

#30
ALL games written in glbasic have this problem on gp2x .

just take the time to play with a game in glbasic to notice the flash.

games fenix or c + + did not have this problem .

thank you to correct this flash visible only has the eye and very poorly on a video

Kitty Hello

Strange. Can you please post a small video of the bug? I don't know what you mean, but with a video I might get this fixed, easier.

Moru

It's a bit hard to catch on video as it can happen once in 10 minutes or even longer. I'll try to find my testcode that shows it and the one that does not show any flickering.

Moru

This is source with some comments and the compiled gp2x files for running it, one version that flickers and one that don't. The only difference is the flickering runtime is displaying the background as a sprite every VBL, the non-flickering file is displaying the background with LOADBMP "xx.png".

The flickering occurs around 7 seconds in I think, I was lucky with the recording, last time I had to wait around 10 minutes :-)

testflicker.zip

Kitty Hello

OK. I'll try to get this working now.

Kitty Hello

Ah. I see. Can you confirm it's not flickering, when you remove the music1.mp3 file?
It might be  a bug in the libSDLmixer...

Moru

#36
It's not playing the MP3 file in my movie but I can check anyway by removing it totally from the program. I only tested that because I coudln't get any flickering at all so had to dig around in other games that was said to flicker and they all used mp3 players so I stole a song from someone and tried it but still no flicker. But that was while I was using the background drawing I mentioned earlier.

Ok, flickers after 20 seconds the third time I run the program, without mp3.

Kitty Hello

OK, please try setting the CPU clock back to 200MHz:

Code (glbasic) Select

FUNCTION foo:
ENDFUNCTION


INLINE
#ifdef GP2X
extern "C"
{
typedef long off_t;
typedef long mode_t;
typedef long size_t;
int open(const char *path, int flags, ...);
void *mmap(void *addr, size_t LEN, int prot, int flags,     int fildes, off_t off);
}
#define MAP_SHARED 0x01
#define O_RDWR 0x02
#define PROT_READ 0x01
#define PROT_WRITE 0x02

  int memfd;
  unsigned long* memregs32;
  unsigned short* memregs16;

int InitGP2Xregs()
{
  memfd = open("/dev/mem", O_RDWR);
  memregs32 = (unsigned long*) mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, memfd, 0xc0000000);
  memregs16 = (unsigned short *)memregs32;
}
#endif

#define SYS_CLK_FREQ 7372800

void SetClock(unsigned int MHZ)
{
#ifdef GP2X
  InitGP2Xregs();
 
  unsigned int v;
  unsigned int mdiv,pdiv=3,scale=0;
  MHZ*=1000000;
  mdiv=(MHZ*pdiv)/SYS_CLK_FREQ;

  mdiv=((mdiv-8)<<8) & 0xff00;
  pdiv=((pdiv-2)<<2) & 0xfc;
  scale&=3;
  v = mdiv | pdiv | scale;

  unsigned int l = memregs32[0x808>>2];// Get interupt flags
  memregs32[0x808>>2] = 0xFF8FFFE7;   //Turn off interrupts
  memregs16[0x910>>1]=v;              //Set frequentie
  while(memregs16[0x0902>>1] & 1);    //Wait for the frequentie to be ajused
  memregs32[0x808>>2] = l;            //Turn on interrupts
#endif
}


ENDINLINE



FUNCTION SetGP2XClock: mhz
INLINE
SetClock((unsigned int) mhz);
ENDINLINE

ENDFUNCTION

Moru

Still flickered after waiting for one minute this time but that is different from time to time as I said earlier. Not that I find this irritating, I didn't even think about it until someone else pointed it out :-)

Kitty Hello

I know. But it is a bit concerning.
What is the differencec between you flicker/noflicker version!?

Moru

When I draw the background (white with text) picture with "DRAWSPRITE 1, 0, 0" i get flickering

If I draw the background by running LOADBMP "title.png" in the start it doesn't flicker so I'm guessing there is some trouble with the backbuffer clearing and swapping and then skipping one vbl, showing a black screen?

heliuse

Gernot Frisch : "What is the differencec between you flicker/noflicker version!?"
On my gp2x flash is visible on 2 versions.

Moru : "Not that I find this irritating, I didn't even think about it until someone else pointed it out :-)"
I'm still waiting for the correction of this bug to continue a program to glbasic on gp2x

   
thank you

Kitty Hello

OK, it seems there's a problem with the vblank somewhere. When you use SDL with hardware accelleration (GLBasic uses the GP2X blitter a _lot_), you experience the same. Thus, fenix does not have these problems, since they use the CPU for blitting.
I'll have to investigate further.

@heliuse - does the flickering occour more frequently for you? It happens once minute or so for me.

heliuse

#43
Kitty Hello :"does the flickering occour more frequently for you? It happens once minute or so for me."
randomly.
on average once per minute
Kitty Hello :"I'll have to investigate further."
thank you very much

Kitty Hello

HA!
I think it's a sync thingy. Please try setting LIMITFPS to 55 and to 65, and see if any of these might fix it, or make it worse/better.