Skip to content

Raspberry Pi

Georg Zotti edited this page Jul 30, 2019 · 35 revisions

Stellarium on Raspberry Pi

The Raspberry Pi is a very popular family of single-board computers for many kinds of programming experiments and hardware tinkering projects. A new open-source graphics driver has been created by Eric Anholt, which enables you to run Stellarium with hardware acceleration on the multi-core models 2 and 3. Don't expect a super computer, but you should get typically over 10 frames per seconds, which should be enough for many applications where you don't want to waste too much energy. (E.g. solar/battery powered observatory.) I get 18fps on a 1400x1050 screen with Satellites not shown.

For current Raspbian ("Stretch" as of early 2018), you must

  • activate the "Experimental OpenGL Driver" in raspi-config
  • build libdrm and Mesa 17 from sources (see below)
  • build Stellarium from sources as described here

Alternatively, you can run Ubuntu Mate. After a trial install I updated to 16.04.3 which has Mesa 17.0.7, followed https://ubuntu-mate.community/t/tutorial-activate-opengl-driver-for-ubuntu-mate-16-04/7094 to activate VC4, and tried Stellarium 0.16.1 from our ppa. You don't have to compile anything yourself!

I found this preferable with Stretch 2018-0627 because Mesa would not configure for me.

The following seemed to work on Pi3B+ model http://www.raspberryconnect.com/gamessoftware/item/314-trying_out_opengl_on_raspberry_pi_3

First Impressions, Limitations

The new driver seems to work pretty well in many cases, but some hardware limitations persist.

  • You cannot show your own landscapes or 3D sceneries with any textures larger than 2048x2048 pixels. Also the built-in "Sterngarten" scenery will not work.
  • The Scenery3D plugin should be used with Perspective Projection only. All other projections require too much texture memory.
  • It seems that some bug prevents OBJ planets from being rendered. Keep this option disabled!
  • If you want higher framerate, consider disabling the Satellites plugin, or at least think about reducing number of satellites to the ones you are critically interested in. Also, don't load too many minor bodies.
  • The DSS layer seems to work for short periods, then the X server fails. It may have to do with limitations of texture memory. You can try to press Ctrl-Alt-Backspace to restart it, but sometimes you will have to reboot if the graphics failed.

Building the external libraries

The following instructions which are required for Raspbian have been taken from Eric Anholt's site (https://github.com/anholt/mesa/wiki/VC4-complete-Raspbian-upgrade) on February 24, 2018. Fortunately we don't need to build a new kernel!

libdrm

Until Raspbian gets its libdrm updated, we need to build it ourselves.

sudo apt-get install \
    xutils-dev libpthread-stubs0-dev \
    automake autoconf libtool git
git clone git://anongit.freedesktop.org/mesa/drm
cd drm
./autogen.sh \
    --prefix=/usr \
    --libdir=/usr/lib/arm-linux-gnueabihf
make
sudo make install

Mesa

sudo apt-get install \
    flex bison python-mako \
    libxcb-dri3-dev libxcb-dri2-0-dev \
    libxcb-glx0-dev libx11-xcb-dev \
    libxcb-present-dev libxcb-sync-dev \
    libxshmfence-dev \
    libxdamage-dev libxext-dev libxfixes-dev \
    x11proto-dri2-dev x11proto-dri3-dev \
    x11proto-present-dev x11proto-gl-dev \
    libexpat1-dev libudev-dev gettext \
    libxrandr-dev

git clone git://anongit.freedesktop.org/mesa/mesa
cd mesa
./autogen.sh \
    --prefix=/usr \
    --libdir=/usr/lib/arm-linux-gnueabihf \
    --with-gallium-drivers=vc4 \
    --with-dri-drivers= \
    --with-egl-platforms=x11,drm
make
sudo make install

Notes for building Stellarium

You may want to install a swap file, otherwise you may run out of virtual memory when compiling https://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/

Then, make sure to install the build requirements (https://github.com/Stellarium/stellarium/wiki/Linux-build-dependencies) and follow the building instructions for Linux (https://github.com/Stellarium/stellarium/wiki/Compilation-on-Linux).

If you are doing the compile on your Pi, follow the Linux instructions but use the command

nice make -j4

Otherwise, you may lose control of the pi with all cores busy. Or run with

make -j3

to keep one core free for other tasks.

Raspberry Pi Model 4B

We have no experience with the latest (2019) model yet, or with the 2019 Raspbian Buster. Find out yourself and fill your observations here!

Clone this wiki locally