After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 786023 - Screen rotation not applied to input layer
Screen rotation not applied to input layer
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
3.25.x
Other Linux
: Normal critical
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2017-08-08 21:53 UTC by Adam Williamson
Modified: 2017-08-22 11:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ShakyCam(TM) video of the bug (webm) (2.81 MB, application/octet-stream)
2017-08-08 21:54 UTC, Adam Williamson
  Details
monitor-manager: Don't cancel confirm dialog on verifying (2.64 KB, patch)
2017-08-11 07:14 UTC, Jonas Ådahl
none Details | Review
cursor-renderer-native: Don't use HW cursor on transformed logical monitor (3.47 KB, patch)
2017-08-11 07:14 UTC, Jonas Ådahl
none Details | Review
monitor-manager: Remove unused meta_monitor_manager_get_resources() API (3.12 KB, patch)
2017-08-11 07:14 UTC, Jonas Ådahl
accepted-commit_now Details | Review
monitor-manager: Don't cancel confirm dialog on verifying (1.14 KB, patch)
2017-08-21 03:11 UTC, Jonas Ådahl
committed Details | Review
cursor-renderer-native: Don't use HW cursor on transformed logical monitor (4.98 KB, patch)
2017-08-21 03:12 UTC, Jonas Ådahl
committed Details | Review

Description Adam Williamson 2017-08-08 21:53:24 UTC
With version 3.25.4 of all relevant components (mutter, control-center, gnome-shell), when I rotate either of my displays, the display is rotated but the input layer does not seem to be. By that I mean the cursor is still drawn as if no rotation was applied (so it's effectively 'sideways'), and the input layer still seems to think everything is where it would be if the screen weren't rotated - say a button is in the top middle of the screen, to click on it I have to click on the area of the screen that would be the 'top middle' if the screen were *not* rotated. Clicking on what's *actually* the top middle of the screen doesn't work at all.

I'm attaching a video which should hopefully clarify things, if the explanation wasn't enough. After I rotate the screen in the video, first I just show that the cursor has the wrong orientation; then I move the cursor over the window close button and click, and you see it *doesn't* close the window (because it thinks I'm clicking on the top *left* hand corner of the window, which would be in that position if the screen were not rotated); then I move the cursor to an entry in the list of nicknames and click a few times, and you can see that it's actually selecting / deselecting some text in the main channel window; note that if the screen were *not* rotated, that text would be in the place where the cursor is.
Comment 1 Adam Williamson 2017-08-08 21:54:56 UTC
Created attachment 357218 [details]
ShakyCam(TM) video of the bug (webm)
Comment 2 Adam Williamson 2017-08-08 21:58:20 UTC
Whenever I rotate the display I get these messages in the journal:

Aug 08 13:32:32 adam.happyassassin.net gnome-shell[2577]: Failed to apply DRM plane transform 0: Invalid argument
Aug 08 13:32:32 adam.happyassassin.net gnome-shell[2577]: Failed to apply DRM plane transform 0: Invalid argument
Aug 08 13:32:32 adam.happyassassin.net gsd-color[2913]: failed to set screen _ICC_PROFILE: Failed to open file “/var/lib/gdm/.local/share/icc/edid-6de393498033ef1303dc340fc30e4908.icc”: Permission denied

note I did also see those in the past, when rotation worked correctly. The graphics card is an NVIDIA GeForce 9600 GT, the monitors are Dell U2211H, connected via DVI.
Comment 3 Adam Williamson 2017-08-11 00:10:40 UTC
So this doesn't seem to be related to gnome-settings-daemon. I downgraded back to 3.24.3 (the version I was running the last time I was able to rotate successfully) and that didn't help. I'm not yet sure what the offending component is, but I'll keep trying to identify it. If anyone can name components that *may* be related, it'd help...
Comment 4 Adam Williamson 2017-08-11 00:28:52 UTC
OK, I figured out the offending component: it's gnome-control-center. control-center-3.25.4-2.fc27 displays this bug; control-center-3.24.2-3.fc27 behaves correctly. So the bug appeared somewhere between those versions.
Comment 5 Adam Williamson 2017-08-11 00:31:32 UTC
I see 3.25.90 was tagged yesterday, so I'll see if that behaves any better when Fedora packages land.
Comment 6 Florian Müllner 2017-08-11 00:35:20 UTC
(In reply to Adam Williamson from comment #4)
> OK, I figured out the offending component: it's gnome-control-center.
> control-center-3.25.4-2.fc27 displays this bug; control-center-3.24.2-3.fc27
> behaves correctly. So the bug appeared somewhere between those versions.

That may be a red herring - 3.24.4 moved to mutter's new display management API, so it's entirely possible that gnome-control-center just exposed a regression in mutter (with regard to the still available legacy API).
Comment 7 Adam Williamson 2017-08-11 00:44:50 UTC
Aha, I see. How can I check whether that's the case? What data would be useful?
Comment 8 Jonas Ådahl 2017-08-11 02:35:23 UTC
The output of "modetest" could be useful.
Comment 9 Adam Williamson 2017-08-11 04:21:07 UTC
[root@adam adamw]# modetest
trying to open device 'i915'...failed
trying to open device 'amdgpu'...failed
trying to open device 'radeon'...failed
trying to open device 'nouveau'...done
Encoders:
id	crtc	type	possible crtcs	possible clones	
43	0	DAC	0x00000003	0x00000000
44	38	TMDS	0x00000003	0x00000000
46	0	DAC	0x00000003	0x00000000
47	41	TMDS	0x00000003	0x00000000

Connectors:
id	encoder	status		name		size (mm)	modes	encoders
42	44	connected	DVI-I-1        	480x270		11	43, 44
  modes:
	name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
  1920x1080 60 1920 2008 2052 2200 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: preferred, driver
  1280x1024 75 1280 1296 1440 1688 1024 1025 1028 1066 135000 flags: phsync, pvsync; type: driver
  1280x1024 60 1280 1328 1440 1688 1024 1025 1028 1066 108000 flags: phsync, pvsync; type: driver
  1152x864 75 1152 1216 1344 1600 864 865 868 900 108000 flags: phsync, pvsync; type: driver
  1024x768 75 1024 1040 1136 1312 768 769 772 800 78750 flags: phsync, pvsync; type: driver
  1024x768 60 1024 1048 1184 1344 768 771 777 806 65000 flags: nhsync, nvsync; type: driver
  800x600 75 800 816 896 1056 600 601 604 625 49500 flags: phsync, pvsync; type: driver
  800x600 60 800 840 968 1056 600 601 605 628 40000 flags: phsync, pvsync; type: driver
  640x480 75 640 656 720 840 480 481 484 500 31500 flags: nhsync, nvsync; type: driver
  640x480 60 640 656 752 800 480 490 492 525 25175 flags: nhsync, nvsync; type: driver
  720x400 70 720 738 846 900 400 412 414 449 28320 flags: nhsync, pvsync; type: driver
  props:
	1 EDID:
		flags: immutable blob
		blobs:

		value:
			00ffffffffffff0010ac5e404c364a41
			2e14010380301b78eeee95a3544c9926
			0f5054a54b00714f8180d1c001010101
			010101010101023a801871382d40582c
			4500db0b1100001e000000ff00585656
			3538304249414a364c0a000000fc0044
			454c4c205532323131480a20000000fd
			00384c1e5311000a2020202020200003
	2 DPMS:
		flags: enum
		enums: On=0 Standby=1 Suspend=2 Off=3
		value: 0
	5 link-status:
		flags: enum
		enums: Good=0 Bad=1
		value: 0
	28 subconnector:
		flags: immutable enum
		enums: Unknown=0 DVI-D=3 DVI-A=4
		value: 3
	31 underscan:
		flags: enum
		enums: auto=2 off=0 on=1
		value: 0
	32 underscan hborder:
		flags: range
		values: 0 128
		value: 0
	33 underscan vborder:
		flags: range
		values: 0 128
		value: 0
	34 vibrant hue:
		flags: range
		values: 0 180
		value: 90
	35 color vibrance:
		flags: range
		values: 0 200
		value: 150
	26 scaling mode:
		flags: enum
		enums: None=0 Full=1 Center=2 Full aspect=3
		value: 0
	29 dithering mode:
		flags: enum
		enums: auto=34 off=0 static 2x2=25 dynamic 2x2=17
		value: 34
	30 dithering depth:
		flags: enum
		enums: auto=3 6 bpc=0 8 bpc=2
		value: 3
45	47	connected	DVI-I-2        	480x270		11	46, 47
  modes:
	name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
  1920x1080 60 1920 2008 2052 2200 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: preferred, driver
  1280x1024 75 1280 1296 1440 1688 1024 1025 1028 1066 135000 flags: phsync, pvsync; type: driver
  1280x1024 60 1280 1328 1440 1688 1024 1025 1028 1066 108000 flags: phsync, pvsync; type: driver
  1152x864 75 1152 1216 1344 1600 864 865 868 900 108000 flags: phsync, pvsync; type: driver
  1024x768 75 1024 1040 1136 1312 768 769 772 800 78750 flags: phsync, pvsync; type: driver
  1024x768 60 1024 1048 1184 1344 768 771 777 806 65000 flags: nhsync, nvsync; type: driver
  800x600 75 800 816 896 1056 600 601 604 625 49500 flags: phsync, pvsync; type: driver
  800x600 60 800 840 968 1056 600 601 605 628 40000 flags: phsync, pvsync; type: driver
  640x480 75 640 656 720 840 480 481 484 500 31500 flags: nhsync, nvsync; type: driver
  640x480 60 640 656 752 800 480 490 492 525 25175 flags: nhsync, nvsync; type: driver
  720x400 70 720 738 846 900 400 412 414 449 28320 flags: nhsync, pvsync; type: driver
  props:
	1 EDID:
		flags: immutable blob
		blobs:

		value:
			00ffffffffffff0010ac5e404c385341
			2e14010380301b78eeee95a3544c9926
			0f5054a54b00714f8180d1c001010101
			010101010101023a801871382d40582c
			4500db0b1100001e000000ff00585656
			35383042494153384c0a000000fc0044
			454c4c205532323131480a20000000fd
			00384c1e5311000a20202020202000ed
	2 DPMS:
		flags: enum
		enums: On=0 Standby=1 Suspend=2 Off=3
		value: 0
	5 link-status:
		flags: enum
		enums: Good=0 Bad=1
		value: 0
	28 subconnector:
		flags: immutable enum
		enums: Unknown=0 DVI-D=3 DVI-A=4
		value: 3
	31 underscan:
		flags: enum
		enums: auto=2 off=0 on=1
		value: 0
	32 underscan hborder:
		flags: range
		values: 0 128
		value: 0
	33 underscan vborder:
		flags: range
		values: 0 128
		value: 0
	34 vibrant hue:
		flags: range
		values: 0 180
		value: 90
	35 color vibrance:
		flags: range
		values: 0 200
		value: 150
	26 scaling mode:
		flags: enum
		enums: None=0 Full=1 Center=2 Full aspect=3
		value: 0
	29 dithering mode:
		flags: enum
		enums: auto=34 off=0 static 2x2=25 dynamic 2x2=17
		value: 34
	30 dithering depth:
		flags: enum
		enums: auto=3 6 bpc=0 8 bpc=2
		value: 3

CRTCs:
id	fb	pos	size
38	75	(0,0)	(1920x1080)
  1920x1080 60 1920 2008 2052 2200 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: preferred, driver
  props:
41	80	(0,0)	(1920x1080)
  1920x1080 60 1920 2008 2052 2200 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: preferred, driver
  props:

Planes:
id	crtc	fb	CRTC x,y	x,y	gamma size	possible crtcs
36	38	60	0,0		0,0	0       	0x00000001
  formats: C8   RG16 XR15 AR15 XR24 AR24 XB30 AB30 XB24 AB24
  props:
	6 type:
		flags: immutable enum
		enums: Overlay=0 Primary=1 Cursor=2
		value: 1
37	0	0	0,0		0,0	0       	0x00000001
  formats: AR24
  props:
	6 type:
		flags: immutable enum
		enums: Overlay=0 Primary=1 Cursor=2
		value: 2
39	41	80	0,0		0,0	0       	0x00000002
  formats: C8   RG16 XR15 AR15 XR24 AR24 XB30 AB30 XB24 AB24
  props:
	6 type:
		flags: immutable enum
		enums: Overlay=0 Primary=1 Cursor=2
		value: 1
40	0	0	0,0		0,0	0       	0x00000002
  formats: AR24
  props:
	6 type:
		flags: immutable enum
		enums: Overlay=0 Primary=1 Cursor=2
		value: 2

Frame buffers:
id	size	pitch
Comment 10 Jonas Ådahl 2017-08-11 07:14:01 UTC
Created attachment 357380 [details] [review]
monitor-manager: Don't cancel confirm dialog on verifying

When another D-Bus call that just tries to verify a configuration is
made, don't cancel any active monitor configuration dialog, as doing so
would effectively confirm queried configuration.
Comment 11 Jonas Ådahl 2017-08-11 07:14:06 UTC
Created attachment 357381 [details] [review]
cursor-renderer-native: Don't use HW cursor on transformed logical monitor

The HW cursor plane can't do any transformations, and as we still don't
pre-transform any buffer before uploading to the cursor plane, we must
disable the HW cursor when a logical monitor is transformed.

This worked previously because the transform of a MetaCrtc did not
correspond to the transform of a CRTC, but the transform of the logical
monitor the CRTC was assigned to.
Comment 12 Jonas Ådahl 2017-08-11 07:14:12 UTC
Created attachment 357382 [details] [review]
monitor-manager: Remove unused meta_monitor_manager_get_resources() API

Last user was the native cursor renderer.
Comment 13 Jonas Ådahl 2017-08-11 07:47:44 UTC
(moving back to mutter, as thats where the issue lies)
Comment 14 Adam Williamson 2017-08-11 18:17:08 UTC
There is still a reference to meta_monitor_manager_get_resources in src/backends/meta-monitor-config.c :

https://git.gnome.org/browse/mutter/tree/src/backends/meta-monitor-config.c#n2182
Comment 15 Florian Müllner 2017-08-11 18:26:34 UTC
(In reply to Adam Williamson from comment #14)
> There is still a reference to meta_monitor_manager_get_resources in
> src/backends/meta-monitor-config.c :
> 
> https://git.gnome.org/browse/mutter/tree/src/backends/meta-monitor-config.
> c#n2182

The patches here were likely done on top of the (new) ones from bug 777732 ...
Comment 16 Adam Williamson 2017-08-11 18:54:46 UTC
zoiks, that is a lot of patches. well, i'll try these just on their own, minus the API removal patch, and report on how it goes. if I have to just wait for a new release with all that stuff merged too, then fine, i guess.
Comment 17 Jonas Ådahl 2017-08-12 02:38:30 UTC
(In reply to Adam Williamson from comment #16)
> zoiks, that is a lot of patches. well, i'll try these just on their own,
> minus the API removal patch, and report on how it goes. if I have to just
> wait for a new release with all that stuff merged too, then fine, i guess.

Yoi can just ignore the patch removing .._get_resources(), it is just a cleanup that I seem to have placed incorrectly. No need to land all those other patches to test the fix in this bug.
Comment 18 Adam Williamson 2017-08-13 00:46:48 UTC
Confirmed, with the other two patches (and the rest of GNOME at 3.25.90), the bug is fixed. Thanks.
Comment 19 Florian Müllner 2017-08-13 01:00:04 UTC
Review of attachment 357380 [details] [review]:

The API additions ended up in the wrong patch ...
Comment 20 Florian Müllner 2017-08-13 01:00:18 UTC
Review of attachment 357381 [details] [review]:

LGTM, just a question:

::: src/backends/native/meta-cursor-renderer-native.c
@@ +389,3 @@
+  MetaBackend *backend = meta_get_backend ();
+  MetaMonitorManager *monitor_manager =
+    meta_backend_get_monitor_manager (backend);

Why this change? backend isn't used elsewhere in the function, so the more concise meta_monitor_get() seems fine?
(But a big yes to the s/monitors/monitor_manager/ change)
Comment 21 Jonas Ådahl 2017-08-13 05:17:49 UTC
(In reply to Florian Müllner from comment #20)
> Review of attachment 357381 [details] [review] [review]:
> 
> LGTM, just a question:
> 
> ::: src/backends/native/meta-cursor-renderer-native.c
> @@ +389,3 @@
> +  MetaBackend *backend = meta_get_backend ();
> +  MetaMonitorManager *monitor_manager =
> +    meta_backend_get_monitor_manager (backend);
> 
> Why this change? backend isn't used elsewhere in the function, so the more
> concise meta_monitor_get() seems fine?
> (But a big yes to the s/monitors/monitor_manager/ change)

The purpose is to decrease the number of global singletons (and maybe one day (almost) none), so I tend to always get the monitor manager from the backend (where one day the backend can be retrieved in some non-singleton way).
Comment 22 Jonas Ådahl 2017-08-21 03:11:57 UTC
Created attachment 358043 [details] [review]
monitor-manager: Don't cancel confirm dialog on verifying

When another D-Bus call that just tries to verify a configuration is
made, don't cancel any active monitor configuration dialog, as doing so
would effectively confirm queried configuration.
Comment 23 Jonas Ådahl 2017-08-21 03:12:06 UTC
Created attachment 358044 [details] [review]
cursor-renderer-native: Don't use HW cursor on transformed logical monitor

The HW cursor plane can't do any transformations, and as we still don't
pre-transform any buffer before uploading to the cursor plane, we must
disable the HW cursor when a logical monitor is transformed.

This worked previously because the transform of a MetaCrtc did not
correspond to the transform of a CRTC, but the transform of the logical
monitor the CRTC was assigned to.
Comment 24 Florian Müllner 2017-08-21 11:08:54 UTC
Review of attachment 358043 [details] [review]:

LGTM
Comment 25 Florian Müllner 2017-08-21 11:08:57 UTC
Review of attachment 358044 [details] [review]:

OK
Comment 26 Florian Müllner 2017-08-21 11:09:01 UTC
Review of attachment 357382 [details] [review]:

LGTM
Comment 27 Jonas Ådahl 2017-08-21 13:32:22 UTC
Attachment 358043 [details] pushed as 6584d06 - monitor-manager: Don't cancel confirm dialog on verifying
Attachment 358044 [details] pushed as 14fe6e9 - cursor-renderer-native: Don't use HW cursor on transformed logical monitor
Comment 28 Guillaume Ayoub 2017-08-22 11:16:35 UTC
*** Bug 783196 has been marked as a duplicate of this bug. ***