Bug 97236 - No mouse cursor after xrandr --transform
Summary: No mouse cursor after xrandr --transform
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Chris Wilson
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-08 06:37 UTC by Da Fox
Modified: 2016-08-08 10:36 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Xorg.0.log (81.16 KB, text/plain)
2016-08-08 06:38 UTC, Da Fox
no flags Details

Description Da Fox 2016-08-08 06:37:43 UTC
I'm trying to implement a small rotation of my screen output, such that the entirety of the screen still fits on the output. I.e. something like this:
+---------------------------------+
|      '---..                     |
|     /      ''---..              |
|    /              ''---..       |
|   /                      ''---..|
|  /                            / |
| /                            /  |
|''--..                       /   |
|      ''--..                /    |
|            ''--..         /     |
|                  ''--..  /      |
|                        ''       |
+---------------------------------+
Where the outer box represents the real output, e.g. 1920x1080px, and the inner box represent a 10 degree rotated virtual screen of 1482x834px. Rotation and size of the inner virtual screen is such that after rotation, the corners of the virtual screen just touch the outer border.

This should be (is) possible with the --transform option to xranr. Incidentally the rotation example given in the man-page does something completely different:
+---------------------------------+
|'---..                           |
|      ''---..                    |
|             ''---..             |
|                    ''---..      |
|                           ''---.|
|                               / |
|                              /  |
|                             /   |
|                            /    |
|                           /     |
|                          /      |
+---------------------------------+
I.e. it rotates the screen around the origin (0,0), and the final result does not fit the output; a large part of the virtual screen is hidden outside of view.

The correct way to rotate a screen is to first translate, then do the rotation, and finally translate back. This does still not solve the problem of parts of the virtual screen being cut off and 'hidden' outside borders of the output. For this an additional scaling is required. Quite counter intuitively this scaling must not be done using the --transform (or --scale) option, but rather by specifying a smaller virtual screen size (using the --fb option).

Putting all of this together, the following command will rotate & scale a 1920x1080 virtual screen by 10 degrees, so that the rotated and scaled virtual screen still fits the 1920x1080 output:
/usr/bin/xrandr --output LVDS1 --fb 1482x834 --transform 0.984808,0.173648,-298.19,-0.173648,0.984808,52.906,0,0,1



The problem now is that after issuing the above command, my mouse cursor disappears entirely. I can see that the mouse still works because I can click on things and see e.g. mouse-over effects triggering, but the mouse cursor itself is completely invisible.

--------------------------------------------------------

Software versions:
xorg-server 1.18.3
xrandr 1.4.3
libXcursor 1.1.14
xf86-video-intel 2.99.917_p20160704
Kernel 4.7.0-rc5

I am using the 'whiteglass' cursor theme.
Comment 1 Da Fox 2016-08-08 06:38:53 UTC
Created attachment 125582 [details]
Xorg.0.log
Comment 2 Michel Dänzer 2016-08-08 07:14:44 UTC
This is probably an intel driver issue. (Could be related to bug 94677?)
Comment 3 Chris Wilson 2016-08-08 09:10:45 UTC
Step 1. I had forgotten to cancel the translate when computing the right affine transformation for the hw cursor image.

Appears the cursor position is off as well... :|
Comment 4 Chris Wilson 2016-08-08 10:36:09 UTC
commit 52343d7da1cc8f3aef3497dfac5d16c249b2a63d
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Aug 8 11:31:51 2016 +0100

    sna: Remove translation from affine HW cursor transformation
    
    When the CRTC is transformed, we also want to apply that transformation
    to the cursor image so that we can continue to use the HW cursor (but
    have it appear relative to the output and not to the framebuffer).
    However, we need to convert the CRTC transformation relative to the
    cursor and convert it to a simple rotation/scaling/skew transformation
    (we already verify it is an affine) by removing any translation.
    
    Reported-by: Da Fox <da.fox.mail@gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97236
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>


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.