[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251211224102.5e079d70@pumpkin>
Date: Thu, 11 Dec 2025 22:41:02 +0000
From: David Laight <david.laight.linux@...il.com>
To: Nicolas Frattaroli <nicolas.frattaroli@...labora.com>
Cc: Sandy Huang <hjc@...k-chips.com>, Heiko Stübner
<heiko@...ech.de>, Andy Yan <andy.yan@...k-chips.com>, Maarten Lankhorst
<maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Chaoyi Chen <chaoyi.chen@...k-chips.com>,
dri-devel@...ts.freedesktop.org, linux-arm-kernel@...ts.infradead.org,
linux-rockchip@...ts.infradead.org, linux-kernel@...r.kernel.org, Daniel
Stone <daniels@...labora.com>, kernel@...labora.com
Subject: Re: [PATCH v4 2/8] drm/rockchip: vop2: Switch impossible pos
conditional to WARN_ON
On Thu, 11 Dec 2025 21:40:32 +0100
Nicolas Frattaroli <nicolas.frattaroli@...labora.com> wrote:
> From: Daniel Stone <daniels@...labora.com>
>
> We already clip the plane to the display bounds in atomic_check, and
> ensure that it is sufficiently sized. Instead of trying to catch this
> and adjust for it in atomic_update, just assert that atomic_check has
> done its job.
>
> Signed-off-by: Daniel Stone <daniels@...labora.com>
> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@...labora.com>
> ---
> drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 29 +++++++++-------------------
> 1 file changed, 9 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> index 20b49209ddcd..81b3eba07095 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> @@ -1214,28 +1214,17 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
> src_w = drm_rect_width(src) >> 16;
> src_h = drm_rect_height(src) >> 16;
> dsp_w = drm_rect_width(dest);
> -
> - if (dest->x1 + dsp_w > adjusted_mode->hdisplay) {
> - drm_dbg_kms(vop2->drm,
> - "vp%d %s dest->x1[%d] + dsp_w[%d] exceed mode hdisplay[%d]\n",
> - vp->id, win->data->name, dest->x1, dsp_w, adjusted_mode->hdisplay);
> - dsp_w = adjusted_mode->hdisplay - dest->x1;
> - if (dsp_w < 4)
> - dsp_w = 4;
> - src_w = dsp_w * src_w / drm_rect_width(dest);
> - }
> -
> dsp_h = drm_rect_height(dest);
>
> - if (dest->y1 + dsp_h > adjusted_mode->vdisplay) {
> - drm_dbg_kms(vop2->drm,
> - "vp%d %s dest->y1[%d] + dsp_h[%d] exceed mode vdisplay[%d]\n",
> - vp->id, win->data->name, dest->y1, dsp_h, adjusted_mode->vdisplay);
> - dsp_h = adjusted_mode->vdisplay - dest->y1;
> - if (dsp_h < 4)
> - dsp_h = 4;
> - src_h = dsp_h * src_h / drm_rect_height(dest);
> - }
> + /* drm_atomic_helper_check_plane_state calls drm_rect_clip_scaled for
> + * us, which keeps our planes bounded within the CRTC active area
> + */
> + WARN_ON(dest->x1 + dsp_w > adjusted_mode->hdisplay);
> + WARN_ON(dest->y1 + dsp_h > adjusted_mode->vdisplay);
> + WARN_ON(dsp_w < 4);
> + WARN_ON(dsp_h < 4);
> + WARN_ON(src_w < 4);
> + WARN_ON(src_h < 4);
You need to do something when the tests fail.
Carrying on regardless is never right.
David
>
> /*
> * This is workaround solution for IC design:
>
Powered by blists - more mailing lists