mickelson / attract

A graphical front-end for command line emulators that hides the underlying operating system and is intended to be controlled with a joystick or gamepad.
http://attractmode.org
GNU General Public License v3.0
393 stars 115 forks source link

Attract Mode not working on Raspberry Pi 4 #575

Closed chunksin closed 1 year ago

chunksin commented 5 years ago

Attract Mode compiles but will not run on the new Raspberry Pi 4 - I suspect this is due to the new videocore - are there compile flags we can use to get this working or will it need to be recoded for the new hardware?

mickelson commented 5 years ago

Are you linking to regular sfml or ‘sfml-pi’?

I think the pi 4 supports regular opengl now, so you could try building and linking to regular sfml and see if that works ... you would not use the ‘USE_GLES’ flag when compiling attractmode, and you would need to have x11 running.

On Jul 3, 2019, at 5:14 AM, chunksin notifications@github.com wrote:

Attract Mode compiles but will not run on the new Raspberry Pi 4 - I suspect this is due to the new videocore - are there compile flags we can use to get this working or will it need to be recoded for the new hardware?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

kwyxz commented 5 years ago

Linking to sfml-pi using the old method (hence linking with the libs in /opt/vc/) ends up with this:

pi@pi4:~ $ attract
* failed to add service - already in use?

Using the packaged sfml, attract is asking for X11.

Running X11 sure is a solution, but it's a lot of CPU / GPU power wasted as it would be real nice to be able to run Attract-mode directly from KMS like before.

kwyxz commented 4 years ago

Just saw Attract-Mode was updated to 2.6.0 @chunksin does it fix your issue?

kwyxz commented 4 years ago

Welp unfortunately, I am still getting the same message even with latest Git version of Attract-Mode

pi@pi4:~ $ attract
* failed to add service - already in use?
iOtero55 commented 4 years ago

I'm in the same situation...

chunksin commented 4 years ago

Confirmed working for me in X11 but not from the frame buffer

joyrider3774 commented 4 years ago

if drm / kms support is used / implemented in sfml-pi (if at all possible) is that enough for running attract outside of X11 ? i've seen sample codes kmscube or others on github that run on my pi when using /dev/dri/card1 (card0 does not produce output in samples i tried). Unfortunatly i'm no linux dev expert and have no idea how hard it would be to get this working als don't know if adding it to sfml-pi is enough to get it working outside X11

alinke commented 4 years ago

getting the same error, anyone have a fix to compile attract yet on Pi 4? I make a LED marquee called Pixelcade https://youtu.be/WizU4eX6M5A?t=539, have quite a few Pi 4 customers requesting Attract Mode support so would like to take the project up, just hoping it can compile on a Pi 4 and then I can make the needed mods to integration with the marquee , thanks

kwyxz commented 4 years ago

I believe an update to SFML is necessary. Until then Attract-Mode won't work under DRM/KMS on the Pi4.

I ended up giving up and built Attract-Mode under X11. The Pi4 is more than capable and the performance loss is manageable, even though it brings other challenges (sometimes when it starts, Attract Mode doesn't have mouse focus which is quite problematic on a system with no mouse)

alinke commented 4 years ago

thanks much @kwyxz ! will try on X11. Have not built under X11 before, if you have any instructions on how to do that, would be helpful.

kwyxz commented 4 years ago

As far as I can remember, there's nothing specific to do as long as the X11 development packages from Raspbian are installed. You can even use libsfml-dev from Raspbian. The build process should find the proper headers and build a X11-enabled Attract-mode.

alinke commented 4 years ago

Got it @kwyxz , thx much !

kwyxz commented 4 years ago

You're welcome, hope you get it to work. In order to minimize the desktop environment impact, I switched from whatever is installed by default to i3 and I run attract automatically from its startup file. As I said I sometimes suffer from mouse cursor issues and attract-mode cannot capture the focus, and sometimes not, it's random. Also, the PixelCade LED marquee looks AMAZING!! Any chance this could be adapted to a Picade? That is what I plugged my Pi4 to.

alinke commented 4 years ago

Will try this out tonight and report back , thx again ! For Pixelcade , it can do one led panel too for bartops , here is one I did https://youtu.be/krdcABgy68A . For Pi Cade , can you send me the dimensions of the marquee spot and I will check , send to al@ledpixelart.com . I still need to mod attract mode and add in the hooks for Pixelcade which are just rest api calls triggered when attract mode selects a game (screen saver events too if possible). I have this working for EmulationStation , having the same compile problem there too , am hoping this fix will also take care of that.

oomek commented 4 years ago

Hi, I see a lot of interest of running AM under DRM recently, so I've been thinking about what would be the best approach to that. There are 3 paths:

  1. Suggest a DRM backend addition to SFML devs (Which I have already done, sadly Laurent the main dev wasn't even aware of its existence and did not say if he's interested)
  2. Adding it myself and propose a pull request to SFML
  3. Move to managing DRM window creation inside AM, a bit messy, but the only path that gives us full control.

Currently I'm occupied by other projects, anyway, I doubt it's a one man job, I would need some helping hand. Anyway with the DRM window and GLES 2.0 context and through MESA's OpenGL driver we would have finally shaders working on the RPI, so the outcome would be quite rewarding.

chase-cobb commented 4 years ago

I just added a page to the wiki with the build process I followed to get a working build in Buster.

alinke commented 4 years ago

thanks Chase, I tried that on the latest RetroPie Pi 4 image that was released a few days ago. It compiles but then errors out when launching X. I didn't try though on Raspian, will give that a shot too. As RetroPie doesn't have X, I also did

sudo apt-get install xinit xinit attract

This process did work for me through on the RetroPie Pi 4 image https://forum.odroid.com/viewtopic.php?t=18283

chase-cobb commented 4 years ago

thanks Chase, I tried that on the latest RetroPie Pi 4 image that was released a few days ago. It compiles but then errors out when launching X. I didn't try though on Raspian, will give that a shot too. As RetroPie doesn't have X, I also did

sudo apt-get install xinit xinit attract

This process did work for me through on the RetroPie Pi 4 image https://forum.odroid.com/viewtopic.php?t=18283

Thanks for the link.

I can only validate that the method I outlined worked for me on Raspbian Buster. Haven't tried it personally on any other distros or permutations.

joyrider3774 commented 4 years ago

'xinit attract' did not work for me. Well it is to say it did start attract but i'm having focus issues and advmame did not work (no keyboard input working). I also used apt to install xinit (not sure if i installed something else) then used & installed fluxbox as window manager created a startup script to start attract & set background black using 'xterm -e attract' also edited xterm app settings to show always maximized and without window decorations i also added a 'killall Xorg' command so that when i exit attract X is closed and i end up outside x. it's working fine now for me also in advmame (input is working) now and can't say i have noticed focus issues yet but have not tested much still need to test other emulators

It's a workaround but having a KMS backend for sfml pi would be nicer

chase-cobb commented 4 years ago

'xinit attract' did not work for me. Well it is to say it did start attract but i'm having focus issues and advmame did not work (no keyboard input working). I also used apt to install xinit (not sure if i installed something else) then used & installed fluxbox as window manager created a startup script to start attract & set background black using 'xterm -e attract' also edited xterm app settings to show always maximized and without window decorations i also added a 'killall Xorg' command so that when i exit attract X is closed and i end up outside x. it's working fine now for me also in advmame (input is working) now and can't say i have noticed focus issues yet but have not tested much still need to test other emulators

It's a workaround but having a KMS backend for sfml pi would be nicer

Your suggestion is a workaround for not running a X11 environment, but that's not what this ticket is for. Using the instructions I provided, Attract Mode does work on Raspberry Pi 4. Which should help resolve this specific issue.

What you're asking for are new features and should probably be it's own ticket.

joyrider3774 commented 4 years ago

i know that it compiles like that, i have done it in the past already, and recently did it again. Was just saying that running "xinit attract" will show attract but you can end up with "usuability problems" one such example is mouse fouces if the default window manager is used (twm). Another problem i alreay encoutered is using advmame and twm user input from keyboards is not working then but probably also a focus issue. Thats why i used fluxbox window manager with a few extra's. Was just saying it to give a headsup that you might encounter problems running it like that.

Suggestion was long time ago made already in sfml-pi repo. Only mentioned that i'm using that workaround until the feature might be implemented.

kwyxz commented 4 years ago

Your suggestion is a workaround for not running a X11 environment, but that's not what this ticket is for. Using the instructions I provided, Attract Mode does work on Raspberry Pi 4. Which should help resolve this specific issue.

It's unclear because of the wording of the issue title. Building and running with X11 has always worked. Looking at what the OP wrote, he was definitely trying to run attract-mode without X11. Maybe @chunksin could update the issue title to reflect this.

chase-cobb commented 4 years ago

Your suggestion is a workaround for not running a X11 environment, but that's not what this ticket is for. Using the instructions I provided, Attract Mode does work on Raspberry Pi 4. Which should help resolve this specific issue.

It's unclear because of the wording of the issue title. Building and running with X11 has always worked. Looking at what the OP wrote, he was definitely trying to run attract-mode without X11. Maybe @chunksin could update the issue title to reflect this.

I get what you're saying and maybe this ticket should be closed either way. The issue is moot because AM does indeed run on Raspberry Pi 4, which is the literal solution to the title of the issue, or it is an ambiguous duplicate of the other issue.

kwyxz commented 1 year ago

Same here, this can definitely be closed @mickelson

chunksin commented 1 year ago

Thanks all, attract mode working perfectly in and out of X windows on Pi 4