RenderTarget texture got deleted between RenderPresent

chronos? They should be in /opt/vc/include. At least they are on my Raspbian Stretch.

I put Raspbian Stretch Lite on an SD card and executed these commands. Got me a working SDL2 with the RPI and KMSDRM driver.

sed 's/^#deb-src/deb-src/' /etc/apt/sources.list | sudo dd of=/etc/apt/sources.list   # Activate sources
sudo apt-get update                      # Update package list
sudo apt-get upgrade                     # Upgrade installed packages
sudo apt-get install mercurial           # Install mercurial
sudo apt-get build-dep libsdl2           # Install most build dependencies
sudo apt-get install libgbm-dev          # Install the libgbm dependency
sudo apt-get install libgl1-mesa-dri     # Install the vc4 driver
hg clone https://hg.libsdl.org/SDL       # Get the source with mercurial
mkdir SDL/out                            # Create build directory
cd SDL/out
../configure --disable-video-x11 --disable-video-wayland --enable-video-kmsdrm --host arm-raspberry-linux-gnueabihf --disable-rpath 
make -j4
sudo make install                        # Install into /usr/local
sudo ldconfig                            # Update ld cache to make the linker aware of the new library

The firmwire-side driver should work with this immediately.

Change over to the KMS driver with raspi-config to test the KMSDRM driver. Because the RPI and KMSDRM driver bite each other a bit, you have to start your application with more environment variables:

SDL_VIDEODRIVER=kmsdrm SDL_VIDEO_GL_DRIVER=libGL.so.1 SDL_VIDEO_EGL_DRIVER=libEGL.so ./application

This isn’t necessary if you just don’t build it with the RPI driver.