Thread (15 messages) 15 messages, 3 authors, 2025-12-15

Re: [PATCH v4 2/8] drm/rockchip: vop2: Switch impossible pos conditional to WARN_ON

From: Daniel Stone <hidden>
Date: 2025-12-15 17:57:19
Also in: dri-devel, linux-rockchip, lkml

Hi,

On Thu, 11 Dec 2025 at 22:41, David Laight [off-list ref] wrote:
On Thu, 11 Dec 2025 21:40:32 +0100
Nicolas Frattaroli [off-list ref] wrote:
quoted
-     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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help