From daff55ad6e7ea39f7d8b91a574116eef338ce1eb Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 2 Aug 2017 10:22:48 -0700 Subject: Fixed bug 3690 - SDL2 KMS/DRM render context support Manuel The attached patch adds support for KMS/DRM context graphics. It builds with no problem on X86_64 GNU/Linux systems, provided the needed libraries are present, and on ARM GNU/Linux systems that have KMS/DRM support and a GLES2 implementation. Tested on Raspberry Pi: KMS/DRM is what the Raspberry Pi will use as default in the near future, once the propietary DispmanX API by Broadcom is overtaken by open graphics stack, it's possible to boot current Raspbian system in KMS mode by adding "dtoverlay=vc4-kms-v3d" to config.txt on Raspbian's boot partition. X86 systems use KMS right away in every current GNU/Linux system. Simple build instructions: $./autogen.sh $./configure --enable-video-kmsdrm $make --- cmake/sdlchecks.cmake | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'cmake') diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 770378828..6f6a41f90 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -1149,3 +1149,46 @@ macro(CheckRPI) endif(SDL_VIDEO AND HAVE_VIDEO_RPI) endif(VIDEO_RPI) endmacro(CheckRPI) + +# Requires: +# - EGL +# - PkgCheckModules +# Optional: +# - KMSDRM_SHARED opt +# - HAVE_DLOPEN opt +macro(CheckKMSDRM) + if(VIDEO_KMSDRM) + pkg_check_modules(KMSDRM libdrm gbm egl) + if(KMSDRM_FOUND) + link_directories( + ${KMSDRM_LIBRARY_DIRS} + ) + include_directories( + ${KMSDRM_INCLUDE_DIRS} + ) + set(HAVE_VIDEO_KMSDRM TRUE) + set(HAVE_SDL_VIDEO TRUE) + + file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${KMSDRM_SOURCES}) + + list(APPEND EXTRA_CFLAGS ${KMSDRM_CLFLAGS}) + + set(SDL_VIDEO_DRIVER_KMSDRM 1) + + if(KMSDRM_SHARED) + if(NOT HAVE_DLOPEN) + message_warn("You must have SDL_LoadObject() support for dynamic KMS/DRM loading") + else() + FindLibraryAndSONAME(drm) + FindLibraryAndSONAME(gbm) + set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "\"${DRM_LIB_SONAME}\"") + set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "\"${GBM_LIB_SONAME}\"") + set(HAVE_KMSDRM_SHARED TRUE) + endif() + else() + set(EXTRA_LIBS ${KMSDRM_LIBRARIES} ${EXTRA_LIBS}) + endif() + endif() + endif() +endmacro() -- cgit v1.2.1