Retropie - How to add two custom HDMI video modes?
-
Hi All,
I built a nice small cabinet with a raspberry pi 3B+ in it. All works fine, however I can't figure out how to add two extra screen modes.
I know I can add a screen mode using config.txt and this works just fine. It shows up in retropie as DMT-87.
But.... I want to add two extra video modes. Not just one.My screen is a 1024x600 screen that can do 50Hz and 60Hz refresh rates. Some emulators (like mame) work best with 60Hz refresh rate, however other emulators (like vice and amiberry) work better with 50 Hz.
So what I want is add a 1024x600 60 Hz option (DMT-87) and and a 1024x600 50 Hz option (DMT-88?) so I can pick the one with the correct refresh rate for each emulator.
How can I do this? So far it seems I can only add one extra video mode. Not two.Regards,
Rene
-
@renepela This should be possible via the runcommand menu
-
Can you explain this a little more please? In the runcommand menu I can see my DMT-87 mode which I added in config.txt. But how do I add another one using the runcommand menu? I simply want a 1024x600 50Hz and 60Hz option to choose from.
I'm probably stupid, but just can't figure it out. -
@renepela Runcommand should list all available display modes for your given display. Does it not show different options for refresh rate?
-
@quicksilverBesides the default display modes (1-86) which does not contain 1024x600 resolutions, I only see 1024x600 at 60 Hz as DMT-87, which I added myself in config.txt. So no 50Hz mode. There are a few 50Hz modes in the DMT modes lower than 87, but then the resolution is all wrong.
I can edit config.txt to get 1024x600 at 50Hz and it works just fine (so my display supports it), but it replaces DMT-87 with 1024x600 at 50Hz, so now 60 Hz is gone. I want both, not just one of them. Is there really no way to add a custom DMT-87 1024x600 60 Hz and a DMT-88 mode with 1024x600 50Hz?
Or is there some command line option to set it at 50Hz which I can run when the emulator starts? -
@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.