diff mbox series

sdl2: add patch to fix busy-loop in C library

Message ID 20191220160438.102444-1-paul@crapouillou.net
State Accepted
Headers show
Series sdl2: add patch to fix busy-loop in C library | expand

Commit Message

Paul Cercueil Dec. 20, 2019, 4:04 p.m. UTC
For some obscure reason, the order in which the libdrm/libgbm libraries
are loaded matters.

Without this fix, the first call to check_modesetting() will work and
load then unload all symbols properly, but the second call to this
function will lock up as soon as dlopen() is called on libdrm.

Swapping the order in which the libdrm and libgbm libraries are loaded
is enough to fix (or work around?) this issue.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 .../sdl2/0002-fix-busy-loop-in-dlopen.patch   | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 package/sdl2/0002-fix-busy-loop-in-dlopen.patch

Comments

Yann E. MORIN Dec. 22, 2019, 10:28 a.m. UTC | #1
Paul, All,

On 2019-12-20 17:04 +0100, Paul Cercueil spake thusly:
> For some obscure reason, the order in which the libdrm/libgbm libraries
> are loaded matters.
> 
> Without this fix, the first call to check_modesetting() will work and
> load then unload all symbols properly, but the second call to this
> function will lock up as soon as dlopen() is called on libdrm.
> 
> Swapping the order in which the libdrm and libgbm libraries are loaded
> is enough to fix (or work around?) this issue.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Applied to master, after adding a URL to the upstream commit.
Thanks!

Regards,
Yann E. MORIN.

> ---
>  .../sdl2/0002-fix-busy-loop-in-dlopen.patch   | 37 +++++++++++++++++++
>  1 file changed, 37 insertions(+)
>  create mode 100644 package/sdl2/0002-fix-busy-loop-in-dlopen.patch
> 
> diff --git a/package/sdl2/0002-fix-busy-loop-in-dlopen.patch b/package/sdl2/0002-fix-busy-loop-in-dlopen.patch
> new file mode 100644
> index 0000000000..984a80d9c1
> --- /dev/null
> +++ b/package/sdl2/0002-fix-busy-loop-in-dlopen.patch
> @@ -0,0 +1,37 @@
> +
> +# HG changeset patch
> +# User Paul Cercueil <paul@crapouillou.net>
> +# Date 1576820863 28800
> +# Node ID 4f5bef55183c677d12a7da8f3392879ed50670a3
> +# Parent  01f16d7f36cb9f4fa02016e57fbe915fdea71cc8
> +kmsdrm: Fix busy-loop within libc's dlopen()
> +For some obscure reason, the order in which the libdrm/libgbm libraries
> +are loaded matters.
> +
> +Without this fix, the first call to check_modesetting() will work and
> +load then unload all symbols properly, but the second call to this
> +function will lock up as soon as dlopen() is called on libdrm.
> +
> +Swapping the order in which the libdrm and libgbm libraries are loaded
> +is enough to fix (or work around?) this issue.
> +
> +Fixes #4891:
> +https://bugzilla.libsdl.org/show_bug.cgi?id=4891
> +
> +Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> +
> +diff -r 01f16d7f36cb -r 4f5bef55183c src/video/kmsdrm/SDL_kmsdrmdyn.c
> +--- a/src/video/kmsdrm/SDL_kmsdrmdyn.c	Thu Dec 19 21:45:44 2019 -0800
> ++++ b/src/video/kmsdrm/SDL_kmsdrmdyn.c	Thu Dec 19 21:47:43 2019 -0800
> +@@ -50,8 +50,8 @@
> + #endif
> + 
> + static kmsdrmdynlib kmsdrmlibs[] = {
> +-    {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC},
> +-    {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM}
> ++    {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM},
> ++    {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC}
> + };
> + 
> + static void *
> +
> -- 
> 2.24.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Peter Korsgaard Dec. 25, 2019, 9:26 p.m. UTC | #2
>>>>> "Paul" == Paul Cercueil <paul@crapouillou.net> writes:

 > For some obscure reason, the order in which the libdrm/libgbm libraries
 > are loaded matters.

 > Without this fix, the first call to check_modesetting() will work and
 > load then unload all symbols properly, but the second call to this
 > function will lock up as soon as dlopen() is called on libdrm.

 > Swapping the order in which the libdrm and libgbm libraries are loaded
 > is enough to fix (or work around?) this issue.

 > Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Committed to 2019.02.x and 2019.11.x, thanks.
diff mbox series

Patch

diff --git a/package/sdl2/0002-fix-busy-loop-in-dlopen.patch b/package/sdl2/0002-fix-busy-loop-in-dlopen.patch
new file mode 100644
index 0000000000..984a80d9c1
--- /dev/null
+++ b/package/sdl2/0002-fix-busy-loop-in-dlopen.patch
@@ -0,0 +1,37 @@ 
+
+# HG changeset patch
+# User Paul Cercueil <paul@crapouillou.net>
+# Date 1576820863 28800
+# Node ID 4f5bef55183c677d12a7da8f3392879ed50670a3
+# Parent  01f16d7f36cb9f4fa02016e57fbe915fdea71cc8
+kmsdrm: Fix busy-loop within libc's dlopen()
+For some obscure reason, the order in which the libdrm/libgbm libraries
+are loaded matters.
+
+Without this fix, the first call to check_modesetting() will work and
+load then unload all symbols properly, but the second call to this
+function will lock up as soon as dlopen() is called on libdrm.
+
+Swapping the order in which the libdrm and libgbm libraries are loaded
+is enough to fix (or work around?) this issue.
+
+Fixes #4891:
+https://bugzilla.libsdl.org/show_bug.cgi?id=4891
+
+Signed-off-by: Paul Cercueil <paul@crapouillou.net>
+
+diff -r 01f16d7f36cb -r 4f5bef55183c src/video/kmsdrm/SDL_kmsdrmdyn.c
+--- a/src/video/kmsdrm/SDL_kmsdrmdyn.c	Thu Dec 19 21:45:44 2019 -0800
++++ b/src/video/kmsdrm/SDL_kmsdrmdyn.c	Thu Dec 19 21:47:43 2019 -0800
+@@ -50,8 +50,8 @@
+ #endif
+ 
+ static kmsdrmdynlib kmsdrmlibs[] = {
+-    {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC},
+-    {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM}
++    {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM},
++    {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC}
+ };
+ 
+ static void *
+