Steam for Linux

Steam for Linux

mabrowning 2012 年 12 月 3 日 上午 11:37
[WORKAROUND] Allow TF2 to run with legacy ATI drivers 12.6.
NOTE: AMD have released a new Legacy driver which resolves the problem this workaround originally... worked around. Go get 'em!


























The Catalyst Legacy 12.6 drivers are missing a fairly trivial extension, GL_EXT_texture_sRGB_decode. This extension allows the game engine to switch a texture between sRGB decoding(gamma correction) and linear decoding (no gamma correction). It is used for DX9 emulation, which it appears the source engine is doing. Thus, colors are off quite a bit in-game when using dxlevel9* (tends to be a bit dark). dxlevel81 runs perfectly well.

Here is a temporary fix for the missing extension:

This has been consistently working for many users for a few weeks now.

Essentially, we're overriding the libc function strstr, which searches for a string within a string. This function is used by TF2 to check for GL extensions. We're overriding the default with a version which will always claim that the string GL_EXT_texture_sRGB_decode matches, even if it doesn't.

If you are running 64bit, install some necessary 32bit development packages:

sudo apt-get install libc6-dev-i386
Create a file "strstr.c" with the following content:
#include <string.h> char * strstr( const char * haystack, const char * needle ) { //Default strstr implementation. Kind of Slow, but hopefully //TF2 doesn't use this often. if( needle == NULL || haystack == NULL ) { return (char*)haystack; } char * n = (char*)needle; char * h = (char*)haystack; while( *h ) { if( *n == '\0' ) { return h-n+(char*)needle; } if( *h == *n ) { n++; } else { n = (char*)needle; } h++; } //Suddenly, MAGIC! if( strcmp(needle,"GL_EXT_texture_sRGB_decode") == 0 ) { return (char*)haystack; } return NULL; }
Build the file (64bit):
gcc -fPIC -DPIC -g -m32 -c strstr.c && ld -m elf_i386 -shared -o strstr.so strstr.o

Now, to get the game to use our override, we can make use of the GAME_DEBUGGER variable, which is used by the game launch scripts to allow hooking into gdb or strace to debug the game. It is invoked with the hl2_linux process and arguments (find and look at hl2.sh for more details).

First, create our "debugger", a process that loads that library we just built, but doesn't really do any debuging (won't affect performance). Use your favorite editor to create the file ~/bin/hl2debug and add the following content. Adjust the path to strstr.so depending on where you built it.

#!/bin/bash export LD_PRELOAD="$HOME/strstr.so $LD_PRELOAD" "$@" #Launch the original process and all arguments

Now, make it executable:
chmod +x ~/bin/hl2debug

In your .bashrc (or .zshrc, or .profile), add this at the end so that steam knows what "debugger" to use and where to find it:

export PATH=$HOME/bin:$PATH export GAME_DEBUGGER="hl2debug"

Either log out/back in if you want to launch steam with the menu option, or just get the variable into your environment (`source ~/.bashrc`) and launch steam from the terminal.

Other posts mention TF2 specific launch options to help improve performance or work around other bugs, but launching with "-novid" works around some errors related to video playback, and launching with "-nojoy" improves performance a lot for some older cards.

Voila!
最後修改者:mabrowning; 2013 年 10 月 19 日 下午 7:11
< >
目前顯示第 1-15 則留言,共 112
Schrödinger's cat 2012 年 12 月 3 日 下午 12:13 
How much fps is difference between fglrx-legacy and open source driver?
mabrowning 2012 年 12 月 3 日 下午 12:15 
I haven't even tried the open source driver, but I would guess at least 2x, if not more.
Schrödinger's cat 2012 年 12 月 3 日 下午 12:16 
And what is your GPU and how much fps do you get?
Beelzebud 2012 年 12 月 3 日 下午 12:17 
I hope AMD gets their act together soon, because with a 5770 and the latest beta driver, it simply can't run TF2 at full speed. Same hardware in Win7 has no trouble with TF2.
boot 2012 年 12 月 3 日 下午 12:34 
Tried to follow this, but it doesn't compile.

In file included from /usr/include/stdio.h:28:0, from strstr.c:1: /usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory compilation terminated.
mabrowning 2012 年 12 月 3 日 下午 12:39 
引用自 boot
Tried to follow this, but it doesn't compile.

In file included from /usr/include/stdio.h:28:0, from strstr.c:1: /usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory compilation terminated.

Hmm, that's unusual. You may not have required development headers or something. As you can see, the program is extermely trivial... though it doesn't even need stdio.h. Try removing that include.
boot 2012 年 12 月 3 日 下午 12:42 
Same error.(with /usr/include/string.h:27:0,)
I'm using Kubuntu 12.10 64-bit.
最後修改者:boot; 2012 年 12 月 3 日 下午 12:43
mabrowning 2012 年 12 月 3 日 下午 12:43 
引用自 boot
Same error.
I'm using Kubuntu 12.10 64-bit.
Ok. I just edited the main post. Looks like package libc6-dev-i386 is necessary for building 32bit library.
boot 2012 年 12 月 3 日 下午 12:51 
It's launching, but getting some errors.

Error: Material "fullscreenvideomaterial" uses unknown shader "Bik"

Used -novid flag to bypass this.
Now getting:

Could not load chromehtml library.IDirect3DDevice9::Create: BackBufWidth: 1920, BackBufHeight: 1080, D3DFMT: 3, BackBufCount: 1, MultisampleType: 0, MultisampleQuality: 0
Can't find background image materials/Console/startup_loading.vtf

So I'm trying to verify game files.
mabrowning 2012 年 12 月 3 日 下午 12:54 
引用自 boot
It's launching, but getting some errors.

Error: Material "fullscreenvideomaterial" uses unknown shader "Bik"

Used -novid flag to bypass this.
Now getting:

Could not load chromehtml library.IDirect3DDevice9::Create: BackBufWidth: 1920, BackBufHeight: 1080, D3DFMT: 3, BackBufCount: 1, MultisampleType: 0, MultisampleQuality: 0
Can't find background image materials/Console/startup_loading.vtf

So I'm trying to verify game files.

I had all that too. Are you symlinking to your ntfs partition? I was at first, but now I'm only symlinking the gcf. The SteamApps/$USER/Team Fortress 2/ folder is on my /home. Uses about 1.2GB of "extracted" space, but it works!
最後修改者:mabrowning; 2012 年 12 月 3 日 下午 12:55
mabrowning 2012 年 12 月 3 日 下午 12:56 
引用自 gcc
And what is your GPU and how much fps do you get?

HD3870. Looks like ~10fps at 2560x1600. I only just got it to launch when I made my post, so yeah... its kind of unplayable.

Edit: With highframes[fakkelbrigade.eu], I'm getting 35fps at 1280x800. Reasonably playable. Colors look much better here, too.

Edit again. Oh wow. Yeah, turn off pyrovision->100fps.
最後修改者:mabrowning; 2012 年 12 月 4 日 上午 1:23
boot 2012 年 12 月 3 日 下午 12:59 
引用自 RunningRiot

I had all that too. Are you symlinking to your ntfs partition? I was at first, but now I'm only symlinking the gcf. The SteamApps/$USER/Team Fortress 2/ folder is on my /home. Uses about 1.2GB of "extracted" space, but it works!

Yes, I'm symlinking SteamApps folder to another driver, but it is on a ext4 partition.

Edit: Is there anyway to solve this problem without changing the symlink?
最後修改者:boot; 2012 年 12 月 3 日 下午 1:21
mabrowning 2012 年 12 月 3 日 下午 2:17 
引用自 boot

Edit: Is there anyway to solve this problem without changing the symlink?

Try just deleting your $USER/Team Fortress 2/ directory, leaving all the gcfs in place. After launching it again (And it "Verified Local Cache") it seems work work wonderfully.
最後修改者:mabrowning; 2012 年 12 月 3 日 下午 2:18
boot 2012 年 12 月 3 日 下午 2:51 
Ok, lets see.

Game tends to crash..., a lot. Especially when changing video settings.
Intro video has a sort of green overlay to it.
The colours are somewhat darker in some parts.
Brightness slider option does nothing.
Sky box isn't rendering properly.
Some fonts not rendering properly in-game.
Slower performance than windows.
Everything on menus (before starting/entering server) displays properly.

Kubuntu 12.10 64-bit
Ati HD4770 with fglrx-legacy 12.6
mabrowning 2012 年 12 月 3 日 下午 2:56 
引用自 boot
Ok, lets see.

Game tends to crash..., a lot. Especially when changing video settings.
Intro video has a sort of green overlay to it.
The colours are somewhat darker in some parts.
Brightness slider option does nothing.
Sky box isn't rendering properly.
Some fonts not rendering properly in-game.
Slower performance than windows.
Everything on menus (before starting/entering server) displays properly.

Kubuntu 12.10 64-bit
Ati HD4770 with fglrx-legacy 12.6

Did you try applying the highframes config from http://fakkelbrigade.eu/chris/configs/ ? I'm getting over 100fps with no problems on an older card with half the number of shaders. Graphics quality is a bit lowered. I still need to find the right balance, but this is a great start. Windowed mode seems to help quite a bit, as does turning off compiz ( metacity --replace )
< >
目前顯示第 1-15 則留言,共 112
每頁顯示: 1530 50

張貼日期: 2012 年 12 月 3 日 上午 11:37
回覆: 112