mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 23:52:08 +02:00
drm/rockchip: vop2: Simplify format_mod_supported
Make it a little less convoluted, and just directly check if the combination of plane + format + modifier is supported. Signed-off-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20251215-vop2-atomic-fixups-v5-8-83463c075a8d@collabora.com
This commit is contained in:
parent
c8c85c0a7f
commit
28c2490458
|
|
@ -367,59 +367,47 @@ static bool is_yuv_output(u32 bus_format)
|
|||
}
|
||||
}
|
||||
|
||||
static bool rockchip_afbc(struct drm_plane *plane, u64 modifier)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (modifier == DRM_FORMAT_MOD_LINEAR)
|
||||
return false;
|
||||
|
||||
for (i = 0 ; i < plane->modifier_count; i++)
|
||||
if (plane->modifiers[i] == modifier)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool rockchip_vop2_mod_supported(struct drm_plane *plane, u32 format,
|
||||
u64 modifier)
|
||||
{
|
||||
struct vop2_win *win = to_vop2_win(plane);
|
||||
struct vop2 *vop2 = win->vop2;
|
||||
int i;
|
||||
|
||||
/* No support for implicit modifiers */
|
||||
if (modifier == DRM_FORMAT_MOD_INVALID)
|
||||
return false;
|
||||
|
||||
if (vop2->version == VOP_VERSION_RK3568) {
|
||||
if (vop2_cluster_window(win)) {
|
||||
if (modifier == DRM_FORMAT_MOD_LINEAR) {
|
||||
drm_dbg_kms(vop2->drm,
|
||||
"Cluster window only supports format with afbc\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (format == DRM_FORMAT_XRGB2101010 || format == DRM_FORMAT_XBGR2101010) {
|
||||
if (vop2->version == VOP_VERSION_RK3588) {
|
||||
if (!rockchip_afbc(plane, modifier)) {
|
||||
drm_dbg_kms(vop2->drm, "Only support 32 bpp format with afbc\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (modifier == DRM_FORMAT_MOD_LINEAR)
|
||||
return true;
|
||||
|
||||
if (!rockchip_afbc(plane, modifier)) {
|
||||
drm_dbg_kms(vop2->drm, "Unsupported format modifier 0x%llx\n",
|
||||
modifier);
|
||||
|
||||
/* The cluster window on 3568 is AFBC-only */
|
||||
if (vop2->version == VOP_VERSION_RK3568 && vop2_cluster_window(win) &&
|
||||
!drm_is_afbc(modifier)) {
|
||||
drm_dbg_kms(vop2->drm,
|
||||
"Cluster window only supports format with afbc\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return vop2_convert_afbc_format(format) >= 0;
|
||||
/* 10bpc formats on 3588 are AFBC-only */
|
||||
if (vop2->version == VOP_VERSION_RK3588 && !drm_is_afbc(modifier) &&
|
||||
(format == DRM_FORMAT_XRGB2101010 || format == DRM_FORMAT_XBGR2101010)) {
|
||||
drm_dbg_kms(vop2->drm, "Only support 10bpc format with afbc\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Linear is otherwise supported everywhere */
|
||||
if (modifier == DRM_FORMAT_MOD_LINEAR)
|
||||
return true;
|
||||
|
||||
/* Not all format+modifier combinations are allowable */
|
||||
if (vop2_convert_afbc_format(format) == VOP2_AFBC_FMT_INVALID)
|
||||
return false;
|
||||
|
||||
/* Different windows have different format/modifier support */
|
||||
for (i = 0; i < plane->modifier_count; i++) {
|
||||
if (plane->modifiers[i] == modifier)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user