modesetting: Handle cursor images and buffers smaller than 64x64 correctly

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
stefan11111
2025-09-22 14:37:14 +03:00
committed by Enrico Weigelt
parent 5752116343
commit d5162b4493
2 changed files with 19 additions and 6 deletions

View File

@@ -1965,11 +1965,25 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
return FALSE;
/* Need to extend HWcursor support to handle mask interleave */
if (!ms->drmmode.sw_cursor)
if (!ms->drmmode.sw_cursor) {
/* XXX Is there any spec that says we should interleave the cursor bits? XXX */
int interleave;
if (cursor_dim.width >= 64)
interleave = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64;
else if (cursor_dim.width >= 32)
interleave = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32;
else if (cursor_dim.width >= 16)
interleave = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16;
else if (cursor_dim.width >= 8)
interleave = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8;
else
interleave = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
xf86_cursors_init(pScreen, cursor_dim.width, cursor_dim.height,
HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
interleave |
HARDWARE_CURSOR_UPDATE_UNHIDDEN |
HARDWARE_CURSOR_ARGB);
}
/* Must force it before EnterVT, so we are in control of VT and
* later memory should be bound when allocating, e.g rotate_mem */

View File

@@ -4679,8 +4679,8 @@ drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
xf86CrtcPtr crtc = xf86_config->crtc[i];
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
drmmode_cursor_rec cursor = drmmode_crtc->cursor;
/* If we don't have any dimensions then
/* If we don't have any dimensions then
* something has gone terribly wrong. */
assert(cursor.num_dimensions);
@@ -4829,8 +4829,7 @@ Bool drmmode_get_largest_cursor(ScrnInfoPtr pScrn, drmmode_cursor_dim_ptr cursor
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
/* We need the cursor image to be at least 64x64 */
int max_width = 64, max_height = 64;
int max_width = 0, max_height = 0;
if (!cursor_lim)
return FALSE;