Reply: SDL Digest, Vol 79, Issue 22

Driedfruit,

Thanks for the information.

I tried the patch, but the problem remained, and now I’m worked around it by
simply commenting the call to the blocking function:
XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);

I bet it’s dangerous to do so, but no idea how to do it better.

Joy------------------------------

Message: 2
Date: Wed, 10 Jul 2013 18:04:18 +0400
From: driedfruit@mindloop.net (Driedfruit)
To: sdl at lists.libsdl.org
Subject: Re: [SDL] Why the app freezed at SDL_HideWindow while calling
SDL_DetroyWindow or SDL_CreateRenderer with SDL_RENDERER_ACCERLATED?
Message-ID: <20130710180418.7f110ef4 at driedfruit.mindloop.net>
Content-Type: text/plain; charset=UTF-8

Could you please test this patch, and see if it helps?

http://bugzilla.libsdl.org/show_bug.cgi?id=1526

On Wed, 10 Jul 2013 20:30:25 +0800 ??? Joy Woo <@_Joy_Woo> wrote:

Dear all, please help.

I met two confusing situations while using SDL2.0 in Qt5.1.0 to build
a media player under vmware virtual machine (ubuntu12.04 on x86 32
laptop).

  1. SDL_CreateRenderer(pt_sdl_window, -1, SDL_RENDERER_ACCELERATED)
    hangs on infinitely.

pt_sdl_window points to a SDL window created by SDL_CreateWindowFrom
from a QWidget placed on QMainWindow.

I built a debug version of SDL2.0 to check out why the application
stopped, then came across that it’s the code inside function
X11_HideWindow blocked, the code is as below(SDL_x11window.c):

if (X11_IsWindowMapped(_this, window)) {
    XUnmapWindow(display, data->xwindow);
    /* Blocking wait for "UnmapNotify" event */
    XIfEvent(display, &event, &isUnmapNotify, 

(XPointer)&data->xwindow); XFlush(display);
}

It’s very obviously after calling the XUnmapWindow, no UnmapNotify
event received, so that the code infinitely blocked…

Further, I found the documentation of XUnmapWindow as below:

The XUnmapWindow() function unmaps the specified window and causes the
X server to generate an UnmapNotify event. If the specified window is
already unmapped, XUnmapWindow() has no effect. Normal exposure
processing on formerly obscured windows is performed. Any child window
will no longer be visible until another map call is made on the
parent. In other words, the subwindows are still mapped but are not
visible until the parent is mapped. Unmapping a window will generate
Expose events on windows that were formerly obscured by it.

The apparent reason would be that the X server wasn’t generate any
UnmapNotify event at all after calling XUnmapWindow.

  1. SDL_DetroyWindow(pt_sdl_window) hangs on.

The reason was absolutely the same as the above one. They hanged on at
the same place.

Why does this happen? Any suggestions on that?

Thanks a million! By the way, the SDL2.0 documentation is so …you
know.

-----???-----
???: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org]
?? sdl-request at lists.libsdl.org
???: 2013?7?10? 23:36
???: sdl at lists.libsdl.org
??: SDL Digest, Vol 79, Issue 22

Send SDL mailing list submissions to
sdl at lists.libsdl.org

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
or, via email, send a message with subject or body ‘help’ to
sdl-request at lists.libsdl.org

You can reach the person managing the list at
sdl-owner at lists.libsdl.org

When replying, please edit your Subject line so it is more specific than
"Re: Contents of SDL digest…"

Today’s Topics:

  1. Re: Thread local storage API (Jonathan Dearborn)
  2. Re: Why the app freezed at SDL_HideWindow while calling
    SDL_DetroyWindow or SDL_CreateRenderer with
    SDL_RENDERER_ACCERLATED? (Driedfruit)
  3. Re: Compiling latest version of SDL test programs (in Linux)
    (Stephen Anthony)
  4. Re: Compiling latest version of SDL test programs (in Linux)
    (Stephen Anthony)
  5. Re: Full screen not really full screen on Linux?
    (Sik the hedgehog)
  6. Re: Full screen not really full screen on Linux?
    (Sik the hedgehog)
  7. Re: Compiling latest version of SDL test programs (in Linux)
    (Gabriel Jacobo)
  8. Segfault after some infinite loop in SDL code (Ludovic Pouzenc)

Message: 1
Date: Wed, 10 Jul 2013 09:55:44 -0400
From: grimfang4@gmail.com (Jonathan Dearborn)
To: SDL Development List
Subject: Re: [SDL] Thread local storage API
Message-ID:
<CA+DSiHYWpBBw-bJe3vG0Mn5-542zMAFTgdfUyi0Nx=Hftx4V8g at mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”

I wouldn’t refer to TLS in SDL as a design fault. Maybe a cross-platform
API for making your own design faults more robust?

Jonny D

On Wed, Jul 10, 2013 at 9:02 AM, Sik the hedgehog < sik.the.hedgehog at gmail.com> wrote:

2013/7/10, john skaller :

As you say, they’re like globals: a design fault.

May as well say the heap is a design fault.

Again I still don’t remember well but I think that what I was doing
back then had something to do with resource management, but I suppose
you probably consider having the program doing it instead of the
language to be a design fault.

There’s also the fact that simply you want functions to cope with
thread-specific stuff, but you want them to be able to fetch that
automatically, rather than having to pass around the data all over the
place. So in that sense it helps simplify the program’s APIs by not
having to pass around the thread-specific data all over the place. But
again, that sounds like global-land again.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

-------------- next part --------------
An HTML attachment was scrubbed…
URL:
<http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130710/09573
380/attachment-0001.htm>


Message: 2
Date: Wed, 10 Jul 2013 18:04:18 +0400
From: driedfruit@mindloop.net (Driedfruit)
To: sdl at lists.libsdl.org
Subject: Re: [SDL] Why the app freezed at SDL_HideWindow while calling
SDL_DetroyWindow or SDL_CreateRenderer with SDL_RENDERER_ACCERLATED?
Message-ID: <20130710180418.7f110ef4 at driedfruit.mindloop.net>
Content-Type: text/plain; charset=UTF-8

Could you please test this patch, and see if it helps?

http://bugzilla.libsdl.org/show_bug.cgi?id=1526

On Wed, 10 Jul 2013 20:30:25 +0800 ??? Joy Woo <@_Joy_Woo> wrote:

Dear all, please help.

I met two confusing situations while using SDL2.0 in Qt5.1.0 to build
a media player under vmware virtual machine (ubuntu12.04 on x86 32
laptop).

  1. SDL_CreateRenderer(pt_sdl_window, -1, SDL_RENDERER_ACCELERATED)
    hangs on infinitely.

pt_sdl_window points to a SDL window created by SDL_CreateWindowFrom
from a QWidget placed on QMainWindow.

I built a debug version of SDL2.0 to check out why the application
stopped, then came across that it’s the code inside function
X11_HideWindow blocked, the code is as below(SDL_x11window.c):

if (X11_IsWindowMapped(_this, window)) {
    XUnmapWindow(display, data->xwindow);
    /* Blocking wait for "UnmapNotify" event */
    XIfEvent(display, &event, &isUnmapNotify, 

(XPointer)&data->xwindow); XFlush(display);
}

It’s very obviously after calling the XUnmapWindow, no UnmapNotify
event received, so that the code infinitely blocked…

Further, I found the documentation of XUnmapWindow as below:

The XUnmapWindow() function unmaps the specified window and causes the
X server to generate an UnmapNotify event. If the specified window is
already unmapped, XUnmapWindow() has no effect. Normal exposure
processing on formerly obscured windows is performed. Any child window
will no longer be visible until another map call is made on the
parent. In other words, the subwindows are still mapped but are not
visible until the parent is mapped. Unmapping a window will generate
Expose events on windows that were formerly obscured by it.

The apparent reason would be that the X server wasn’t generate any
UnmapNotify event at all after calling XUnmapWindow.

  1. SDL_DetroyWindow(pt_sdl_window) hangs on.

The reason was absolutely the same as the above one. They hanged on at
the same place.

Why does this happen? Any suggestions on that?

Thanks a million! By the way, the SDL2.0 documentation is so …you
know.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


driedfruit


Message: 3
Date: Wed, 10 Jul 2013 11:48:01 -0230
From: sa666666@gmail.com (Stephen Anthony)
To: SDL Development List
Subject: Re: [SDL] Compiling latest version of SDL test programs (in
Linux)
Message-ID: <201307101148.01700.sa666666 at gmail.com>
Content-Type: Text/Plain; charset=“iso-8859-1”

Some of the test programs fail with the latest hg update, in particular
teststreaming (which is exactly the functionality I need for my project).

Running through gdb seems to indicate problems with getting/setting an
error, and TLS. Maybe this is related to the latest TLS stuff??

The gdb log is as follows (both SDL and the test programs compiled with -
g):

(gdb) bt 20
#0 0x00007ffff7a989bc in SDL_SetError (fmt=<error reading variable: Cannot
access memory at address 0x7fffff7fefe8>)
at /home/stephen/src/SDL/src/SDL_error.c:54
#1 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17de890) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
#2 0x00007ffff7b28cb5 in SDL_GetErrBuf () at
/home/stephen/src/SDL/src/thread/SDL_thread.c:62
#3 0x00007ffff7a989dc in SDL_SetError (fmt=0x7ffff7bbae9f “Parameter '%s’
is
invalid”) at /home/stephen/src/SDL/src/SDL_error.c:62
#4 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17de580) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
#5 0x00007ffff7b28cb5 in SDL_GetErrBuf () at
/home/stephen/src/SDL/src/thread/SDL_thread.c:62
#6 0x00007ffff7a989dc in SDL_SetError (fmt=0x7ffff7bbae9f “Parameter '%s’
is
invalid”) at /home/stephen/src/SDL/src/SDL_error.c:62
#7 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17de270) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
#8 0x00007ffff7b28cb5 in SDL_GetErrBuf () at
/home/stephen/src/SDL/src/thread/SDL_thread.c:62
#9 0x00007ffff7a989dc in SDL_SetError (fmt=0x7ffff7bbae9f “Parameter '%s’
is
invalid”) at /home/stephen/src/SDL/src/SDL_error.c:62
#10 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17ddf60) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
#11 0x00007ffff7b28cb5 in SDL_GetErrBuf () at
/home/stephen/src/SDL/src/thread/SDL_thread.c:62
#12 0x00007ffff7a989dc in SDL_SetError (fmt=0x7ffff7bbae9f “Parameter '%s’
is
invalid”) at /home/stephen/src/SDL/src/SDL_error.c:62
#13 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17ddc50) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
#14 0x00007ffff7b28cb5 in SDL_GetErrBuf () at
/home/stephen/src/SDL/src/thread/SDL_thread.c:62
#15 0x00007ffff7a989dc in SDL_SetError (fmt=0x7ffff7bbae9f “Parameter '%s’
is
invalid”) at /home/stephen/src/SDL/src/SDL_error.c:62
#16 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17dd940) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
#17 0x00007ffff7b28cb5 in SDL_GetErrBuf () at
/home/stephen/src/SDL/src/thread/SDL_thread.c:62
#18 0x00007ffff7a989dc in SDL_SetError (fmt=0x7ffff7bbae9f “Parameter '%s’
is
invalid”) at /home/stephen/src/SDL/src/SDL_error.c:62
#19 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17dd630) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
(More stack frames follow…)


Message: 4
Date: Wed, 10 Jul 2013 11:55:27 -0230
From: sa666666@gmail.com (Stephen Anthony)
To: SDL Development List
Subject: Re: [SDL] Compiling latest version of SDL test programs (in
Linux)
Message-ID: <201307101155.27714.sa666666 at gmail.com>
Content-Type: Text/Plain; charset=“iso-8859-1”

On July 10, 2013 11:48:01 AM Stephen Anthony wrote:

Some of the test programs fail with the latest hg update, in particular
teststreaming (which is exactly the functionality I need for my
project).

Running through gdb seems to indicate problems with getting/setting an
error, and TLS. Maybe this is related to the latest TLS stuff??

Sorry to respond to myself. Going back to the 7390 changeset (before TLS
stuff was added) fixes the teststreaming issue.

Thanks,
Steve A.
Stella maintainer


Message: 5
Date: Wed, 10 Jul 2013 11:31:15 -0300
From: sik.the.hedgehog@gmail.com (Sik the hedgehog)
To: SDL Development List
Subject: Re: [SDL] Full screen not really full screen on Linux?
Message-ID:
<CAEyBR+XCdnqhWA1-OD4oprSJ8xUL819ucu89LsfiNZRECMusRA at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Going to test this again later today, if I forget to do it make sure
to nag me, OK?

2013/7/8, Ryan C. Gordon :

I think the problem is more apparent with games, given they’re usually
very expensive on the hardware. One of the most common things to do to
help improve performance is reduce the rendering resolution, however
not all players like being restricted to a window. In this case proper
fullscreen is going to be needed (other than really ugly workarounds
like the one mentioned before).

Not that I disagree with you, but the theory with
SDL_WINDOW_FULLSCREEN_DESKTOP is that you render to a framebuffer object
that’s at whatever lower resolution you want, then use
GL_EXT_framebuffer_blit (or draw a single textured quad) to the higher
resolution. Some argue that the GL scales up the smaller framebuffer
better than your LCD would in any case, and you can spend less on pixel
shaders and fillrate by rendering at the lower resolution.

Extra credit for doing it like Valve: draw the game at the lower
resolution in an FBO, blast it to the screen, then draw the UI at native
resolution on top of it, so text doesn’t get blurry, etc.

Yes, I keep hearing arguments against fullscreen. “It causes windows
to be rearranged” we had this issue back in the Windows 9x days and in
the end it was considered just a minor inconvenience. “Games that
crash don’t restore the original resolution” (outside Windows) we used
to have this before too. Annoying, yes, but a crash usually means
something else went wrong too, and the user can just switch back to
the original resolution.

This is an X11-specific issue, and we have a proposal pending to fix
this, by adding a protocol to make the window manager handle resolution
changes, so a crashed fullscreen game goes away and the window manager
cleans up properly.

Also can we get SDL to fail to create a fullscreen window if it can’t
be handled properly, please?

That’s the stickier point, I suppose. As far as I know, it does work
on some X11 configurations (without FULLSCREEN_DESKTOP). If it’s not
working, and it’s an SDL bug, we should strive to fix it.

Part of me thinks we’re going to have to abandon X11 for Wayland and/or
Mir before we can completely fix this on Linux machines, though.

–ryan.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Message: 6
Date: Wed, 10 Jul 2013 11:31:34 -0300
From: sik.the.hedgehog@gmail.com (Sik the hedgehog)
To: SDL Development List
Subject: Re: [SDL] Full screen not really full screen on Linux?
Message-ID:
<CAEyBR+WHJ_hJ9-94MMVV8s_gtmf6daxv6pNe+Nq7ikcifFfwUQ at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Er should have removed the quote there. Oh well.


Message: 7
Date: Wed, 10 Jul 2013 11:40:22 -0300
From: gabomdq@gmail.com (Gabriel Jacobo)
To: SDL Development List
Subject: Re: [SDL] Compiling latest version of SDL test programs (in
Linux)
Message-ID:
<CAKDfesn62YfNnZqLCaxvixt6kZrkHkhxu5hERR=zbrwVnAWQWw at mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”

There’s a circular dependency problem in the code.

SDL_TLSSet fails, then -> SDL_SetError -> SDL_GetErrBuf -> SDL_TLSSet ->
and the loop goes on

My fix would be removing the SDL_SetError related functions from SDL_TLSSet
and just return -1, but let’s see what Sam thinks.

2013/7/10 Stephen Anthony

On July 10, 2013 11:48:01 AM Stephen Anthony wrote:

Some of the test programs fail with the latest hg update, in particular
teststreaming (which is exactly the functionality I need for my
project).

Running through gdb seems to indicate problems with getting/setting an
error, and TLS. Maybe this is related to the latest TLS stuff??

Sorry to respond to myself. Going back to the 7390 changeset (before TLS
stuff was added) fixes the teststreaming issue.

Thanks,
Steve A.
Stella maintainer


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.
-------------- next part --------------
An HTML attachment was scrubbed…
URL:
<http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130710/9ab4d
56d/attachment-0001.htm>


Message: 8
Date: Wed, 10 Jul 2013 17:35:46 +0200
From: lpouzenc@free.fr (Ludovic Pouzenc)
To: sdl at lists.libsdl.org
Subject: [SDL] Segfault after some infinite loop in SDL code
Message-ID: <51DD7F52.5060900 at free.fr>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi there,

I am an happy user of SDL 2. I am planning to dev a little game. I have
wrote a test program much like testspriteminimal to try things, learn a
bit and enjoy watching a Lemming bashing again and again :slight_smile:

With the last tarball (SDL-2.0.0-7392) I have a segfault when running my
code.
With a slightly older one (SDL-2.0.0-7353) my code run well.

gdb with my code says show a not so cool stack strace :

Starting program: /home/lpouzenc/Bureau/mplemmings/sbsprite
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib/i386-linux-gnu/libthread_db.so.1”.

Program received signal SIGSEGV, Segmentation fault.
0xb7d8ca13 in ?? () from /lib/i386-linux-gnu/libc.so.6
(gdb) up
#1 0xb7d8ed28 in malloc () from /lib/i386-linux-gnu/libc.so.6
(gdb) up
#2 0xb7f45c0b in SDL_malloc (size=size at entry=776)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/stdlib/SDL_malloc.c:31
31 return malloc(size);
(gdb) up
#3 0xb7f46c04 in SDL_GetErrBuf () at
/home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/SDL_thread.c:57
57 errbuf = (SDL_error *)SDL_malloc(sizeof(*errbuf));
(gdb) up
#4 0xb7eebd53 in SDL_SetError (fmt=fmt at entry=0xb7faf790 “Parameter ‘%s’ is
invalid”)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/SDL_error.c:62
62 error = SDL_GetErrBuf();
(gdb) up
#5 0xb7fab046 in SDL_TLSSet (id=1, value=value at entry=0xa77a128)
at
/home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/pthread/SDL_systls.c:75
75 return SDL_InvalidParamError(id);
(gdb) up
#6 0xb7f46c34 in SDL_GetErrBuf () at
/home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/SDL_thread.c:62
62 SDL_TLSSet(tls_errbuf, errbuf);
(gdb) up
#7 0xb7eebd53 in SDL_SetError (fmt=fmt at entry=0xb7faf790 “Parameter ‘%s’ is
invalid”)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/SDL_error.c:62
62 error = SDL_GetErrBuf();
(gdb) up
#8 0xb7fab046 in SDL_TLSSet (id=1, value=value at entry=0xa779e18)
at
/home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/pthread/SDL_systls.c:75
75 return SDL_InvalidParamError(id);
(gdb) up
#9 0xb7f46c34 in SDL_GetErrBuf () at
/home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/SDL_thread.c:62
62 SDL_TLSSet(tls_errbuf, errbuf);
(gdb) up
#10 0xb7eebd53 in SDL_SetError (fmt=fmt at entry=0xb7faf790 “Parameter ‘%s’ is
invalid”)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/SDL_error.c:62
62 error = SDL_GetErrBuf();
(gdb) up
#11 0xb7fab046 in SDL_TLSSet (id=1, value=value at entry=0xa779b08)
at
/home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/pthread/SDL_systls.c:75
75 return SDL_InvalidParamError(id);
(gdb) up
#12 0xb7f46c34 in SDL_GetErrBuf () at
/home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/SDL_thread.c:62
62 SDL_TLSSet(tls_errbuf, errbuf);
(gdb) up
#13 0xb7eebd53 in SDL_SetError (fmt=fmt at entry=0xb7faf790 “Parameter ‘%s’ is
invalid”)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/SDL_error.c:62
62 error = SDL_GetErrBuf();
(gdb) up
#14 0xb7fab046 in SDL_TLSSet (id=1, value=value at entry=0xa7797f8)
at
/home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/pthread/SDL_systls.c:75
75 return SDL_InvalidParamError(id);
(gdb) up

I have reduced to the smaller code that trigger the segfault on my system :

#include <SDL.h>

int main(int argc, char *argv[]) {
int res;
res=SDL_Init(0);
return res;
}

I have tried other values that 0 to SDL_Init() : same results. Segfault.

I have compiled this code with :

gcc -DHAVE_CONFIG_H -I. -D_REENTRANT -I/usr/local/include/SDL2 -g -O2
-MT src/sandbox/sprite.o -MD -MP -MF $depbase.Tpo -c -o src/sandbox/sprite.o
src/sandbox/sprite.c &&
mv -f $depbase.Tpo $depbase.Po
gcc -D_REENTRANT -I/usr/local/include/SDL2 -g -O2 -o sbsprite
src/sandbox/sprite.o -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lSDL2
-lpthread

(automake generated stuff…)

Am I out of the specs or there is a bug in SDL2 ?

Cheers,
Ludovic Pouzenc



SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

End of SDL Digest, Vol 79, Issue 22