black screen when enabling rotation on a gpu screen

Bug #1308515 reported by Maarten Lankhorst on 2014-04-16
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
HWE Next
Undecided
Unassigned
OEM Priority Project
High
Ara Pulido
X.Org X server
Fix Released
Critical
xorg-server (Ubuntu)
Undecided
Maarten Lankhorst
Saucy
Undecided
Maarten Lankhorst
Trusty
Undecided
Maarten Lankhorst
Vivid
Undecided
Maarten Lankhorst
xorg-server-lts-saucy (Ubuntu)
Low
Unassigned
Precise
Undecided
Maarten Lankhorst
Vivid
Low
Unassigned

Bug Description

Running with the proprietary nvidia drivers in an optimus config works, but enabling reflection or rotation on the intel screen causes a black screen to appear.

[Impact]
 * Causes a black screen if rotation or reflection is enabled.

[Test Case]
 * Run xrandr --output SOMEOUTPUT --rotation left
    - Expected: Screen should rotate, or the call should fail.
    - Bad behavior: Succeeds, but causes a black screen.

[Regression Potential]
 * The affected codepaths have reflection and rotation disabled for gpu screens. Another fix could be fixing reflection/rotation, but that will be more involved and likely require driver fixes.

[Other Info]
 * N/A

no longer affects: xorg-server (Ubuntu Precise)
no longer affects: xorg-server-lts-saucy (Ubuntu Saucy)
no longer affects: xorg-server-lts-saucy (Ubuntu Trusty)
Changed in xorg-server-lts-saucy (Ubuntu):
status: New → Invalid
Changed in xorg-server (Ubuntu Saucy):
assignee: nobody → Maarten Lankhorst (mlankhorst)
Changed in xorg-server (Ubuntu Trusty):
assignee: nobody → Maarten Lankhorst (mlankhorst)
Changed in xorg-server-lts-saucy (Ubuntu Precise):
assignee: nobody → Maarten Lankhorst (mlankhorst)
status: New → In Progress
Changed in xorg-server (Ubuntu Trusty):
status: New → In Progress
Changed in xorg-server (Ubuntu Saucy):
status: New → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xorg-server - 2:1.15.1-0ubuntu2

---------------
xorg-server (2:1.15.1-0ubuntu2) trusty; urgency=medium

  * Disable support for rotations and transforms
    on gpu screens for now. (LP: #1308515)
 -- Maarten Lankhorst <email address hidden> Wed, 16 Apr 2014 10:14:39 +0200

Changed in xorg-server (Ubuntu Trusty):
status: In Progress → Fix Released

Hello Maarten, or anyone else affected,

Accepted xorg-server into saucy-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/xorg-server/2:1.14.6-0ubuntu1 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 xorg-server (Ubuntu Saucy):
status: In Progress → Fix Committed
tags: added: verification-needed
tags: added: blocks-hwcert-enablement
Changed in hwe-next:
status: New → Triaged
Kent Lin (kent-jclin) on 2014-05-26
Changed in oem-priority:
importance: Undecided → Critical
importance: Critical → High
Ara Pulido (apulido) on 2014-05-26
Changed in oem-priority:
status: New → In Progress
assignee: nobody → Ara Pulido (apulido)
Brian Murray (brian-murray) wrote :

Hello Maarten, or anyone else affected,

Accepted xorg-server-lts-saucy into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/xorg-server-lts-saucy/2:1.14.6-0ubuntu1~precise2 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 xorg-server-lts-saucy (Ubuntu Precise):
status: In Progress → Fix Committed
jerry.kao (jerry.kao) wrote :

After update precise-proposed package on Kowalski 4, the prime version is still 0.5~hybrid0.0.2stella3.

   - switch to Nvidia GPU : pass
   - resolution : fail, black screen in some resolution
   - rotation : fail, can not rotate. just one option "normal"
   - guest session : pass, but can not adjust brightness

The behaviour is similar to prime version 0.0.2stella1285062

jerry.kao (jerry.kao) wrote :

@Ara,

Please confirm if only one option of rotation "normal" is acceptable?

jerry.kao (jerry.kao) wrote :

Run xrandr --output eDP-0 --rotation left
xrandr: output eDP-0 cannot rotation "left" reflection "none"

Due to default GPU is Intel, there is no certification issue. Add tag verification-done.

tags: added: verification-done
removed: verification-needed
Alberto Milone (albertomilone) wrote :

I can confirm that the package solves the problem here too. I think it's safe to approve it now

Daniel Manrique (roadmr) on 2014-06-18
Changed in xorg-server-lts-saucy (Ubuntu):
importance: Undecided → Low
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xorg-server-lts-saucy - 2:1.14.6-0ubuntu1~precise2

---------------
xorg-server-lts-saucy (2:1.14.6-0ubuntu1~precise2) precise-proposed; urgency=medium

   * Revive the old drm_device_keep_trying.patch (LP: #1322212).
     [ Maarten Lankhorst ]
     - Remove the call to get_drm_info fixes switching to guest sessions.
     [ Alberto Milone ]
     - Backport and fix the patch from Utopic.

xorg-server-lts-saucy (2:1.14.6-0ubuntu1~precise1) precise-proposed; urgency=low

  * Copy SRU back to precise.

xorg-server (2:1.14.6-0ubuntu1) saucy-proposed; urgency=medium

  * New upstream release (MRE).
  * Disable support for rotations and transforms
    on gpu screens for now. (LP: #1308515)
  * Only set RR caps that are appropriate to main/gpu screen. (LP: #1277014)
  * Fix crash in RRCrtcDetachScanoutPixmap. (LP: #1280743)
 -- Alberto Milone <email address hidden> Thu, 22 May 2014 16:53:47 +0200

Changed in xorg-server-lts-saucy (Ubuntu Precise):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for xorg-server-lts-saucy 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 regressions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xorg-server - 2:1.14.6-0ubuntu1

---------------
xorg-server (2:1.14.6-0ubuntu1) saucy-proposed; urgency=medium

  * New upstream release (MRE).
  * Disable support for rotations and transforms
    on gpu screens for now. (LP: #1308515)
  * Only set RR caps that are appropriate to main/gpu screen. (LP: #1277014)
  * Fix crash in RRCrtcDetachScanoutPixmap. (LP: #1280743)
 -- Maarten Lankhorst <email address hidden> Tue, 22 Apr 2014 12:37:21 +0200

Changed in xorg-server (Ubuntu Saucy):
status: Fix Committed → Fix Released
Ara Pulido (apulido) on 2014-07-02
Changed in oem-priority:
status: In Progress → Fix Released

Created attachment 102848
bisect report

Good day,

xorg segfaults with latest xf86-video-intel driver and nvidia binary blob 340.24 randr offloading.

Enclosing xorg log, git bisect report and my .xinitrc.

Created attachment 102849
xorg log

Created attachment 102850
.xinitrc im using

After reverting commit in question, everything works for me once again (latest master).

That wasn't the bug I was expecting to see... Why do you have the low power igfx slaved to the dgpu? That prevents -nvidia from ever powering down.

Can you attach gdb and get a 'bt full'? Note that requires a second computer to ssh in and run 'gdb --pid `pidof X`'

Will do.
by the way, why would I had to use ssh for this? Can't I just fire gdb from unused tty?

(In reply to comment #4)
> That wasn't the bug I was expecting to see... Why do you have the low power
> igfx slaved to the dgpu? That prevents -nvidia from ever powering down.

I'm playing around some opengl 4.x extensions and this machine is muxless optimus laptop so I can either go for offloading or use things like bumblebee, which brings some extra complexity when I'm debugging.

Also, I'm playing some videogames in my spare time so I don't mind having nvidia (I have custom runlevel that only runs on igfx for powersave).

(In reply to comment #5)
> Can you attach gdb and get a 'bt full'? Note that requires a second computer
> to ssh in and run 'gdb --pid `pidof X`'

Hm, it seems that it's not X thats segfaulting, it's 'xrandr --auto' that is being run after 'xrandr --setprovideroutputsource "Intel" NVIDIA-0'.

(In reply to comment #8)
> (In reply to comment #5)
> > Can you attach gdb and get a 'bt full'? Note that requires a second computer
> > to ssh in and run 'gdb --pid `pidof X`'
>
> Hm, it seems that it's not X thats segfaulting, it's 'xrandr --auto' that is
> being run after 'xrandr --setprovideroutputsource "Intel" NVIDIA-0'.

Sorry for jitter, its 'xrandr --auto' that causes X to crash, but I'm unable to catch it in time since X is dying too quickly.
Will give it some thought in the evening when I have free time.
Any advice would be appreciated (perhaps I should just send dump or something).

If you don't have a second machine handy, try reproducing the crash after compiling xf86-video-intel with --enable-debug=full. That will dump lots to Xorg.0.log, so please compress before attaching.

Created attachment 102979
Xorg.0.log

Here is the log with --enable-debug=full.
This time X didn't actually crash, but rather froze showing black screen and '_' cursor. Had to reboot the laptop.

Thanks. I see that the handling of foreign scanouts is indeed broken and needs some tlc.

The fix in your case should be fairly trivial, remove the sna_crtc->transform = true and remember to unoffset the CRTC. However, handling the transformed slaved CRTC was broken.

commit a45b2ea11c15f35c36330ff27cb45854a29c2e2c
Author: Chris Wilson <email address hidden>
Date: Thu Jul 17 14:40:51 2014 +0100

    sna: Handle rotated slaved scanouts

    As per the usual handling of rotated scanouts with unsupported
    rotations, we stage the drawing onto a backbuffer then rotate onto the
    crtc later. The difference here is that we must read the contents from
    the master pixmap rather than our own screen pixmap.

    Spotted was looking at slaved scanouts mistakenly setting the CRTC
    transformed flag.

    Reported-by: Tomas Pruzina <email address hidden>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81383
    Signed-off-by: Chris Wilson <email address hidden>

(In reply to comment #13)
> The fix in your case should be fairly trivial, remove the
> sna_crtc->transform = true and remember to unoffset the CRTC. However,
> handling the transformed slaved CRTC was broken.
>
>
> commit a45b2ea11c15f35c36330ff27cb45854a29c2e2c
> Author: Chris Wilson <email address hidden>
> Date: Thu Jul 17 14:40:51 2014 +0100
>
> sna: Handle rotated slaved scanouts
>
> As per the usual handling of rotated scanouts with unsupported
> rotations, we stage the drawing onto a backbuffer then rotate onto the
> crtc later. The difference here is that we must read the contents from
> the master pixmap rather than our own screen pixmap.
>
> Spotted was looking at slaved scanouts mistakenly setting the CRTC
> transformed flag.
>
> Reported-by: Tomas Pruzina <email address hidden>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81383
> Signed-off-by: Chris Wilson <email address hidden>

Thanks, I'll test it for a bit and report back if anything is unstable.

Shih-Yuan Lee (fourdollars) wrote :

This issue doesn't exist on Ubuntu 14.10.
Please help to enable the rotation options on Ubuntu 14.10.

Changed in hwe-next:
status: Triaged → Fix Released
no longer affects: xorg-server-lts-saucy (Ubuntu Utopic)
no longer affects: xorg-server (Ubuntu Utopic)
Tim Chen (timchen119) wrote :

https://bugs.launchpad.net/bugs/1386620 this issue is fixed by Maarten Lankhorst (mlankhorst) and the option will be re-enabled.

Changed in xorg-server:
status: New → Invalid
Changed in xorg-server:
importance: Undecided → Unknown
status: Invalid → Unknown
Changed in xorg-server:
importance: Unknown → Critical
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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