Closed Fourdee closed 7 years ago
Compiles:
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib #mv /usr/local/lib/* /usr/lib/ # deb installs to /usr/local, path option?
ldconfig
libpng12.so.0
libFLAC.so.8
libmpg123.so.0
libprofiler.so.0
libfreetype.so.6
libXxf86vm.so.1
apt-get install -y libpng12-0 libflac8 libmpg123-0 libgoogle-perftools4 libfreetype6 libxxf86vm1
🈴 Hopefully due to SSH
root@DietPi:~# ./amiberry-sdl2
Amiberry-SDL2 by Dimitris (MiDWaN) Panokostas
INFO: SDL could not initialize! SDL_Error:
Internal error; file src/main.cpp, line 991
Aborted
References: https://www.raspberrypi.org/forums/viewtopic.php?f=67&t=122525 https://solarianprogrammer.com/2015/01/22/raspberry-pi-raspbian-getting-started-sdl-2/ http://interactivesoundmachine.blogspot.co.uk/2016/03/how-to-install-clean-and-optimized.html
Test app:
#include <SDL2/SDL.h>
// +--------------------------------------------------+
// | Minimal SDL2 Test Program |
// | Creates a graphics window then shuts it down |
// | after 10 seconds. |
// +--------------------------------------------------+
int main ( int argc, char** argv )
{
SDL_Window *window;
SDL_Init(SDL_INIT_VIDEO);
window = SDL_CreateWindow(
"SDL2 TEST PROGRAM", // window title
SDL_WINDOWPOS_CENTERED, // the x position of the window
SDL_WINDOWPOS_CENTERED, // the y position of the window
400,400, // window width and height
SDL_WINDOW_RESIZABLE // create resizeable window
);
if(window == NULL) // if no win, show error
{
printf("Could not create SDL2 test window: %s\n", SDL_GetError());
return 1;
}
SDL_Delay(10000); // 10sec delay
SDL_DestroyWindow(window); // kill window
SDL_Quit(); // clean up
return 0; // return success
}
gcc `sdl2-config --cflags --libs` -v -o myprog main.c
root@DietPi:~# ./myprog
Could not create SDL2 test window:
root@DietPi:~# dpkg -l | grep sdl2
ii libsdl2-2.0-0:armhf 2.0.2+dfsg1-6 armhf Simple DirectMedia Layer
ii libsdl2-dev 2.0.2+dfsg1-6 armhf Simple DirectMedia Layer development files
ii libsdl2-image 2.0.1-1 armhf Package created with checkinstall 1.6.2
ii libsdl2-mixer 2.0.1-1 armhf Package created with checkinstall 1.6.2
ii libsdl2-net 2.0.1-1 armhf Package created with checkinstall 1.6.2
ii libsdl2-ttf 2.0.14-1 armhf Package created with checkinstall 1.6.2
🈴 RP test:
apt-get install git build-essential -y
git clone https://github.com/RetroPie/RetroPie-Setup.git --depth=1
cd Retro*
./retropie_packages.sh sdl2
Amiberry-SDL2 by Dimitris (MiDWaN) Panokostas
INFO: SDL could not initialize! SDL_Error:
Internal error; file src/main.cpp, line 991
Aborted
xinit ./amiberry-sdl2
#terminates
@midwan
Cannot get SDL window to init. Which system + setup have you run with SDL2 + RPi and its working? eg: RetroPie image + SDL2 install? I can then replicate install and see whats needed/missing.
@Fourdee I've tested it in Raspbian, RetroPie and DietPi. :)
The key ingredients are: 1) install the SDL2 package from the RetroPie repo, as per the instructions in the Amiberry SDL2 readme 2) have the "Legacy" driver enabled in raspi-config, not OpenGL. Unfortunately I haven't found a way around this one, but OpenGL causes all SDL2 windows to fail to initialize from the console - they do work if launched from within X11, but not with xinit.
@midwan
install the SDL2 package from the RetroPie repo, as per the instructions in the Amiberry SDL2 readme
Legend 👍 thanks: https://github.com/midwan/amiberry/blob/sdl2/README.md
Different errors:
error: XDG_RUNTIME_DIR not set in the environment.
INFO: SDL could not initialize! SDL_Error: No available video device
#Upgrade to RPi kernel (required for libraspberrypi-dev update through apt due to package dep/version on held packages)
apt-mark unhold raspberrypi-bootloader raspberrypi-kernel
apt-get upgrade -y
apt-get install git build-essential -y git clone https://github.com/RetroPie/RetroPie-Setup --depth=1 cd RetroPie-Setup ./retropie_packages.sh sdl2
apt-get install -y libsdl2-image-dev libsdl2-ttf-dev
apt-get install -y libxml2-dev libflac-dev libmpg123-dev libpng-dev google-perftools libgoogle-perftools-dev
root@DietPi:~# ./amiberry-sdl2 Amiberry-SDL2 by Dimitris (MiDWaN) Panokostas INFO: SDL could not initialize! SDL_Error: Internal error; file src/main.cpp, line 991 Aborted
- 🈴 4.9 kernel
root@DietPi:~# ./amiberry-sdl2 Amiberry-SDL2 by Dimitris (MiDWaN) Panokostas INFO: SDL could not initialize! SDL_Error: Internal error; file src/main.cpp, line 991 Aborted
root@DietPi:~# dpkg -l | grep sdl2 ii libsdl2-2.0-0:armhf 2.0.5+5rpi armhf Simple DirectMedia Layer hi libsdl2-dev:armhf 2.0.5+5rpi armhf Simple DirectMedia Layer development files ii libsdl2-image-2.0-0:armhf 2.0.0+dfsg-3+b1 armhf Image loading library for Simple DirectMedia Layer 2, libraries ii libsdl2-image-dev:armhf 2.0.0+dfsg-3+b1 armhf Image loading library for Simple DirectMedia Layer 2, development files ii libsdl2-ttf-2.0-0:armhf 2.0.12+dfsg1-2 armhf TrueType Font library for Simple DirectMedia Layer 2, libraries ii libsdl2-ttf-dev:armhf 2.0.12+dfsg1-2 armhf TrueType Font library for Simple DirectMedia Layer 2, development files
Note to self:
uae4arm
references with amiberry
, due to name/dir changes for install (/etc/amiberry
)@midwan
Finally sussed it, my original SDL2 compiles were fine. User error forgetting to increase GPU mem split lol 😭 .
x2/3 framerate with SDL 2 (Elite / Indy 500), great work, smooth as a baby's bum 👍
SDL1 + SDL2 dual installs are compatible.
AmiBerry SDL2 compile:
#Pre-Reqs
apt-get install -y \
git build-essential \
libgl1-mesa-dev libegl1-mesa-dev \
libxml2-dev libflac-dev libmpg123-dev libpng-dev google-perftools libgoogle-perftools-dev
#Install DietPi compiled SDL2 debs
wget http://dietpi.com/downloads/binaries/rpi/sdl2_rpi.7z -O package.7z
7z x -y package.7z -osdl2_rpi
rm package.7z
dpkg -i sdl2_rpi/no_opengl_x11/*.deb
rm -R sdl2_rpi
#AmiBerry
git clone https://github.com/midwan/amiberry -b sdl2 amiberry-sdl2 --depth=1
cd amiberry-sdl2
# - RPi3
make -j $(nproc --all) all; mv amiberry-sdl2 /root/amiberry-rpi3-sdl2
# - RPi2
make clean; make -j $(nproc --all) all PLATFORM=rpi2; mv amiberry-sdl2 /root/amiberry-rpi2-sdl2
# - RPi1 (native compile, must be on a RPi1, else, fails)
make all PLATFORM=rpi1; mv amiberry-sdl2 /root/amiberry-rpi1-sdl2
src/osdep/amiberry_gfx.cpp:95:4: error: ‘SDL_PIXELFORMAT_BGRA32’ was not declared in this scope
https://wiki.libsdl.org/SDL_PixelFormatEnum
alias for BGRA byte array of color data, for the current platform (>= SDL 2.0.5)
root@DietPi:~/amiberry-sdl2# dpkg -l | grep sdl2
ii libsdl2-dev 2.0.2+dfsg1-6 armhf
-disable-video-x11 --disable-video-opengl
RPi 1:
src/osdep/neon_helper.s:753: Error: selected processor does not support ARM mode `vst1.8 {d4,d5,d6,d7},[r0]!'
Makefile:202: recipe for target 'src/osdep/neon_helper.o' failed
@Fourdee The neon_helper is a version for newer ARM processors only, but I'm working towards phasing it out completely since I didn't see any noticeable speed improvements when using that vs C++ code optimized by the compiler.
The alternative is the "arm_helper" file from the SDL1 archive, it contains versions of the same functions for the older CPU of the Pi 1/Zero.
@midwan
The alternative is the "arm_helper" file from the SDL1 archive, it contains versions of the same functions for the older CPU of the Pi 1/Zero.
Thanks, although i have no idea how to go about achieving this, any pointers/steps? :)
Or even better, do you have a rpi1 compiled binary available you could upload? Only one i'am missing.
Notes: If SDL2 is complied with OpenGL enabled, and, OpenGL not installed:
Apr 18 10:18:52 DietPi systemd[1]: Started AmiBerry Amiga Emulator.
Apr 18 10:18:53 DietPi bash[1978]: Amiberry-SDL2 by Dimitris (MiDWaN) Panokostas
Apr 18 10:18:53 DietPi bash[1978]: Unable to create window Could not initialize OpenGL / GLES library
Either way, i've compiled both with OpenGL and X11 enable/disabled in our package: http://dietpi.com/downloads/binaries/rpi/sdl2_rpi.7z
Our installer will install non OpenGL, X11 SDL2.
SDL2 available from dietpi-autostart
:
And
systemctl start amiberry-sdl2
Weird, this just appeared, i'll add font to our zip.
root@DietPi:/etc/amiberry# ./amiberry-sdl2 -f conf/autostart.uae
Amiberry-SDL2 by Dimitris (MiDWaN) Panokostas
starting sound thread..
SDLTrueTypeFont::SDLTrueTypeFont. Couldn't open data/Topaznew.ttf
stopping sound thread..
@Fourdee It's a recent change, the font has been replaced with something more Amiga-like. The color scheme in the GUI is also updated, and I am currently working on enabling custom mapping of any key to functions like "enter GUI", "Quit" and eventually Custom Controls.
The next step will then be to allow custom mapping of any controller button to those functions as well.
Things are moving rather quickly, so I missed notifying you about this change, sorry. :)
@midwan
Aye, no worries, great to see Amiberry progress quickly 👍
We'll most likely have to stick with xinit
for this, this ensures input grab, regardless of tty. I've tried various bash/systemD options and "hacks" to control input, no joy.
@Fourdee
Forgot to mention that there are 2 more files added in the data
directory:
@midwan
2 more files added in the datadirectory:
Thanks, updated 👍
SDL2 leaks to desktop aswell. Think we may have to recompile with the patch.
but it throws a "Failed to set keyboard mode" error if we are remotely debugging an SDL2 application, and keyboard input still leaks to the console in that case. https://github.com/midwan/amiberry/issues/78#issuecomment-294785415
May replicate with the systemD service we use to launch this, i'll have to test. Yep, leaks to console, unless launched from main TTY.
xinit
using our non-RetroPie SDL2 binaries is the only solution to cover autostart and service control. Although, no usage from desktop due to leak.ToDo:
/etc/amiberry
instead of uae4arm
Completed.
@midwan I'll keep an eye on SDL2 devolpment. But if you can give me a heads up on major releases, we can roll that out to our DietPi users during updates.
Great work on SDL2, Amiberry smooth as butter now 👍
@Fourdee Thanks, of course I'll notify you of any major changes/releases. For now I'm focusing of fixing some bugs, since I wouldn't want to release something that has annoying issues.
Good work integrating this in DietPi! :)
Additional installation to SDL1 version.