mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-21 21:55:38 +00:00
Added proper support for the Raspberry Pi 4.
This commit is contained in:
parent
c642848081
commit
ac4710a18e
|
@ -35,6 +35,7 @@ option(RPI "Set to ON to enable Raspberry Pi specific build" ${RPI})
|
|||
option(CEC "Set to ON to enable CEC" ${CEC})
|
||||
option(VLC_PLAYER "Set to ON to build the VLC-based video player" ${VLC_PLAYER})
|
||||
option(CLANG_TIDY "Set to ON to build using the clang-tidy static analyzer" ${CLANG_TIDY})
|
||||
option(VIDEO_HW_DECODING "Set to OFF to disable FFmpeg HW decoding" ON)
|
||||
|
||||
if(CLANG_TIDY)
|
||||
find_program(CLANG_TIDY_BINARY NAMES clang-tidy)
|
||||
|
@ -58,14 +59,7 @@ endif()
|
|||
#---------------------------------------------------------------------------------------------------
|
||||
# OpenGL setup.
|
||||
|
||||
# Check if we're running on a Raspberry Pi.
|
||||
if(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h")
|
||||
message("-- Building on a Raspberry Pi (bcm_host.h found)")
|
||||
# Setting BCMHOST seems to break OpenGL ES on the RPi 4 so set RPI instead.
|
||||
#set(BCMHOST found)
|
||||
set(RPI ON)
|
||||
set(GLSYSTEM "Embedded OpenGL" CACHE STRING "The OpenGL system to be used")
|
||||
elseif(GLES OR RPI)
|
||||
if(GLES)
|
||||
set(GLSYSTEM "Embedded OpenGL" CACHE STRING "The OpenGL system to be used")
|
||||
else()
|
||||
set(GLSYSTEM "Desktop OpenGL" CACHE STRING "The OpenGL system to be used")
|
||||
|
@ -73,6 +67,32 @@ endif()
|
|||
|
||||
set_property(CACHE GLSYSTEM PROPERTY STRINGS "Desktop OpenGL" "Embedded OpenGL")
|
||||
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
# Raspberry Pi setup.
|
||||
|
||||
# If manually set to RPI (used for testing purposes).
|
||||
if(RPI)
|
||||
set(VIDEO_HW_DECODING OFF)
|
||||
endif()
|
||||
|
||||
# Raspberry Pi OS 32-bit (armv7l)
|
||||
if(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h")
|
||||
set(RPI ON)
|
||||
set(RPI_32 ON)
|
||||
set(VIDEO_HW_DECODING OFF)
|
||||
set(BCMHOST found)
|
||||
message("-- Building on a Raspberry Pi (32-bit OS)")
|
||||
endif()
|
||||
|
||||
# Raspberry Pi OS 64-bit (aarch64)
|
||||
if(EXISTS "/usr/include/bcm_host.h")
|
||||
set(RPI ON)
|
||||
set(RPI_64 ON)
|
||||
set(VIDEO_HW_DECODING OFF)
|
||||
set(BCMHOST found)
|
||||
message("-- Building on a Raspberry Pi (64-bit OS)")
|
||||
endif()
|
||||
|
||||
#---------------------------------------------------------------------------------------------------
|
||||
# Package dependencies.
|
||||
|
||||
|
@ -196,18 +216,22 @@ else()
|
|||
add_definitions(-DUSE_OPENGLES_10)
|
||||
endif()
|
||||
|
||||
if(RPI)
|
||||
add_definitions(-D_RPI_)
|
||||
endif()
|
||||
|
||||
if(VLC_PLAYER)
|
||||
add_definitions(-DBUILD_VLC_PLAYER)
|
||||
endif()
|
||||
|
||||
if(DEFINED BCMHOST OR RPI)
|
||||
add_definitions(-D_RPI_)
|
||||
endif()
|
||||
|
||||
if(DEFINED libCEC_FOUND)
|
||||
add_definitions(-DHAVE_LIBCEC)
|
||||
endif()
|
||||
|
||||
if(VIDEO_HW_DECODING)
|
||||
add_definitions(-DVIDEO_HW_DECODING)
|
||||
endif()
|
||||
|
||||
# GLM library options.
|
||||
add_definitions(-DGLM_FORCE_CXX17)
|
||||
add_definitions(-DGLM_FORCE_XYZW_ONLY)
|
||||
|
@ -279,7 +303,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|||
list(APPEND COMMON_INCLUDE_DIRS ${ALSA_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(DEFINED BCMHOST OR RPI)
|
||||
if(RPI_32)
|
||||
list(APPEND COMMON_INCLUDE_DIRS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include"
|
||||
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vcos"
|
||||
"${CMAKE_FIND_ROOT_PATH}/opt/vc/include/interface/vmcs_host/linux"
|
||||
|
@ -358,9 +382,6 @@ endif()
|
|||
|
||||
# Add libCEC libraries.
|
||||
if(DEFINED libCEC_FOUND)
|
||||
if(DEFINED BCMHOST OR RPI)
|
||||
list(APPEND COMMON_LIBRARIES bcm_host vchiq_arm)
|
||||
endif()
|
||||
list(APPEND COMMON_LIBRARIES dl ${libCEC_LIBRARIES})
|
||||
endif()
|
||||
|
||||
|
@ -369,14 +390,22 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|||
list(APPEND COMMON_LIBRARIES ${ALSA_LIBRARY})
|
||||
endif()
|
||||
|
||||
# Raspberry Pi.
|
||||
if(DEFINED BCMHOST)
|
||||
list(APPEND COMMON_LIBRARIES bcm_host vchiq_arm)
|
||||
if(RPI_32)
|
||||
link_directories("${CMAKE_FIND_ROOT_PATH}/opt/vc/lib")
|
||||
list(APPEND COMMON_LIBRARIES bcm_host brcmEGL ${OPENGLES_LIBRARIES})
|
||||
elseif(RPI)
|
||||
link_directories("${CMAKE_FIND_ROOT_PATH}/opt/vc/lib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Note: Building with GLES support on the Raspberry Pi currently seems to be broken.
|
||||
if(GLES AND RPI_32)
|
||||
list(APPEND COMMON_LIBRARIES brcmEGL ${OPENGLES_LIBRARIES})
|
||||
elseif(GLES AND RPI_64)
|
||||
list(APPEND COMMON_LIBRARIES ${OPENGLES_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# OpenGL.
|
||||
if(GLSYSTEM MATCHES "Desktop OpenGL")
|
||||
list(APPEND COMMON_LIBRARIES ${OPENGL_LIBRARIES})
|
||||
else()
|
||||
|
|
|
@ -1010,7 +1010,7 @@ void GuiMenu::openOtherOptions()
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !defined(_RPI_)
|
||||
#if defined(VIDEO_HW_DECODING)
|
||||
// Whether to enable hardware decoding for the FFmpeg video player.
|
||||
auto video_hardware_decoding = std::make_shared<SwitchComponent>(mWindow);
|
||||
video_hardware_decoding->setState(Settings::getInstance()->getBool("VideoHardwareDecoding"));
|
||||
|
|
|
@ -98,7 +98,7 @@ void Settings::setDefaults()
|
|||
|
||||
// Scraper.
|
||||
mStringMap["Scraper"] = {"screenscraper", "screenscraper"};
|
||||
mBoolMap["ScraperUseAccountScreenScraper"] = {false, false};
|
||||
mBoolMap["ScraperUseAccountScreenScraper"] = {true, true};
|
||||
mStringMap["ScraperUsernameScreenScraper"] = {"", ""};
|
||||
mStringMap["ScraperPasswordScreenScraper"] = {"", ""};
|
||||
|
||||
|
@ -154,7 +154,11 @@ void Settings::setDefaults()
|
|||
// UI settings -> media viewer settings.
|
||||
mBoolMap["MediaViewerKeepVideoRunning"] = {true, true};
|
||||
mBoolMap["MediaViewerStretchVideos"] = {false, false};
|
||||
#if defined(_RPI_)
|
||||
mBoolMap["MediaViewerVideoScanlines"] = {false, false};
|
||||
#else
|
||||
mBoolMap["MediaViewerVideoScanlines"] = {true, true};
|
||||
#endif
|
||||
mBoolMap["MediaViewerVideoBlur"] = {false, false};
|
||||
mBoolMap["MediaViewerScreenshotScanlines"] = {true, true};
|
||||
|
||||
|
@ -177,7 +181,11 @@ void Settings::setDefaults()
|
|||
mIntMap["ScreensaverSwapVideoTimeout"] = {0, 0};
|
||||
mBoolMap["ScreensaverStretchVideos"] = {false, false};
|
||||
mBoolMap["ScreensaverVideoGameInfo"] = {true, true};
|
||||
#if defined(_RPI_)
|
||||
mBoolMap["ScreensaverVideoScanlines"] = {false, false};
|
||||
#else
|
||||
mBoolMap["ScreensaverVideoScanlines"] = {true, true};
|
||||
#endif
|
||||
mBoolMap["ScreensaverVideoBlur"] = {false, false};
|
||||
|
||||
mBoolMap["MenuBlurBackground"] = {true, true};
|
||||
|
@ -199,8 +207,8 @@ void Settings::setDefaults()
|
|||
mBoolMap["EnableMenuKidMode"] = {false, false};
|
||||
|
||||
// Sound settings.
|
||||
mIntMap["SoundVolumeNavigation"] = {80, 80};
|
||||
mIntMap["SoundVolumeVideos"] = {100, 100};
|
||||
mIntMap["SoundVolumeNavigation"] = {70, 70};
|
||||
mIntMap["SoundVolumeVideos"] = {80, 80};
|
||||
mBoolMap["GamelistVideoAudio"] = {true, true};
|
||||
mBoolMap["MediaViewerVideoAudio"] = {true, true};
|
||||
mBoolMap["ScreensaverVideoAudio"] = {false, false};
|
||||
|
@ -221,7 +229,7 @@ void Settings::setDefaults()
|
|||
// Other settings.
|
||||
mStringMap["MediaDirectory"] = {"", ""};
|
||||
#if defined(_RPI_)
|
||||
mIntMap["MaxVRAM"] = {80, 80};
|
||||
mIntMap["MaxVRAM"] = {180, 180};
|
||||
#else
|
||||
mIntMap["MaxVRAM"] = {256, 256};
|
||||
#endif
|
||||
|
@ -230,12 +238,7 @@ void Settings::setDefaults()
|
|||
mStringMap["FullscreenMode"] = {"normal", "normal"};
|
||||
#endif
|
||||
#if defined(BUILD_VLC_PLAYER)
|
||||
#if defined(_RPI_)
|
||||
// As the FFmpeg video player is not HW accelerated, use VLC as default on this weak device.
|
||||
mStringMap["VideoPlayer"] = {"vlc", "vlc"};
|
||||
#else
|
||||
mStringMap["VideoPlayer"] = {"ffmpeg", "ffmpeg"};
|
||||
#endif
|
||||
#endif
|
||||
mStringMap["ExitButtonCombo"] = {"F4", "F4"};
|
||||
mStringMap["SaveGamelistsMode"] = {"always", "always"};
|
||||
|
@ -246,7 +249,7 @@ void Settings::setDefaults()
|
|||
#if defined(_WIN64)
|
||||
mBoolMap["LaunchWorkaround"] = {true, true};
|
||||
#endif
|
||||
#if !defined(_RPI_)
|
||||
#if !defined(VIDEO_HW_DECODING)
|
||||
mBoolMap["VideoHardwareDecoding"] = {false, false};
|
||||
#endif
|
||||
mBoolMap["VideoUpscaleFrameRate"] = {false, false};
|
||||
|
|
|
@ -1227,7 +1227,7 @@ void VideoFFmpegComponent::startVideo()
|
|||
|
||||
// Video stream setup.
|
||||
|
||||
#if defined(_RPI_)
|
||||
#if !defined(VIDEO_HW_DECODING)
|
||||
bool hwDecoding = false;
|
||||
#else
|
||||
bool hwDecoding = Settings::getInstance()->getBool("VideoHardwareDecoding");
|
||||
|
|
Loading…
Reference in a new issue