The SDL_WarpMouse && GLES Freeze


ptitSeb

Serial Porter
Joined
Aug 15, 2012
Messages
9,306
Age
51
Location
France, near Lyon
On the OpenPandora, currently, when in GLES Mode, using some Mouse function Freeze the App.

This is annoying, and render port more complicated (or crippled the port).

I hopen this thread so we can find some solution...

Here is the problem.

Once SDL initalised with EGL, a call to

SDL_WarpMouse(x, y);

Freeze the app.

*EDIT*

I have a diff for SDL that seems to solve all hard freeze / mini freeze with Grabbed Mouse and GLES: seb.zip here is the diff.

 

* I didn't found a way to exit cleanly, every time I have to Reset the Pandora. => If anyone has a solution to exit / kill the freezed software correctly ?

Using SDL 1.2.15, we see that:

* The SDL_WarpMouse first updates some internal variables (used for relative mouse movement). and then call video->WarpWMCursor(x, y)

if the video->WarpWMCursor exist of course.

Assuming we are using X11 as a video driver, the function is this :

void X11_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
{
 if ( using_dga & DGA_MOUSE ) {
  SDL_PrivateMouseMotion(0, 0, x, y);
 } else if ( mouse_relative) {
  /* RJR: March 28, 2000
   leave physical cursor at center of screen if
   mouse hidden and grabbed */
  SDL_PrivateMouseMotion(0, 0, x, y);
 } else {
  SDL_Lock_EventThread();
  XWarpPointer(SDL_Display, None, SDL_Window, 0, 0, 0, 0, x, y);
  XSync(SDL_Display, False);
  SDL_Unlock_EventThread();
 }
}

Any idea on what's next ?
 
Last edited by a moderator:
* I didn't found a way to exit cleanly, every time I have to Reset the Pandora. => If anyone has a solution to exit / kill the freezed software correctly ?
If its just the app that's frozen, not the OS, and you have dropbear and wifi enabled you could ssh in and kill the offending program. That's what worked for me when pewpew2 was crashing on me.

- Neelix
 
* I didn't found a way to exit cleanly, every time I have to Reset the Pandora. => If anyone has a solution to exit / kill the freezed software correctly ?
If its just the app that's frozen, not the OS, and you have dropbear and wifi enabled you could ssh in and kill the offending program. That's what worked for me when pewpew2 was crashing on me.


- Neelix
Thanx, that works fine and avoid hard reboot.
 
So, I think I've found something.

The XSync(SDL_Display, False); is causing the freeze.

I have commented the one in X11_WarpWMCursor function (line 182 of file src/video/X11/SDL_x11mouse.c),

plus another one on the X11_GrabInputNoLock function (line 376 of file src/video/X11/SDL_x11wm.c).

I have try the resulting libSDL.so with a build of Teeworlds with the original input.c (with SDL_WM_GrabInput and SDL_WarpMouse), and it worked !!!

I'll put a need build of Teeworlds on the repo with that, and put a binary SDL here if someone dare testing (warning, don't put that lib in /usr/lib it is highly experimental software !!!!).

libSDL-GLES.zip
 

Attachments

  • libSDL-GLES.zip
    237.2 KB · Views: 391
Last edited by a moderator:
Dunno if you already use it, but the OP-optimized SDL sources are here:

git clone git://notaz.gp2x.de/~notaz/sdl_omap.git
 
 
oups! Yes, this is what I missed  :wacko:

I don't think it mater for GLES( I assume there is no blit, GLES do all the work), but I will get those sources and add my mod (well comment 2 lines).

Thanx for the tip.
 
Last edited by a moderator:
export CFLAGS="-DPANDORA -O2 -pipe -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ffast-math"
export CXXFLAGS="-DPANDORA -O2 -pipe -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ffast-math"
cd /root/sdl_omap
patch -p1 < ../SDL-xgetrequest.diff
./autogen.sh
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --mandir=/usr/man --libdir=/usr/lib --disable-static --enable-shared=yes --disable-x11-shared --disable-debug --enable-cdrom --enable-threads --enable-timers --enable-endian --enable-file --enable-oss --enable-alsa --disable-esd --disable-arts --disable-diskaudio --disable-nas --disable-esd-shared --disable-esdtest --disable-mintaudio --disable-nasm --enable-video-x11 --disable-video-dga --enable-video-fbcon --disable-video-directfb --disable-video-ps2gs --disable-video-xbios --disable-video-gem --disable-video-dummy --enable-video-opengl --enable-input-events --enable-pthreads --disable-video-picogui --disable-video-qtopia --enable-dlopen --enable-input-tslib --disable-video-ps3
This is more or less how notaz compiles the lib.
 
Last edited by a moderator:
Wow, ok, I copy paste, see if I get a working lib, and then mod it and recompile... 

Just a side note, instead of -O2 -ffast-math now I use -Ofast  I think this has been introduced with GCC 4.7.x , and it include -O3 -ffast-math -vectorize blabl ect.. Use that now, and it works well.
 
If XSync(display, false) is causing these freezes, my life just got much easier. I can update my preload lib to drop XSync calls, and GL apps will work much better. I was previously stubbing WarpMouse, GrabInput, etc by hand.
 
Last edited by a moderator:
If XSync(display, false) is causing these freezes, my life just got much easier :) I can update my preload lib to drop XSync calls, and GL apps will work much better. I was previously stubbing WarpMouse, GrabInput, etc by hand.
Ah yes, that libGL of your's is a wonderfull piece of software. It's already working very well ! 
 
ok, here is the version of the Notaz super optimzed sdl with the 2 offending lines commented out, so GrabMouse and MouseWarp don't freeze under GLES

libSDL-GLES.zip
 

Attachments

  • libSDL-GLES.zip
    234.8 KB · Views: 374
I updated my libpreload.so to wrap XSync and did some tests. If I just drop all XSync()s, it crashes most programs.
However, if I force discard to 1, it fixes the freeze for me.
 
For anyone interested:

http://bochs.info/pnd/.gl/libpreload.so

Code:
export LD_PRELOAD=/path/to/libpreload.so
 
Last edited by a moderator:
About the XSync, may be it is cleaner to force discard to true than completely drop the call ?!

I'll try on SDL build also, and see if Teeworlds still works. Thanks for the hint.
 
Back
Top