From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 D8C6F2FD695 for ; Thu, 30 Apr 2026 15:35:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777563341; cv=none; b=k1rd6V4kEeErg8M7f30YQdQs2Ty9FBpTyJmtU7I+992gcz0Ws0EBGIUoX/f7PPNsP1AT6lbtdmDVgJtd2t/9YTFQbugCVnVtm4hAhabtVNeO2b/VgoHoRlWDBb2eB3CezQZEKpPpvY6UEo//SWoReEpfsRRXF+chKQaXSKzfDSU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777563341; c=relaxed/simple; bh=NlhbRUl79f9tq9R3YugScP6gF9vXwrtrDCSId5OhOrU=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References: Content-Type:MIME-Version; b=su5Rwts9Wj1xe6sB6r33VbEUPKrC0N+TrRjwjQRwOMXNMnuuewARNelx4+E1BuwVnjBmJCRklBqHzQpz2Ir6yV68LIHIdihdoAvDwyMmW91+DkHiX1+jH6Vf+Z4guyW78wcGXf6EZXBbAzj9o9I4vdYwYW1UcoMYJLcOVgSd+84= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20251104.gappssmtp.com header.i=@baylibre-com.20251104.gappssmtp.com header.b=QHQoHiUs; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20251104.gappssmtp.com header.i=@baylibre-com.20251104.gappssmtp.com header.b="QHQoHiUs" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-48a7fe4f40bso11141845e9.0 for ; Thu, 30 Apr 2026 08:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1777563337; x=1778168137; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:organization :references:in-reply-to:date:to:from:subject:message-id:from:to:cc :subject:date:message-id:reply-to; bh=NlhbRUl79f9tq9R3YugScP6gF9vXwrtrDCSId5OhOrU=; b=QHQoHiUsA4SyWbZC6ohu/tk9zzJyDB+7J4yQ0eBFNMV1WS3c+Wy2bL5ZnECqwPVtb1 t1KbmzEISHFcfD1hnaNMQV1hQbcR+qwCzfTK2gWl25cy1oy8jrJncrdx6Aa/GNy3v8pi eX2EsbH+CKnaVgtl8PTmtaCoWj8Q7/SttfCPns6q62GqRLRQCCeNjkhW9jdZEJKl8zWP 69qBN/cFpdjeChR2QNZPsQB1N+aaM3LnCxI3KT3cq/+9L1SFgxISYFGR5O9lEClRkpAq f2YVhpIvBMILkK3M8Hv6Q5F7v+IOb2CpQL40zDKXlJIsJvH9Sjf6mQkCixK6JMRyzoWt Rz7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777563337; x=1778168137; h=mime-version:user-agent:content-transfer-encoding:organization :references:in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NlhbRUl79f9tq9R3YugScP6gF9vXwrtrDCSId5OhOrU=; b=tHmHnaUfmpAnLrOQsjGvRdYiDVY8rWC1S2UGmu4H/9yWNDk3SSO2Wn8jmTEWjcMnj4 P1KVU3kZvL0bPmQ1Ku4A23OzIrjVMHyB38TqMUpWmH7HVR9cp20Z57A7zQeDopubZVQV H5EwBRvzYb2RSXdcx8EcuBH9wPgGzZp1TlzZfsWdk7+29S631AZec3mHgONKsBvQuOOL YOzU4W5ZNbvIq2AI88VVg3yGGmhoqGgAGQ8MrVgeaVdh30MFwWYH9l+kmvVusBcPLBFI EyDCrksk5lVlroI6ZUpuAtaXT+Oo4viI/RlWnrSGGcEcex9SsW5PemcLznnRY6fp2nU6 CZ1Q== X-Forwarded-Encrypted: i=1; AFNElJ9HG8wofam60beJTBSYqCBOQZgrxB/Cx7XInDS8iep79AB3fUbcAAIqYqkc8+5u0O5Tl36hUbRkEuqXUu0=@vger.kernel.org X-Gm-Message-State: AOJu0Yzn3F+tb/l91djMbnQkQ+UZ6FEWOYAXDtj75R7JonZkq75Kq2Qv ojnyABvL8Z7CVRDg8IizaUyUslK/FWJgkReqmzlY0p8FUIPljXbybC7vZGakyLpmFwM= X-Gm-Gg: AeBDieuTPpP5ZJrVx5Eq8r/iewLpf+5w71TYwVbFLTt7lB5S9lUfnlIEdj0bKFQpDcC //zseROWdDDEGC1jUoYq1UBoq4Qd7xVmgXdx77bQKmPxExJal+rbYvjHOcTh0yMgMqVLXUnSgFI cJOoVkJZgbz7UJtAXYuHqr5MARoujnLDDl+svKGFZ4K63NXmqE0mdrZjd0dxhn0N80iAg1jjQxv TB+dgdRemZfODn8fuhQzwpY1hBLCztiKHWszashvHWgmpeunTRL5lXphCHWfXmlIjHWIKpKRXrD 7YV4/7DP9BJGrQXKv3sYm+bMy6uteOjfGNeiKPbUfp7mtxfzfKv82bZG4Nn2s1zEf29MfTpZwJN Y1ykjhGh/ZFYXi4EQo+sih0nr9bPtU0Hx5cAGXz9QqnQjhYmN8ftXJ8DJgLCby63/ZCBHWXz81J YRaLb2ftx5M0oft1rBIo5iDP52 X-Received: by 2002:a05:600c:c0c2:b0:489:1ff5:edda with SMTP id 5b1f17b1804b1-48a83d66d38mr42439965e9.6.1777563337249; Thu, 30 Apr 2026 08:35:37 -0700 (PDT) Received: from [10.19.106.145] ([151.19.88.6]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a822c832fsm122768725e9.10.2026.04.30.08.35.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 08:35:36 -0700 (PDT) Message-ID: Subject: Re: [PATCH] drm/fb-helper: Fix clipping when damage area spans a single scanline From: Francesco Lavra To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Date: Thu, 30 Apr 2026 17:35:34 +0200 In-Reply-To: <20260210173545.733937-1-flavra@baylibre.com> References: <20260210173545.733937-1-flavra@baylibre.com> Organization: BayLibre Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Friendly ping On Tue, 2026-02-10 at 18:35 +0100, Francesco Lavra wrote: > When the damage area resulting from a dirty memory range spans a single > scanline, the width of the rectangle is calculated dynamically because it > may not coincide with the framebuffer width. > If the dirty range ends exactly at the end of the scanline, the `bit_end` > variable is incorrectly assigned a 0 value, which results in a bogus clip > rectangle where the x2 coordinate is 0. This prevents the dirty scanline > from being flushed to the hardware. > Change the calculation of the `bit_end` value to fix the x2 coordinate > value in the above edge case. >=20 > Fixes: ded74cafeea9 ("drm/fb-helper: Clip damage area horizontally") > Signed-off-by: Francesco Lavra > --- > =C2=A0drivers/gpu/drm/drm_fb_helper.c | 2 +- > =C2=A01 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/drivers/gpu/drm/drm_fb_helper.c > b/drivers/gpu/drm/drm_fb_helper.c > index 4b47aa0dab35..d545342d24b3 100644 > --- a/drivers/gpu/drm/drm_fb_helper.c > +++ b/drivers/gpu/drm/drm_fb_helper.c > @@ -608,7 +608,7 @@ static void drm_fb_helper_memory_range_to_clip(struct > fb_info *info, off_t off, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 * the number of horizontal pixels that need an upd= ate. > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 */ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0off_t bit_off =3D (off % line_length) * 8; > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0off_t bit_end =3D (end % line_length) * 8; > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0off_t bit_end =3D bit_off + len * 8; > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0x1 =3D bit_off / info->var.bits_per_pixel; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0x2 =3D DIV_ROUND_UP(bit_end, info->var.bits_per_pix= el);