133
  • Kubuntu 20.04, 64 bit
  • GPU: Geforce GT610
  • nvidia-driver-390
  • Chrome Version 85.0.4183.83
  • Intel i5-4430, core 4, 4 thread , 3GHz
  • RAM: 16GB

Each time I go into suspend mode and then resume, Chrome browser displays the current tab as full of sand of colors, something like dithering in image processing.

screenshot

Other tabs display glitches too.

The current solution is to close and reopen the browser.

I tested nvidia-driver-418 but got a black screen problem and reinstalled nvidia-driver-390.

The problem is more evident in Chrome, but it sometimes appears in vscode in small areas. There, hovering the mouse over the affected place or resizing the window fixes the problem. In Kubuntu the avatar of the user in the application launcher also shows dithered.

screenshot

I tested in the same machine with fedora 32 workstation(gnome), nvidia driver, and had the same problems with Chrome browser.

ubuntu-drivers output

Could it be a GPU problem?

vvvvv
  • 878

12 Answers12

83

Same problem for me.

Enabling enable-vulkan in chrome://flags then restarting the browser fixed it. If that does not work, you can also try enabling ignore-gpu-blacklist as well.

Answer based on this old askubuntu answer

Mike
  • 713
Gurgeh
  • 947
  • 1
  • 5
  • 2
61

I'm having more or less the same issue, on:

  • Ubuntu 18.04, 64 bit
  • GPU: GeForce GTX 1070
  • Driver: 440.100
  • Chrome Version: 86.0.4240.75 (Official Build) (64-bit)

I don't want to have to deactivate GPU usage for Chrome, and I don't want to have to restart the browser every time, losing all my tabs.

But I found a workaround that is good enough for me (at least for now):

You can kill just the browser's GPU process

  • Open the Task Manager:

    • Hit Shift+Esc (as pointed out by @NYCeyes in the comments).
    • Or alternatively, go to the Chrome main menu (3 dots on the top right corner) → More ToolsTask Manager.
  • Sort by process Task name.

  • Find the process called GPU Process.

  • Click on End process.

Chrome Task Manager - GPU Process - End process

That will "clean" all the glitchy image noise. And Chrome will immediately create a new GPU process automatically.

Note: You can automatize the process, check Andrew Bruce's answer putting these steps in a script that runs automatically.

I assume the problem is something like the GPU process using memory assuming it has the old state as before the sleep cycle, but it just has some default random noise from the default state. So I imagine Ubuntu doesn't save and restore GPU memory on a sleep cycle (I don't think it should) but the Chrome process doesn't detect that. And by killing the process it "frees" that GPU memory and then Chrome creates a new process that re-generates any needed GPU memory state (that's instant).

tiangolo
  • 866
29

Using tiangolo's answer, you can automate the restart of the Chrome GPU process on wake. As root, I put this script in /lib/systemd/system-sleep/revive-chrome-gpu:

#!/bin/sh

set -e

if [ "$2" = "suspend" ] || [ "$2" = "hybrid-sleep" ] then case "$1" in pre) true ;; post) sleep 1 pkill -f 'chrome --type=gpu-process' ;; esac fi

Be sure to make the script executable with:

chmod +x /lib/systemd/system-sleep/revive-chrome-gpu
Andrew Bruce
  • 391
  • 2
  • 2
15

I have the same issues on Arch, and although enabling Vulkan does fix the glitches when resuming from sleep or hibernation, it also impacts performance a lot. Based on this bug report and this answer I've tried starting Chrome with the following flags: --use-cmd-decoder=validating --use-gl=desktop and this seems to fix my issue without any performance penalties.

I'm not sure if this applies to all distros, but on Arch you can put these arguments into ~/.config/chrome-flags.conf and then they will be used every time Chrome is started (or ~/.config/chromium-flags.conf if using Chromium):

~/.config/chrome-flags.conf
--use-cmd-decoder=validating --use-gl=desktop
xx77aBs
  • 251
7

1st Solution (performance issues)

In my case a solution for the Chrome browser is disable in Settings: Use hardware acceleration when available.

chrome://settings/system

enter image description here

2nd Solution

Yes, the above solution comes with performance issues. If you don't like that, you can test this other option, Chrome will run flawlessly.

Run Chrome with some flags, run always Chrome by terminal.

google-chrome-stable --use-cmd-decoder=validating --use-gl=desktop &

The & avoid blocking the terminal.

5

I followed xx77aBs's solution but, since I'm using Chromium under Ubuntu, I added these options in /etc/chromium-browser/customizations, as mentioned here. I added a file named nvidia-fix under that directory with the following content:

CHROMIUM_FLAGS="${CHROMIUM_FLAGS} --use-cmd-decoder=validating --use-gl=desktop"
tetebueno
  • 163
  • 6
4

I had a very similar issue on my Arch system with both Chrome and Chromium where I had to restart it ever time after sleep (VS code and Steam also had minor artifact but simply switching tabs fixed it there)

Simply enabling Vulkan in chrome://flags seems to have finally resolved it.

I also wanted to mention that I did not suffer from this issue up until several weeks ago I am on nVidia 1060 with 450.66 driver

Artem
  • 41
3

xx77aBs's can be adapted for Chrome, not Chromium, on Ubuntu using this answer.

cp /usr/share/applications/google-chrome.desktop ~ # or wherever you want to keep that desktop launch file
sed -i 's/google-chrome-stable /google-chrome-stable --use-cmd-decoder=validating --use-gl=desktop /' ~/google-chrome.desktop
chmod +x ~/google-chrome.desktop

Then use that newly created and modified .desktop file to launch Chrome.

2

For my setup (Ubuntu 20.04, Thinkpad P53) flag --use-gl=desktop was enough to avoid Chromium problems after resume. I didn't notice a visible slowdown of my machine.

I added the file ~/.chromium-browser.init with contents: CHROMIUM_FLAGS="--use-gl=desktop".

Danijel
  • 485
2

Try this script (works for Ubuntu 20.04), then reboot

#!/bin/bash

Followed by this tutorial: https://download.nvidia.com/XFree86/Linux-x86_64/450.57/README/powermanagement.html

NVIDIA_DRIVER_VERSION=$(head -1 /proc/driver/nvidia/version | sed "s/.Kernel Module ([0-9]). .*/\1/g") NVIDIA_DIR=/usr/share/doc/nvidia-driver-${NVIDIA_DRIVER_VERSION}

if [[ ! -d ${NVIDIA_DIR} ]]; then echo ${NVIDIA_DIR} does not exist. Skipping. exit 0 fi

Installing

sudo install ${NVIDIA_DIR}/nvidia-suspend.service /etc/systemd/system sudo install ${NVIDIA_DIR}/nvidia-hibernate.service /etc/systemd/system sudo install ${NVIDIA_DIR}/nvidia-resume.service /etc/systemd/system sudo install ${NVIDIA_DIR}/nvidia /lib/systemd/system-sleep sudo install ${NVIDIA_DIR}/nvidia-sleep.sh /usr/bin

Enabling nvidia systemd

sudo systemctl enable nvidia-suspend.service sudo systemctl enable nvidia-hibernate.service sudo systemctl enable nvidia-resume.service

UPD1: for ones, who don't know how to make it as a script

  1. create file: install_nvidia_powermanagement.sh
  2. copy paste the content into install_nvidia_powermanagement.sh
  3. make it a executable: chmod +x install_nvidia_powermanagement.sh
  4. run it: ./install_nvidia_powermanagement.sh
RedEyed
  • 1,513
1

My problems with chrome after resume were reproducible by switching to vty and back to X or after sleep, lock etc. I finally ran with the --disable-extensions flag from the command line and the problem went away.

The issue was pretty strange. It would jumble contents from different tabs or block out portions of pages with large black block or leftover content from a previous tab. Scrolling caused issues too or popover etc.

Via trial and error I narrowed in on ....

Microsoft Office Extension

It apparently messes with the browsers use of gl. It was spitting out these errors when started from a console and triggering the bug. Disabling or removind the extension fixed it.

ERROR:angle_platform_impl.cc(43)] ClearErrors(2057): Preexisting GL error 0x00000506 as of ../../third_party/angle/src/libANGLE/renderer/gl/TextureGL.cpp, setImageHelper:256.

86.0.4240.75 Linux 5.4.0-48-generic nvidia 450 and libnvidia-gl-450.

Bug shown here

0

I was having the same problem. Here is the solution that I used.

Step 1: Copy the python code and make it into an executable file and place it on your home folder

#!/usr/bin/python3
import os,signal
import time
a=1
while (a==1):
    try:   
        #iterating through each instance of the proess 
        process=os.popen('ps aux | grep "brave.com/brave/brave --type=gpu-process" | 
        grep -v grep')
        str=(process.read())
        length=0
        length=len(str)
        if (length==0):
            print("Process Teminated..")
            a=2
        else:
            for line in os.popen('ps aux | grep "brave.com/brave/brave --type=gpu-process" | grep -v grep'):  
                fields = line.split() 
                #extracting Process ID from the output 
                pid = int(fields[1])  
                res=fields[3]
                res=float(res)/100*7.69*1024 #7.69 is the amount of ram i have.... yours might vary.
                # terminating process  
                if(res>100):
                    print(f"pid={pid} res={res}")
                    os.kill(int(pid), signal.SIGKILL)  
                    print("Process Successfully terminated") 
                time.sleep(6)
                length=0
except: 
    print("Error Encountered while running script") 
    time.sleep(10)

Step 2: Create a shell script to launch both the applications at the same time

cd /usr/bin/;brave-browser-stable & brave=$!
sleep 2
cd /home/<your-username-here>/;./kill-gpu-brave & kill=$! #I named my  python execulable file kill-gpu-brave
wait $brave
wait $kill

Step 3: Make this an executable file with chmod +x <filename> and launch brave through this file.