Cant get OpenGL Context after Hibernation (nVidia 450.66 and Linux 5.8.7)

Hello!

I have been trying to get Hibernation to work on my HP Omen 17 (2019 version with RTX 2080 Mobile).

I am using Gentoo Linux with a custom yet fat Linux Kernel configuration, and unmodified nvidia drivers. Also I am using OpenRC, so no systemd stuff.

I managed to fix issues where I couldnt hibernate and resume at all, but I still have a big issue.

Once I resume from Hibernation many Applications that try to get a OpenGL Context fail to do so. In the past weeks I was only able to observe this with QML in the KDE System Settings.

I thought that it could be a Qt5 bug.

But today I found out that when I enable Hardware Acceleration in any instance of Chromium (e.g. Brave), I can also see rendering errors after resume. Turning off Hardware Acceleration in Brave would make the rendering issues go away, but that doesnt fix the issue anyways.

I have been experiencing these issues for a few weeks from nVidia Driver 440 up to 450.66 and Linux 5.7 up to 5.8.7.

One thing to note is that I dont have iGPU on my Intel i9-9880H, so I can only use nVidia or CPU Rendering. You can probably guess that I would not want CPU Rendering …

To give some information, I have NoFlip enabled.

As said above, I see QML Rendering issues in the System Settings, and it has this output:

QQmlEngine::setContextForObject(): Object already has a QQmlContext
QQuickWidget: Failed to make context current
QQuickWidget::resizeEvent() no OpenGL context
QQuickWidget: Failed to make context current
QQuickWidget: Attempted to render scene with no context
QQuickWidget::invalidateRenderControl could not make context current

Please note again that this only happens AFTER a resume from Hibernation. On a normal Bootup this issue does NOT come up!

The rendering issues I am talking about are simple Black boxes where whatever OpenGL Hardware Accelerated output would normally be.

I dont have the rendering bug I saw in Brave right now as I disabled Hardware Acceleration, but I can share an image once I am done working and try to reproduce it with HA enabled.

While looking for Error Logs I found that I have a ACPI error with a reference to NVIDIA X driver, so I will also try to change the ACPI vendor to Windows to see if that changes anything. Also I will try to use sys-power/acpid.

Just for complete ness, here is the xorg config:

Section "Device"                                                                                                                                                                                                                              
    Identifier     "Device0"                                                                                                                                                                                                                  
    Driver         "nvidia"                                                                                                                                                                                                                   
    VendorName     "NVIDIA Corporation"                                                                                                                                                                                                       
    Option         "NoFlip" "true"                                                                                                                                                                                                              
EndSection

To summorze the system a bit more, here is inxi with full verbosity:

System:    Kernel: 5.8.7-ATVG x86_64 bits: 64 compiler: N/A Desktop: KDE Plasma 5.19.5 tk: Qt 5.14.2 info: latte-dock 
        wm: kwin_x11 dm: SDDM Distro: Gentoo Base System release 2.7 
Machine:   Type: Laptop System: HP product: OMEN by HP Laptop 17-cb0xxx v: N/A serial: <filter> Chassis: type: 10 
        serial: <filter> 
        Mobo: HP model: 8603 v: 45.38 serial: <filter> UEFI: AMI v: F.15 date: 08/01/2019 
Battery:   ID-1: BAT1 charge: 62.8 Wh condition: 62.8/70.1 Wh (90%) volts: 17.3/15.4 model: COMPAL PABAS0241231 type: Li-ion 
        serial: <filter> status: Full 
CPU:       Info: 8-Core model: Intel Core i9-9880H bits: 64 type: MT MCP arch: Kaby Lake rev: D L2 cache: 16.0 MiB 
        flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 73625 
        Speed: 4376 MHz min/max: 800/4800 MHz Core speeds (MHz): 1: 4376 2: 3932 3: 4064 4: 4350 5: 4257 6: 4233 7: 3915 
        8: 3918 9: 3943 10: 3887 11: 4458 12: 4320 13: 4455 14: 4296 15: 4400 16: 4184 
Graphics:  Device-1: NVIDIA TU104BM [GeForce RTX 2080 Mobile] vendor: Hewlett-Packard driver: nvidia v: 450.66 bus ID: 01:00.0 
        chip ID: 10de:1ed0 
        Device-2: Quanta HP Wide Vision HD Camera type: USB driver: N/A bus ID: 1-5:2 chip ID: 0408:5300 serial: <filter> 
        Display: x11 server: X.org 1.20.8 compositor: kwin_x11 driver: nvidia resolution: <xdpyinfo missing> 
        OpenGL: renderer: GeForce RTX 2080/PCIe/SSE2 v: 4.6.0 NVIDIA 450.66 direct render: Yes 
Audio:     Device-1: Intel Cannon Lake PCH cAVS vendor: Hewlett-Packard driver: snd_hda_intel v: kernel bus ID: 00:1f.3 
        chip ID: 8086:a348 
        Device-2: NVIDIA TU104 HD Audio vendor: Hewlett-Packard driver: snd_hda_intel v: kernel bus ID: 01:00.1 
        chip ID: 10de:10f8 
        Sound Server: ALSA v: k5.8.7-ATVG 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Hewlett-Packard driver: r8169 v: kernel 
        port: 3000 bus ID: 3b:00.0 chip ID: 10ec:8168 
        IF: eth0 state: down mac: <filter> 
        Device-2: Intel Wi-Fi 6 AX200 driver: iwlwifi v: kernel port: 3000 bus ID: 3d:00.0 chip ID: 8086:2723 
        IF: wlan0 state: up mac: <filter> 
        IF-ID-1: br-97cbb56206a7 state: down mac: <filter> 
        IF-ID-2: br-9d8dfee6b069 state: down mac: <filter> 
        IF-ID-3: br-ea95d8772746 state: down mac: <filter> 
        IF-ID-4: br-f113d8718081 state: down mac: <filter> 
        IF-ID-5: br-f66bbf9d8bcf state: up speed: 10000 Mbps duplex: unknown mac: <filter> 
        IF-ID-6: br-fecb3866f18c state: down mac: <filter> 
        IF-ID-7: docker0 state: down mac: <filter> 
        IF-ID-8: veth9361452 state: up speed: 10000 Mbps duplex: full mac: <filter> 
        IF-ID-9: virbr0 state: down mac: <filter> 
        IF-ID-10: virbr0-nic state: down mac: <filter> 
Drives:    Local Storage: total: 931.51 GiB used: 808.65 GiB (86.8%) 
        ID-1: /dev/sda vendor: Samsung model: SSD 860 EVO 1TB size: 931.51 GiB speed: 6.0 Gb/s serial: <filter> rev: 3B6Q 
        scheme: MBR 
RAID:      Hardware-1: Intel 82801 Mobile SATA Controller [RAID mode] driver: ahci v: 3.0 port: 5020 bus ID: 00:17.0 
        chip ID: 8086.282a rev: 10 
Partition: ID-1: / size: 881.78 GiB used: 808.49 GiB (91.7%) fs: ext4 dev: /dev/sda1 
        ID-2: /boot size: 4.01 GiB used: 108.3 MiB (2.6%) fs: vfat dev: /dev/sda2 
Swap:      ID-1: swap-1 type: partition size: 34.00 GiB used: 49.5 MiB (0.1%) priority: -2 dev: /dev/sda3 
Sensors:   System Temperatures: cpu: 58.0 C mobo: 10.0 C 
        Fan Speeds (RPM): N/A 
Info:      Processes: 375 Uptime: 14h 51m Memory: 30.99 GiB used: 6.12 GiB (19.7%) Init: SysVinit v: 2.93 rc: OpenRC v: 0.42.1 
        runlevel: default default: 3 Compilers: gcc: 9.3.0 alt: 8.4.0/9.3.0 Packages: 1415 emerge: 1391 flatpak: 24 
        Shell: fish v: 3.1.2 default: Bash v: 5.0.18 running in: konsole inxi: 3.1.06

I just reproduced the Rendering glitch in Brave. It occurres when HA is enabled, the browser is open and I Hibernate and Resume.

Also I forgot to mention that every time I resume from Hibernate the Display Brightness is lower then before, yet still at Maximum value. It only changes to the right brightness when I change the brightness once.

Update:

I now have nvidia driver 455.23.04 and kernel 5.9.0. Its still NOT working.