Bug 41158

Summary: RADEON KMS: radeon_crtc_cursor_move is off by one pixel
Product: DRI Reporter: Nicholas Miell <nmiell>
Component: DRM/RadeonAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: XOrg git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
test cursor theme, unzip into ~/.icons and configure your desktop environment to use it none

Description Nicholas Miell 2011-09-23 11:46:12 UTC
Created attachment 51555 [details]
test cursor theme, unzip into ~/.icons and configure your desktop environment to use it

When the mouse cursor is partially off the top or left edge of the screen, the cursor image is drawn one pixel further to the top or left than the actual position.

This manifests itself in two ways:

1) When the cursor transitions from entirely on the screen to partially offscreen, the image jumps two pixels instead of moving by only one pixel. (Due to the transition from a correctly positioned image to an off-by-one image.)

2) It is possible to move the cursor's hotspot off the screen. (Appearance only, of course, as far as X is concerned the hotspot is still in the uppermost or leftmost row of pixels.)

This seems obvious when you map out what the function actually does to calculate the xorigin and yorigin values, but some doubt was raised based on the wording of the register descriptions in the manuals. (Instead of speaking of offsets or coordinates, the term "length" is used, and it wasn't clear whether this length included the actual hotspot pixel.)

So I tested it empirically by constructing a rather hideous looking cursor theme. It is a 31x31 mouse cursor image with the hotspot on the exact center pixel.

The cursor has a one pixel red border. Immediately inside the red border is one pixel of yellow. You will not be able to position the cursor on the screen such that the outer red border is off the top or left but the inner yellow border is still visible.

There is a one pixel wide yellow cross in the center of the cursor image, with the center pixel of the cross being the cursor's hotspot. Surrounding the yellow cross is a one pixel red border. When you move the cursor to the upper left pixel, the yellow cross vanishes entirely, which shouldn't be possible because you can't move the mouse cursor's hotspot off of the screen.

Neither of these things happen when you use SWcursor.

Testing was done on a RS880. I assume Evergreen is broken in the same way, but I'm not sure about pre-Avivo chips.
Comment 1 Michel Dänzer 2011-09-29 10:24:24 UTC
Indeed, looks like you're right even for pre-AVIVO (tested on RV350).

Can you submit a patch to fix this to the dri-devel list?
Comment 2 Michel Dänzer 2011-10-05 02:38:36 UTC
Your fix has landed in Linus' tree as commit b356fe0afe9aa2cfdc7be0bae22ea1c93afc2451, thanks!

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.