Bug 14820

Summary: randr 1.2 always shows the hwcursor after a mode change
Product: xorg Reporter: Stephane Marchesin <marchesin>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: ppaalanen
Version: git   
Hardware: Other   
OS: All   
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 16399, 17452    
Description Flags
Xorg log file
Log file on the 2nd card
Log file with the nv10
1st option
2nd option
Proposed fix.
A better fix.
Tested and working patch
Oops none

Description Stephane Marchesin 2008-03-04 15:03:17 UTC
Created attachment 14833 [details]
Xorg log file

With Randr1.2 enabled, I get two mouse cursors after a few mode changes. One that moves (sw emulated cursor) and one that doesn't (presumably the hw cursor sitting there).

01:00.0 0300: 10de:002d (rev 15)
01:00.0 VGA compatible controller: nVidia Corporation NV5M64 [RIVA TNT2 Model 64/Model 64 Pro] (rev 15)
Comment 1 Stephane Marchesin 2008-03-04 15:10:20 UTC
Same on this card:

00:08.0 0300: 10de:002c (rev 15)
00:08.0 VGA compatible controller: nVidia Corporation NV6 [Vanta/Vanta LT] (rev 15)

The 2nd cursor seems to appear after the first mode change, i.e. after xrandr -s 1 for example. The hw cursor is the default X cursor (X shaped) and the sw cursor is my normal gnome cursor and works fine.
Comment 2 Stephane Marchesin 2008-03-04 15:11:52 UTC
Created attachment 14834 [details]
Log file on the 2nd card
Comment 3 Stephane Marchesin 2008-03-04 15:43:29 UTC
I also get this on an nv10. On that card, the hardware cursor is wrong, but that's for another bug.

01:00.0 0300: 10de:0101 (rev 10)
01:00.0 VGA compatible controller: nVidia Corporation NV10DDR [GeForce 256 DDR] (rev 10)
Comment 4 Stephane Marchesin 2008-03-04 15:44:06 UTC
Created attachment 14838 [details]
Log file with the nv10
Comment 5 Maarten Maathuis 2008-03-04 15:45:41 UTC
Do you also get this when forcing a SWCursor on a NV11+ card?
Comment 6 Stephane Marchesin 2008-03-05 11:11:52 UTC
(In reply to comment #5)
> Do you also get this when forcing a SWCursor on a NV11+ card?

No I don't.
Comment 7 Stuart Bennett 2008-03-06 14:17:01 UTC
Created attachment 14896 [details] [review]
1st option

First of two possible fixes. This one definitely does the right thing, but is probably overkill.
Comment 8 Stuart Bennett 2008-03-06 14:18:36 UTC
Created attachment 14897 [details] [review]
2nd option

A less heavyweight solution, but I don't know for sure that GetSpriteCursor is always going to do the right thing. This stuff really wants fixing in the xserver.
Comment 9 Stuart Bennett 2008-03-06 14:47:20 UTC
Original nouveau bug repurposed for xserver issue.

After an xrandr mode change, drivers tend to call xf86_reload_cursors in the commit function. This in turn will show a hw cursor, if configured. This is not the correct behaviour for hardware that cannot do alpha cursors natively, if the cursor is an alpha cursor at the time; two cursors (one hardware (2 colour), one software (alpha)) show up, when the hardware cursor should be hidden.

In the nouveau case, the 1st option in comment 7 has been applied to the driver as a work-around which takes a trip through xf86CursorSetCursor which sorts things out.
Comment 10 Maarten Maathuis 2008-03-20 13:22:49 UTC
Created attachment 15344 [details] [review]
Proposed fix.

This should fix it.
Comment 11 Stuart Bennett 2008-03-26 10:08:11 UTC
Doesn't work (when applied to xserver 1.3.0, anyway). IIRC this approach won't work, as the cursor_shown variable will still get set when xf86CursorSetCursor calls xf86SetCursor on the hw cursor path.
Comment 12 Maarten Maathuis 2008-04-01 15:35:42 UTC
Created attachment 15617 [details] [review]
A better fix.

It may not be perfect yet, so comment is appreciated.
Comment 13 Stuart Bennett 2008-08-10 14:40:48 UTC
Created attachment 18201 [details] [review]
Tested and working patch

This seems to work for all the cases I could think to test
Comment 14 Stuart Bennett 2008-08-10 14:47:05 UTC
Created attachment 18202 [details] [review]

Okay, it *was* tested and working, before I moved some comments and whitespace around, and deleted a semicolon.
Comment 15 Pekka Paalanen 2008-08-22 13:02:07 UTC
Using the git xserver not older than a week, I seem to get bitten by this bug.

I like to play Diablo II using Wine, but in the game I see the game mouse cursor which is alive, and another cursor stuck where-ever the cursor was when the game switched display modes. The stuck cursor is whatever the cursor was when starting the game, and on desktop I'm using the standard hw cursors.
Comment 16 Keith Packard 2008-12-02 23:01:21 UTC
Patch applied in 0b8f8b24f718820a72ebdc52423c2e6a44e848c5

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.