Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using VLC for splashscreen #3674

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

joolswills
Copy link
Member

@joolswills joolswills commented Mar 8, 2023

Here is a possible solution for splashscreen support that works on bullseye.

omxiv / omxplayer only works on the Raspberry Pi legacy and fkms drivers.

This change switches to vlc for both utilities, as it supports mmal output on the Raspberry Pi legacy drivers, and drm output on KMS on Raspberry Pi OS (on bullseye).

This change includes stopping vlc before launching ES on kms as ES will fail to open the display otherwise. Maybe we should introduce an option to "wait" for vlc to finish before we start ES. May be useful for video splashes etc.

From my testing:

On Buster:

RPI3

Legacy Driver (default config)

  • omxiv - ES displays over splashscreen
  • vlc - ES displays over splashscreen

FKMS

  • omxiv - ES displays under splashscreen
  • vlc - ES displays under splashscreen (mmal_vout)

KMS

  • omxiv - no output (no openmax)
  • vlc - no output (version in Buster doesn't have drm support)

RPI4

FKMS (default config)

  • omxiv - ES displays under splashscreen
  • vlc - ES displays under splashscreen

KMS

  • omxiv - no output
  • vlc - no output

On Bullseye:

RPI3/RPI4

KMS

  • omxiv - not available
  • vlc - uses drm_vout - need to stop VLC before ES launches or it will fail

Copy link
Contributor

@cmitu cmitu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've looked over the changes and generally they're working fine. I left a few comments in the code where I think changes may be necessary (though they're not comprehensive).

During testing, I noticed a few things that may need to be addressed:

  1. Pi4, KMS, 'bullseye'

    • during preview and service startup, an error is logged about XDG_RUNTIME_DIR not being present:

        error: XDG_RUNTIME_DIR not set in the environment.
        error: XDG_RUNTIME_DIR not set in the environment.
      

      This seems to be triggered by some gstreamer plugin and couldn't find a vlc parameter to disable it. Seems to be similar to the issue noticed in the audiosettings module, when running pulseaudio commands via sudo. The fix can be similar (i.e. just set XDG_RUNTIME_DIR), though for the preview part, using sudo -E also quiesces the error.

    • the effective splash time is like 2sec on my system. Basically vlc starts about the same time as the auto-login code runs, barely showing anything on the screen.

  2. Pi3, OMX, 'buster' (upgraded from current splashscreen).

    • the splashscreen is obscured by ES's startup. Just like omxplayer/omxiv before, it requires an 'upper' layer ID to run. This can be fixed with the --mmal-layer 10000 parameter.
  3. General

    • there may be some options for vlc to start-up faster that we may want to add: --disable-dbus, --disable-config, --no-media-library (vlc saves some info on exit to '$HOME/.local/share/vlc/without it),--no-lua(no LUA scripts are searched in$HOME/.local/share/vlc/lua` or in the install folders). There may not be so important, on my USB (Pi4) the start-up is fast enough.
    • the omxiv should not be installed if vlc takes over.

scriptmodules/supplementary/splashscreen.sh Outdated Show resolved Hide resolved
scriptmodules/supplementary/splashscreen/asplashscreen.sh Outdated Show resolved Hide resolved
@gizmo98
Copy link
Member

gizmo98 commented Mar 12, 2023

Isn‘t mpv the better player for the task? Console player. More lightweight, no GUI. Uses ffmpeg as well. Can use drm output as well.

mpv -vo gpu --gpu-context=drm

@joolswills
Copy link
Member Author

This seems to be triggered by some `gstreamer` plugin and couldn't find a `vlc` parameter to disable it. Seems to be similar to the issue noticed in the `audiosettings` module, when running `pulseaudio` commands via `sudo`. The fix can be similar (i.e. just set `XDG_RUNTIME_DIR`), though for the preview part, using `sudo -E` also quiesces the error.
  • the effective splash time is like 2sec on my system. Basically vlc starts about the same time as the auto-login code runs, barely showing anything on the screen.

Yes - the short time isn't ideal. But at least it technically works.

  • Pi3, OMX, 'buster' (upgraded from current splashscreen).

    • the splashscreen is obscured by ES's startup. Just like omxplayer/omxiv before, it requires an 'upper' layer ID to run. This can be fixed with the --mmal-layer 10000 parameter.

This didn't work when I tried but maybe I missed something. Will re-test.

  • there may be some options for vlc to start-up faster that we may want to add: --disable-dbus, --disable-config, --no-media-library (vlc saves some info on exit to '$HOME/.local/share/vlc/without it),--no-lua(no LUA scripts are searched in$HOME/.local/share/vlc/lua` or in the install folders). There may not be so important, on my USB (Pi4) the start-up is fast enough.

I will try these thanks.

  • the omxiv should not be installed if vlc takes over.

I thought I disabled the installation, but perhaps not. But will check all that.

@joolswills
Copy link
Member Author

Isn‘t mpv the better player for the task? Console player. More lightweight, no GUI. Uses ffmpeg as well. Can use drm output as well.

I don't know - I didn't try this. I can take a look and see if it's a better fit (Feel free to test / compare).

mpv -vo gpu --gpu-context=drm

@joolswills
Copy link
Member Author

Thanks for the feedback.

@cmitu
Copy link
Contributor

cmitu commented Mar 13, 2023

  • Pi3, OMX, 'buster' (upgraded from current splashscreen).

    • the splashscreen is obscured by ES's startup. Just like omxplayer/omxiv before, it requires an 'upper' layer ID to run. This can be fixed with the --mmal-layer 10000 parameter.

This didn't work when I tried but maybe I missed something. Will re-test.

It should work (tested it), but use a number over 10000.
SDL RPI video driver runs at 10000.

https://github.com/libsdl-org/SDL/blob/d5b5e524af010d51437470255d5ac848996eeabd/src/video/raspberry/SDL_rpivideo.h#L53-L55

omxplayer in EmulationStation uses 10010 just to make sure it's overlayed properly:

https://github.com/cmitu/EmulationStation/blob/b99e8c21bab4d7bba564f6c7894566dfc60d000f/es-core/src/components/VideoPlayerComponent.cpp#L159-L162

@gizmo98
Copy link
Member

gizmo98 commented Mar 14, 2023

@joolswills will the new splashscreen logic only be installed if there is no /opt/retropie/supplementary/splashscreen dir?

if [[ ! -d "$md_inst" ]]; then

I added mpv to asplashscreen.sh and was wondering why /opt/retropie/supplementary/splashscreen/asplashscreen was not updated.

@gizmo98
Copy link
Member

gizmo98 commented Mar 14, 2023

Vlc works fine under bullseye with a pi4. Mpv works as well but it is not faster or slower. Mpv runs with „mpv —vo=gpu —gpu-context=drm —drm-connector=1.HDMI-A-1 —image-display-duration=6 —hwdec=v4l2m2m-copy“

@joolswills
Copy link
Member Author

@joolswills will the new splashscreen logic only be installed if there is no /opt/retropie/supplementary/splashscreen dir?

if [[ ! -d "$md_inst" ]]; then

Actually that check can probably be removed - it dates back to before the splashscreen was an installable module (and the package update mechanisms). So it would install the splashscreen dependencies when the configuration was accessed. Now the configuration is only available when it's installed

I added mpv to asplashscreen.sh and was wondering why /opt/retropie/supplementary/splashscreen/asplashscreen was not updated.

Did you update the splashscreen module first ? eg. via sudo ./retropie_packages.sh splashscreen or via retropie-setup.

@gizmo98
Copy link
Member

gizmo98 commented Mar 15, 2023

@joolswills will the new splashscreen logic only be installed if there is no /opt/retropie/supplementary/splashscreen dir?

if [[ ! -d "$md_inst" ]]; then

Actually that check can probably be removed - it dates back to before the splashscreen was an installable module (and the package update mechanisms). So it would install the splashscreen dependencies when the configuration was accessed. Now the configuration is only available when it's installed

I added mpv to asplashscreen.sh and was wondering why /opt/retropie/supplementary/splashscreen/asplashscreen was not updated.

Did you update the splashscreen module first ? eg. via sudo ./retropie_packages.sh splashscreen or via retropie-setup.

Via retropie_setup.sh.

@joolswills
Copy link
Member Author

Via retropie_setup.sh.

Please can you be more specific - You went to "Manage Packages" -> Main Packages -> splashscreen and did update ? That should be enough but if you think something isn't working please provide a log or how to reproduce it and I will check.

@gizmo98
Copy link
Member

gizmo98 commented Mar 15, 2023

Via retropie_setup.sh.

Please can you be more specific - You went to "Manage Packages" -> Main Packages -> splashscreen and did update ? That should be enough but if you think something isn't working please provide a log or how to reproduce it and I will check.

I went to „Configuration / tools“/„Splashscreen“ and selected and tested some splashscreens. No module update.

@joolswills
Copy link
Member Author

joolswills commented Mar 15, 2023

I went to „Configuration / tools“/„Splashscreen“ and selected and tested some splashscreens. No module update.

You need to update first. For end users this is handled automatically by the _update_hook if they just update RetroPie-Setup script. Easiest way when testing like this is to just update from the commandline.

function _update_hook_splashscreen() {
# make sure splashscreen is always up to date if updating just RetroPie-Setup
if rp_isInstalled "$md_id"; then
install_bin_splashscreen
configure_splashscreen
fi
}

I will remove the following code block at the start of the gui_splashscreen function.

if [[ ! -d "$md_inst" ]]; then
rp_callModule splashscreen depends
rp_callModule splashscreen install
fi

@joolswills joolswills force-pushed the vlc_splashscreen branch 5 times, most recently from dacdf63 to 19fb9e5 Compare July 1, 2023 18:06
@joolswills joolswills marked this pull request as ready for review September 18, 2023 17:20
omxiv / omxplayer only works on the Raspberry Pi legacy and fkms drivers.

This change switches to vlc for both utilities, as it supports mmal output on the Raspberry Pi legacy drivers, and drm output on KMS on Raspberry Pi OS (bullseye).

Remove dependencies for omxplayer / omxiv

Switch code to use vlc.

Run asplashscreen as $user (not root).

Remove wait for dbus (no longer needed)

Save vlc pid and Exit vlc before launching emulationstation on KMS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants