From nobody Thu Sep 24 14:25:59 2026 Received: from mail-yx2-f13.google.com (mail-yx2-f13.google.com [74.125.224.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E6D047F3D8 for ; Wed, 23 Sep 2026 20:59:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790197147; cv=none; b=l3ZeMXZitTyO79n3/+GdQzEOwqP7RtIJmbv+nixTbmoBgB9yHw1ofX6rRZ7+y+DAM2sU3gjZwvXyq5fdr+QQ3lZE+YtTSOFbQud/FrvrnXQCz5aMWbyuIuYZ+rQuvDgr4Ne4/WCF95RWb5MBVpGO32xhtbWxn0YceFBTGL3nGXs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790197147; c=relaxed/simple; bh=8JREQkLVGNW/V6YBNEl1nDP06ooU4XDJt9RQvxEZqSk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HrKneI43AfhfOwWGHELgPkn3xnt8sxIQvqgO+FYAlYKLUaihDeCjR7bp2/tVSbcihWO09SRPjmBjBWo5111d42dEu20Fn2E8OMiUCo1QNdcUgPjEUz7a5RGK89ivcJCDkV2VAm3X9XxFV9xwjC9JdbnTYyNkmqQ1/rBm4RotXdU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WpsuOl3Z; arc=none smtp.client-ip=74.125.224.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WpsuOl3Z" Received: by mail-yx2-f13.google.com with SMTP id 00721157ae682-85d46e4cdcdso17293357b3.2 for ; Wed, 23 Sep 2026 13:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790197143; x=1790801943; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OI+RXS7AWef0aTId53Kef6aofXdoW+lQEP5J9ptA3JM=; b=WpsuOl3ZPBEudrXlgXRD+dDN8CmSjRTajGPhccyNQ358WJj5Yx7zvZkc241hfH7ms7 w9JUadW8rfNtb/ONo+HTJbhQwPsf7f/12ptqsNYK0ZnW7i21V0ZpTyYiV6mMUjRVblEp FWP/og3ikk4HdVCVtfBQFFHC+iK3gNQvAH+NMRlX3whFaCFgfYuB/OOW6h0+qkrzvek7 fjhS95GSt0eXS0V/uZK+dJiVg+nJMTYP48an2XYTuid9cu0+NWMZfHIjf9fMvWcLu9QJ BN8tY/VD9WuZ1NszytJAzr9Zc/LGWVvqsfkpPtjoRCVcaoUxS+hw9xUQE0y6RMOejQrP 684g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790197143; x=1790801943; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=OI+RXS7AWef0aTId53Kef6aofXdoW+lQEP5J9ptA3JM=; b=WCdtAxVb0bvRDK4uqA3yJ4rmyXDxmAEL32bQTHK7GCigidYjq+mN4BDtrn1tq26/sm lgjQgAgwQil0R3fTYQRfIrpopWleqKoQYCy3KwLxRgdV5aKGkuJeN0b9EoIL6wutvqsm z87fYwGMjITk3fykc1WT7Mh6NlC4lXpxKUuWeQbQtOtqblNerEW017ML7TsrgzS80wbl R06p5oZGfar/W/Wrt0PrQp6C3uGJi2UY4my7pO2o54s0mtH61FiFUbgwsBGLKsNUQ7h0 /neH5z9bWCYeBR69sVt8gkSn2Y/kqs9R/JVGymBVkTGrhvsPFNLrTxTb/hgOrebg0WEp GQeA== X-Forwarded-Encrypted: i=1; AKwUvBwCVmCWVZ82X7FDo9Fjob+sr9mDIo0Ka4mOa1gjwFBPW4d0sVGJDHINRTXYP7iDGSo9Wu7qu3ta/weg+tI=@vger.kernel.org X-Gm-Message-State: AFuF++mqsV722tjSXetsda5kLJSA66Dor7Urgv94tgiisuRJB8P5P/On WkVYiMWr22LhcK1CUGYP0zxNbrb6Zoqd3DvLJpK6asqENwoTyBAO9rXr X-Gm-Gg: AYBFou0BpZaYx+yCMy9A7d4V6RFUJG9Q9yQexzY8gww8r+boCchT/68W2Mb1KJEkZv8 kumltPFPCrdZZGnMZnQrTY3ZAUC7Qz9nf4PfVpQU6PqQPFd60Ski7a3oPgIxST6EqEcvtoReSdB CQqbiw5/eB29UzNWpxGQt+qPY9aMofoz/AD6KF5HBOFObyGTVjM4jTJEmFwLfy4MrN5531euoVO saE68Y2o7uAATgq1HL6Qrz4IcSNqywiTpLqN6peG8nKQ5XE6MyiivXCUT19YY/dB1iMwRjlBuaL 9Ks7EKu71vMsJ+Ulylst79hDzAHRQK83h1XvJfNmpkLGrAjTm+BgxvVHDUQMvxdvH2lmvslFFQu HTQiENrqqE/AglouqsnlmGT67CE760keyHR7KiLru3ti5ra29NJbykDZmJy7Q0lqRszFcebUSE8 Dxh+tJDGf6KITx1U0FDK8B6PdaXTTmhtcFbia82pkD5QifwNB7INxFDuhJVt9wofO+exliIEm5Q XyeHCMNaQ== X-Received: by 2002:a05:690c:39b:b0:882:b4b2:c49 with SMTP id 00721157ae682-8a646e8848bmr3505747b3.18.1790197142862; Wed, 23 Sep 2026 13:59:02 -0700 (PDT) Received: from DESKTOP-TLFH1MG ([76.255.203.42]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8a65270b1e2sm1073467b3.41.2026.09.23.13.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2026 13:59:02 -0700 (PDT) From: Jonathan Frazin To: dri-devel@lists.freedesktop.org Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, kamlesh.gurudasani@gmail.com, lanzano.alex@gmail.com, phil@raspberrypi.com, linux-kernel@vger.kernel.org, Jonathan Frazin , Dave Stevenson Subject: [PATCH v3 1/2] drm/mipi-dbi: honour the plane source offset when flushing Date: Wed, 23 Sep 2026 15:58:33 -0500 Message-ID: <20260923205835.3505-2-frazinjonathan@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260923205835.3505-1-frazinjonathan@gmail.com> References: <20260923205835.3505-1-frazinjonathan@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" mipi_dbi_fb_dirty() takes the damage rectangle from drm_atomic_helper_damage_merged(), which is expressed in framebuffer coordinates and already clipped to the plane's source rectangle. It then passed that rectangle straight to mipi_dbi_set_window_address(), which is correct only while the source rectangle starts at (0,0) - i.e. while the framebuffer is exactly panel-sized. If a driver allows a framebuffer larger than the panel and the plane selects a sub-region with a non-zero src_x/src_y, the controller was still addressed in framebuffer coordinates, so the wrong part of the panel was written and an out-of-range window could be programmed. Pass the integer plane source origin down to mipi_dbi_fb_dirty() and subtract it when programming the column/page address. The copy into the transfer buffer still uses the framebuffer-coordinate rectangle, so it keeps reading the correct pixels from an oversized source. With a panel-sized framebuffer src_x/src_y are zero and behaviour is unchanged. The rectangle from drm_atomic_helper_damage_merged() is clipped against the src rectangle's exact 16.16 fixed-point bounds, while src_x/src_y above are that same origin truncated to whole pixels. When the origin has a fractional part, the truncation can leave the rectangle's far edge up to a pixel past where a whole-pixel origin would place the panel's own width/height - and tx_buf is sized for exactly the panel, with no slack for that overshoot. Clamp the rectangle to the panel's fixed mode before using it for the window address or the transfer length. A damage clip can also lie entirely within that one-pixel sliver past the panel edge - the damage iterator clips only against the exact fixed-point bound, not the whole-pixel one used here - collapsing the clamped rectangle to zero width or height. Skip the flush in that case rather than program an inverted (start past end) address window, which is undefined behaviour per the MIPI DCS spec. Cc: Dave Stevenson Signed-off-by: Jonathan Frazin --- Changes since v2: - A damage clip lying entirely within the one-pixel sliver the v2 clamp cuts off collapses the clamped rectangle to zero width or height, which was still reaching mipi_dbi_set_window_address() as an inverted (start past end) address window ahead of a zero-length write - skip the flush when the clamped rectangle is empty. Thanks again to the automated review for catching this on v2. Changes since v1: - Clamp the damage rectangle to the panel's fixed mode before using it, as described above. Thanks to the automated review for catching this. drivers/gpu/drm/drm_mipi_dbi.c | 43 ++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c index 25cf04d02..bb557fab1 100644 --- a/drivers/gpu/drm/drm_mipi_dbi.c +++ b/drivers/gpu/drm/drm_mipi_dbi.c @@ -271,19 +271,45 @@ static void mipi_dbi_set_window_address(struct mipi_d= bi_dev *dbidev, } =20 static void mipi_dbi_fb_dirty(struct iosys_map *src, struct drm_framebuffe= r *fb, - struct drm_rect *rect, struct drm_format_conv_state *fmtcnv_state) + struct drm_rect *rect, unsigned int src_x, unsigned int src_y, + struct drm_format_conv_state *fmtcnv_state) { struct mipi_dbi_dev *dbidev =3D drm_to_mipi_dbi_dev(fb->dev); - unsigned int height =3D rect->y2 - rect->y1; - unsigned int width =3D rect->x2 - rect->x1; const struct drm_format_info *dst_format; struct mipi_dbi *dbi =3D &dbidev->dbi; bool swap =3D dbi->swap_bytes; + unsigned int height, width; int ret =3D 0; size_t len; bool full; void *tr; =20 + /* + * @rect is in framebuffer coordinates, clipped to the plane's src + * rectangle by the damage iterator against that rectangle's exact + * 16.16 fixed-point bounds. @src_x/@src_y are that same origin + * truncated to whole pixels. When the origin has a fractional part, + * that truncation can leave @rect's far edge up to a pixel past + * where a whole-pixel @src_x/@src_y would place the panel's own + * width/height -- and tx_buf is sized for exactly the panel, with no + * slack for that overshoot. Clamp before using @rect for anything. + * + * A damage clip can lie entirely in that one-pixel sliver past the + * panel edge -- the iterator above clips only against the exact + * fixed-point bound, not the whole-pixel one used here -- in which + * case the clamp collapses @rect to zero width or height. Nothing in + * it was ever visible on the panel, so skip the flush rather than + * program an inverted (start past end) address window. + */ + rect->x2 =3D min_t(int, rect->x2, src_x + dbidev->mode.hdisplay); + rect->y2 =3D min_t(int, rect->y2, src_y + dbidev->mode.vdisplay); + + if (rect->x2 <=3D rect->x1 || rect->y2 <=3D rect->y1) + return; + + height =3D rect->y2 - rect->y1; + width =3D rect->x2 - rect->x1; + full =3D width =3D=3D fb->width && height =3D=3D fb->height; =20 DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_REC= T_ARG(rect)); @@ -298,8 +324,13 @@ static void mipi_dbi_fb_dirty(struct iosys_map *src, s= truct drm_framebuffer *fb, tr =3D src->vaddr; /* TODO: Use mapping abstraction properly */ } =20 - mipi_dbi_set_window_address(dbidev, rect->x1, rect->x2 - 1, rect->y1, - rect->y2 - 1); + /* + * @rect is in framebuffer coordinates and has been clipped to the plane + * src rectangle by the damage iterator. The panel is addressed relative + * to the src origin, so subtract it here. + */ + mipi_dbi_set_window_address(dbidev, rect->x1 - src_x, rect->x2 - 1 - src_= x, + rect->y1 - src_y, rect->y2 - 1 - src_y); =20 if (fb->format->format =3D=3D DRM_FORMAT_XRGB8888) dst_format =3D drm_format_info(dbidev->pixel_format); @@ -390,6 +421,8 @@ void drm_mipi_dbi_plane_helper_atomic_update(struct drm= _plane *plane, if (drm_dev_enter(plane->dev, &idx)) { if (drm_atomic_helper_damage_merged(old_plane_state, plane_state, &rect)) mipi_dbi_fb_dirty(&shadow_plane_state->data[0], fb, &rect, + plane_state->src_x >> 16, + plane_state->src_y >> 16, &shadow_plane_state->fmtcnv_state); drm_dev_exit(idx); } --=20 2.53.0 From nobody Thu Sep 24 14:25:59 2026 Received: from mail-yx2-f12.google.com (mail-yx2-f12.google.com [74.125.224.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 462CC57EDA4 for ; Wed, 23 Sep 2026 20:59:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.140 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790197152; cv=none; b=PNgZLJ1dgMlJuxaDTPn/Cm8U9xJtZfOWduCcS9H43CAaBHJ8u/2plUu2w+gYHqQPuFm7O1+QbYnuvU2cAt0FeN+3Zf2ohxeHnmO6ye6GbkCj81bZrG1KhLc5vNJjcNxajXg39JeaAandJAABWmhxZa2eI67CsHfaVmhT1wmb3FA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790197152; c=relaxed/simple; bh=GMD+L9rkwITPj+/7F7oAO8xahOstS3wY3JMvvdRI0cI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AsNMNNicy85yGwpzMGHS4fT30JxElsu+0CDYrm1W4vidge5LJrGsUbkXEmlpN5/uv7DpIIEwbfpsViGxrAkfHmsdffbi/uKBruOCWppgIaTwsGWuAQaWiIK7AQfESqghEc/Clz/0jTBkKBm9t9HXzjIH9XsQeBedSru/YSd6lh4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=e+lMWHPX; arc=none smtp.client-ip=74.125.224.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e+lMWHPX" Received: by mail-yx2-f12.google.com with SMTP id 00721157ae682-8716a5baf64so18990417b3.3 for ; Wed, 23 Sep 2026 13:59:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790197145; x=1790801945; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=SjUwon+Xf+9yJ/mOuCEt+pLNo2N/EnsMcHazZxAI2W0=; b=e+lMWHPXg3z6H4H0akclOXRVvgfDbMt6vixaPTQMGsUNVi3ANgkMm2r3nwN48mMWmv Y+E6e7vXtl1vC04pxfsJnQYURmbIx3HidOkmtAiHyaEqSwZjbi5gNwEJ+BgnBU1G9tPU y9cC4sP/+izSZHP7CF9b4yjiItUskGzYcjdoqhYEsGjONQYbjvgHbhksr4u7nKKYf2Qi iSfiGtthAnPgIarzZO/HyToYmeuaOqWj/SZGGfrlr/Kl7tMoaho0t38RICIhmbsX0KJF aGq4o+APUdwaZz1Vl/MXct89EQSk9Yye7PDPWtbbRzja/befIKRX4Oc1Mq61Oq13HGsG UZVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790197145; x=1790801945; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=SjUwon+Xf+9yJ/mOuCEt+pLNo2N/EnsMcHazZxAI2W0=; b=zYH5ldwhil5A+ibcAc9fbXKNklR8SGIzMsb1yMyGwLihfrQtI2nzOyvaeKd2/EvfxA wdAbWxqbgS041osqRQzn6HU4Uik7lQrL3iR2A/NsOaeeY3dGgVGhiKlxZKeBWJhJSbay P6KeNVMPjxFqqnN391S2M5P2sP2CAQdfUZrh/JCbtsixhb0WI9l9zIjsQuB8Kv91s7s2 WDQwKAbkp6hffy/DRd4uV4v708pGmiaLZZU4ihQ9RuOtsPYfB0FzoFO8OOnQWfmPhK86 eAEoiGFm4nMV4CT9jhgGpkefglB3Blra2o1I+EPz05P3+7xV3IO72CG1KvP+LYWjJwT9 V2/A== X-Forwarded-Encrypted: i=1; AKwUvBxLXzql5XxM9Wit/vv4LwQKfUbr2BxARGjzgnYEZOjVKZ3/MtxYx5WxgemFNo4xjbmzPKBzL8GSzf1PgNU=@vger.kernel.org X-Gm-Message-State: AFuF++k2aIyCLCxXkuNTy9crLt30x4W2/lPqBj0pPR3EHeLcewulmDI9 vm/GKxfbNsHl4ClJJLRgJp+VuiXqh792UoDYIzn0d829n1rhPU86SjhJ X-Gm-Gg: AYBFou1xPDm+MGqCvsc5aWn6J5nJxOHlU/6BP8Jw++DhA3PHA4rPWKTAKj1mDemsw6q IDRL5HEN8HFEG34P65hgbQcjZaAoA5qrHs/rcUC7hk2JphBN+9d4yp/4XFLu8PolB3vCwNLRSbf LYtXF5mBV44DW/cXmgCIz3kcFbarFyFHk8gA1ZeKcN0ywETLV1WKFIKiexloF48aRAp2IheJLZU kBUMLm3q7ij8kCNQb3DY0GSmJBWoKGgtj3EDgxc4P8uJGt9h+xyBLF68qL/eHz4b/+aSpooe7O6 9IIEMpU+oTPXVw2GFPm4g5TJ59uJidiT+UQ9p6RnaBZpG5C3Fii2msWdGVAXbsn3Ooi4Eq2YjxT BoTHKk4zQ7p9FWBpos/ynmYr8/wGxU662i7y5mcO5lUNiktjC+KytxSCFQ8+uqqzim0TiZOoUdM RaFYfSI7Ym0bFa0nTab2389MllOPZiMUJt+qqZDgFYqhHgedZ1TrIlGpv/59T0czOIAqYBox6wR d7/+baU5rcbhGBK9UB9 X-Received: by 2002:a05:690c:6d82:b0:845:1064:5c03 with SMTP id 00721157ae682-8a64bc39bb2mr2852547b3.23.1790197144917; Wed, 23 Sep 2026 13:59:04 -0700 (PDT) Received: from DESKTOP-TLFH1MG ([76.255.203.42]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8a65270b1e2sm1073467b3.41.2026.09.23.13.59.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2026 13:59:04 -0700 (PDT) From: Jonathan Frazin To: dri-devel@lists.freedesktop.org Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, kamlesh.gurudasani@gmail.com, lanzano.alex@gmail.com, phil@raspberrypi.com, linux-kernel@vger.kernel.org, Jonathan Frazin , Dave Stevenson Subject: [PATCH v3 2/2] drm/tiny: allow a framebuffer larger than the panel on MIPI DBI drivers Date: Wed, 23 Sep 2026 15:58:34 -0500 Message-ID: <20260923205835.3505-3-frazinjonathan@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260923205835.3505-1-frazinjonathan@gmail.com> References: <20260923205835.3505-1-frazinjonathan@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Every drm/tiny MIPI DBI driver pins mode_config.max_width/max_height to the panel size, so KMS rejects any framebuffer that is not exactly panel-sized: ili9341 spi0.0: bad framebuffer width 480, should be >=3D 240 && <=3D 2= 40 Raise the maximums to DRM_SHADOW_PLANE_MAX_WIDTH/HEIGHT (which its kerneldoc recommends for shadow-plane drivers) on the drivers that flush through the shared drm_mipi_dbi_plane_helper_atomic_update(), so a client can allocate a larger framebuffer and pick the displayed region through the plane source rectangle - a crop / pan with no scaling, now that drm_mipi_dbi honours the source offset (previous patch): ili9341, hx8357d, ili9486, mi0283qt, ili9163, panel-mipi-dbi, st7735r The fixed mode, the minimums and the connector are unchanged. The plane check (drm_mipi_dbi_plane_helper_atomic_check) still forbids scaling and repositioning, and the transfer buffer is sized from the display mode, so the flushed rectangle stays bounded by the panel regardless of the framebuffer dimensions. ili9225 is left out: it has its own atomic_update / ili9225_fb_dirty() that addresses the panel from the damage rectangle without the source offset, so raising its limits would let a mispositioned buffer through. st7735r lives under drivers/gpu/drm/sitronix/ rather than drivers/gpu/drm/tiny/ and was missed in the original pass over this list; confirmed by grepping the whole tree for DRM_MIPI_DBI_PLANE_HELPER_FUNCS, which finds exactly these seven drivers and no others. Cc: Dave Stevenson Signed-off-by: Jonathan Frazin --- Changes since v2: - Add st7735r, missed from the original list because it lives under drivers/gpu/drm/sitronix/ rather than drivers/gpu/drm/tiny/. Confirmed by grepping the whole tree for DRM_MIPI_DBI_PLANE_HELPER_FUNCS that no other driver shares this flush path. Thanks to the automated review for catching this. Changes since v1: unchanged. drivers/gpu/drm/sitronix/st7735r.c | 8 ++++++-- drivers/gpu/drm/tiny/hx8357d.c | 8 ++++++-- drivers/gpu/drm/tiny/ili9163.c | 8 ++++++-- drivers/gpu/drm/tiny/ili9341.c | 8 ++++++-- drivers/gpu/drm/tiny/ili9486.c | 8 ++++++-- drivers/gpu/drm/tiny/mi0283qt.c | 8 ++++++-- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 8 ++++++-- 7 files changed, 42 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/sitronix/st7735r.c b/drivers/gpu/drm/sitronix/= st7735r.c index bd763871d..e78bd2da3 100644 --- a/drivers/gpu/drm/sitronix/st7735r.c +++ b/drivers/gpu/drm/sitronix/st7735r.c @@ -295,9 +295,13 @@ static int st7735r_probe(struct spi_device *spi) return ret; =20 drm->mode_config.min_width =3D dbidev->mode.hdisplay; - drm->mode_config.max_width =3D dbidev->mode.hdisplay; + /* + * Allow a framebuffer larger than the panel so a sub-region can be + * displayed via the plane source rectangle (crop / pan, no scaling). + */ + drm->mode_config.max_width =3D DRM_SHADOW_PLANE_MAX_WIDTH; drm->mode_config.min_height =3D dbidev->mode.vdisplay; - drm->mode_config.max_height =3D dbidev->mode.vdisplay; + drm->mode_config.max_height =3D DRM_SHADOW_PLANE_MAX_HEIGHT; drm->mode_config.funcs =3D &st7735r_mode_config_funcs; drm->mode_config.preferred_depth =3D 16; drm->mode_config.helper_private =3D &st7735r_mode_config_helper_funcs; diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c index f942a8d09..0599b8ccf 100644 --- a/drivers/gpu/drm/tiny/hx8357d.c +++ b/drivers/gpu/drm/tiny/hx8357d.c @@ -320,9 +320,13 @@ static int hx8357d_probe(struct spi_device *spi) return ret; =20 drm->mode_config.min_width =3D dbidev->mode.hdisplay; - drm->mode_config.max_width =3D dbidev->mode.hdisplay; + /* + * Allow a framebuffer larger than the panel so a sub-region can be + * displayed via the plane source rectangle (crop / pan, no scaling). + */ + drm->mode_config.max_width =3D DRM_SHADOW_PLANE_MAX_WIDTH; drm->mode_config.min_height =3D dbidev->mode.vdisplay; - drm->mode_config.max_height =3D dbidev->mode.vdisplay; + drm->mode_config.max_height =3D DRM_SHADOW_PLANE_MAX_HEIGHT; drm->mode_config.funcs =3D &hx8357d_mode_config_funcs; drm->mode_config.preferred_depth =3D 16; drm->mode_config.helper_private =3D &hx8357d_mode_config_helper_funcs; diff --git a/drivers/gpu/drm/tiny/ili9163.c b/drivers/gpu/drm/tiny/ili9163.c index 884242450..fe6c13056 100644 --- a/drivers/gpu/drm/tiny/ili9163.c +++ b/drivers/gpu/drm/tiny/ili9163.c @@ -251,9 +251,13 @@ static int ili9163_probe(struct spi_device *spi) return ret; =20 drm->mode_config.min_width =3D dbidev->mode.hdisplay; - drm->mode_config.max_width =3D dbidev->mode.hdisplay; + /* + * Allow a framebuffer larger than the panel so a sub-region can be + * displayed via the plane source rectangle (crop / pan, no scaling). + */ + drm->mode_config.max_width =3D DRM_SHADOW_PLANE_MAX_WIDTH; drm->mode_config.min_height =3D dbidev->mode.vdisplay; - drm->mode_config.max_height =3D dbidev->mode.vdisplay; + drm->mode_config.max_height =3D DRM_SHADOW_PLANE_MAX_HEIGHT; drm->mode_config.funcs =3D &ili9163_mode_config_funcs; drm->mode_config.preferred_depth =3D 16; drm->mode_config.helper_private =3D &ili9163_mode_config_helper_funcs; diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c index 003381aa2..1e4bb56e3 100644 --- a/drivers/gpu/drm/tiny/ili9341.c +++ b/drivers/gpu/drm/tiny/ili9341.c @@ -282,9 +282,13 @@ static int ili9341_probe(struct spi_device *spi) return ret; =20 drm->mode_config.min_width =3D dbidev->mode.hdisplay; - drm->mode_config.max_width =3D dbidev->mode.hdisplay; + /* + * Allow a framebuffer larger than the panel so a sub-region can be + * displayed via the plane source rectangle (crop / pan, no scaling). + */ + drm->mode_config.max_width =3D DRM_SHADOW_PLANE_MAX_WIDTH; drm->mode_config.min_height =3D dbidev->mode.vdisplay; - drm->mode_config.max_height =3D dbidev->mode.vdisplay; + drm->mode_config.max_height =3D DRM_SHADOW_PLANE_MAX_HEIGHT; drm->mode_config.funcs =3D &ili9341_mode_config_funcs; drm->mode_config.preferred_depth =3D 16; drm->mode_config.helper_private =3D &ili9341_mode_config_helper_funcs; diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c index fab8bd7ce..de33d702a 100644 --- a/drivers/gpu/drm/tiny/ili9486.c +++ b/drivers/gpu/drm/tiny/ili9486.c @@ -309,9 +309,13 @@ static int ili9486_probe(struct spi_device *spi) return ret; =20 drm->mode_config.min_width =3D dbidev->mode.hdisplay; - drm->mode_config.max_width =3D dbidev->mode.hdisplay; + /* + * Allow a framebuffer larger than the panel so a sub-region can be + * displayed via the plane source rectangle (crop / pan, no scaling). + */ + drm->mode_config.max_width =3D DRM_SHADOW_PLANE_MAX_WIDTH; drm->mode_config.min_height =3D dbidev->mode.vdisplay; - drm->mode_config.max_height =3D dbidev->mode.vdisplay; + drm->mode_config.max_height =3D DRM_SHADOW_PLANE_MAX_HEIGHT; drm->mode_config.funcs =3D &ili9486_mode_config_funcs; drm->mode_config.preferred_depth =3D 16; drm->mode_config.helper_private =3D &ili9486_mode_config_helper_funcs; diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283q= t.c index b0121e89e..df3801914 100644 --- a/drivers/gpu/drm/tiny/mi0283qt.c +++ b/drivers/gpu/drm/tiny/mi0283qt.c @@ -290,9 +290,13 @@ static int mi0283qt_probe(struct spi_device *spi) return ret; =20 drm->mode_config.min_width =3D dbidev->mode.hdisplay; - drm->mode_config.max_width =3D dbidev->mode.hdisplay; + /* + * Allow a framebuffer larger than the panel so a sub-region can be + * displayed via the plane source rectangle (crop / pan, no scaling). + */ + drm->mode_config.max_width =3D DRM_SHADOW_PLANE_MAX_WIDTH; drm->mode_config.min_height =3D dbidev->mode.vdisplay; - drm->mode_config.max_height =3D dbidev->mode.vdisplay; + drm->mode_config.max_height =3D DRM_SHADOW_PLANE_MAX_HEIGHT; drm->mode_config.funcs =3D &mi0283qt_mode_config_funcs; drm->mode_config.preferred_depth =3D 16; drm->mode_config.helper_private =3D &mi0283qt_mode_config_helper_funcs; diff --git a/drivers/gpu/drm/tiny/panel-mipi-dbi.c b/drivers/gpu/drm/tiny/p= anel-mipi-dbi.c index 60cd65cae..a0a098b0d 100644 --- a/drivers/gpu/drm/tiny/panel-mipi-dbi.c +++ b/drivers/gpu/drm/tiny/panel-mipi-dbi.c @@ -448,9 +448,13 @@ static int panel_mipi_dbi_spi_probe(struct spi_device = *spi) return ret; =20 drm->mode_config.min_width =3D dbidev->mode.hdisplay; - drm->mode_config.max_width =3D dbidev->mode.hdisplay; + /* + * Allow a framebuffer larger than the panel so a sub-region can be + * displayed via the plane source rectangle (crop / pan, no scaling). + */ + drm->mode_config.max_width =3D DRM_SHADOW_PLANE_MAX_WIDTH; drm->mode_config.min_height =3D dbidev->mode.vdisplay; - drm->mode_config.max_height =3D dbidev->mode.vdisplay; + drm->mode_config.max_height =3D DRM_SHADOW_PLANE_MAX_HEIGHT; drm->mode_config.funcs =3D &panel_mipi_dbi_mode_config_funcs; drm->mode_config.preferred_depth =3D bpp; drm->mode_config.helper_private =3D &panel_mipi_dbi_mode_config_helper_fu= ncs; --=20 2.53.0