Screen freeze and garbled after resume from suspend

Bug #1210077 reported by Yung Shen
160
This bug affects 51 people
Affects Status Importance Assigned to Milestone
HWE Next
Fix Released
Undecided
Unassigned
Trusty
Fix Released
Undecided
Unassigned
Unity
Fix Released
High
Christopher Townsend
nvidia-graphics-drivers-331 (Ubuntu)
Fix Released
High
Alberto Milone
Precise
Fix Released
Medium
Alberto Milone
nvidia-graphics-drivers-331-updates (Ubuntu)
Fix Released
High
Alberto Milone
unity (Ubuntu)
Fix Released
High
Christopher Townsend

Bug Description

[Impact]
Users of nvidia graphics drivers can see graphics freezes or corruption after suspend/resume. Switching to a VT and back to X can potentially solve freeze issues, but corruption may result.

[Test Case]
Suspend/Resume many times with nvidia graphics and see if the problem happens.

[Regression Potential]
This is already in Trusty.

--

Perform regular suspend, either from system menu or close laptop lid, when system resuming from suspend, it will freeze.

Switch to VT and back to X can solve freeze issue,
but the screen are gabled and some character rendering are strange,
however whole system can perform usual task.

found affected graphics:
gf108m
gf117m
gk107glm

Revision history for this message
Yung Shen (kaxing) wrote :
Revision history for this message
Yung Shen (kaxing) wrote :
Revision history for this message
Yung Shen (kaxing) wrote :
Revision history for this message
Yung Shen (kaxing) wrote :
Revision history for this message
Yung Shen (kaxing) wrote :
Revision history for this message
Yung Shen (kaxing) wrote :
summary: - Screen freeze after resume
+ Screen freeze and gabled after resume from suspend
description: updated
Changed in nvidia-prime (Ubuntu):
assignee: nobody → Alberto Milone (albertomilone)
Revision history for this message
Launchpad Janitor (janitor) wrote : Re: Screen freeze and gabled after resume from suspend

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nvidia-prime (Ubuntu):
status: New → Confirmed
Changed in nvidia-prime (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Kalyan (rkalyankumar) wrote : Re: [Bug 1210077] Re: Screen freeze and gabled after resume from suspend

It's still happening in my laptop running Ubuntu 12.04.3 LTS. It's very
strange and couldn't debug more.

*--*
*Regards,*
*Kalyankumar Ramaseshan*
*Cell-#: 91 95000 74239*

*Talk is cheap. Show me the code. ~Linus Torvalds.*

On Thu, Oct 17, 2013 at 2:58 PM, Yang Kun (YK) <email address hidden>wrote:

> ** Changed in: nvidia-prime (Ubuntu)
> Importance: Undecided => Medium
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1210077
>
> Title:
> Screen freeze and gabled after resume from suspend
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/ubuntu/+source/nvidia-prime/+bug/1210077/+subscriptions
>

Revision history for this message
Alberto Milone (albertomilone) wrote : Re: Screen freeze and gabled after resume from suspend

I don't see anything obvious in the logs that could be causing the problem.

Can you try the following beta driver, please? (keep nvidia-prime installed)

http://people.canonical.com/~amilone/nvidia-331-updates_331.13-0ubuntu0.0.1_amd64.deb

Revision history for this message
Jan Evert van Grootheest (j-e-van-grootheest) wrote :

Me too. Using nvidia-319-updates on regular 13.10, Dell Latitude E6530,

01:00.0 VGA compatible controller: NVIDIA Corporation GF108GLM [NVS 5200M] (rev a1)

Revision history for this message
Aditya M (adix-me) wrote :

Its still freezing with nvidia 331.13 beta drivers on the 13.10 randomly, background screen and window shadows corrupts on resume from sleep.

01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 540M] (rev a1)

any manual work around these bugs ?

Revision history for this message
Alberto Milone (albertomilone) wrote :

@Daniel: any ideas about this issue?

Revision history for this message
Daniel Dadap (ddadap) wrote :

It's not explicitly stated anywhere in this bug report, but due to the bug being assigned to "nvidia-prime" and the attached bug reports apparently coming from systems with PRIME configured, can it be assumed that this bug happens specifically on systems with RandR 1.4 display offloading configured? Does anybody have images of the corruption?

I'm assuming the corruption is observed with the default Unity desktop. Does it also occur with non-composited desktops? (e.g. unity-2d, xfce4 default config)

Revision history for this message
Alberto Milone (albertomilone) wrote :

Yes, that's definitely with RandR 1.4.

Revision history for this message
Erno Kuusela (erno-iki) wrote :

There are screenshots showing corruption attached to this bug report.

Revision history for this message
Erno Kuusela (erno-iki) wrote :

Can kaxing or one of the people marked as affected answer ddadap's question about composited vs non-compostied desktops? I don't have a setup to test easily anymore.

Revision history for this message
Lauri Siltala (latelol) wrote :

I have this bug as well with a geforce GT 640M. To answer that question, it happens to me on both KDE (with compositing) and LXDE (no compositing) so compositing does not appear to matter.

Also, for me, kernel 3.9 works fine; the issue only appears on newer ones than that.

Another report of what looks like the same bug: https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-319/+bug/1220865

Revision history for this message
Yung Shen (kaxing) wrote :

Thanks Lauri Siltala for the additional information.

To Erno Kuusela,

I've reproduced the issue on one of the same hardware but with stable Saucy, it was tested with development release.

And both with and without composite on got the same troubles.

Verifying by using xfce4:

killall xfwm4 && xfwm4 --compositor=off &

then suspend and resume, you will see the same result.

Revision history for this message
Yung Shen (kaxing) wrote :
Revision history for this message
Erno Kuusela (erno-iki) wrote :

On precise + 3.11 kernel + acpi_handle_hack + nvidia.com 331.17 driver package, the issue remains.

summary: - Screen freeze and gabled after resume from suspend
+ Screen freeze and garbled after resume from suspend
Revision history for this message
Tim Chen (timchen119) wrote :

it also can reproduce in Unity 2D + 331.20 driver + nvidia-prime on 12.04 + Saucy LTS HWE stack. (3.11 kernel)

Revision history for this message
Giorgio Dramis (jorged) wrote :

I have the same problem with Ubuntu 14.04 LTS, kernel 3.13-12, and driver Nvidia 331.38 + nvidia-prime 0.5.7

Revision history for this message
Lars Hansson (romabysen) wrote :

Also happen on HP Notebook 14 with a Intel HD 4000 and Nvidia 820M. When coming back from suspend the screen is black. Switching to Vt1 and back gives you the authentication box with garbled background. After authenticating you get the desktop with a garbled wallpaper and some odd drawing artifacts in menus.
Logging out and back in fixes it.

nvidia-319-updates: 319.60-0ubuntu1
nvidia-prime: 0.4.2~ubuntu13.10.1

Ara Pulido (ara)
Changed in nvidia-prime (Ubuntu):
importance: Medium → High
tags: added: blocks-hwcert-enablement
Changed in hwe-next:
status: New → Triaged
Revision history for this message
Daniel Dadap (ddadap) wrote :

It looks like this is a consequence of recent changes in the kernel that allow the system to optionally skip VT switches on suspend and resume:

24576d2 drm/i915: enable VT switchless resume v3
​3cf2667 fb: add support for drivers not needing VT switch at suspend/resume time
f43f627 PM: make VT switching to the suspend console optional v3

The kernel will not skip VT switches if no drivers register their VT switch requirements through pm_vt_switch_required(); however, if any drivers do so, and all of them indicate that VT switches are not required, they will be skipped. In the PRIME case, this is exactly what happens: the Intel driver registers itself as not needing VT switches, and the NVIDIA driver does not register its VT switch requirements one way or the other (the NVIDIA driver *does* need a VT switch on suspend/resume), so the kernel skips the VT switch, resulting in corruption when attempting to restore the NVIDIA X screen.

The NVIDIA driver can be updated to pm_vt_switch_required() (I verified with a quick spot check that doing so restores the desired behavior: more testing will be needed before this change can be made officially); in the meantime, it is possible to work around this issue by adding 'no_console_suspend' to the kernel command line.

Revision history for this message
Alberto Milone (albertomilone) wrote :

@Daniel: would it be enough to call pm_vt_switch_required() somewhere in nvidia_init_module(), and then to call pm_vt_switch_unregister() in nvidia_exit_module() (in nv.c)?

Revision history for this message
Daniel Dadap (ddadap) wrote :

@Alberto: that's essentially the change which I tested successfully on a laptop I have which reproduces the issue, but some of my colleagues have suggested calling into pm_vt_switch_*() elsewhere in the driver. I would prefer if you could wait for an official patch and/or driver update, which we'll make available after the change has been properly reviewed and tested at NVIDIA.

Revision history for this message
Alberto Milone (albertomilone) wrote :

@Daniel: ok, if you think it's best that I wait, I will. Thanks for your help.

Revision history for this message
Daniel Dadap (ddadap) wrote :

@Alberto:

Here's a patch that adds calls into pm_vt_switch_{required,unregister}() to the NVIDIA driver. It resolves the corruption issue on my test system. This change will be included with the next release of the 331 series drivers.

Revision history for this message
Daniel Dadap (ddadap) wrote :

Moving this bug from nvidia-prime to nvidia-graphics-drivers-331, since the fix goes in the NVIDIA driver, and not nvidia-prime.

FWIW, the attached patch has been formatted for use with the NVIDIA .run installer's "--apply-patch" option, but it should be usable for DKMS, since DKMS uses patchlevel -p1. The patch includes a conftest so that the calls to the new pm_vt_switch_*() functions will only be compiled if the kernel actually provides them, so you don't need to worry about PATCH_MATCH, and can just apply the patch unconditionally.

affects: nvidia-prime (Ubuntu) → nvidia-graphics-drivers-331 (Ubuntu)
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "NVIDIA driver patch for pm_vt_switch_required()" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Alberto Milone (albertomilone) wrote :

Thank you very much, Daniel

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nvidia-graphics-drivers-331 - 331.38-0ubuntu5

---------------
nvidia-graphics-drivers-331 (331.38-0ubuntu5) trusty; urgency=medium

  [ Alberto Milone ]
  * debian/dkms_nvidia/patches/register-VT-switch-requirements.patch:
    - Make sure to call pm_vt_switch_{required,unregister}(), so that
      the kernel knows that the driver requires a vt switch at
      suspend/resume time. This resolves a corruption issue on resume
      from S3 (LP: #1210077).
      Thanks to NVIDIA for the patch.

  [ Graham Inggs ]
  * debian/templates/nvidia-graphics-drivers.shlibs.in,
    debian/templates/libcuda1-flavour.shlibs.in,
    debian/templates/nvidia-libopencl1-flavour.shlibs.in:
    - Separate .shlibs for libcuda1 and nvidia-libopencl1
      (LP: #1260974).
 -- Alberto Milone <email address hidden> Fri, 14 Mar 2014 15:55:26 +0100

Changed in nvidia-graphics-drivers-331 (Ubuntu):
status: Confirmed → Fix Released
Changed in hwe-next:
status: Triaged → Fix Released
Revision history for this message
Alberto Milone (albertomilone) wrote :

Apparently, things are better with the patch, however the launcher still shows corruption, which goes away if you refresh the screen.

I suspect that Unity's launcher is simply not being redrawn on resume.

Changed in unity (Ubuntu):
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Alberto Milone (albertomilone) wrote :

I digged a bit deeper into this issue and here's what I found out:

* UnityScreen::UnityScreen() connects to the correct event (coming from Upower):

    UScreen::GetDefault()->resuming.connect([this] {
      /* Force paint local::FRAMES_TO_REDRAW_ON_RESUME frames on resume */
      force_draw_countdown_ += local::FRAMES_TO_REDRAW_ON_RESUME;
    });

* UnityScreen::damageCutoff() is the place where Unity checks force_draw_countdown_ and triggers the redraw.

However it's not clear to me what's supposed to call UnityScreen->damageCutoff(). I grepped through the whole source of Unity and nothings seems to call it. Maybe this is the problem?

Revision history for this message
Alberto Milone (albertomilone) wrote :

Here's a screenshot of the problem

Revision history for this message
Alberto Milone (albertomilone) wrote :

I discussed the issue with Andrea Azzarone and Martin Pitt, and the problem might be related to the signal coming from UPower not being reliable enough. We should really rely upon the PrepareForSleep signal coming from org.freedesktop.login1.Manager.

We should also make sure that PrepareForSleep returns False (as this means that the system has just resumed)

Something like the attached patch only with the "proxy_.Connect" line changed (so as to check that PrepareForSleep returns False) should work.

Changed in unity (Ubuntu):
assignee: nobody → Andrea Azzarone (andyrock)
Revision history for this message
Lauri Siltala (latelol) wrote :

I am also still getting some occasional corruption (on KDE) with the 331.38-0ubuntu5 drivers when resuming. I don't get freezes anymore, but what I do see is windows that were open before suspending becoming glitched (see attached screenshot) but those do not occur every time after resuming unlike the freezes this bug was about. The attached screenshot shows a fullscreen firefox window after resuming, which was fixed by leaving and then re-entering fullscreen. I've seen the same thing with some other programs as well. Also, the weird patterns the corruption shows were the same that appeared for me before the driver patch as well.

Changed in unity:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Christopher Townsend (townsend)
milestone: none → 7.2.0
Changed in unity (Ubuntu):
assignee: Andrea Azzarone (andyrock) → Christopher Townsend (townsend)
Changed in unity:
status: Confirmed → In Progress
Changed in unity (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity - 7.1.2+14.04.20140320.1-0ubuntu1

---------------
unity (7.1.2+14.04.20140320.1-0ubuntu1) trusty; urgency=low

  [ Chris Townsend ]
  * Change the signal for detecting resuming from Suspend from UPower
    (which is unreliable) to logind. (LP: #1210077)

  [ Brandon Schaefer ]
  * Use key_code instead of key_sym for the Super+<Num> shortcut. (LP:
    #1294885)

  [ Andrea Azzarone ]
  * Wait for the grab before showing the lockscreen. (LP: #1291497)
  * Do not lock a guest session. (LP: #1295194)
 -- Ubuntu daily release <email address hidden> Thu, 20 Mar 2014 23:51:55 +0000

Changed in unity (Ubuntu):
status: In Progress → Fix Released
Stephen M. Webb (bregma)
Changed in unity:
status: In Progress → Fix Committed
Revision history for this message
Giorgio Dramis (jorged) wrote :

Now it works, but when i resume my PC i see two screens in one monitor. I think that is a problem of my PC, because when i open Monitor in System Settings i find two monitors connected, but indeed there is only one monitor connected. I opened a new bug here: https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-331-updates/+bug/1293237

Revision history for this message
Stephen M. Webb (bregma) wrote :

Fix Released in Unity Unity 7.2.0.

Changed in unity:
status: Fix Committed → Fix Released
Chris J Arges (arges)
Changed in nvidia-graphics-drivers-331 (Ubuntu Precise):
assignee: nobody → Alberto Milone (albertomilone)
importance: Undecided → Medium
status: New → In Progress
no longer affects: unity (Ubuntu Precise)
description: updated
Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello Yung, or anyone else affected,

Accepted nvidia-graphics-drivers-331 into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/nvidia-graphics-drivers-331/331.20-0ubuntu0.0.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in nvidia-graphics-drivers-331 (Ubuntu Precise):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

The problem with suspend was solved in nvidia driver 331.67 (not this one 331.38)
http://www.nvidia.com/Download/driverResults.aspx/75019/en-us
http://www.nvidia.com/object/unix.html

Here is chunk from release notes (331.67):
"Fixed a bug that could cause display corruption when resuming from suspend on systems using RandR 1.4 display offloading with recent Linux kernels."

Revision history for this message
Alberto Milone (albertomilone) wrote :

@Bartosz: the driver in -proposed has a patch that does exactly the same

Changed in nvidia-graphics-drivers-331-updates (Ubuntu):
status: New → In Progress
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

I can confirm that nvidia-graphics-drivers-331 331.20-0ubuntu0.0.2 is working correctly, and I don't observe any artifacts after suspend.

Unfortunately I cannot test nvidia-graphics-drivers-331-updates 331.38-0ubuntu0.0.1, because it is still in NEW state:
https://launchpad.net/ubuntu/precise/+queue?queue_state=0

tags: added: verification-done-precise
removed: verification-needed
Changed in nvidia-graphics-drivers-331-updates (Ubuntu):
assignee: nobody → Alberto Milone (albertomilone)
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nvidia-graphics-drivers-331 - 331.20-0ubuntu0.0.2

---------------
nvidia-graphics-drivers-331 (331.20-0ubuntu0.0.2) precise-proposed; urgency=medium

  [ Shih-Yuan Lee (FourDollars) ]
  * debian/nvidia_supported,
    debian/rules:
    - Add subsystem ID parsing support for LP: #1255813.

  [ Alberto Milone ]
  * debian/dkms_nvidia/patches/register-VT-switch-requirements.patch:
    - Make sure to call pm_vt_switch_{required,unregister}(), so that
      the kernel knows that the driver requires a vt switch at
      suspend/resume time. This resolves a corruption issue on resume
      from S3 (LP: #1210077).
      Thanks to NVIDIA for the patch.
  * debian/dkms_nvidia_uvm/patches/buildfix_kernel_3.12.patch,
    debian/dkms_nvidia/patches/buildfix_kernel_3.13.patch:
    - Add support for Linux 3.13 (LP: #1294163).
 -- Alberto Milone <email address hidden> Thu, 20 Mar 2014 11:50:12 +0100

Changed in nvidia-graphics-drivers-331 (Ubuntu Precise):
status: Fix Committed → Fix Released
Revision history for this message
Scott Kitterman (kitterman) wrote : Update Released

The verification of the Stable Release Update for nvidia-graphics-drivers-331 has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (3.6 KiB)

This bug was fixed in the package nvidia-graphics-drivers-331-updates - 331.38-0ubuntu0.0.1

---------------
nvidia-graphics-drivers-331-updates (331.38-0ubuntu0.0.1) precise-proposed; urgency=medium

  [ Shih-Yuan Lee (FourDollars) ]
  * debian/nvidia_supported,
    debian/rules:
    - Add subsystem ID parsing support for LP: #1255813.

  [ Alberto Milone ]
  * debian/dkms_nvidia/patches/register-VT-switch-requirements.patch:
    - Make sure to call pm_vt_switch_{required,unregister}(), so that
      the kernel knows that the driver requires a vt switch at
      suspend/resume time. This resolves a corruption issue on resume
      from S3 (LP: #1210077).
      Thanks to NVIDIA for the patch.
  * debian/dkms_nvidia_uvm/patches/buildfix_kernel_3.12.patch,
    debian/dkms_nvidia/patches/buildfix_kernel_3.13.patch:
    - Add support for Linux 3.13 (LP: #1294163).
  * debian/substvars:
    - Add support for X ABI 15 and lts-trusty.
  * New upstream release:
    - Added support for X.org xserver ABI 15 (xorg-server 1.15).
    - Fixed a bug that caused the X server to crash if video memory
      is exhausted and the GPU does not support rendering to system
      memory.
    - Updated nvidia-installer to make the --multiple-kernel-modules
      option imply the --no-unified-memory option: Unified memory is
      incompatible with multiple kernel modules.
    - Updated the behavior of the nvidia-settings PowerMizer
      Preferred Mode drop-down menu, to make the setting apply
      consistently across all GPUs in an SLI group.
    - Improved the robustness of the NVIDIA X driver in scenarios
      where GPU-accessible memory for allocating pixmaps was
      exhausted.
    - Added NV-CONTROL attributes to control the brightness of the
      illuminated logos on certain graphics boards.For example, to
      turn off the illumination of the
      GEFORCE GTX
      lettering on the GeForce GTX 780, use
      nvidia-settings --assign GPULogoBrightness=0
    - Fixed a bug that prevented screen transformations from being
      applied properly when starting X.
    - GLX protocol for the following OpenGL extensions from OpenGL
      2.1 and OpenGL 3.0 have been promoted from unofficial to ARB
      approved official status:
        GL_ARB_pixel_buffer_object
        GL_NV_conditional_render
        GL_ARB_map_buffer_range
        GL_EXT_texture_integer
        GL_ARB_vertex_array_object
      GL_ARB_pixel_buffer_object was the last piece of protocol
      needed to have official support for indirect rendering with all
      OpenGL 2.1 commands.
    - GLX Protocol for the miscellaneous OpenGL 3.0 commands not
      associated with specific extensions has also been promoted from
      unofficial to ARB approved status.
    - Deprecated display mask related configuration of display
      devices via NV-CONTROL and nvidia-settings.Display target
      specifications should be used instead - A display target is one
      of the display's valid names, with an optional GPU or X screen
      qualifier.
    - Deprecated the following NV-CONTROL attributes:
        NV_CTRL_CONNECTED_DISPLAYS
        NV_CTRL_ENABLED_DISPLAYS
        NV_CTRL_ASSOCIATED_DISPLAYS
       ...

Read more...

Changed in nvidia-graphics-drivers-331-updates (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Jan Vetulani (vetulani) wrote :

Hi there!

I'm not sure if this is the same bug I've been having for years, but here goes.

Currently running Ubuntu 14.04 with Nvidia drivers 343.36.

After I come back from suspend, anything that seems to rely on GPU acceleration is garbled.

In blender all the textures are replaced with colourful patches of noise, same goes for films in cmplayer, mplayer, smplayer, vlc.
Observed the same thing in google maps in chrome too.

In media players it goes away after I just hit play, google maps - zoom in and out. Blender however needs a reload of the file.
It's not anything major, but seems like something I'd like fixed.

Cheers!

Revision history for this message
tom (00-11-00) wrote :

Hi,
I've got the same bug with 14.04 and nvidia cuda drivers nvidia-352.39-0ubuntu1. I've tried to install the nvidia-352-update driver but cuda is not working then.

Is there any solution for that driver too?

Thanks

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.