]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/rockchip: vop2: Add mode valid callback for crtc
authorAndy Yan <andy.yan@rock-chips.com>
Sat, 17 Jan 2026 02:07:30 +0000 (10:07 +0800)
committerHeiko Stuebner <heiko@sntech.de>
Tue, 20 Jan 2026 10:09:46 +0000 (11:09 +0100)
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
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c

index a0099e4dd4ea9756b0ff083d69aea7dd19b22449..ec3b4fde10dbfa0990f61ea87492a181d97ef075 100644 (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,