Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D325CCD196 for ; Wed, 15 Oct 2025 11:00:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F004B10E296; Wed, 15 Oct 2025 11:00:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="J/NHKyjG"; dkim-atps=neutral Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5973E10E28A for ; Wed, 15 Oct 2025 11:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1760526045; bh=2F7n8GrvPSvu9/I5riuRc9v1csnuDAkcVq7XV/b9tzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J/NHKyjGeEKg+oLEg/jSU+TF4kMM7Y0XPEGba0Is5W2QIqG/eP0MZ6GJY17Yiy6U/ fRxIykTSZbefsErEpfHPrM2vS+eFcIlnEwuOrB+BqvzNz1uWIkj4TqwDSJOi9GIWKD BkSQq/TmmPviCjnXcSMdgxjqYeuylUzPm9VP2kjYlJeQpgASuLnEEZVKWHKeT9NcQ0 CY069GnG/DyKUtta7CPWKQE6GunYI4ty+7l4cJ49NBL6pMu9GtVF5DS1KRUKssTUTE kUWC1pPL6eorlNyuHSUZhZ4hjpVYDDyuYr007KZYML9LmK7RyQYowUhiPXe7DAKehC CXQMyd0Glo1mQ== Received: from reinforced.mynet (unknown [IPv6:2a01:4b00:be1d:c600:6089:8bab:34a0:d4c5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: daniels) by bali.collaboradmins.com (Postfix) with ESMTPSA id AC0B617E1562; Wed, 15 Oct 2025 13:00:45 +0200 (CEST) From: Daniel Stone To: dri-devel@lists.freedesktop.org Cc: andy.yan@rock-chips.com, hjc@rock-chips.com, heiko@sntech.de, cristian.ciocaltea@collabora.com, kernel@collabora.com Subject: [PATCH 07/13] drm/rockchip: Switch impossible pos conditional to WARN_ON Date: Wed, 15 Oct 2025 12:00:36 +0100 Message-ID: <20251015110042.41273-8-daniels@collabora.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251015110042.41273-1-daniels@collabora.com> References: <20251015110042.41273-1-daniels@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 28 ++++++-------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 8c5042fb2e7e..812a46032396 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -1212,28 +1212,16 @@ 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); /* * This is workaround solution for IC design: -- 2.51.0