Showing posts with label Google Chrome. Show all posts
Showing posts with label Google Chrome. Show all posts

Tuesday, October 25, 2016

Enabling Nvidia Hardware Acceleration in Google Chrome on Ubuntu 16.04

I bought an ASUS GeForce GTX 750 Ti for my Ubuntu 16.04 machine to replace an AMD video card and I noticed right away that Chrome was not operating at peak efficiency. So I checked chrome://gpu and sure enough the hardware acceleration was disabled. What to do?

First, I looked at chrome://settings to make sure hardware acceleration was enabled there. Going to Show advanced settings... --> System showed that the "Use hardware acceleration when available" option was checked. So far so good.

Next, I looked at chrome://flags and enabled the "Override software rendering list" option. I restarted Chrome but when I went back to chrome://gpu hardware acceleration was still disabled.

Doing some research pointed to the fact that the Chrome GPU sandbox was not playing nice with the Nvidia driver, or vice versa. The way to get around this issue was to edit my Unity launcher shortcut found at ~/.local/share/applications/google-chrome.desktop and add the --disable-gpu-sandbox command-line option to the following line:

Exec=/opt/google/chrome/chrome --disable-gpu-sandbox %U

After closing and reopening Chrome, chrome://gpu finally showed that hardware acceleration was enabled on most of the items listed under Graphics Feature Status. The two items that were still disabled were:
  • Rasterization
  • Native GpuMemoryBuffers
Going back to chrome://flags, I enabled the "GPU rasterization" option and restarted Chrome which enabled the Rasterization item. To get the Native GPU Memory Buffers to work, I had to add the --enable-native-gpu-memory-buffers command-line option to the Unity launcher shortcut. Closing and reopening Chrome enabled the Native GpuMemoryBuffers item.

Doing all of this work greatly improved everything Chrome handles including video playback. A neat place to test out the new and improved performance is the WebGL Aquarium page. Select 1000 fish and check the FPS (mine is pegged at 60 fps which is equal to the refresh rate of my monitor).

Note

Getting the right Nvidia proprietary driver to install properly on Ubuntu 16.04 for the GeForce GTX 750 Ti was nothing short of a nightmare. The first thing that I had to do was add the Proprietary GPU Drivers PPA which gives you a lot more options of various Nvidia driver versions than the standard Ubuntu repos do.
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
I tried several different versions of the Nvidia driver and had serious issues with each one I tried. So I went to the Nvidia Download Drivers page and looked up what the appropriate Linux 64-bit driver should be for my card. At the time of this writing, version 367.57 was the one that came up and can be installed with the following command:
sudo apt-get install nvidia-367

Friday, April 8, 2016

Why does Google Chrome use so much RAM?

I know this issue is not Linux-specific since Chrome did the same thing on Windows, but I want to bring it up anyway. Currently I have thirteen tabs open in Chrome and this is what System Monitor looks like:


Thirteen tabs, and nineteen out of the top twenty memory hogging processes are chrome. Seriously, how can Google Chrome take up a half-gig of memory for just one process? I have done a lot of Web application programming with JavaScript frameworks such as jQuery and Dojo so I understand web pages are more complicated now than they used to be. However, it seems to me these memory numbers are an order of magnitude off as I would expect even the most dazzling Ajax-ified web application to take no more than 50 MiB of memory. Even then, at 50 MiB that is some serious HTML/CSS/JavaScript/images/videos/etc.

And I thought Microsoft was terrible at memory management, especially with their Office apps.

Edit: I received a tweet from @perlmeister1l pointing me to a Chrome Help page called Reduce Chrome memory. Basically, Chrome has its own built-in Task Manager that allows you to see exactly which tabs are consuming your CPU and RAM resources.

While this is definitely more helpful than the System Monitor, the only suggestion provided in the help was to kill tabs you no longer need to free up memory. This is not entirely helpful since I would have done this anyway. Rather, I would prefer to know in greater detail about exactly why my Yahoo! Mail tab is taking up 536MB of RAM. How much of that is the DOM? JavaScript? Images? Ads? You get the picture.