[PATCH v4 2/8] drm/rockchip: vop2: Switch impossible pos conditional to WARN_ON
Daniel Stone
daniel at fooishbar.org
Mon Dec 15 09:57:07 PST 2025
Hi,
On Thu, 11 Dec 2025 at 22:41, David Laight <david.laight.linux at gmail.com> wrote:
> On Thu, 11 Dec 2025 21:40:32 +0100
> Nicolas Frattaroli <nicolas.frattaroli at collabora.com> wrote:
> > - 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.
When we arrive at this point, because the load-bearing assumption in
the comment has not been met, our options would be:
* display random incorrect content, and hope that we aren't reading
out of bounds from a buffer that's too small
* turn the display off
* there is no third option
Which are you suggesting?
Cheers,
Daniel
More information about the Linux-rockchip
mailing list