Gpu940: Glswapbuffers() Hangs...


GameGod

Still Fresh
Joined
Nov 26, 2006
Messages
89
Hi guys,

I'm working on a port of something and the application runs/renders for usually a couple of seconds, then just completely freezes. About 95% of the time it freezes when glSwapBuffers() is called. Does anyone know what would cause this behaviour?

The amount of time the app runs for is pretty random, it'll be anywhere between 1 second and like 20 seconds, but it'll always freeze. (I can telnet in and kill still though, so it doesn't freeze the whole GP2X...)

Thoughts?

I tried taking a look at the actual glSwapBuffers() function in gpu940's egl.c, which looks like this:

Code:
GLboolean glSwapBuffers(void)
{
	if (active_buffer == ~0U) {
		active_buffer = 0;
	} else {
		if (gpuOK != gpuShowBuf(buffers[active_buffer].out, true)) {
			return GL_FALSE;
		}
		// wait until this buffer is actually on display
		gpuWaitDisplay();
		if (++ active_buffer >= sizeof_array(buffers)) {
			active_buffer = 0;
		}
	}
	if (gpuOK != gpuSetBuf(gpuOutBuffer, buffers[active_buffer].out, true)) {
		return GL_FALSE;
	}
	if (buffers[active_buffer].depth && gpuOK != gpuSetBuf(gpuZBuffer, buffers[active_buffer].depth, true)) {
		return GL_FALSE;
	}
	return GL_TRUE;
}

The line that caught my eye was the gpuWaitDisplay() line. I tried commenting it out, but it didn't seem to have any effect. (I could have screwed that up though, I dunno.)

Any help anyone could provide me with would be greatly appreciated. Thanks! :)
 
Seems I've solved my own problem.

I had an SDL_Init(SDL_INIT_VIDEO) in there to initialize the video, and after removing that, the app doesn't seem to hang randomly on glSwapBuffer() anymore. :D

(The bad news is that the app still randomly hangs elsewhere, but for now it seems that gpu940 is off the hook.) :)
 
OK, this is strange because Egoboo2X does SDL_Init(SDL_INIT_VIDEO) (amongst other things).

Perhaps I should remove this :)

As for random crashing : please try to lower the GPU max speed from 250 to 200MHz ; some people reported (again concerning Egoboo2X) that the ARM940 randomly crashed at that speed.

You can lower it in bin/gpu940.c, for example adding a line like :

Code:
if (s > REASONABLY_FAST) s = REASONABLY_FAST;

at the beginning of set_speed(unsigned s).
 
rixed posted on Feb 9 2007 at 07:55 AM said:
OK, this is strange because Egoboo2X does SDL_Init(SDL_INIT_VIDEO) (amongst other things).

Perhaps I should remove this :)

As for random crashing : please try to lower the GPU max speed from 250 to 200MHz ; some people reported (again concerning Egoboo2X) that the ARM940 randomly crashed at that speed.

You can lower it in bin/gpu940.c, for example adding a line like :

Code:
if (s > REASONABLY_FAST) s = REASONABLY_FAST;

at the beginning of set_speed(unsigned s).


sigh, I just spent all day figuring that out. :p
Yeah, the random crashes were being caused by the CPU speed being too fast. (btw, check your PM...)
 
Last edited by a moderator:
Back
Top