SDL: removed directfb support.

From 3aea865cdf4c0802ba045bc095bb6084302c0186 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Tue, 22 Nov 2022 20:45:45 +0300
Subject: [PATCH] removed directfb support.

---
 CMakeLists.txt                           |    3 -
 cmake/sdlchecks.cmake                    |   31 -
 configure                                |  157 ---
 configure.ac                             |   51 -
 docs/README-directfb.md                  |  123 ---
 docs/README-linux.md                     |    3 -
 docs/README.md                           |    1 -
 include/SDL_config.h.cmake               |    3 -
 include/SDL_config.h.in                  |    3 -
 include/SDL_syswm.h                      |   18 -
 src/events/SDL_scancode_tables.c         |    4 +-
 src/render/SDL_render.c                  |   15 -
 src/render/SDL_sysrender.h               |    1 -
 src/video/SDL_sysvideo.h                 |    1 -
 src/video/SDL_video.c                    |    3 -
 src/video/SDL_vulkan_internal.h          |    3 -
 src/video/directfb/SDL_DirectFB_WM.c     |  412 -------
 src/video/directfb/SDL_DirectFB_WM.h     |   56 -
 src/video/directfb/SDL_DirectFB_dyn.c    |  117 --
 src/video/directfb/SDL_DirectFB_dyn.h    |   41 -
 src/video/directfb/SDL_DirectFB_events.c |  739 -------------
 src/video/directfb/SDL_DirectFB_events.h |   34 -
 src/video/directfb/SDL_DirectFB_modes.c  |  414 -------
 src/video/directfb/SDL_DirectFB_modes.h  |   59 -
 src/video/directfb/SDL_DirectFB_mouse.c  |  388 -------
 src/video/directfb/SDL_DirectFB_mouse.h  |   44 -
 src/video/directfb/SDL_DirectFB_opengl.c |  332 ------
 src/video/directfb/SDL_DirectFB_opengl.h |   64 --
 src/video/directfb/SDL_DirectFB_render.c | 1267 ----------------------
 src/video/directfb/SDL_DirectFB_render.h |   25 -
 src/video/directfb/SDL_DirectFB_shape.c  |  138 ---
 src/video/directfb/SDL_DirectFB_shape.h  |   38 -
 src/video/directfb/SDL_DirectFB_video.c  |  418 -------
 src/video/directfb/SDL_DirectFB_video.h  |  165 ---
 src/video/directfb/SDL_DirectFB_vulkan.c |  169 ---
 src/video/directfb/SDL_DirectFB_vulkan.h |   47 -
 src/video/directfb/SDL_DirectFB_window.c |  565 ----------
 src/video/directfb/SDL_DirectFB_window.h |   83 --
 38 files changed, 2 insertions(+), 6033 deletions(-)
 delete mode 100644 docs/README-directfb.md
 delete mode 100644 src/video/directfb/SDL_DirectFB_WM.c
 delete mode 100644 src/video/directfb/SDL_DirectFB_WM.h
 delete mode 100644 src/video/directfb/SDL_DirectFB_dyn.c
 delete mode 100644 src/video/directfb/SDL_DirectFB_dyn.h
 delete mode 100644 src/video/directfb/SDL_DirectFB_events.c
 delete mode 100644 src/video/directfb/SDL_DirectFB_events.h
 delete mode 100644 src/video/directfb/SDL_DirectFB_modes.c
 delete mode 100644 src/video/directfb/SDL_DirectFB_modes.h
 delete mode 100644 src/video/directfb/SDL_DirectFB_mouse.c
 delete mode 100644 src/video/directfb/SDL_DirectFB_mouse.h
 delete mode 100644 src/video/directfb/SDL_DirectFB_opengl.c
 delete mode 100644 src/video/directfb/SDL_DirectFB_opengl.h
 delete mode 100644 src/video/directfb/SDL_DirectFB_render.c
 delete mode 100644 src/video/directfb/SDL_DirectFB_render.h
 delete mode 100644 src/video/directfb/SDL_DirectFB_shape.c
 delete mode 100644 src/video/directfb/SDL_DirectFB_shape.h
 delete mode 100644 src/video/directfb/SDL_DirectFB_video.c
 delete mode 100644 src/video/directfb/SDL_DirectFB_video.h
 delete mode 100644 src/video/directfb/SDL_DirectFB_vulkan.c
 delete mode 100644 src/video/directfb/SDL_DirectFB_vulkan.h
 delete mode 100644 src/video/directfb/SDL_DirectFB_window.c
 delete mode 100644 src/video/directfb/SDL_DirectFB_window.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 260ab3aa7a8f..65e276b96ee8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -448,8 +448,6 @@ set_option(SDL_ARMNEON             "use NEON assembly blitters on ARM" OFF)
 dep_option(SDL_DBUS                "Enable D-Bus support" ON ${UNIX_SYS} OFF)
 set_option(SDL_DISKAUDIO           "Support the disk writer audio driver" ON)
 set_option(SDL_DUMMYAUDIO          "Support the dummy audio driver" ON)
-set_option(SDL_DIRECTFB            "Use DirectFB video driver" OFF)
-dep_option(SDL_DIRECTFB_SHARED     "Dynamically load directfb support" ON "SDL_DIRECTFB" OFF)
 set_option(SDL_DUMMYVIDEO          "Use dummy video driver" ON)
 dep_option(SDL_IBUS                "Enable IBus support" ON ${UNIX_SYS} OFF)
 set_option(SDL_SYSTEM_ICONV        "Use iconv() from system-installed libraries" ON)
@@ -1409,7 +1407,6 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
     # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
     CheckRPI()
     CheckX11()
-    CheckDirectFB()
     # Need to check for EGL first because KMSDRM and Wayland depends on it.
     CheckEGL()
     CheckKMSDRM()
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 553d67092681..38e6e13473a4 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -559,37 +559,6 @@ macro(CheckCOCOA)
   endif()
 endmacro()
 
-# Requires:
-# - PkgCheckModules
-# Optional:
-# - DIRECTFB_SHARED opt
-# - HAVE_SDL_LOADSO opt
-macro(CheckDirectFB)
-  if(SDL_DIRECTFB)
-    pkg_check_modules(PKG_DIRECTFB directfb>=1.0.0)
-    if(PKG_DIRECTFB_FOUND)
-      set(HAVE_DIRECTFB TRUE)
-      file(GLOB DIRECTFB_SOURCES ${SDL3_SOURCE_DIR}/src/video/directfb/*.c)
-      list(APPEND SOURCE_FILES ${DIRECTFB_SOURCES})
-      set(SDL_VIDEO_DRIVER_DIRECTFB 1)
-      set(SDL_VIDEO_RENDER_DIRECTFB 1)
-      list(APPEND EXTRA_CFLAGS ${PKG_DIRECTFB_CFLAGS})
-      list(APPEND SDL_CFLAGS ${PKG_DIRECTFB_CFLAGS})
-      if(SDL_DIRECTFB_SHARED AND NOT HAVE_SDL_LOADSO)
-        message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading")
-      endif()
-      FindLibraryAndSONAME("directfb" LIBDIRS ${PKG_DIRECTFB_LIBRARY_DIRS})
-      if(SDL_DIRECTFB_SHARED AND DIRECTFB_LIB AND HAVE_SDL_LOADSO)
-        set(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "\"${DIRECTFB_LIB_SONAME}\"")
-        set(HAVE_DIRECTFB_SHARED TRUE)
-      else()
-        list(APPEND EXTRA_LDFLAGS ${PKG_DIRECTFB_LDFLAGS})
-      endif()
-      set(HAVE_SDL_VIDEO TRUE)
-    endif()
-  endif()
-endmacro()
-
 # Requires:
 # - n/a
 macro(CheckVivante)
diff --git a/configure b/configure
index 1b86efd5dc59..8681b7953423 100755
--- a/configure
+++ b/configure
@@ -695,8 +695,6 @@ LIBGBM_LIBS
 LIBGBM_CFLAGS
 LIBDRM_LIBS
 LIBDRM_CFLAGS
-DIRECTFB_LIBS
-DIRECTFB_CFLAGS
 X_EXTRA_LIBS
 X_LIBS
 X_PRE_LIBS
@@ -899,8 +897,6 @@ enable_video_vivante
 enable_video_cocoa
 enable_video_metal
 enable_render_metal
-enable_video_directfb
-enable_directfb_shared
 enable_video_kmsdrm
 enable_kmsdrm_shared
 enable_video_dummy
@@ -958,8 +954,6 @@ DECOR_LIBS
 RPI_CFLAGS
 RPI_LIBS
 XMKMF
-DIRECTFB_CFLAGS
-DIRECTFB_LIBS
 LIBDRM_CFLAGS
 LIBDRM_LIBS
 LIBGBM_CFLAGS
@@ -1689,9 +1683,6 @@ Optional Features:
   --enable-video-cocoa    use Cocoa video driver [default=yes]
   --enable-video-metal    include Metal support [default=yes]
   --enable-render-metal   enable the Metal render driver [default=yes]
-  --enable-video-directfb use DirectFB video driver [default=no]
-  --enable-directfb-shared
-                          dynamically load directfb support [default=yes]
   --enable-video-kmsdrm   use KMSDRM video driver [default=yes]
   --enable-kmsdrm-shared  dynamically load kmsdrm support [default=yes]
   --enable-video-dummy    use dummy video driver [default=yes]
@@ -1785,10 +1776,6 @@ Some influential environment variables:
   RPI_CFLAGS  C compiler flags for RPI, overriding pkg-config
   RPI_LIBS    linker flags for RPI, overriding pkg-config
   XMKMF       Path to xmkmf, Makefile generator for X Window System
-  DIRECTFB_CFLAGS
-              C compiler flags for DIRECTFB, overriding pkg-config
-  DIRECTFB_LIBS
-              linker flags for DIRECTFB, overriding pkg-config
   LIBDRM_CFLAGS
               C compiler flags for LIBDRM, overriding pkg-config
   LIBDRM_LIBS linker flags for LIBDRM, overriding pkg-config
@@ -24099,149 +24086,6 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_METAL 1" >>confdefs.h
     fi
 }
 
-CheckDirectFB()
-{
-    # Check whether --enable-video-directfb was given.
-if test ${enable_video_directfb+y}
-then :
-  enableval=$enable_video_directfb;
-else $as_nop
-  enable_video_directfb=no
-fi
-
-    if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
-
-pkg_failed=no
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for directfb >= 1.0.0" >&5
-printf %s "checking for directfb >= 1.0.0... " >&6; }
-
-if test -n "$DIRECTFB_CFLAGS"; then
-    pkg_cv_DIRECTFB_CFLAGS="$DIRECTFB_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "directfb >= 1.0.0") 2>&5
-  ac_status=$?
-  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags "directfb >= 1.0.0" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-if test -n "$DIRECTFB_LIBS"; then
-    pkg_cv_DIRECTFB_LIBS="$DIRECTFB_LIBS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "directfb >= 1.0.0") 2>&5
-  ac_status=$?
-  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_DIRECTFB_LIBS=`$PKG_CONFIG --libs "directfb >= 1.0.0" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi
-        if test $_pkg_short_errors_supported = yes; then
-	        DIRECTFB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "directfb >= 1.0.0" 2>&1`
-        else
-	        DIRECTFB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "directfb >= 1.0.0" 2>&1`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$DIRECTFB_PKG_ERRORS" >&5
-
-	video_directfb=no
-elif test $pkg_failed = untried; then
-        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-	video_directfb=no
-else
-	DIRECTFB_CFLAGS=$pkg_cv_DIRECTFB_CFLAGS
-	DIRECTFB_LIBS=$pkg_cv_DIRECTFB_LIBS
-        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-printf "%s\n" "yes" >&6; }
-	video_directfb=yes
-fi
-
-        if test x$video_directfb = xyes; then
-            # SuSE 11.1 installs directfb-config without directfb-devel
-            save_CPPFLAGS="$CPPFLAGS"
-            CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
-            ac_fn_c_check_header_compile "$LINENO" "directfb.h" "ac_cv_header_directfb_h" "$ac_includes_default"
-if test "x$ac_cv_header_directfb_h" = xyes
-then :
-  have_directfb_hdr=yes
-else $as_nop
-  have_directfb_hdr=no
-fi
-
-            CPPFLAGS="$save_CPPFLAGS"
-            video_directfb=$have_directfb_hdr
-        fi
-
-        if test x$video_directfb = xyes; then
-            # Check whether --enable-directfb-shared was given.
-if test ${enable_directfb_shared+y}
-then :
-  enableval=$enable_directfb_shared;
-else $as_nop
-  enable_directfb_shared=yes
-fi
-
-
-
-printf "%s\n" "#define SDL_VIDEO_DRIVER_DIRECTFB 1" >>confdefs.h
-
-
-printf "%s\n" "#define SDL_VIDEO_RENDER_DIRECTFB 1" >>confdefs.h
-
-            SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
-
-            directfb_shared=no
-            directfb_lib=`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
-            if test x$have_loadso != xyes && \
-               test x$enable_directfb_shared = xyes; then
-                { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic directfb loading" >&5
-printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic directfb loading" >&2;}
-            fi
-            if test x$have_loadso = xyes && \
-               test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
-                directfb_shared=yes
-                echo "-- dynamic libdirectfb -> $directfb_lib"
-
-printf "%s\n" "#define SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC \"$directfb_lib\"" >>confdefs.h
-
-                SUMMARY_video="${SUMMARY_video} directfb(dynamic)"
-            else
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
-                SUMMARY_video="${SUMMARY_video} directfb"
-            fi
-            SDL_CFLAGS="$SDL_CFLAGS $DIRECTFB_CFLAGS"
-            have_video=yes
-        fi
-    fi
-}
-
 CheckKMSDRM()
 {
     # Check whether --enable-video-kmsdrm was given.
@@ -27220,7 +27064,6 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
         # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
         CheckRPI
         CheckX11
-        CheckDirectFB
         # Need to check for EGL first because KMSDRM and Wayland depends on it.
         CheckEGL
         CheckKMSDRM
diff --git a/configure.ac b/configure.ac
index ede7e065ec19..7a41dbbd35e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2019,56 +2019,6 @@ dnl     Work around that we don't have Objective-C support in autoconf
     fi
 }
 
-dnl Find DirectFB
-CheckDirectFB()
-{
-    AC_ARG_ENABLE(video-directfb,
-[AS_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [default=no]])],
-                  , enable_video_directfb=no)
-    if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
-        PKG_CHECK_MODULES([DIRECTFB], [directfb >= 1.0.0], video_directfb=yes, video_directfb=no)
-
-        if test x$video_directfb = xyes; then
-            # SuSE 11.1 installs directfb-config without directfb-devel
-            save_CPPFLAGS="$CPPFLAGS"
-            CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
-            AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
-            CPPFLAGS="$save_CPPFLAGS"
-            video_directfb=$have_directfb_hdr
-        fi
-
-        if test x$video_directfb = xyes; then
-            AC_ARG_ENABLE(directfb-shared,
-[AS_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [default=yes]])],
-                              , enable_directfb_shared=yes)
-
-            AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ])
-            AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
-
-            directfb_shared=no
-            directfb_lib=[`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
-            if test x$have_loadso != xyes && \
-               test x$enable_directfb_shared = xyes; then
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
-            fi
-            if test x$have_loadso = xyes && \
-               test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
-                directfb_shared=yes
-                echo "-- dynamic libdirectfb -> $directfb_lib"
-                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
-                SUMMARY_video="${SUMMARY_video} directfb(dynamic)"
-            else
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
-                SUMMARY_video="${SUMMARY_video} directfb"
-            fi
-            SDL_CFLAGS="$SDL_CFLAGS $DIRECTFB_CFLAGS"
-            have_video=yes
-        fi
-    fi
-}
-
 dnl Find KMSDRM
 CheckKMSDRM()
 {
@@ -3454,7 +3404,6 @@ case "$host" in
         # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
         CheckRPI
         CheckX11
-        CheckDirectFB
         # Need to check for EGL first because KMSDRM and Wayland depends on it.
         CheckEGL
         CheckKMSDRM
diff --git a/docs/README-directfb.md b/docs/README-directfb.md
deleted file mode 100644
index 3b28eef344e2..000000000000
--- a/docs/README-directfb.md
+++ /dev/null
@@ -1,123 +0,0 @@
-DirectFB
-========
-
-Supports:
-
-- Hardware YUV overlays
-- OpenGL - software only
-- 2D/3D accelerations (depends on directfb driver)
-- multiple displays
-- windows
-
-What you need:
-
-* DirectFB 1.0.1, 1.2.x, 1.3.0
-* Kernel-Framebuffer support: required: vesafb, radeonfb .... 
-* Mesa 7.0.x	   - optional for OpenGL
-
-The `/etc/directfbrc` file should contain the following lines to make
-your joystick work and avoid crashes:
-
-```
-disable-module=joystick
-disable-module=cle266
-disable-module=cyber5k
-no-linux-input-grab
-```
-
-To disable to use x11 backend when DISPLAY variable is found use
-
-```
-export SDL_DIRECTFB_X11_CHECK=0
-```
-
-To disable the use of linux input devices, i.e. multimice/multikeyboard support,
-use
-
-```
-export SDL_DIRECTFB_LINUX_INPUT=0
-```
-
-To use hardware accelerated YUV-overlays for YUV-textures, use:
-
-```
-export SDL_DIRECTFB_YUV_DIRECT=1
-```
-
-This is disabled by default. It will only support one 
-YUV texture, namely the first. Every other YUV texture will be
-rendered in software.
-
-In addition, you may use (directfb-1.2.x)
-
-```
-export SDL_DIRECTFB_YUV_UNDERLAY=1
-```
-
-to make the YUV texture an underlay. This will make the cursor to
-be shown.
-
-Simple Window Manager
-=====================
-
-The driver has support for a very, very basic window manager you may
-want to use when running with `wm=default`. Use
-
-```
-export SDL_DIRECTFB_WM=1
-```
-
-to enable basic window borders. In order to have the window title rendered,
-you need to have the following font installed:
-
-```
-/usr/share/fonts/truetype/freefont/FreeSans.ttf
-```
-
-OpenGL Support
-==============
-
-The following instructions will give you *software* OpenGL. However this
-works at least on all directfb supported platforms.
-
-As of this writing 20100802 you need to pull Mesa from git and do the following:
-
-```
-git clone git://anongit.freedesktop.org/git/mesa/mesa
-cd mesa 
-git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
-```
-
-Edit `configs/linux-directfb` so that the Directories-section looks like this:
-
-```
-# Directories
-SRC_DIRS     = mesa glu 
-GLU_DIRS     = sgi
-DRIVER_DIRS  = directfb
-PROGRAM_DIRS = 
-```
-
-Then do the following:
-
-```
-make linux-directfb
-make
-
-echo Installing - please enter sudo pw.
-
-sudo make install INSTALL_DIR=/usr/local/dfb_GL
-cd src/mesa/drivers/directfb
-make
-sudo make install INSTALL_DIR=/usr/local/dfb_GL
-```
-
-To run the SDL - testprograms:
-
-```
-export SDL_VIDEODRIVER=directfb
-export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
-export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
-
-./testgl
-```
diff --git a/docs/README-linux.md b/docs/README-linux.md
index 4634ecd88412..345e0acbc3a6 100644
--- a/docs/README-linux.md
+++ b/docs/README-linux.md
@@ -42,9 +42,6 @@ NOTES:
   for higher-quality audio resampling. SDL will work without it if the library
   is missing, so it's safe to build in support even if the end user doesn't
   have this library installed.
-- DirectFB isn't included because the configure script (currently) fails to find
-  it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the 
-  configure script to include DirectFB support. Send patches.  :)
 
 
 Joystick does not work
diff --git a/docs/README.md b/docs/README.md
index 99220ff91647..090d75b864dc 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -25,7 +25,6 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd
 
 - [Android](README-android.md)
 - [CMake](README-cmake.md)
-- [DirectFB](README-directfb.md)
 - [DynAPI](README-dynapi.md)
 - [Emscripten](README-emscripten.md)
 - [GDK](README-gdk.md)
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index 336987f7ef2f..5df0fc41c69c 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -383,8 +383,6 @@
 #cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@
 #cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@
 #cmakedefine SDL_VIDEO_DRIVER_UIKIT @SDL_VIDEO_DRIVER_UIKIT@
-#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@
-#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@
 #cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
 #cmakedefine SDL_VIDEO_DRIVER_OFFSCREEN @SDL_VIDEO_DRIVER_OFFSCREEN@
 #cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
@@ -435,7 +433,6 @@
 #cmakedefine SDL_VIDEO_RENDER_OGL @SDL_VIDEO_RENDER_OGL@
 #cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@
 #cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@
-#cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@
 #cmakedefine SDL_VIDEO_RENDER_METAL @SDL_VIDEO_RENDER_METAL@
 #cmakedefine SDL_VIDEO_RENDER_VITA_GXM @SDL_VIDEO_RENDER_VITA_GXM@
 #cmakedefine SDL_VIDEO_RENDER_PS2 @SDL_VIDEO_RENDER_PS2@
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in
index 9a8f9e196f67..706acd325ff5 100644
--- a/include/SDL_config.h.in
+++ b/include/SDL_config.h.in
@@ -349,8 +349,6 @@
 /* Enable various video drivers */
 #undef SDL_VIDEO_DRIVER_HAIKU
 #undef SDL_VIDEO_DRIVER_COCOA
-#undef SDL_VIDEO_DRIVER_DIRECTFB
-#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
 #undef SDL_VIDEO_DRIVER_DUMMY
 #undef SDL_VIDEO_DRIVER_WINDOWS
 #undef SDL_VIDEO_DRIVER_WAYLAND
@@ -395,7 +393,6 @@
 #undef SDL_VIDEO_RENDER_OGL
 #undef SDL_VIDEO_RENDER_OGL_ES
 #undef SDL_VIDEO_RENDER_OGL_ES2
-#undef SDL_VIDEO_RENDER_DIRECTFB
 #undef SDL_VIDEO_RENDER_METAL
 
 /* Enable OpenGL support */
diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h
index 243ed28174ca..87468eeeafad 100644
--- a/include/SDL_syswm.h
+++ b/include/SDL_syswm.h
@@ -76,10 +76,6 @@ struct SDL_SysWMinfo;
 
 #endif /* defined(SDL_VIDEO_DRIVER_X11) */
 
-#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
-#include <directfb.h>
-#endif
-
 #if defined(SDL_VIDEO_DRIVER_COCOA)
 #ifdef __OBJC__
 @class NSWindow;
@@ -133,7 +129,6 @@ typedef enum
     SDL_SYSWM_UNKNOWN,
     SDL_SYSWM_WINDOWS,
     SDL_SYSWM_X11,
-    SDL_SYSWM_DIRECTFB,
     SDL_SYSWM_COCOA,
     SDL_SYSWM_UIKIT,
     SDL_SYSWM_WAYLAND,
@@ -167,11 +162,6 @@ struct SDL_SysWMmsg
             XEvent event;
         } x11;
 #endif
-#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
-        struct {
-            DFBEvent event;
-        } dfb;
-#endif
 #if defined(SDL_VIDEO_DRIVER_COCOA)
         struct
         {
@@ -234,14 +224,6 @@ struct SDL_SysWMinfo
             Window window;              /**< The X11 window */
         } x11;
 #endif
-#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
-        struct
-        {
-            IDirectFB *dfb;             /**< The directfb main interface */
-            IDirectFBWindow *window;    /**< The directfb window handle */
-            IDirectFBSurface *surface;  /**< The directfb client surface */
-        } dfb;
-#endif
 #if defined(SDL_VIDEO_DRIVER_COCOA)
         struct
         {
diff --git a/src/events/SDL_scancode_tables.c b/src/events/SDL_scancode_tables.c
index 9c9a55fe8968..766817b1b22d 100644
--- a/src/events/SDL_scancode_tables.c
+++ b/src/events/SDL_scancode_tables.c
@@ -20,7 +20,7 @@
 */
 #include "../SDL_internal.h"
 
-#if SDL_INPUT_LINUXEV || SDL_VIDEO_DRIVER_DIRECTFB || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_X11
+#if SDL_INPUT_LINUXEV || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_X11
 
 #include "SDL_scancode_tables_c.h"
 
@@ -68,6 +68,6 @@ SDL_Scancode SDL_GetScancodeFromTable(SDL_ScancodeTable table, int keycode)
     return scancode;
 }
 
-#endif /* SDL_INPUT_LINUXEV || SDL_VIDEO_DRIVER_DIRECTFB || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_X11 */
+#endif /* SDL_INPUT_LINUXEV || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_X11 */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 5f821b33e95b..d103e958ed95 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -112,9 +112,6 @@ static const SDL_RenderDriver *render_drivers[] = {
 #if SDL_VIDEO_RENDER_OGL_ES
     &GLES_RenderDriver,
 #endif
-#if SDL_VIDEO_RENDER_DIRECTFB
-    &DirectFB_RenderDriver,
-#endif
 #if SDL_VIDEO_RENDER_PS2 && !SDL_RENDER_DISABLED
     &PS2_RenderDriver,
 #endif
@@ -1481,18 +1478,6 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface)
         } else {
             SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch);
         }
-
-#if SDL_VIDEO_RENDER_DIRECTFB
-        /* DirectFB allows palette format for textures.
-         * Copy SDL_Surface palette to the texture */
-        if (SDL_ISPIXELFORMAT_INDEXED(format)) {
-            if (SDL_strcasecmp(renderer->info.name, "directfb") == 0) {
-                extern void DirectFB_SetTexturePalette(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Palette *pal);
-                DirectFB_SetTexturePalette(renderer, texture, surface->format->palette);
-            }
-        }
-#endif
-
     } else {
         SDL_PixelFormat *dst_fmt;
         SDL_Surface *temp = NULL;
diff --git a/src/render/SDL_sysrender.h b/src/render/SDL_sysrender.h
index d87b2563e6e0..d9b6651c4128 100644
--- a/src/render/SDL_sysrender.h
+++ b/src/render/SDL_sysrender.h
@@ -300,7 +300,6 @@ extern SDL_RenderDriver D3D12_RenderDriver;
 extern SDL_RenderDriver GL_RenderDriver;
 extern SDL_RenderDriver GLES2_RenderDriver;
 extern SDL_RenderDriver GLES_RenderDriver;
-extern SDL_RenderDriver DirectFB_RenderDriver;
 extern SDL_RenderDriver METAL_RenderDriver;
 extern SDL_RenderDriver PS2_RenderDriver;
 extern SDL_RenderDriver PSP_RenderDriver;
diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h
index a62f93b65a7f..5a0c24d6295d 100644
--- a/src/video/SDL_sysvideo.h
+++ b/src/video/SDL_sysvideo.h
@@ -450,7 +450,6 @@ typedef struct VideoBootStrap
 /* Not all of these are available in a given build. Use #ifdefs, etc. */
 extern VideoBootStrap COCOA_bootstrap;
 extern VideoBootStrap X11_bootstrap;
-extern VideoBootStrap DirectFB_bootstrap;
 extern VideoBootStrap WINDOWS_bootstrap;
 extern VideoBootStrap WINRT_bootstrap;
 extern VideoBootStrap HAIKU_bootstrap;
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 22fc34a2ac87..e25cb2dab582 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -77,9 +77,6 @@ static VideoBootStrap *bootstrap[] = {
 #if SDL_VIDEO_DRIVER_VIVANTE
     &VIVANTE_bootstrap,
 #endif
-#if SDL_VIDEO_DRIVER_DIRECTFB
-    &DirectFB_bootstrap,
-#endif
 #if SDL_VIDEO_DRIVER_WINDOWS
     &WINDOWS_bootstrap,
 #endif
diff --git a/src/video/SDL_vulkan_internal.h b/src/video/SDL_vulkan_internal.h
index ae9b962209f1..95521b05a3b6 100644
--- a/src/video/SDL_vulkan_internal.h
+++ b/src/video/SDL_vulkan_internal.h
@@ -37,9 +37,6 @@
 #define VK_USE_PLATFORM_METAL_EXT
 #define VK_USE_PLATFORM_MACOS_MVK
 #endif
-#if SDL_VIDEO_DRIVER_DIRECTFB
-#define VK_USE_PLATFORM_DIRECTFB_EXT
-#endif
 #if SDL_VIDEO_DRIVER_UIKIT
 #define VK_USE_PLATFORM_METAL_EXT
 #define VK_USE_PLATFORM_IOS_MVK
diff --git a/src/video/directfb/SDL_DirectFB_WM.c b/src/video/directfb/SDL_DirectFB_WM.c
deleted file mode 100644
index dc4af539f6cf..000000000000
--- a/src/video/directfb/SDL_DirectFB_WM.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../../SDL_internal.h"
-
-#if SDL_VIDEO_DRIVER_DIRECTFB
-
-#include "SDL_DirectFB_video.h"
-#include "SDL_DirectFB_window.h"
-
-#include "../../events/SDL_windowevents_c.h"
-
-#define COLOR_EXPAND(col) col.r, col.g, col.b, col.a
-
-static DFB_Theme theme_std = {
-    4, 4, 8, 8,
-    {255, 200, 200, 200},
-    24,
-    {255, 0, 0, 255},
-    16,
-    {255, 255, 255, 255},
-    "/usr/share/fonts/truetype/freefont/FreeSans.ttf",
-    {255, 255, 0, 0},
-    {255, 255, 255, 0},
-};
-
-static DFB_Theme theme_none = {
-    0, 0, 0, 0,
-    {0, 0, 0, 0},
-    0,
-    {0, 0, 0, 0},
-    0,
-    {0, 0, 0, 0},
-    NULL
-};
-
-static void
-DrawTriangle(IDirectFBSurface * s, int down, int x, int y, int w)
-{
-    int x1, x2, x3;
-    int y1, y2, y3;
-
-    if (down) {
-        x1 = x + w / 2;
-        x2 = x;
-        x3 = x + w;
-        y1 = y + w;
-        y2 = y;
-        y3 = y;
-    } else {
-        x1 = x + w / 2;
-        x2 = x;
-        x3 = x + w;
-        y1 = y;
-        y2 = y + w;
-        y3 = y + w;
-    }
-    s->FillTriangle(s, x1, y1, x2, y2, x3, y3);
-}
-
-static void
-LoadFont(_THIS, SDL_Window * window)
-{
-    SDL_DFB_DEVICEDATA(_this);
-    SDL_DFB_WINDOWDATA(window);
-
-    if (windata->font != NULL) {
-        SDL_DFB_RELEASE(windata->font);
-        windata->font = NULL;
-        SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, windata->font));
-    }
-
-    if (windata->theme.font != NULL)
-    {
-        DFBFontDescription fdesc;
-
-        SDL_zero(fdesc);
-        fdesc.flags = DFDESC_HEIGHT;
-        fdesc.height = windata->theme.font_size;
-        SDL_DFB_CHECK(devdata->
-                      dfb->CreateFont(devdata->dfb, windata->theme.font,
-                                      &fdesc, &windata->font));
-        SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, windata->font));
-    }
-}
-
-static void
-DrawCraption(_THIS, IDirectFBSurface * s, int x, int y, char *text)
-{
-    DFBSurfaceTextFlags flags;
-
-    flags = DSTF_CENTER | DSTF_TOP;
-
-    s->DrawString(s, text, -1, x, y, flags);
-}
-
-void
-DirectFB_WM_RedrawLayout(_THIS, SDL_Window * window)
-{
-    SDL_DFB_WINDOWDATA(window);
-    IDirectFBSurface *s = windata->window_surface;
-    DFB_Theme *t = &windata->theme;
-    int i;
-    int d = (t->caption_size - t->font_size) / 2;
-    int x, y, w;
-
-
-    if (!windata->is_managed || (window->flags & SDL_WINDOW_FULLSCREEN))
-        return;
-
-    SDL_DFB_CHECK(s->SetSrcBlendFunction(s, DSBF_ONE));
-    SDL_DFB_CHECK(s->SetDstBlendFunction(s, DSBF_ZERO));
-    SDL_DFB_CHECK(s->SetDrawingFlags(s, DSDRAW_NOFX));
-    SDL_DFB_CHECK(s->SetBlittingFlags(s, DSBLIT_NOFX));
-
-    LoadFont(_this, window);
-    /* s->SetDrawingFlags(s, DSDRAW_BLEND); */
-    s->SetColor(s, COLOR_EXPAND(

(Patch may be truncated, please check the link at the top of this post.)