Skip to content

Commit 19f4da8

Browse files
author
Thomas Zimmermann
committed
drm/ast: cursor: Add support for ARGB4444
Add support for cursor image data in ARGB4444 format. This is the hardware's native format and requires no conversion. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250217122336.230067-4-tzimmermann@suse.de
1 parent 966a0d4 commit 19f4da8

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

drivers/gpu/drm/ast/ast_mode.c

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ static void ast_set_cursor_enabled(struct ast_device *ast, bool enabled)
720720
}
721721

722722
static const uint32_t ast_cursor_plane_formats[] = {
723+
DRM_FORMAT_ARGB4444,
723724
DRM_FORMAT_ARGB8888,
724725
};
725726

@@ -771,17 +772,28 @@ static void ast_cursor_plane_helper_atomic_update(struct drm_plane *plane,
771772
*/
772773

773774
if (drm_atomic_helper_damage_merged(old_plane_state, plane_state, &damage)) {
774-
u8 *argb4444 = ast_cursor_plane->argb4444;
775-
struct iosys_map argb4444_dst[DRM_FORMAT_MAX_PLANES] = {
776-
IOSYS_MAP_INIT_VADDR(argb4444),
777-
};
778-
unsigned int argb4444_dst_pitch[DRM_FORMAT_MAX_PLANES] = {
779-
AST_HWC_PITCH,
780-
};
781-
782-
drm_fb_argb8888_to_argb4444(argb4444_dst, argb4444_dst_pitch,
783-
shadow_plane_state->data, fb, &damage,
784-
&shadow_plane_state->fmtcnv_state);
775+
u8 *argb4444;
776+
777+
switch (fb->format->format) {
778+
case DRM_FORMAT_ARGB4444:
779+
argb4444 = shadow_plane_state->data[0].vaddr;
780+
break;
781+
default:
782+
argb4444 = ast_cursor_plane->argb4444;
783+
{
784+
struct iosys_map argb4444_dst[DRM_FORMAT_MAX_PLANES] = {
785+
IOSYS_MAP_INIT_VADDR(argb4444),
786+
};
787+
unsigned int argb4444_dst_pitch[DRM_FORMAT_MAX_PLANES] = {
788+
AST_HWC_PITCH,
789+
};
790+
791+
drm_fb_argb8888_to_argb4444(argb4444_dst, argb4444_dst_pitch,
792+
shadow_plane_state->data, fb, &damage,
793+
&shadow_plane_state->fmtcnv_state);
794+
}
795+
break;
796+
}
785797
ast_set_cursor_image(ast, argb4444, fb->width, fb->height);
786798
ast_set_cursor_base(ast, dst_off);
787799
}

0 commit comments

Comments
 (0)