Bug 79809 - radeonsi: mouse cursor corruption using weston on AMD Kaveri
Summary: radeonsi: mouse cursor corruption using weston on AMD Kaveri
Status: RESOLVED FIXED
Alias: None
Product: Wayland
Classification: Unclassified
Component: weston (show other bugs)
Version: 1.5.0
Hardware: All All
: medium minor
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-09 02:15 UTC by Alvaro Fernando García
Modified: 2015-05-20 06:54 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
mouse cursor corruption photo 01 (283.53 KB, image/jpeg)
2014-06-09 02:15 UTC, Alvaro Fernando García
Details
Do not assume 64x64 cursor, added support for other sizes (like in AMD Kaveri, 128x128). (3.04 KB, patch)
2014-06-09 03:54 UTC, Alvaro Fernando García
Details | Splinter Review
Original patch + fallback to 64x64 (3.88 KB, patch)
2014-06-09 13:16 UTC, Alvaro Fernando García
Details | Splinter Review
gbm: Remove 64x64 restriction from GBM_BO_USE_CURSOR (4.15 KB, text/plain)
2014-06-10 03:53 UTC, Michel Dänzer
Details
cursor_size v3 (4.94 KB, patch)
2014-06-11 03:15 UTC, Alvaro Fernando García
Details | Splinter Review
cursor_size_v4 (original + fixes) (4.75 KB, patch)
2014-06-11 03:41 UTC, Alvaro Fernando García
Details | Splinter Review

Description Alvaro Fernando García 2014-06-09 02:15:08 UTC
Created attachment 100690 [details]
mouse cursor corruption photo 01

Distribution: Arch Linux
Hardware: AMD A10-7850K Kaveri APU
Kernel: 3.11+ (needed for Kaveri KMS support).

Description: After launching weston on AMD Kaveri APU (or similar), mouse cursor gets corrupted. 

The bug was initially reported to kernel bugtracker: https://bugzilla.kernel.org/show_bug.cgi?id=77531

The conclusion was that weston assumes 64x64 cursor size, when this hardware support only 128x128.

Steps to reproduce:
- Launch weston (tested with 1.4+).
- Mouse cursor gets corrupted.
Comment 1 Alvaro Fernando García 2014-06-09 02:17:47 UTC
This patch was mentioned in the kernel bug report as related to the issue:
http://cgit.freedesktop.org/xorg/driver/xf86-video-modesetting/commit/?id=677935b2d20f54f21c645b5eb386b6c9485fee5f
Comment 2 Alvaro Fernando García 2014-06-09 03:54:09 UTC
Created attachment 100697 [details] [review]
Do not assume 64x64 cursor, added support for other sizes (like in AMD Kaveri, 128x128).

I've written a patch based on the xf86-video-modesetting link.
Tested with weston-git + the patch, the problem is gone.
Comment 3 Emilio Pozuelo Monfort 2014-06-09 10:31:05 UTC
Comment on attachment 100697 [details] [review]
Do not assume 64x64 cursor, added support for other sizes (like in AMD Kaveri, 128x128).

Review of attachment 100697 [details] [review]:
-----------------------------------------------------------------

::: src/compositor-drm.c
@@ +1307,3 @@
>  	else
>  		ec->clock = CLOCK_REALTIME;
>  

Shouldn't you initialize ec->cursor_{width,height} to 64 here, so that if drmGetCap() fails later, we get a sensible value?
Comment 4 Alvaro Fernando García 2014-06-09 13:16:26 UTC
Created attachment 100737 [details] [review]
Original patch + fallback to 64x64

Is it ok like this? Added fallback to 64x64 if drmGetCap() fails.
Comment 5 Alex Deucher 2014-06-09 13:17:26 UTC
Michel has a patch to fix the cursor bo flag in gbm as well.
Comment 6 Michel Dänzer 2014-06-10 03:53:52 UTC
Created attachment 100784 [details]
gbm: Remove 64x64 restriction from GBM_BO_USE_CURSOR

Here's the GBM patch Alex mentioned.
Comment 7 Alvaro Fernando García 2014-06-10 13:14:34 UTC
So, should I update the patch to use GBM_BO_USE_CURSOR?
Comment 8 Michel Dänzer 2014-06-11 02:17:30 UTC
(In reply to comment #7)
> So, should I update the patch to use GBM_BO_USE_CURSOR?

I think so, then I'll submit the GBM patch to Mesa. But you'll need some kind of fallback for currently released versions of Mesa, which don't define GBM_BO_USE_CURSOR yet.
Comment 9 Alvaro Fernando García 2014-06-11 03:15:45 UTC
Created attachment 100856 [details] [review]
cursor_size v3

In this patch, GBM_BO_USE_CURSOR gets replaced with GBM_BO_USE_CURSOR_64X64 if is not defined.

I've tested on my pc and it works, but is sufficient like that or GBM_BO_USE_CURSOR_64X64 should be used only if width and height are 64 (like in the previous patch)?

(Sorry for my ignorance, it's my 1st patch in this area).
Comment 10 Michel Dänzer 2014-06-11 03:29:39 UTC
(In reply to comment #9)
> I've tested on my pc and it works, but is sufficient like that or
> GBM_BO_USE_CURSOR_64X64 should be used only if width and height are 64 (like
> in the previous patch)?

The latter, as GBM will reject cursor dimensions other than 64x64 if it doesn't define GBM_BO_USE_CURSOR. Something like this:

#ifdef GBM_BO_USE_CURSOR
	flags = GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE;
#else
	flags = GBM_BO_USE_WRITE;
	if (ec->cursor_width == 64 && ec->cursor_height == 64)
		flags |= GBM_BO_USE_CURSOR_64X64;
#endif
Comment 11 Alvaro Fernando García 2014-06-11 03:41:30 UTC
Created attachment 100857 [details] [review]
cursor_size_v4 (original + fixes)

This time it should be ok... If needed, I can squash the commits to simplify the patch.
Comment 12 Michel Dänzer 2014-06-11 04:00:05 UTC
Looks good to me. I just posted the GBM patch to the mesa-dev mailing list for review.
Comment 13 Michel Dänzer 2014-06-25 01:33:11 UTC
My GBM patch has landed on Mesa Git master.

Can you post your patches to the wayland-devel mailing list? Not sure anyone will pick them up from here.
Comment 14 Alvaro Fernando García 2014-06-25 03:31:07 UTC
Hi. I've sent the patches to the mailing list. Thanks!
Comment 15 Bryce Harrington 2015-05-20 06:54:19 UTC
Looks like this patch landed in weston in July 2014, commit dce7c6e5a2fb2e639e1e96ec0eaaf0f6551bc7b6

This bug looks like it can be closed.


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.