Retropie - How to add two custom HDMI video modes?
-
@renepela Someone who knows a little more might need to chime in. I know that how runcommand polls available video modes is different on the pi 4, it lists all available refresh rates for any given resolution. I cant remember exactly how runcommand works on the pi 3.
-
@renepela said in Retropie - How to add two custom HDMI video modes?:
So what I want is add a 1024x600 60 Hz option (DMT-87) and and a 1024x600 50 Hz option (DMT-88?)
You can't, DMT-87 is the single 'custom mode' allowed by the firmware, there's no
DMT-88
.But how do I add another one using the runcommand menu? I simply want a 1024x600 50Hz and 60Hz option to choose from.
Are the video modes detected by the firmware ? Runcommand will show the supported video modes, as detected from the monitor/TV. What's the output of
tvservice -s
? -
tvservice -s gives the following output:
state 0x1200a [HDMI DMT (87) RGB full 15:9], 1024x600 @ 60.00Hz, progressiveHowever when I change my config.txt I can also make it 50.00Hz, so tvservice -s simply shows what I configured in config.txt
Is there no way to change my refresh rate using the command line? Or is it possible to put the lines from config.txt in some other config file I can use before running my emulator or is config.txt the only place I can configure the DMT-87 custom video mode?
-
state 0x1200a [HDMI DMT (87) RGB full 15:9], 1024x600 @ 60.00Hz, progressive
That's because you've explicitly set-up your display with this single resolution. What does it say if you're not configuring it in
config.txt
? Does it detect the available video modes ?Or is it possible to put the lines from config.txt in some other config file I can use before running my emulator or is config.txt the only place I can configure the DMT-87 custom video mode?
Similar to
config.txt
settings, you can dynamically add (at runtime) a new video mode (withvcgencmd
) - it will simply be available asDMT-87
- to which you can switch by usingtvservice
.See https://github.com/raspberrypi/firmware/issues/637#issuecomment-237868061 for the syntax of the command. Curiously, this isn't in the main RPI video documentation.
-
@mitu I'm getting close. I can create the video mode using the command: vcgencmd hdmi_cvt 1024 600 50 6 0 0 0
But after creating it, how do I swich to it. You say tvservice is the command to use, but how? -
@renepela said in Retropie - How to add two custom HDMI video modes?:
You say tvservice is the command to use, but how?
Read again the link I posted, it shows the exact command to execute.
-
Yes, I got it now. So I'm able to set my DMT 87 by the command line. All I now have to figure out is how to run these commands before the emulator starts to put it at 50 Hz and once I leave the emulator make it go back to 60 hz. Is it possible to do this using runcommand? Or do I have to add the lines to the startup script for each emulator?
-
You can create your own
runcommand
custom scripts to run before and after the emulator is started using theonstart
andonend
script support - https://retropie.org.uk/docs/Runcommand/#runcommand-onstart-and-runcommand-onend-scripts.On the start script you can see which system you're emulating and decide to switch the video mode, on the end script you could switch back to the default video mode.
-
Thank you so much for all your help. I'm getting closer and closer to what I want.
I created the following runcommand-onstart.sh script:#!/usr/bin/env bash
system="$1"
emulator="$2"if [[ "$emulator" == "lr-vice" ]]; then
vcgencmd hdmi_cvt 1024 600 50 6 0 0 0 &
tvservice -e "DMT 87" &
fbset -depth 8 && fbset -depth 16 &
fiIt's almost doing what I want. It does indeed put DMT mode 87 at 50 Hz and it even works when I run the lr-vice C64 emulator. However during start it no longer shows the text messages. The screen is blank. Once the emulator is started it works fine.
It looks like the fbset -depth 8 && fbset -depth 16 & line is not working. I think I made a mistake, but can;t figure out what. Looks like I'm running a command from a script in the wrong way. -
@renepela said in Retropie - How to add two custom HDMI video modes?:
It's almost doing what I want. It does indeed put DMT
I fixed it! Everything is working exactly the way I want.
runcommand-onstart.sh script now looks like this:
#!/usr/bin/env bash system="$1" emulator="$2" if [[ "$emulator" == "lr-vice" ]]; then vcgencmd hdmi_cvt 1024 600 50 6 0 0 0 tvservice -e "DMT 87" sleep 1 fbset -depth 8 && fbset -depth 16 fi
The runcommand-onend.sh script looks like this:
#!/usr/bin/env bash vcgencmd hdmi_cvt 1024 600 60 6 0 0 0 tvservice -e "DMT 87" sleep 1 fbset -depth 8 && fbset -depth 16
So the last problem was just a timing issue. I added a sleep 1 and now it works fine.
For every emulator I want 50 Hz I just copy the if block and use another emulator name.Thank you very, very, very(!) musch for all the help.
-
Glad it worked out !
NOTE: I added some code blocks around the scripts code so it's easier to see and (maybe) copy&paste for future users. -
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.