We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5231

Summary: [KMSDRM][PATCH] Fix for hardware cursor: size and alpha-premultiplication.
Product: SDL Reporter: Manuel Alfayate Corchete <redwindwanderer>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: HG 2.1   
Hardware: All   
OS: Linux   
Attachments: Fix for KMSDRM mouse cursor alpha and supported size.
V2 Fix for KMSDRM mouse cursor alpha and supported size

Description Manuel Alfayate Corchete 2020-07-13 21:05:54 UTC
Created attachment 4411 [details]
Fix for KMSDRM mouse cursor alpha and supported size.

Hi there,

I noticed pt2-clone had problems with it's optional hardware mouse on the KMSDRM backend: cursor had a transparent block around it.
So I was investigating and it seems that a GBM cursor needs it's pixels to be alpha-premultiplied instead of straight-alpha.
A
lso, I was previously relying on "manual testing" for the cursor size, but it's far better to use whatever the DRM driver recommends via drmGetCap(): any working driver should make a size recommendation via drmGetCap(), so that's what we use now. I took this decision because I found out that the AMDGPU driver reported working cursor sizes that would appear garbled on screen, and only the recommended cursor size works.

The included patch applies cleanly on current mercurial sources. Please merge.

Thanks!

Manuel
Comment 1 Manuel Alfayate Corchete 2020-07-15 00:46:23 UTC
Created attachment 4412 [details]
V2 Fix for KMSDRM mouse cursor alpha and supported size

V2 of the previous patch, fixing small variable types mismatch with drmGetCap() parameters.
Comment 2 Manuel Alfayate Corchete 2020-07-19 20:13:51 UTC
Merged by @slouken. Thanks!