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

Workaround for performance problems on video mode changes #110

Conversation

c0d3h4x0r
Copy link
Contributor

@c0d3h4x0r c0d3h4x0r commented Feb 8, 2024

Problem:

Please see MiSTer-devel/Main_MiSTer#873

Workaround:

The safest approach is to redirect MiSTer's output to /dev/null. The challenge is to make that easy, automatic, and persistent.

My solution is to move the MiSTer binary and replace it with a shell script that calls the real binary and redirects the output. The user can run redirect_mister_output_to_file.sh /dev/null for best performance and zero disk space consumption, or they can redirect output to a local log file (example: /tmp/MiSTer.log) for troubleshooting.

The script moves the original MiSTer binary to /media/fat/main/stable/MiSTer, then creates a symlink to it at /media/fat/main/MiSTer, and finally writes a shell script to /media/fat/MiSTer that calls the symlink. This structure is good for a user who switches between different stable and unstable builds. They can keep downloaded binaries organized (example: /media/fat/main/stable/MiSTer_20270606, /media/fat/main/unstable/MiSTer_unstable_20290103_7432a62) and just update the symlink to point to the one they want. The symlink makes it very clear which MiSTer build they are using.

I have used this on my MiSTer for a few months, because I wanted to make sure it didn't create any new problems or interfere with update_all.sh. When the updater downloads a new stable MiSTer binary and overwrites /media/fat/MiSTer, the user can just run redirect_mister_output_to_file.sh /dev/null again to restore the setup. If the user wants it to fix itself automatically, they can add that command /media/fat/linux/user-startup.sh so the next reboot will fix it.

@c0d3h4x0r
Copy link
Contributor Author

Someone in Discord suggested I have the redirect script default to /dev/null if no file argument is provided. I like that idea. I'd like to push that one change before this gets merged. I can get to it later today.

@rsn8887
Copy link

rsn8887 commented Feb 9, 2024

I suggested the default to /dev/null if there's no argument supplied. That way, the user can start it directly via the scripts menu, instead of manually typing in the shell.
As it is now, the user has to open the shell, and type "redirect_mister_output_to_file.sh /dev/null" instead of just launching via scripts.

@sorgelig
Copy link
Member

Moving MiSTer binary isn't a good idea at all.
stdout redirection can be integrated in binary instead. If i remember right, it's possible to redefine stdout to a file with couple lines in code.

@sorgelig sorgelig closed this Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants