Bug 237050 - [PATCH] vt efifb back-end does not send display release / re-acquire signals on suspend / resume
Summary: [PATCH] vt efifb back-end does not send display release / re-acquire signals ...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Ed Maste
URL:
Keywords: patch, patch-ready
Depends on:
Blocks:
 
Reported: 2019-04-05 15:19 UTC by Erik Kurzinger
Modified: 2019-06-04 18:11 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Kurzinger 2019-04-05 15:19:10 UTC
Using the latest NVIDIA driver, upon resuming from suspend while X is running the display will remain blank. Additionally, and OpenGL applications that were running will trigger a number of error messages from the NVIDIA driver resembling the following:

NVRM: GPU at PCI:0000:05:00: GPU-e0851a46-0a85-f806-1e95-94e61ad45653
NVRM: GPU Board Serial Number: 0331118033409
NVRM: Xid (PCI:0000:05:00): 13, Graphics SM Warp Exception on (GPC 0, TPC 1): Illegal Instruction Encoding
NVRM: Xid (PCI:0000:05:00): 13, Graphics Exception: ESR 0x504e48=0x3f0009 0x504e50=0x0 0x504e44=0xd3eff2 0x504e4c=0x17f
NVRM: Xid (PCI:0000:05:00): 13, Graphics SM Warp Exception on (GPC 0, TPC 2): Illegal Instruction Encoding
NVRM: Xid (PCI:0000:05:00): 13, Graphics Exception: ESR 0x505648=0x3f0009 0x505650=0x0 0x505644=0xd3eff2 0x50564c=0x17f

This is because the efifb back-end for vt will not signal the X server to release the display before suspending (or to re-acquire it after resuming) resulting in important code in the NVIDIA driver responsible for smoothly shutting down and re-initializing the GPU not running. Since the NVIDIA driver doesn't currently support framebuffer devices, vt is forced to fall back to this efifb back-end, unlike on Intel hardware, for instance, where it will instead use the fb back-end that does correctly implement the display hand-off logic. The following patch adds vd_suspend and vd_resume members to the efifb back-end's vt_driver struct. These simply call the vt_suspend and vt_resume functions from vt_core.c (similar to the behavior of the fb back-end). This ensures the X server is properly able to re-initialize the display and prevents the above errors from 3D applications.

--- sys/dev/vt/hw/efifb/efifb.c (revision 345767)
+++ sys/dev/vt/hw/efifb/efifb.c (working copy)
@@ -66,6 +66,8 @@
        .vd_fb_mmap = vt_fb_mmap,
        /* Better than VGA, but still generic driver. */
        .vd_priority = VD_PRIORITY_GENERIC + 1,
+       .vd_suspend = vt_suspend,
+       .vd_resume = vt_resume,
 };
 
 static struct fb_info local_info;
Comment 1 Conrad Meyer freebsd_committer 2019-04-05 19:11:24 UTC
(Bug also present in CURRENT.)
Comment 2 Austin Shafer 2019-05-13 22:18:32 UTC
I have the same problem, and this patch works for me. Running 12-RELEASE (amd64) with a NVIDIA 1070. Anything preventing this from being committed? I'm happy to test if needed.
Comment 3 commit-hook freebsd_committer 2019-05-21 18:43:04 UTC
A commit references this bug:

Author: emaste
Date: Tue May 21 18:42:36 UTC 2019
New revision: 348059
URL: https://svnweb.freebsd.org/changeset/base/348059

Log:
  vt efifb: add suspend/resume calls

  Using the latest NVIDIA driver, upon resuming from suspend with X
  running the display remained blank.  Additionally OpenGL applications
  that were running triggered a number of error messages from the NVIDIA
  driver.

  This occurred because the vt efifb back-end did not signal the X server
  to release the display before suspending (or to re-acquire it after
  resuming).  The NVIDIA driver includes code for smoothly shutting down
  and re-initializing the GPU, which was not getting called.

  Since the NVIDIA driver doesn't currently support framebuffer devices
  and vt is forced to fall back to the efifb back-end, add vd_suspend and
  vd_resume members to connect the suspend/resume path.  This ensures the
  X server is properly able to re-initialize the display.

  PR:		237050
  Submitted by:	Erik Kurzinger <ekurzinger@nvidia.com>
  Reviewed by:	markj
  MFC after:	2 weeks
  Event:		Waterloo Hackathon 2019

Changes:
  head/sys/dev/vt/hw/efifb/efifb.c
Comment 4 commit-hook freebsd_committer 2019-06-04 18:11:47 UTC
A commit references this bug:

Author: emaste
Date: Tue Jun  4 18:11:12 UTC 2019
New revision: 348651
URL: https://svnweb.freebsd.org/changeset/base/348651

Log:
  MFC r348059: vt efifb: add suspend/resume calls

  Using the latest NVIDIA driver, upon resuming from suspend with X
  running the display remained blank.  Additionally OpenGL applications
  that were running triggered a number of error messages from the NVIDIA
  driver.

  This occurred because the vt efifb back-end did not signal the X server
  to release the display before suspending (or to re-acquire it after
  resuming).  The NVIDIA driver includes code for smoothly shutting down
  and re-initializing the GPU, which was not getting called.

  Since the NVIDIA driver doesn't currently support framebuffer devices
  and vt is forced to fall back to the efifb back-end, add vd_suspend and
  vd_resume members to connect the suspend/resume path.  This ensures the
  X server is properly able to re-initialize the display.

  PR:		237050
  Submitted by:	Erik Kurzinger <ekurzinger@nvidia.com>

Changes:
_U  stable/12/
  stable/12/sys/dev/vt/hw/efifb/efifb.c