Skip to content
This repository has been archived by the owner on May 16, 2020. It is now read-only.

Raspberry Pi support #373

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,49 @@ Be sure to set the CMake variables (see above) beforehand.
(and can safely be renamed), while the dedicated server is just a command-line binary named "etlded".


### Raspberry Pi

ET: Legacy supports both OpenGL and OpenGL ES on the Raspberry Pi.

Using the Raspbian Operating System, both OpenGL and GLES run the game providing good performance at low-mid settings, typically between 20-60 FPS.

Using Ubuntu MATE, neither OpenGL or GLES work currently - tested with Ubuntu MATE 18.04 beta 1.

It is advised to add a slight overclock to the GPU to provide a better experience. Run `sudo nano /boot/config.txt` and
add the following to the config file:

```
core_freq=500
v3d_freq=500
```

You may be able to increase the overclock more than this, but increasing too far will be unstable and will likely crash
your Pi. If you experience crashes whilst having the overclock in place, decrease the values accordingly.

Install using experimental OpenGL driver:

1. Enable experimental OpenGL driver via the `raspi-config` command line application.
2. Modify `easybuild.sh` and set the `FEATURE_RENDERER_GLES` flag to 0 under the `RPI` section.
3. If building SDL from source, ensure you have passed `--host=armv7l-raspberry-linux-gnueabihf` when calling the
configure command. Otherwise, keep `BUNDLED_SDL=1` in `easybuild.sh`.
4. Increase GPU memory split to at least 256mb.
5. Run `./easybuild.sh -RPI -j4` to build for Raspberry Pi.
6. Start the game in windowed mode. Full screen mode has issues currently.

Install using OpenGLES:

1. Ensure the legacy OpenGL driver is enabled via the `raspi-config` command line application (it is by default).
2. Modify `easybuild.sh` and set the `FEATURE_RENDERER_GLES` flag to 1 under the `RPI` section.
3. If building SDL from source, ensure you have passed
`--host=armv7l-raspberry-linux-gnueabihf --host=armv7l-raspberry-linux-gnueabihf --disable-pulseaudio
--disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-opengl`
when calling the configure command. This will ensure SDL is built with an OpenGL ES backend. Otherwise, keep `BUNDLED_SDL=1` in `easybuild.sh`.
Note: The host flag is necessary for SDL to correctly recognise Raspberry Pi 2 and greater.
4. Increase GPU memory split to at least 256mb.
5. Run `./easybuild.sh -RPI -j4` to build for Raspberry Pi.
6. Exit X11 to terminal in order to enable hardware accelerated rendering.


LICENSE
=======

Expand Down
6 changes: 1 addition & 5 deletions cmake/ETLBuildRenderer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ else(RENDERER_DYNAMIC)
endif(RENDERER_DYNAMIC)
if(RENDERER_DYNAMIC OR NOT FEATURE_RENDERER2)

if(FEATURE_RENDERER_GLES)
add_library(${R1_NAME} ${REND_LIBTYPE} ${RENDERERGLES_FILES} ${RENDERER_COMMON})
else()
add_library(${R1_NAME} ${REND_LIBTYPE} ${RENDERER1_FILES} ${RENDERER_COMMON})
endif()
add_library(${R1_NAME} ${REND_LIBTYPE} ${RENDERER1_FILES} ${RENDERER_COMMON})

if(NOT FEATURE_RENDERER_GLES)
if(BUNDLED_GLEW)
Expand Down
44 changes: 33 additions & 11 deletions cmake/ETLSetupFeatures.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,36 @@ if(BUILD_CLIENT)
include_directories(${X11_INCLUDE_DIR})
endif(NOT WIN32)

if(ARM)

#check if we're running on Raspberry Pi
MESSAGE("Looking for bcm_host.h")
if(EXISTS "/opt/vc/include/bcm_host.h")
MESSAGE("bcm_host.h found")
set(BCMHOST found)
else()
MESSAGE("bcm_host.h not found")
endif()

if(DEFINED BCMHOST)
set(COMMON_INCLUDE_DIRS
"/opt/vc/include"
"/opt/vc/include/interface/vcos"
"/opt/vc/include/interface/vmcs_host"
"/opt/vc/include/interface/vmcs_host/linux"
"/opt/vc/include/interface/vcos/pthreads"
)
include_directories(${COMMON_INCLUDE_DIRS})

link_directories("/opt/vc/lib")

LIST(APPEND CLIENT_LIBRARIES
bcm_host
pthread
)
endif()
endif()

if(NOT FEATURE_RENDERER_GLES)
if(NOT BUNDLED_GLEW)
find_package(GLEW REQUIRED)
Expand All @@ -44,17 +74,9 @@ if(BUILD_CLIENT)
endif()

if(NOT BUNDLED_SDL)
# specials for ARM - currently set for RPI raspdian/ubuntu mate
# system sdl lib isn't latest & sndio lib is required
if(ARM)
find_package(SDL2 2.0.4 REQUIRED) # sdl2-dev
list(APPEND SDL_LIBRARIES ${SDL32_BUNDLED_LIBRARIES} sndio)
include_directories(SYSTEM ${SDL2_INCLUDE_DIR})
else()
find_package(SDL2 2.0.8 REQUIRED) # FindSDL doesn't detect 32bit lib when crosscompiling
list(APPEND SDL_LIBRARIES ${SDL2_LIBRARY})
include_directories(SYSTEM ${SDL2_INCLUDE_DIR})
endif(ARM)
find_package(SDL2 2.0.8 REQUIRED) # FindSDL doesn't detect 32bit lib when crosscompiling
list(APPEND SDL_LIBRARIES ${SDL2_LIBRARY})
include_directories(SYSTEM ${SDL2_INCLUDE_DIR})
else() # BUNDLED_SDL
if(MINGW AND WIN32)
# We append the mingw32 library to the client list since SDL2Main requires it
Expand Down
6 changes: 0 additions & 6 deletions cmake/ETLSources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,6 @@ FILE(GLOB RENDERER1_FILES
"src/renderer/*.h"
)

FILE(GLOB RENDERERGLES_FILES
"src/rendererGLES/*.c"
"src/rendererGLES/*.h"
"src/sdl/eglport.c"
)

FILE(GLOB RENDERER2_FILES
"src/renderer2/*.c"
"src/renderer2/*.h"
Expand Down
12 changes: 10 additions & 2 deletions cmake/FindGLES.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
# GLES_LIBRARY
#

find_path(GLES_INCLUDE_DIR GLES/gl.h)
find_library(GLES_LIBRARY NAMES GLESv1_CM)
if(ARM)
# Try RPi location
find_path(GLES_INCLUDE_DIR NAMES GLES/gl.h PATHS "/opt/vc/include/")
find_library(GLES_LIBRARY NAMES brcmGLESv2 PATHS "/opt/vc/lib/")
endif()

if(NOT GLES_LIBRARY)
find_path(GLES_INCLUDE_DIR GLES/gl.h)
find_library(GLES_LIBRARY NAMES GLESv1_CM)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLES DEFAULT_MSG GLES_LIBRARY GLES_INCLUDE_DIR)
43 changes: 43 additions & 0 deletions docs/INSTALL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,46 @@ WEBSITE
=======

For more information consult our website at http://www.etlegacy.com/.

RASPBERRY PI INSTALLATION
=========================

ET: Legacy supports both OpenGL and OpenGL ES on the Raspberry Pi.

Using the Raspbian Operating System, both OpenGL and GLES run the game providing good performance at low-mid settings, typically between 20-60 FPS.

Using Ubuntu MATE, neither OpenGL or GLES work currently - tested with Ubuntu MATE 18.04 beta 1.

It is advised to add a slight overclock to the GPU to provide a better experience. Run `sudo nano /boot/config.txt` and
add the following to the config file:

```
core_freq=500
v3d_freq=500
```

You may be able to increase the overclock more than this, but increasing too far will be unstable and will likely crash
your Pi. If you experience crashes whilst having the overclock in place, decrease the values accordingly.

Install using experimental OpenGL driver:

1. Enable experimental OpenGL driver via the `raspi-config` command line application.
2. Modify `easybuild.sh` and set the `FEATURE_RENDERER_GLES` flag to 0 under the `RPI` section.
3. If building SDL from source, ensure you have passed `--host=armv7l-raspberry-linux-gnueabihf` when calling the
configure command. Otherwise, keep `BUNDLED_SDL=1` in `easybuild.sh`.
4. Increase GPU memory split to at least 256mb.
5. Run `./easybuild.sh -RPI -j4` to build for Raspberry Pi.
6. Start the game in windowed mode. Full screen mode has issues currently.

Install using OpenGLES:

1. Ensure the legacy OpenGL driver is enabled via the `raspi-config` command line application (it is by default).
2. Modify `easybuild.sh` and set the `FEATURE_RENDERER_GLES` flag to 1 under the `RPI` section.
3. If building SDL from source, ensure you have passed
`--host=armv7l-raspberry-linux-gnueabihf --host=armv7l-raspberry-linux-gnueabihf --disable-pulseaudio
--disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-opengl`
when calling the configure command. This will ensure SDL is built with an OpenGL ES backend. Otherwise, keep `BUNDLED_SDL=1` in `easybuild.sh`.
Note: The host flag is necessary for SDL to correctly recognise Raspberry Pi 2 and greater.
4. Increase GPU memory split to at least 256mb.
5. Run `./easybuild.sh -RPI -j4` to build for Raspberry Pi.
6. Exit X11 to terminal in order to enable hardware accelerated rendering.
5 changes: 4 additions & 1 deletion easybuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ parse_commandline() {
ARM=1
CROSS_COMPILE32=0
x86_build=false
FEATURE_RENDERER_GLES=0
FEATURE_RENDERER_GLES=1
RENDERER_DYNAMIC=0
FEATURE_RENDERER2=0
FEATURE_JANSSON=0
Expand All @@ -280,6 +280,7 @@ parse_commandline() {
BUNDLED_FREETYPE=0
#FEATURE_DBMS=0
#BUNDLED_SQLITE3=0
#BUNDLED_SDL=0
FEATURE_LUASQL=1
FEATURE_OMNIBOT=1
INSTALL_OMNIBOT=0
Expand Down Expand Up @@ -359,6 +360,7 @@ generate_configuration() {
#cmake variables
RELEASE_TYPE=${RELEASE_TYPE:-Release}
CROSS_COMPILE32=${CROSS_COMPILE32:-1}
ARM=${ARM:-0}
BUILD_SERVER=${BUILD_SERVER:-1}
BUILD_CLIENT=${BUILD_CLIENT:-1}
BUILD_MOD=${BUILD_MOD:-1}
Expand Down Expand Up @@ -417,6 +419,7 @@ generate_configuration() {
_CFGSTRING="
-DCMAKE_BUILD_TYPE=${RELEASE_TYPE}
-DCROSS_COMPILE32=${CROSS_COMPILE32}
-DARM=${ARM}
-DBUILD_SERVER=${BUILD_SERVER}
-DBUILD_CLIENT=${BUILD_CLIENT}
-DBUILD_MOD=${BUILD_MOD}
Expand Down
2 changes: 1 addition & 1 deletion libs
Submodule libs updated 3615 files
3 changes: 2 additions & 1 deletion src/renderer/tr_animation_mdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,7 @@ void RB_MDM_SurfaceAnim(mdmSurface_t *surface)
}

DBG_SHOWTIME

#ifndef FEATURE_RENDERER_GLES
if (r_bonesDebug->integer)
{
GL_State(GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE);
Expand Down Expand Up @@ -2098,6 +2098,7 @@ void RB_MDM_SurfaceAnim(mdmSurface_t *surface)
qglEnd();
}
}
#endif

/* if( r_showmodelbounds->integer ) {
vec3_t diff, v1, v2, v3, v4, v5, v6;
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/tr_animation_mds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,7 @@ void RB_SurfaceAnim(mdsSurface_t *surface)
}

DBG_SHOWTIME

#ifndef FEATURE_RENDERER_GLES
if (r_bonesDebug->integer)
{
if (r_bonesDebug->integer < 3)
Expand Down Expand Up @@ -1726,6 +1726,7 @@ void RB_SurfaceAnim(mdsSurface_t *surface)
}
}
}
#endif

if (r_bonesDebug->integer > 1)
{
Expand Down
Loading