libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.91k stars 1.83k forks source link

Regression SDL 2.30.0 on Windows #9177

Closed rom1v closed 8 months ago

rom1v commented 8 months ago

Hi,

I just added this commit to upgrade SDL from 2.28.5 to 2.30.0 on my project: https://github.com/Genymobile/scrcpy/commit/1efff3dd4077e24e46adc39bb1d53c3fa516a18b

And the app does not work anymore.

Apparently, SDL_WaitEvent() fails immediately here: https://github.com/Genymobile/scrcpy/blob/1efff3dd4077e24e46adc39bb1d53c3fa516a18b/app/src/scrcpy.c#L170 (with an empty SDL_GetError(), I added a log)

If I revert to 2.28.5, it works again.

slouken commented 8 months ago

Can you debug and see what's going on in SDL?

rom1v commented 8 months ago

Unfortunately, the problem occurs only on Windows, so I'm not able to debug (I just use the pre-built SDL2.dll for Windows).

I just tested, I compiled 2.30.0 natively, and it works on Linux.

rom1v commented 8 months ago

bisect/bad is:

c85ea238ca2d01631d14ca9562c9bd938fb810d1 is the first bad commit
commit c85ea238ca2d01631d14ca9562c9bd938fb810d1
Author: Sam Lantinga <slouken@libsdl.org>
Date:   Thu Jan 25 06:30:07 2024 -0800

    Improved timing accuracy of SDL_WaitEventTimeout() on Windows

    We don't need to use the hack of setting a timer and waiting for a timer message, MsgWaitForMultipleObjects() will allow us to wait for input directly with a timeout.

    Before this change, sleeping for 20 ms would actually sleep for around 30 ms, with this change the sleep time is pretty accurate at 20-21 ms.

    (cherry picked from commit 2670eb44afec9311ee8fbec447703c427db1e1c8)
    (cherry picked from commit 08caafe2f1044ae9baaf77507bba24c29adf551f)

 src/video/windows/SDL_windowsevents.c | 23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

with an empty SDL_GetError()

The log was empty when run from a cmd, but if I run it in a cygwin (via ssh), SDL_GetError() returns the following message:

__FUNCTION__, D3D12CreateDevice: L'interface de périphérique ou niveau de fonctionnalité spécifié n'est pas pris en charge sur ce système.

(probably a previous internal error message related to the access via ssh, without display)

cgutman commented 8 months ago

Probably already fixed by https://github.com/libsdl-org/SDL/commit/4ae87e215ee068257dd7581f9837a71f4799abe8. Can you test with that commit?

rom1v commented 8 months ago

@cgutman I confirm that this commit fixes the problem. Thank you :+1: