RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Retropie - How to add two custom HDMI video modes?

    Scheduled Pinned Locked Moved Help and Support
    retropiehdmivideo modeemulation
    16 Posts 3 Posters 2.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • quicksilverQ
      quicksilver @renepela
      last edited by

      @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.

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by

        @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 ?

        1 Reply Last reply Reply Quote 0
        • R
          renepela
          last edited by renepela

          tvservice -s gives the following output:
          state 0x1200a [HDMI DMT (87) RGB full 15:9], 1024x600 @ 60.00Hz, progressive

          However 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?

          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator
            last edited by

            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 (with vcgencmd) - it will simply be available as DMT-87 - to which you can switch by using tvservice.

            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.

            R 1 Reply Last reply Reply Quote 0
            • R
              renepela @mitu
              last edited by

              @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?

              mituM 1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator @renepela
                last edited by

                @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.

                1 Reply Last reply Reply Quote 0
                • R
                  renepela
                  last edited by renepela

                  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?

                  mituM 1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator @renepela
                    last edited by

                    You can create your own runcommand custom scripts to run before and after the emulator is started using the onstart and onend 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.

                    1 Reply Last reply Reply Quote 0
                    • R
                      renepela
                      last edited by

                      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 &
                      fi

                      It'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.

                      1 Reply Last reply Reply Quote 0
                      • R
                        renepela
                        last edited by mitu

                        @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.

                        1 Reply Last reply Reply Quote 0
                        • mituM
                          mitu Global Moderator
                          last edited by

                          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.

                          1 Reply Last reply Reply Quote 0
                          • M MiroKostovBG referenced this topic on
                          • First post
                            Last post

                          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.