You are not logged in.

#1 2011-03-24 23:20:43

TiZ
Member
Registered: 2009-02-27
Posts: 58

Running games on separate X server with HDMI output

Hi. I've been a long-time user of a script that runs games on a separate X server. By using it, I don't have to turn off my compositor, I don't have to worry about a resolution switch moving all of my stuff around, and I can easily switch between the game and my desktop. But now I have a laptop with an HDMI port, and I'm trying to experiment with displaying games on the TV. It works, but there are a few problems that prevent it from being an optimal experience.

All of my emulators are set to run at 1024x768, which happens to be the highest common resolution between the laptop and HDMI. The only thing though, is that while my intel-powered laptop is nice enough to use aspect scaling (it pillarboxes 4:3 resolutions), I get no such luxury in HDMI; it just fills up the whole screen. I can select 4:3 format to circumvent this, but certain games like Cave Story run at 640x480 no matter what. That works perfectly fine on the laptop, but if I set my tv to 4:3 when it's at 640x480, the game shrinks to take up only a small part of the screen.

What can I do to get a consistent, aspect scaled HDMI gaming experience? Since I run all of my games with a script, I can run any commands necessary after the second x server starts, and before the game begins.

Offline

#2 2011-03-25 12:57:43

stqn
Member
Registered: 2010-03-19
Posts: 1,191
Website

Re: Running games on separate X server with HDMI output

Have you tried xrandr? Something like:

xrandr --output HDMI1 --set "scaling mode" "Full aspect"

(Source: http://ubuntuforums.org/showthread.php?t=1400943)

Offline

#3 2011-03-25 14:16:16

TiZ
Member
Registered: 2009-02-27
Posts: 58

Re: Running games on separate X server with HDMI output

That's what I use to get aspect scaling on my laptop panel.

Doesn't work at all on HDMI.

Offline

#4 2011-03-25 17:16:26

redden0t8
Member
Registered: 2011-01-27
Posts: 42

Re: Running games on separate X server with HDMI output

Can you post or link your script?  I'm interested in using it myself tongue

Also seeing it may help people figure out what's going on.

Offline

#5 2011-03-25 18:00:13

TiZ
Member
Registered: 2009-02-27
Posts: 58

Re: Running games on separate X server with HDMI output

Okay, sure. Here it is:

#!/bin/bash
# Starts a game in a separate X server.

# YOU DID IT RONG.
if [ $# -lt 1 ]; then
    echo "Usage: gamerun <command>"
    exit 1
fi

# Define vars and stuff.
WM="xfwm4"
TMPGAME="/tmp/tmpgame.sh"
DISPLAY=:1.0

# Echo commands into the temporary script.
# Start the WM.
echo "${WM} &" > ${TMPGAME}

# Don't want the screen blanking.
echo "xset s noblank" >> ${TMPGAME}
echo "xset s off" >> ${TMPGAME}
echo "xset dpms 0 0 0" >> ${TMPGAME}
echo "xset -dpms" >> ${TMPGAME}

# Echo the actual command into the script.
echo -n "$1" >> ${TMPGAME}
if [ -n "$2" ]; then echo -n " \"$2\"" >> ${TMPGAME}; fi
if [ -n "$3" ]; then echo -n " \"$3\"" >> ${TMPGAME}; fi
if [ -n "$4" ]; then echo -n " \"$4\"" >> ${TMPGAME}; fi
if [ -n "$5" ]; then echo -n " \"$5\"" >> ${TMPGAME}; fi
if [ -n "$6" ]; then echo -n " \"$6\"" >> ${TMPGAME}; fi
echo "" >> ${TMPGAME}

# Disable screensaver.
(sleep 5 && xscreensaver-command -exit) &

# Run the game.
xinit /tmp/tmpgame.sh -- :1 > ~/.gameXlog 2>&1

# Restart screensaver.
xscreensaver-command -restart

Offline

Board footer

Powered by FluxBB