Fixed / Improved SDL library packages


14 posts
by exobuzz » Thu Feb 12, 2015 7:38 am
Hi,

here is an updated SDL1.x for the PI:

http://malus.exotica.org.uk/~buzz/pi/sdl/sdl1/

(debian packages in deb / debian source packages in deb-src, patches over the wheezy sdl in patches)

it overwrites the wheezy sdl, and offers a fixed up framebuffer output + optional updated dispmanx support. Usually with SDL1 you can switch the videodriver with the env variable SDL_VIDEODRIVER, but so we don't affect SDL2, I have changed this to SDL1_VIDEODRIVER

export SDL1_VIDEODRIVER="fbcon"

will use the framebuffer for output (with rpi fixes from pssc)

export SDL1_VIDEODRIVER="dispmanx"

will use dispmanx for output. Code is based on work done by vanfanel (thanks).

Info:

Recently with a new rpi firmware update, SDL1.x got more unreliable, due to bugs in the way it makes assumptions regarding memory locations. This caused it to produce a black screen for many programs. You can read about the problem here - https://github.com/raspberrypi/firmware/issues/354 - Luckily someone called pssc had already fixed the main issue as part of their squeezeplay work, and so I incorporated the fix into an updated SDL package.

I then decided it would be nice to have dispmanx output in the library, saving having multiple SDLs lying around built with different options (since the dispmanx sdl didn't play nicely with everything), and so had a look at https://github.com/vanfanel/SDL12-kms-dispmanx .

I stripped it down, removed a lot of code I didn't think was needed, and made some improvements - such as fixing a crash for me with advmame + sdl (and other code that called SDL_GetVideoInfo/ListModes), rewriting the scaling code, removing an exit(0), fixing a double free issue, de-duplicating it by making it share the SDL input/video headers, and some other bits. it's possible I removed stuff that was put in for a reason too, as the comments were hard to follow being in Spanish :), but hopefully the changes make sense, and it does work from my testing so far with advmame, dosbox, dgen, scummvm and a few other programs.

Please do try it and let me know how you get on.

I also have some Raspbian packages for SDL2 - http://malus.exotica.org.uk/~buzz/pi/sdl/sdl2/ if that is useful to anyone.

All this work was done as part of / for the retropie project - http://blog.petrockblock.com/retropie/

[edit] found a few things in the dispmanx code that I need to revisit, but would still be useful if people can test. the framebuffer side of things should still be an improvement over the wheezy sdl, whether the dispmanx code is used or not. Thanks.
Posts: 134
Joined: Mon Nov 26, 2012 6:58 pm
by AmigaGamer » Thu Feb 12, 2015 10:37 pm
SDL 1.2 problems on the PI for me have been by far the biggest annoyance in working with games/emulators for as long as ive been here. I spent countless hours wondering what i was doing wrong when compiling/running apps and getting blackscreens, forcing me to hard reset!

It was only after discovering Vanfanels dispmanx build many of my problems were solved, but was constantly switching between libraries for stuff calling GetVideoInfo() , eg Hatari ST emulator

Looking forward to trying this, thanks for your work in putting this together Exobuzz, vanfanel, pssc
Posts: 90
Joined: Sat Feb 01, 2014 9:02 pm
by AmigaGamer » Fri Feb 13, 2015 12:40 am
Briefly tested and working (dispmanx) with the following.

Fuse (spectrum) 1.1.1
Hatari-1.8.0 (atariST) 1.8.0
Vice 2.4.16 (c64)

I built these from source last week against standard raspberry SDL. Without recompiling im able to get full size with the new SDL libs using export SDL1_VIDEODRIVER="dispmanx" . however they are "bordered" on the sides, but i guess this is through preserving aspect ratio.

Very cool

Edit: WELCOME AVATAR!
fixes blackscreen bug with Exult (ultima 7 engine) introduced with new firmwares. My original guide to setup is here viewtopic.php?f=78&t=77185&p=550492&hilit=exult#p550492
Posts: 90
Joined: Sat Feb 01, 2014 9:02 pm
by exobuzz » Fri Feb 13, 2015 12:51 am
Yeh it preserves aspect ratio - there is the same option as with vanfanel's dispmanx sdl to disable that if needed (SDL_DISPMANX_IGNORE_RATIO). The default is to maintain ratio, but it's a little different in the way it does it from the previous code. I may also add a config to make it more lax, so it can scale, but have a percentage "inaccuracy" so it could fill more of the screen. Possible a zoom mode too.

I just uploaded some new debs to http://malus.exotica.org.uk/~buzz/pi/sdl/sdl1/deb/

They should fix uae4all and anything else that changes screen mode etc.

Please could you test them again - appreciate your help :)
Posts: 134
Joined: Mon Nov 26, 2012 6:58 pm
by AmigaGamer » Fri Feb 13, 2015 1:01 am
switching between menu/emu great on uae4all2 dispmanx now thanks

also tested
Code: Select all
export SDL_DISPMANX_IGNORE_RATIO=1
, initial tests working perfectly too.

fbcon still black screen for me on uae menu (not like ill ever use it :lol: )
Posts: 90
Joined: Sat Feb 01, 2014 9:02 pm
by exobuzz » Fri Feb 13, 2015 1:07 am
Not that it matters since the dispmanx output works, but are you on the latest firmware/kernel ? Just wondering what might be different about our systems.

I'm currently testing on a pi2 also.

I'll upload some pi2 optimised debs to the url above in case anyone else wants to try them.
Posts: 134
Joined: Mon Nov 26, 2012 6:58 pm
by AmigaGamer » Fri Feb 13, 2015 12:03 pm
using kernel 20150212-1 from raspbian.

still no luck with fbcon and the guichan menu with default tv res 1360x768.
also tried 720p hdmi_group=1 hdmi_mode=19 same problem.
Just blanks the screen i cant even switch with CTRL-ALT-Fx

maybe updating or recompiling libguichan libguichan-sdl against the new SDL build would help.

Anyways.. most importantly out of all the stuff ive tested with fbcon - its only this one menu thats not working.
I cant see any reason or benefit to use fbcon with uae4all (unless you like half screen amiga emulation!)
Was just investigating out of curiosity.

Also been trying your RPI2 compiled sdl libs this morning... working fine ... might want to rename them to avoid confusion though libsdl1.2debian_1.2.15-8rpi2_armhf.deb (unless that upsets the upgrade process or dpkg list)
Posts: 90
Joined: Sat Feb 01, 2014 9:02 pm
by exobuzz » Sat Feb 14, 2015 4:46 pm
the naming is due to them being generated as part of retropie-setup, and changing the name would mean additional logic needed in the source. the pi1 optimised sdl are probably fine to use anyway - I doubt there will be any real speedup.
Posts: 134
Joined: Mon Nov 26, 2012 6:58 pm
by Higgy » Thu Feb 26, 2015 9:21 am
I hope you guys are still checking this thread what with all the other good & busy work your both doing.

I'm a learning NOOB :lol: so could you please give me some slightly more dumbed down instructions ;)

Ok, slight background and desire. I had a broken ZX Spectrum :( So I converted it into a USB keyboard 8-) . I would like to boot straight into Fuse or ZEsarUX http://sourceforge.net/projects/zesarux/. Failing that or so I can choose between emulators, its boots into a simple menu that I select 1 or 2 to run a .sh to load the required emulator.

Ok, I am at the CMD prompt. What do I type to retrieve your improved SDL package (this is on 256mb RPi v1)?

Also I don't understand where the following is typed:

Usually with SDL1 you can switch the videodriver with the env variable SDL_VIDEODRIVER, but so we don't affect SDL2, I have changed this to SDL1_VIDEODRIVER

export SDL1_VIDEODRIVER="fbcon"

will use the framebuffer for output (with rpi fixes from pssc)

export SDL1_VIDEODRIVER="dispmanx"


is it while building the emulators or in config.txt etc? Also it would it be best to set my screen for 50Hz? and a PC montior is capable of this ok?

I did try Fuse (and I think Vice) in the past and have got blackscreens. Fixing has been trial & error or using different builds without understanding the problem. Although now a lot of emulator distrubitions now have these emulators built in.

Also it sounds like I should go back and update the SDL on my Model B powered Bartop as I will get improvements?

Many thanks for your time.
Posts: 88
Joined: Sun Jun 29, 2014 7:12 pm
by PuppetHoundZ » Sat Feb 28, 2015 8:13 am
Could this be a reason why PRboom and FreedroidRPG will not play with picture when executed from terminal?

All I get in sound and no picture. I can navagate the menu of the above games to quit the applications but no picture.

Any suggestions on how to get this fixed will these improved SDL library packages fix my issue?

How would I install this in raspbian without having to install RetroPie? Can I get steps please?
Setup: (Raspbian w/o NOOBs) Raspberry Pi 2 B w/ Official Broadcom WiFi Adapter w/ 2usb ports & Various USB Drives. I use default Clock.
Use: Raspberry Pi Every day to learn Linux as desktop replacement.
Twitter: @PuppetHoundZ
User avatar
Posts: 135
Joined: Wed Jan 21, 2015 2:57 am
Location: Nevada, USA.
by exobuzz » Sat Feb 28, 2015 9:32 am
the "export" lines are typed into the terminal / console before launching whatever sdl program to switch between backends

for installation instructions try viewtopic.php?p=696874#p696874

or google for how to install debian packages with dpkg.
Posts: 134
Joined: Mon Nov 26, 2012 6:58 pm
by exobuzz » Sat Feb 28, 2015 9:33 am
PuppetHoundZ wrote:Could this be a reason why PRboom and FreedroidRPG will not play with picture when executed from terminal?


yes. See above post for install instructions.
Posts: 134
Joined: Mon Nov 26, 2012 6:58 pm
by PuppetHoundZ » Sat Feb 28, 2015 5:45 pm
exobuzz wrote:
yes. See above post for install instructions.


I read it but I don't know how to install the files. What are the install commands to install via terminal?

Never-mind found it in above post. I'm quoting it here for users to find it easier :D I've also amended a dpkg command to include sudo at the begging as it requires this to work.

For those who want full manual update of SDL libraries. For those who just want PRBoom, ScummVM, FreedroidRPG and other games to work from Raspbian Repository read the command at the very end. Read the completely to the bottom if you want to get games to work.

viewtopic.php?p=696874#p696874

exobuzz w/ amended code by puppethoundz wrote:well, the easiest way is just to install retropie from an image and you get a fully working scummvm set up ready to copy across your games.

to just install the fixed sdl - go to

http://malus.exotica.org.uk/~buzz/pi/sdl/sdl1/deb/rpi1/

and download the library and dev files (if you want to build stuff)

Code: Select all
wget http://malus.exotica.org.uk/~buzz/pi/sdl/sdl1/deb/rpi1/libsdl1.2debian_1.2.15-8rpi_armhf.deb
wget http://malus.exotica.org.uk/~buzz/pi/sdl/sdl1/deb/rpi1/libsdl1.2-dev_1.2.15-8rpi_armhf.deb



and then install with dpkg

Code: Select all
sudo dpkg -i libsdl1.2debian_1.2.15-8rpi_armhf.deb libsdl1.2-dev_1.2.15-8rpi_armhf.deb


For those who just want the games on Raspbian repo to run you don't need libsdl1.2-dev so all you need to use this command:
Code: Select all
wget http://malus.exotica.org.uk/~buzz/pi/sdl/sdl1/deb/rpi1/libsdl1.2debian_1.2.15-8rpi_armhf.deb
sudo dpkg -i libsdl1.2debian_1.2.15-8rpi_armhf.deb
Setup: (Raspbian w/o NOOBs) Raspberry Pi 2 B w/ Official Broadcom WiFi Adapter w/ 2usb ports & Various USB Drives. I use default Clock.
Use: Raspberry Pi Every day to learn Linux as desktop replacement.
Twitter: @PuppetHoundZ
User avatar
Posts: 135
Joined: Wed Jan 21, 2015 2:57 am
Location: Nevada, USA.
by PuppetHoundZ » Mon Mar 09, 2015 10:01 pm
Is this going to be integrated into the next Raspbian image? This issue affects a lot of programs.


Update: I have no idea if it has been updated but, I'll give it a try with the new raspbian dist-upgrade that was released
5/6/15.
Setup: (Raspbian w/o NOOBs) Raspberry Pi 2 B w/ Official Broadcom WiFi Adapter w/ 2usb ports & Various USB Drives. I use default Clock.
Use: Raspberry Pi Every day to learn Linux as desktop replacement.
Twitter: @PuppetHoundZ
User avatar
Posts: 135
Joined: Wed Jan 21, 2015 2:57 am
Location: Nevada, USA.