--- /dev/null
+
+# 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
+
+Upstream: https://hg.libsdl.org/SDL/rev/4f5bef55183c
+
+Signed-off-by: Paul Cercueil <paul@crapouillou.net>
+[yann.morin.1998@free.fr: add upstream commit URL]
+Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
+
+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 *
+