Bug 91562 - [SKL][Linux] : Xrandr is not working as expected
Summary: [SKL][Linux] : Xrandr is not working as expected
Status: CLOSED WORKSFORME
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: DRI git
Hardware: x86-64 (AMD64) Linux (All)
: highest blocker
Assignee: Olivier Berthier
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-05 06:40 UTC by appala
Modified: 2016-04-22 18:10 UTC (History)
8 users (show)

See Also:
i915 platform: SKL
i915 features:


Attachments
New IGT test case. (3.18 KB, patch)
2015-08-05 09:24 UTC, Tvrtko Ursulin
no flags Details | Splinter Review
skl-y_4.2-rc7_dmesg (87.28 KB, text/plain)
2015-08-20 12:58 UTC, cprigent
no flags Details
skl-y_4.2rc7_Xorg.0.log (33.11 KB, text/plain)
2015-08-20 13:01 UTC, cprigent
no flags Details
ddx full debug log (2.15 MB, text/plain)
2015-09-07 13:27 UTC, Tvrtko Ursulin
no flags Details
ddx debug log in Y tiling mode (951.99 KB, text/plain)
2015-09-07 13:36 UTC, Tvrtko Ursulin
no flags Details
dmesg log with rotation 90-270 on drm-nightly ww37 (tar.gz) (874.66 KB, application/octet-stream)
2015-09-10 08:25 UTC, Olivier Berthier
no flags Details
piglit results file igt@kms_rotation_crc* with 90-270 (86.68 KB, text/plain)
2015-09-10 09:48 UTC, Olivier Berthier
no flags Details

Description appala 2015-08-05 06:40:47 UTC
System Environment
==================
Board - SKYLAKE DT RVP8 EV/CRB FAB1 IMVP8 Rev2.0 H42784-105
CPU - SKL S 4+2 DT R1 QDF:QJEB
PCH - SPT-H D0 (QDF: QHQP)
Bios - SKL_DT_RVP8_DSTEP_Prod_SATA_NOPTT_CONS_SKLX090_01_ME_11.0_Consumer_11.0.0.1158
KSC - SKL_DT_AIO_RVP_KSC_v01_04

S/W Stack details:
==================

Linux Kernel   - Eywa 4.2.0-rc3 (6966e74c6e949308e52ed2af8a51757adcd00a30)

Libdrm         - (2.4.62) 293f8fac0a5c1cfd825005c94329aa8a5cd5ce30
Mesa           - (10.7.0-devel)  d69da58e84448188808488ad1c1c0181b5630a74
vaapi          - (0.38.0) 70b80c0dd2effb4956b208775641f7c68a67a9df
libva          - (1.6.1.pre1) 70b80c0dd2effb4956b208775641f7c68a67a9df
intel-driver   - (1.6.0.pre1) 611d8ea9d75dc026c203e3ebe53b434769d4587c
cairo          - (1.14.3)6951fb4238706522d357fd25236b17492baea1b0
Xserver        - (1.15.1) a8a0f6464a33c12c1de495d74fd478c0d952643e

Bug detailed description :
==========================
Xrandr is not working as expected.

xrandr -o left is working as expected, after that if we rotate to right
using "xrandr -o right" we see only black screen.

we are facing blank screen issue for below scenario 2.
scenario 1:
xrandr --output eDP1 --rotate left
xrandr --output eDP1 --rotate normal
xrandr --output eDP1 --rotate right
scenario 2:
xrandr --output eDP1 --rotate left
xrandr --output eDP1 --rotate right
Note: scenario 1 , working fine.

Reproduce Steps
==============
1.Boot the SUT with above mentioned configuration
2. Open the terminal and below commands to rotate the screen.
i. xrandr -o left
ii. xrander -o right

Expected Result
=============
Screen should turn from left to right with out any issues.
Actual Result:
===========
While turning the screen from left to right getting blank display.
Comment 1 Chris Wilson 2015-08-05 08:40:36 UTC
Probably best if Tvrtko takes the first look. Can you please attach an Xorg.0.log with the xf86-video-intel compiled with --enable-debug=full and the dmesg with drm.debug=6.

You should have at least attached the regular Xorg.0.log considering this is an X related bug, and attaching the drm.debug=6 dmesg should be standard practice.
Comment 2 Tvrtko Ursulin 2015-08-05 09:24:31 UTC
Created attachment 117538 [details] [review]
New IGT test case.

Please test with the new IGT test cases "primary-rotation-90-270" and "sprite-rotation-90-270".

Compile tested only since I don't have a SKL machine at the moment.
Comment 3 appala 2015-08-05 13:12:39 UTC
Using IGT we are able dump below registers sequence:


root@appala:/home/appala# tursulin/intel-gpu-tools/tools/intel_reg_read 0x70180 0x7019c
WARNING: Use of tursulin/intel-gpu-tools/tools/intel_reg_read has been deprecated and replaced by intel_reg.
0x70180 : 0xC4802400
0x7019C : 0x3100000
root@appala:/home/appala# xrandr -o left
root@appala:/home/appala# tursulin/intel-gpu-tools/tools/intel_reg_read 0x70180 0x7019c
WARNING: Use of tursulin/intel-gpu-tools/tools/intel_reg_read has been deprecated and replaced by intel_reg.
0x70180 : 0xC4802400
0x7019C : 0x3100000
root@appala:/home/appala# xrandr -o right
root@appala:/home/appala# tursulin/intel-gpu-tools/tools/intel_reg_read 0x70180 0x7019c
WARNING: Use of tursulin/intel-gpu-tools/tools/intel_reg_read has been deprecated and replaced by intel_reg.
0x70180 : 0xC4802400
0x7019C : 0x4980000
root@appala:/home/appala# xrandr -o normal
root@appala:/home/appala# tursulin/intel-gpu-tools/tools/intel_reg_read 0x70180 0x7019c
WARNING: Use of tursulin/intel-gpu-tools/tools/intel_reg_read has been deprecated and replaced by intel_reg.
0x70180 : 0xC4802400
0x7019C : 0x4980000
root@appala:/home/appala#
Comment 4 Tvrtko Ursulin 2015-08-05 13:14:15 UTC
I've run this new IGT on Appala's machine remotely and it works fine. This eliminates potential corner cases where i915 potentially wouldn't handle direct transition from 90 to 270 degree rotation.

But playing with rotation via xrandr and intel_reg_read on PLANE_CTL and PLANE_SURF registers suggests that Xorg is not trying to use hardware rotation at all.
Comment 5 Chris Wilson 2015-08-05 16:43:59 UTC
Tvrtko, you should know better than leaving such a statement hanging in midair without any full-debug logs!
Comment 6 Tvrtko Ursulin 2015-08-06 09:22:36 UTC
Appala is working on providing them.
Comment 7 cprigent 2015-08-20 12:58:48 UTC
Created attachment 117811 [details]
skl-y_4.2-rc7_dmesg
Comment 8 cprigent 2015-08-20 13:01:01 UTC
Created attachment 117812 [details]
skl-y_4.2rc7_Xorg.0.log

Reproduced on SKL-Y with eDP1 and external HDMI and DP screens.
Screen is black, cursor is available (it rotated).

Platform: SKY LAKE Y A0
CPU : Intel(R) Core(TM) m3-6Y30 CPU @ 0.8GHz 4MB (family: 6, model: 78  stepping: 3)
MCP : SKL-Y  D1  2+2
QDF : QVY3 
CPU : SKL D1
Chipset PCH: Sunrise Point LP C1       
CRB : SKY LAKE Y LPDDR3 RVP3 CRB FAB2
Reworks : All Mandatories + FBS02 & FBS03, O-06
Software
BIOS : SKLSE2R1.R00.X093.B02.1507222151
ME FW : 11.0.0.1163
Ksc (EC FW): 1.15
Linux distribution: Ubuntu 14.04 LTS 64 bits
Kernel: drm-intel-nightly 30263ef782e0548c114fb6f2771b58b27c56ba0d 4.2.0-rc7 from git://anongit.freedesktop.org/drm-intel 
Mesa: mesa-10.6.3 ddc976368fef367e464472ebcc2ac4fd89eb9fd8 from http://cgit.freedesktop.org/mesa/mesa/ 
Xf86_video_intel: 2.99.917 baec802b21387d04aebb10ac29e719a1800c5aa0 from http://cgit.freedesktop.org/xorg/driver/xf86-video-intel/ 
Libdrm: libdrm-2.4.62 ba4b5ac010ab85406ec52e3906e13d58cd9aa782 from http://cgit.freedesktop.org/mesa/drm/ 
Cairo: 1.14.2 from 93422b3cb5e0ef8104b8194c8873124ce2f5ea2d http://cgit.freedesktop.org/cairo 
libva: libva-1.6.0 a8008998bc0d4a76ae6927607c048e52ba50fd0e from http://cgit.freedesktop.org/libva/ 
intel-driver: 1.6.0 32268c46d538667d437dc9266aa4c183e51c1286 from http://cgit.freedesktop.org/vaapi/intel-driver 
Xserver: xorg-server-1.17.2 2123f7682d522619f101b05fb75efa75dabbe371 from http://cgit.freedesktop.org/xorg/xserver 

Kernel commit log:
commit 30263ef782e0548c114fb6f2771b58b27c56ba0d
Author: Jani Nikula
Date: Mon Aug 17 10:19:43 2015 +0300
drm-intel-nightly: 2015y-08m-17d-07h-19m-25s UTC integration manifest
Comment 9 cprigent 2015-08-23 14:12:32 UTC
Updated to Highest and Blocker. This is a PV blocker.
Comment 10 Gavin Hindman 2015-08-24 19:42:41 UTC
Does SW rotation still work properly? (assuming there's a flag to disable HW rotation)  That is an acceptable PV workaround for the platform, though the issue should still be root-caused and fixed.
Comment 11 cprigent 2015-09-01 16:58:30 UTC
We didn't find how to disable HW rotation.
For information fbcon rotate works which looks like a SW rotation.
Also here are kms_rotation_crc igt results:
igt@kms_rotation_crc@bad-pixel-format 		        Pass 	
igt@kms_rotation_crc@bad-tiling 			Pass 	
igt@kms_rotation_crc@cursor-rotation-180 		Pass 	
igt@kms_rotation_crc@primary-rotation-180 		Pass 	
igt@kms_rotation_crc@primary-rotation-270 		Pass 	
igt@kms_rotation_crc@primary-rotation-90 		Pass 	
igt@kms_rotation_crc@sprite-rotation-180 		Pass 	
igt@kms_rotation_crc@sprite-rotation-270 		Pass 	
igt@kms_rotation_crc@sprite-rotation-90 		Fail 	
igt@kms_rotation_crc@sprite-rotation-90-pos-100-0 	Fail
Comment 12 Tvrtko Ursulin 2015-09-07 12:49:47 UTC
Some comments:

1. I couldn't reproduce the IGT failures on todays nightly kernel. Can you explore those failures on your end more?

2. Xorg.log you attached will need to be full debug for Chris to analyse (see comment #1). Also it is not clear to me it is attempting any rotations - "rotation normal" ?

3. Kernel log also does not suggest HW rotation is being attempted. You would see something like:

   [drm:intel_rotate_fb_obj_pages] Created rotated page mapping for object size...
Comment 13 Tvrtko Ursulin 2015-09-07 13:27:26 UTC
Created attachment 118121 [details]
ddx full debug log

I tried the "rotate left then right" scenario and it did not result in a black screen here. Log attached.

Thing I realised though is - hardware 90/270 rotation requires Y tiling which AFAIR DDX will not do unless recompiled with a different default.
Comment 14 Tvrtko Ursulin 2015-09-07 13:36:58 UTC
Created attachment 118122 [details]
ddx debug log in Y tiling mode

With the DDX rebuilt to default to Y tiling, this logs shows that when "xrandr -o left" it abandons the Y tiled FB and goes back to X tiled. Presumably falling back to software rotation in the process.
Comment 15 Chris Wilson 2015-09-07 16:21:00 UTC
(In reply to Tvrtko Ursulin from comment #14)
> Created attachment 118122 [details]
> ddx debug log in Y tiling mode
> 
> With the DDX rebuilt to default to Y tiling, this logs shows that when
> "xrandr -o left" it abandons the Y tiled FB and goes back to X tiled.

It sets the rotation, and then the kernel rejects the setcrtc and so it is forced to use a shadowfb, X without rotation, and perform manual rotations (using the GPU of course!) from the Y-tiled frontbuffer to the X-tiled framebuffer.
Comment 16 Tvrtko Ursulin 2015-09-08 09:11:51 UTC
(In reply to Chris Wilson from comment #15)
> (In reply to Tvrtko Ursulin from comment #14)
> > Created attachment 118122 [details]
> > ddx debug log in Y tiling mode
> > 
> > With the DDX rebuilt to default to Y tiling, this logs shows that when
> > "xrandr -o left" it abandons the Y tiled FB and goes back to X tiled.
> 
> It sets the rotation, and then the kernel rejects the setcrtc and so it is
> forced to use a shadowfb, X without rotation, and perform manual rotations
> (using the GPU of course!) from the Y-tiled frontbuffer to the X-tiled
> framebuffer.

Does it try to go Y tiled when attempting to rotate, in the default build? 

Interestingly in the Y tiled build there seems to be a path where it doesn't use fb modifiers ("[drm:intel_framebuffer_init] No Y tiling for legacy addfb").
Comment 17 Chris Wilson 2015-09-08 09:22:46 UTC
(In reply to Tvrtko Ursulin from comment #16)
> (In reply to Chris Wilson from comment #15)
> > (In reply to Tvrtko Ursulin from comment #14)
> > > Created attachment 118122 [details]
> > > ddx debug log in Y tiling mode
> > > 
> > > With the DDX rebuilt to default to Y tiling, this logs shows that when
> > > "xrandr -o left" it abandons the Y tiled FB and goes back to X tiled.
> > 
> > It sets the rotation, and then the kernel rejects the setcrtc and so it is
> > forced to use a shadowfb, X without rotation, and perform manual rotations
> > (using the GPU of course!) from the Y-tiled frontbuffer to the X-tiled
> > framebuffer.
> 
> Does it try to go Y tiled when attempting to rotate, in the default build? 

It's tricky. The buffer cannot be exported and Y-tiling is so much slower for common operations that I am not convinced it is worth it. It is possible for the client to provide a Y-tiled buffer that we will then use. But since the setcrtc failed...


> Interestingly in the Y tiled build there seems to be a path where it doesn't
> use fb modifiers ("[drm:intel_framebuffer_init] No Y tiling for legacy
> addfb").

Right, during the start up it tests whether the interface is deliberately broken.
Comment 18 Tvrtko Ursulin 2015-09-08 09:29:23 UTC
(In reply to Chris Wilson from comment #17)
> (In reply to Tvrtko Ursulin from comment #16)
> > (In reply to Chris Wilson from comment #15)
> > > (In reply to Tvrtko Ursulin from comment #14)
> > > > Created attachment 118122 [details]
> > > > ddx debug log in Y tiling mode
> > > > 
> > > > With the DDX rebuilt to default to Y tiling, this logs shows that when
> > > > "xrandr -o left" it abandons the Y tiled FB and goes back to X tiled.
> > > 
> > > It sets the rotation, and then the kernel rejects the setcrtc and so it is
> > > forced to use a shadowfb, X without rotation, and perform manual rotations
> > > (using the GPU of course!) from the Y-tiled frontbuffer to the X-tiled
> > > framebuffer.
> > 
> > Does it try to go Y tiled when attempting to rotate, in the default build? 
> 
> It's tricky. The buffer cannot be exported and Y-tiling is so much slower
> for common operations that I am not convinced it is worth it. It is possible
> for the client to provide a Y-tiled buffer that we will then use. But since
> the setcrtc failed...

So basically the reported black screen has nothing to do with hardware rotation, since hardware rotation is not supported since it requires Y tiling which the DDX won't attempt.

And either way, since I could not reproduce the black screen, someone else will have to provide full debug logs for that case.
 
> > Interestingly in the Y tiled build there seems to be a path where it doesn't
> > use fb modifiers ("[drm:intel_framebuffer_init] No Y tiling for legacy
> > addfb").
> 
> Right, during the start up it tests whether the interface is deliberately
> broken.

I am pretty sure I've seen it when requesting rotation, not on startup.
Comment 19 Chris Wilson 2015-09-08 09:37:58 UTC
(In reply to Tvrtko Ursulin from comment #18)
> (In reply to Chris Wilson from comment #17)
> > (In reply to Tvrtko Ursulin from comment #16)
> > > (In reply to Chris Wilson from comment #15)
> > > > (In reply to Tvrtko Ursulin from comment #14)
> > > > > Created attachment 118122 [details]
> > > > > ddx debug log in Y tiling mode
> > > > > 
> > > > > With the DDX rebuilt to default to Y tiling, this logs shows that when
> > > > > "xrandr -o left" it abandons the Y tiled FB and goes back to X tiled.
> > > > 
> > > > It sets the rotation, and then the kernel rejects the setcrtc and so it is
> > > > forced to use a shadowfb, X without rotation, and perform manual rotations
> > > > (using the GPU of course!) from the Y-tiled frontbuffer to the X-tiled
> > > > framebuffer.
> > > 
> > > Does it try to go Y tiled when attempting to rotate, in the default build? 
> > 
> > It's tricky. The buffer cannot be exported and Y-tiling is so much slower
> > for common operations that I am not convinced it is worth it. It is possible
> > for the client to provide a Y-tiled buffer that we will then use. But since
> > the setcrtc failed...
> 
> So basically the reported black screen has nothing to do with hardware
> rotation, since hardware rotation is not supported since it requires Y
> tiling which the DDX won't attempt.

The scenario is the same, hw rotation is still requested. We depend on the kernel reporting the failure to go back to manual rotation. So whilst the GTT view should never be created, setting the rotation property during a setcrtc would seem to be the trigger.

> And either way, since I could not reproduce the black screen, someone else
> will have to provide full debug logs for that case.
>  
> > > Interestingly in the Y tiled build there seems to be a path where it doesn't
> > > use fb modifiers ("[drm:intel_framebuffer_init] No Y tiling for legacy
> > > addfb").
> > 
> > Right, during the start up it tests whether the interface is deliberately
> > broken.
> 
> I am pretty sure I've seen it when requesting rotation, not on startup.

On reflection, we only try addfb2 if addfb says no (so everytime).
Comment 20 Tvrtko Ursulin 2015-09-08 09:46:36 UTC
Since I couldn't reproduce the black screen, and we have determined DDX will effectively not try hardware rotation for 90/270, ressigning back to Cristophe to provide debug logs.
Comment 21 Olivier Berthier 2015-09-10 08:25:41 UTC
Created attachment 118181 [details]
dmesg log with rotation 90-270 on drm-nightly ww37 (tar.gz)

Here the dmesg log file for the kms_rotation_crc tests on IGT with the patch on Sky Lake Y with the drm-intel-nightly kernel at :
commit b7be838c844cbccef1c863e2cbcc44952c7f657c
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Wed Sep 9 16:49:55 2015 +0200

    drm-intel-nightly: 2015y-09m-09d-14h-49m-13s UTC integration manifest

The result is dmesg-warn, and sometimes IGT return dmesg-fail.

I don't reproduce the bug with xrandr on this kernel.

On the last drm-intel-testing tag (2015-08-28), I reproduce the IGT test cause a kernel panic.
Comment 22 Tvrtko Ursulin 2015-09-10 08:53:15 UTC
(In reply to Olivier Berthier from comment #21)
> Created attachment 118181 [details]
> dmesg log with rotation 90-270 on drm-nightly ww37 (tar.gz)
> 
> Here the dmesg log file for the kms_rotation_crc tests on IGT with the patch
> on Sky Lake Y with the drm-intel-nightly kernel at :
> commit b7be838c844cbccef1c863e2cbcc44952c7f657c
> Author: Daniel Vetter <daniel.vetter@ffwll.ch>
> Date:   Wed Sep 9 16:49:55 2015 +0200
> 
>     drm-intel-nightly: 2015y-09m-09d-14h-49m-13s UTC integration manifest
> 
> The result is dmesg-warn, and sometimes IGT return dmesg-fail.

I don't see any test fails or warnings triggered by it in the log you attached. Is that the correct log?
 
> I don't reproduce the bug with xrandr on this kernel.
> 
> On the last drm-intel-testing tag (2015-08-28), I reproduce the IGT test
> cause a kernel panic.

Log?
Comment 23 Olivier Berthier 2015-09-10 09:48:10 UTC
Created attachment 118183 [details]
piglit results file igt@kms_rotation_crc* with 90-270

I add the results.json file from piglit.
Comment 24 Tvrtko Ursulin 2015-10-01 10:06:16 UTC
(In reply to Olivier Berthier from comment #23)
> Created attachment 118183 [details]
> piglit results file igt@kms_rotation_crc* with 90-270
> 
> I add the results.json file from piglit.

I don't see the kernel panic?
Comment 25 cprigent 2015-10-01 15:10:48 UTC
Bug scrub:
Assigned to Olivier. Please check logs and report the kernel panic in another bug if reproduced
Comment 26 Olivier Berthier 2015-10-02 13:38:19 UTC
Not reproduced on Sky Lake Y with the kernel 4.3.0-rc2-drm-intel-testing-2015-09-28.
Comment 27 cprigent 2016-02-22 12:06:54 UTC
So closed as not reproduced


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.