Monday, December 29, 2014

Fixing Left 4 Dead 2 Mouse Lag in Ubuntu 14.04

Issue

I have noticed a slight lag-like thing while playing Left 4 Dead 2 recently, mainly when turning with the character. It wasn't too obvious, but I felt something was wrong. I couldn't aim properly with the weapons and therefore I often missed shots. It seemed too much of a coincidence. I have tried tweaking some mouse sensitivity, acceleration etc. however the issue persisted.

Solution

Long story short, others have experienced the same problem while gaming on Linux. Luckily, def075 mentioned [1] that this may be a mouse polling issue. I did a quick search and found the solution [2]. Do the following,

  1.     gksudo gedit /etc/modules
  2.     And add the following 2 lines to the end of the file,
        -r usbhid
      usbhid mousepoll=1
  3.     And finally reboot.

Where the "mousepoll" tells the operating system how often to query (read data from) the mouse. The faster it does it, the less lag there is in the input. For reference [3],

1=1000 Hz (1ms)
2=500Hz (2ms)
4=250Hz (4ms)
8=125Hz (8ms)
10=100Hz (default, 10ms)

I have set mine to "mousepoll=1" and it works just fine. Some other posts say to set it to 2, I personally just went for the maximum to be on the safe side. Feel free to experiment with this, however I personally don't think that this would cause a great decrease in CPU time/performance on overall.

References


[1] - http://forums.steampowered.com/forums/showthread.php?t=3147537
[2] - http://ubuntuforums.org/showthread.php?t=392494
[3] - https://wiki.archlinux.org/index.php/Mouse_Polling_Rate

Thursday, December 25, 2014

First Video in Steam Not Playable - Ubuntu 14.04 64bit

After upgrading to Ubuntu 14.04 64bit I noticed that Steam was misbehaving and some features were unavailable. The first video of any game on the store was appearing as a single picture and couldn't be played and any other video wouldn't play normally on full screen.

Issue

  1. The first video of any game from the store in Steam under Ubuntu 14.04 64bit is not playable. This is also mentioned by other members of the community.[1]
    First Video in Steam is Not Playable "0:00/NaN/NaN"
  2. (Possibly) Full screen videos in Steam have a glitch where the top part of the screen is flashing and doesn't display video. Also the sides of the screen might develop the same glitch.

Solution

Flash layer is the issue and causes all the problems. The solution is to  download a 32bit version of libflashplayer.so and add it to a local Steam directory. [2] Do as the following,
  • Close Steam
  • In your browser go to http://get.adobe.com/flashplayer/otherversions/
  • Download a tar.gz of the 32bit flash player for Linux.
    32 bit Flash player in tar.gz
  • tar xzvf install_flash_player_11_linux.i386.tar.gz
  • mkdir ~/.local/share/Steam/ubuntu12_32/plugins/
  • cp libflashplayer.so ~/.local/share/Steam/ubuntu12_32/plugins/libflashplayer.so
  • Start Steam
The first videos should be playable now and the screen glitch should also be gone. Worked as a charm for me.

Note:
By default the Steam directory is ~/.local/share/Steam however if you have changed this, please change it in the above commands.

You can remove the extra "junk" files that were unpacked from the tar.gz file. Untaring creates a "usr" directory in the download location that can be removed with rm -rf usr and the readme.txt with rm readme.txt.

Refrences


[1] - http://www.reddit.com/r/Steam/comments/2lrbp3/steam_linux_first_video_in_store_page_never/
[2] - http://wiki.gentoo.org/wiki/Steam#Flashplayer_on_amd64 

Sunday, December 21, 2014

Xorg High CPU Usage in Ubuntu 14.04

The Issue

I started having some problems recently with xorg using way too much CPU power on my Linux desktop.

I have recently upgraded to Ubuntu 14.04 on this machine ad got stuck after the login screen. I have tracked down the issue with the proprietary ATI/AMD drivers (fglrx). I have managed to get into tty terminal via CTRL+ALT+F2 and I have removed everything to do with proprietary drivers using this guide.

Hence I switched back to open source drivers that were working just fine. The problem being that xorg used a whole core of my dual-core CPU. This is not normal and had to be addressed. I started looking around and found the issue on many forums and posts.

The output of top looks something like this

PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1262 root      20   0  267204  56016  15320 R  55.8  1.1  27:37.97 Xorg
 2641 nargren   20   0 1431604 574100  54096 R  35.9 11.5  11:26.71 firefox
 2435 nargren   20   0 1353536  84540  39284 S  12.6  1.7   1:09.57 compiz

The Solution

I have worked on this for the better part of 2 days and tried multiple methods suggested in different forum threads.

First I have overlooked this thread and tried to look elsewhere, however it has turned out that those methods didn't work. I got curious when I saw that QIII was also having the exact same issue and was using conky, just like me. He claimed using conky on 2 other distros as well, without any issues (on the same machine) so he ruled that one out as the source of the issue. In the end he has upgraded his OS and got rid of the issue (thread from 2012).

I have quickly killed my conky session with
sudo killall conky
to see what happens. And voilĂ ! Checking top immediately revealed what the issue was. After the change, this is how it looked like below.

PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 2435 nargren   20   0 1352980  84544  39288 R   4.3  1.7   1:20.38 compiz
 1262 root      20   0  267440  56024  15328 R   4.0  1.1  33:18.70 Xorg
 2993 nargren   20   0  654880  26736  12656 S   3.0  0.5   0:08.41 gnome-terminal

Conclusion

The issue was conky indeed. Hence I have to sacrifice my cool, real-time system information for now. However, I will keep on troubleshooting and see if by changing some settings I can get back my conky.

So if you are having the same issue with xorg and are running conky, try killing it and see if the CPU usage drops.