Thanks @brandflake11
I got this one figured out. It was a PITA! :)
Long and short of it is this...
xrandr treats both displays and one large one (extended). You can see below that Screen 0: is recognized as 5760x1080 (4K TV + 1080P monitor):
Screen 0: minimum 320 x 200, current 5760 x 1080, maximum 16384 x 16384
VGA-1 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 800mm x 450mm
3840x2160 30.00 + 24.00 29.97 23.98
4096x2160 30.00 24.00 29.97 23.98
1920x1080 60.00* 59.94 30.00 24.00 29.97 23.98
1920x1080i 60.00 59.94
1680x1050 59.88
1280x1024 75.02 60.02
1440x900 59.90
1280x960 60.00
1280x800 59.91
1152x864 75.00
1280x720 60.00 30.00 59.94 29.97 24.00 23.98
1024x768 75.03 70.07 60.00
800x600 72.19 75.00 60.32
720x480 60.00 59.94
720x480i 60.00 59.94
640x480 75.00 72.81 60.00 59.94
720x400 70.08
DP-2 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 509mm x 286mm
1920x1080 60.00*+ 50.00 59.94
1920x1080i 60.00 50.00 59.94
1680x1050 59.88
1280x1024 60.02
1440x900 59.90
1280x800 59.91
1152x864 75.00
1280x720 60.00 50.00 59.94
1024x768 70.07 60.00
800x600 60.32 56.25
720x576 50.00
720x480 60.00 59.94
640x480 66.67 60.00 59.95 59.94
720x400 70.08
HDMI-2 disconnected (normal left inverted right x axis y axis)
This is what my autostart.sh file looks like:
#! /bin/bash
#set primary display and resolution.
xrandr --display :0 --output HDMI-1 --mode 1920x1080 --primary &
#call cvlc to play a startup animation. Wait for it to end before continuing.
cvlc --random --play-and-stop --play-and-exit --fullscreen --video-on-top --no-video-title-show --quiet --gl=any --preferred-resolution=1080 ~/RetroPie/splashscreens &> /dev/null
#start ES in a terminal (openbox).
gnome-terminal --full-screen --hide-menubar -- emulationstation --no-splash
Naturally, feh sees the display the same way so you need to use the --geometry switch to identify the starting pixel on the 2nd monitor. This is what my runcommand-onstart.sh looks like:
#! /bin/bash
ROMPATH="$3"
ROM_BN_EXT="${ROMPATH##*/}"
ROM_BN="${ROM_BN_EXT%.*}"
CONTROLSIMAGE="/home/pi/RetroPie/roms/$1/images/$ROM_BN-controls.png"
feh --geometry +3840+0 "$CONTROLSIMAGE" &>/dev/null &
This essentially gets the full path to the romfile and trims the extension to get the rom base name.
It then builds the path to the controls image I need and displays at the starting position I tell it to (3840x0) which is the entire screen of the 2nd monitor. When I exit the game, and merely kill feh via runcommand-onend.sh:
#! /bin/bash
killall feh &
This is working perfectly. Now I just need to find a fancy graphic to display on the 2nd monitor when it isn't showing controls. :)
John