GP2X My Weird Kernel Panic Problem, But I Found A Solution Finally !


joyrider

Active Member
Joined
Mar 29, 2006
Messages
589
Age
43
Website
www.willemssoft.be
Hi,

as some of you know i had some problems with one of my games causing a kernel panic at random moments when the gp2x was in the cradle and an usb joystick namely the MP8866 dual convertor was connected to cradle. (see http://www.gp32x.de/board/index.php?showtopic=39215)

Now after weeks of searching, trying self compiled kernels to trace it down i finally found a solution but i don't understand what was wrong with my original code. If someone could explain to me what was wrong with it or why it doesn't generete the kernel panic anymore.

Ok first some more info about the kernel panic. I recompiled the 2.1.x kernel and the modules and used those. This gave me some more info using ksymoops etc. it always happend in the usb-ohci.o module. because i got a message using my compiled modules saying there was a kernel bug in usb-ohci.h namely here:
CODE

/* Recover a TD/ED using its collision chain */
static inline void *
dma_to_ed_td (struct hash_list_t * entry, dma_addr_t dma)
{
struct hash_t * scan = entry->head;
while (scan && scan->dma != dma)
scan = scan->next;
if (!scan)
BUG(); //caused the kernel panic shouldn't happen
return scan->virt;
}



anyway i knew something in my code must be triggering it i also knew it didn't happen when using software surfaces and i also found out that if i removed a certain blit to the screen surface in my code that it didn't happen either.

SOOO i finally found a workaround but i don't understand what was wrong with my orginal code.

CODE

//This causes a kernel panic on the gp2x when constantly blitting buffer to screen
//the kernel panic only happens when a usb joystick is attached to the cradle and joysticks are used in sdl, WEIRD !!!
Screen = SDL_SetVideoMode( WINDOW_WIDTH, WINDOW_HEIGHT,16, SDL_HWSURFACE );
Buffer = SDL_CreateRGBSurface(SDL_HWSURFACE,WINDOW_WIDTH,WINDOW_HEIGHT,16, Screen->format->Rmask,Screen->format->Gmask,Screen->format->Bmask,Screen->format->Amask);


//This doesn't Cause a kernel panic on the gp2x when constantly blitting buffer to screen
Screen = SDL_SetVideoMode( WINDOW_WIDTH, WINDOW_HEIGHT,16, SDL_HWSURFACE );
Tmp = SDL_CreateRGBSurface(SDL_SWSURFACE,WINDOW_WIDTH,WINDOW_HEIGHT,16, Screen->format->Rmask,Screen->format->Gmask,Screen->format->Bmask,Screen->format->Amask);
Buffer = SDL_DisplayFormat(Tmp);
SDL_FreeSurface(Tmp);



if someone could explain to me what's the diffrence between these 2 pieces of code. In the workaround i defined tmp as a software surface first but after calling SDL_Displayformat(tmp) it becomes an hardware surface because Screen is an hw_surface. in the 1st part that's causing the kernel panic to happen i directly defined buffer as an hw surface.

Do they get saved diffrently in memory or something on the gp2x ? Cause the kernel panic never happend in ubuntu 7.10 gutsy.

Thanks.
 
Last edited by a moderator:
pfff the kernel panic is back, the workaround seemed to work fine in blockdude but in dynamate it doesn't :(
paeryn, can i send you the source of my game so you can try to trace it down ?

as was said before, it only happens when using hw_surfaces and the cradle. It could be a kernel bug and It doesn't happen in ubuntu gutsy 7.10 so there could be something wrong gp2x's wise with sdl or the the used kernel :/
 
Back
Top