drm/rockchip: vop2: Add mode valid callback for crtc

The different Video Ports support different maximum resolutions.
Reject resolutions that are not supported by a specific VP.

Only the output width is checked because the hardware itself does
not have a hard output height limit.

Filter the mode that can't output by the VP/crtc.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com> # Sige5
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patch.msgid.link/20260117020738.294825-1-andyshrk@163.com
This commit is contained in:
Andy Yan 2026-01-17 10:07:30 +08:00 committed by Heiko Stuebner
parent aa156ad925
commit 88b14b9279

View File

@ -1426,6 +1426,17 @@ static void vop2_crtc_disable_vblank(struct drm_crtc *crtc)
vop2_crtc_disable_irq(vp, VP_INT_FS_FIELD);
}
static enum drm_mode_status vop2_crtc_mode_valid(struct drm_crtc *crtc,
const struct drm_display_mode *mode)
{
struct vop2_video_port *vp = to_vop2_video_port(crtc);
if (mode->hdisplay > vp->data->max_output.width)
return MODE_BAD_HVALUE;
return MODE_OK;
}
static bool vop2_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adj_mode)
@ -1871,6 +1882,7 @@ static void vop2_crtc_atomic_flush(struct drm_crtc *crtc,
static const struct drm_crtc_helper_funcs vop2_crtc_helper_funcs = {
.mode_fixup = vop2_crtc_mode_fixup,
.mode_valid = vop2_crtc_mode_valid,
.atomic_check = vop2_crtc_atomic_check,
.atomic_begin = vop2_crtc_atomic_begin,
.atomic_flush = vop2_crtc_atomic_flush,