Bug 103618

Summary: Reverse Prime with intel/amdgpu leaves Intel monitor blank
Product: DRI Reporter: EoD <EoD>
Component: DRM/IntelAssignee: Intel GFX Bugs mailing list <intel-gfx-bugs>
Status: CLOSED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: normal    
Priority: medium CC: intel-gfx-bugs
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: SKL i915 features: display/Other
Bug Depends on: 103613    
Bug Blocks:    
Attachments:
Description Flags
Xorg.log with gdb backtrace
none
Xorg.log with xf86-video-intel using --enable-debug=full
none
Allow a PRIME pixmap to be reused.
none
Xorg.log with "Allow a PRIME pixmap to be reused."
none
/sys/kernel/debug/dri/1/i915_display_info after the (new) assert
none
Allow a PRIME pixmap to be reused.
none
Xorg.log with "Allow a PRIME pixmap to be reused." v2
none
Disable DPMS-deferred modesetting for GPU screens.
none
Update vtSema for Leave/EnterVT none

Description EoD 2017-11-08 11:43:25 UTC
I have a primary discrete AMD card (Tonga) using amdgpu and an Intel iGPU (Skylake/HD530) using the intel driver.

I enabled DRI3 on both devices, but xrandr only shows the outputs/monitors of the AMD card.

The main monitor (connected to the AMD Tonga) is active and shows a screen, while the 2nd monitor (connected to the Intel iGPU) is already active but has only a blank screen.

When I use "xrandr --setprovideroutputsource 1 0" it flickers a bit and xrandr shows now all outputs/monitors.

When I try to enable the monitor connected to the iGPU via "xrandr --output HDMI3 --auto" the 2nd monitor stays active but blank.
 
When I "extend" my desktop to the 2nd monitor I can leave the desktop with the mouse, but the monitor is still just blank.


When I use modesetting on the intel card instead, everything works.


Here are further details, including the Xorg.log and the used configs: https://gist.github.com/EoD/c1c4f2b4afde2d0523e9ea8bb1567452
Comment 1 EoD 2017-11-08 12:33:42 UTC
Created attachment 135299 [details]
Xorg.log with gdb backtrace

Apparently there is also an assertion in sna_set_shared_pixmap_backing when I try to stop the X server (log out).

The 2nd monitor has been enabled at [7653.479], the output provider has been set at [7646.890].
Comment 2 Chris Wilson 2017-11-08 15:56:51 UTC
Can you provide an Xorg.log compiled with --enable-debug=full (USE=full-debug I believe)?
Comment 3 EoD 2017-11-08 21:53:53 UTC
Created attachment 135322 [details]
Xorg.log with xf86-video-intel using --enable-debug=full

(In reply to Chris Wilson from comment #2)
> Can you provide an Xorg.log compiled with --enable-debug=full
> (USE=full-debug I believe)?

Attached is the same scenario (just a bit faster) with FULL_DEBUG.
Comment 4 Chris Wilson 2017-11-08 22:26:20 UTC
Created attachment 135323 [details] [review]
Allow a PRIME pixmap to be reused.

Please try this and update the debug xorg.log.
Comment 5 EoD 2017-11-08 22:43:16 UTC
Created attachment 135324 [details]
Xorg.log with "Allow a PRIME pixmap to be reused."

(In reply to Chris Wilson from comment #4)
> Created attachment 135323 [details] [review] [review]
> Allow a PRIME pixmap to be reused.
> 
> Please try this and update the debug xorg.log.

Here is the new Xorg.log
Comment 6 EoD 2017-11-08 22:44:35 UTC
Created attachment 135325 [details]
/sys/kernel/debug/dri/1/i915_display_info after the (new) assert

As requested, also the output of /sys/kernel/debug/dri/1/i915_display_info after shutting down the xserver (=after the assert) with the above patch.
Comment 7 Chris Wilson 2017-11-08 22:47:57 UTC
Created attachment 135326 [details] [review]
Allow a PRIME pixmap to be reused.

Take 2.
Comment 8 EoD 2017-11-08 22:55:29 UTC
Created attachment 135327 [details]
Xorg.log with "Allow a PRIME pixmap to be reused." v2

(In reply to Chris Wilson from comment #7)
> Created attachment 135326 [details] [review] [review]
> Allow a PRIME pixmap to be reused.
> 
> Take 2.

Take 2 it is. No more assertion!
Comment 9 Chris Wilson 2017-11-08 23:33:11 UTC
Created attachment 135333 [details] [review]
Disable DPMS-deferred modesetting for GPU screens.

This should hopefully do the trick, though my memory is hazy...
Comment 10 EoD 2017-11-09 00:01:58 UTC
(In reply to Chris Wilson from comment #9)
> Created attachment 135333 [details] [review] [review]
> Disable DPMS-deferred modesetting for GPU screens.
> 
> This should hopefully do the trick, though my memory is hazy...

This last patch makes the 2nd monitor behaviour as expected and I would consider it fixed as long as 5. is expected.

1. On Boot AMD-monitor is active (showing boot sequence), Intel-monitor is inactive.
2. After logging in the terminal and starting X-Server AMD-monitor stays active, Intel-monitor stays inactive (that's new!).
3. After setting setprovideroutputsource everything stays
4. After "xrandr --output HDMI3 --auto" the 2nd monitor goes active and works like a charm
5. After stopping X (logging off), the 2nd monitor stays enabled and only turns itself off, if X is started again.
Comment 11 Chris Wilson 2017-11-09 00:12:05 UTC
Created attachment 135334 [details] [review]
Update vtSema for Leave/EnterVT

One for the road
Comment 12 EoD 2017-11-09 00:19:19 UTC
(In reply to Chris Wilson from comment #11)
> Created attachment 135334 [details] [review] [review]
> Update vtSema for Leave/EnterVT
> 
> One for the road
And the last one fixes an assertion when trying to press Ctrl+C in a terminal on the startx process (independent of any of the above).

> #4  0x00007f963c48172f in intel_put_master (dev=0x1d89510) at /usr/src/debug/x11-drivers/xf86-video-intel-2.99.917_p20170313/7e9e92c86b0fc4c848d164fe571798add5e1e36e/src/intel_device.c:814
> #5  0x00007f963c541bbe in sna_early_close_screen (screen=0x1ed4870) at /usr/src/debug/x11-drivers/xf86-video-intel-2.99.917_p20170313/7e9e92c86b0fc4c848d164fe571798add5e1e36e/src/sna/sna_driver.c:997
> #6  0x00000000004a59b7 in xf86CrtcCloseScreen (screen=0x1ed4870) at /usr/src/debug/x11-base/xorg-server-1.19.5/xorg-server-1.19.5/hw/xfree86/modes/xf86Crtc.c:741
> #7  0x000000000050dc72 in present_close_screen (screen=0x1ed4870) at /usr/src/debug/x11-base/xorg-server-1.19.5/xorg-server-1.19.5/present/present_screen.c:64
> #8  0x00000000004398e4 in dix_main (argc=6, argv=0x7ffe82237aa8, envp=<optimized out>) at /usr/src/debug/x11-base/xorg-server-1.19.5/xorg-server-1.19.5/dix/main.c:325

Nice work!
Comment 13 Chris Wilson 2017-11-09 00:42:55 UTC
Applied the quick fixes, so for the time being we should be avoiding the black screen of doom. The DPMS hack in particular deserves a proper fix (in Xorg).
Comment 14 Jani Saarinen 2018-04-20 11:13:30 UTC
Closing, please re-open if still occurs.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.