From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796297169; b=QCxtP/4/biyrNlwTrWsys7Udfk7cj5plxiyiKJRt5i/vImCekaCvSos7ydn6e6NyDFHk 6qvUu5zQfnbeD32nPn1TB5IPM4U1QmIPpraJSIZgRncNi9JfTWutlxvKsYl6X+spGHPWP yhmLuhYYr8Fab1zIVwwEo8tRKxa3Ez9Bk3wf/NgDiBNwVJQdIckbo59utSd91MC8/dSo1 b7u6hblfWbbUH7AnRuyDUSMFcNZMuEZOb+uwIts7690Pc9EW3xKRgZ3hqXKtFnCvhL8NE Q1wQKuRIiUwR8kdnSL8Rddxp+cmfH8HSxO8l2v2L7bxdKE0FFR29kF2/v5v+3VIaBDw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796297169; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:From:Content-Language:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=zALp1PBMm5vqJesm71utBajXAW4CXE2cWkyHGba1ehU=; b=pHp6WQZg8J6THk2EAEMrX7TZK5o+KcKA+fcfPiSmWNLqLw7/6YFZQ6vW3P0gA1nzwCnt i/P5UD+dj1bAgzy+dL3+l5O0+LpwseXtq1caA6p2oSw3NzIAjN/PG5uyaaXRYhkvH/hWI eRhQeRIKHdfCnqNQzPI7CubDQIsVp8KHbBcx2699+o5TcN/73WsnpmcYUI22dpAmcH3TO 7RvkzetWLFcG/XhwK8bXL/JkpwMal3JCxe2n4ANcJRiGgTbot2rktRuu/s7KYXDHdOIvw gwu2jnCQBG48GserQF36eLyI4W0xHfxzYfd0AFrcREMdgD6j4e7WhKoQsBLFGq4K1pw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=c9R0i1TT; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF3C9606A33A for ; Thu, 3 Dec 2026 11:26:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=c9R0i1TT Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9628C1F000C1; Thu, 3 Dec 2026 11:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796297169; bh=zALp1PBMm5vqJesm71utBajXAW4CXE2cWkyHGba1ehU=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=c9R0i1TThS63IuzE5L8DpokNPGZPMfvm49Y9Hmj39Q4KkmBFEDkQISpyQMsl5r44T V6Ct7u6ItSUo0uG5vBcksDAqDZvYz1Ny5VgR0/I9P09qKZ3yas1KrXpBVahuDN+LZ9 T+DfI0uZsMhxgCKHDS1ZHzy5nXG+OoFo6C6nREbD7UmQZZ/Pkdl1zGnZlfhGNRPEIG ed23lzupT/y0sG5PkuOf72UYXnmIBEvUTqv9nJEtXofP2F2v1DLUFZ0Lls+VwlZH+j ZnKfF9D+DgM/QrhkKJ9V+S7dCsFAEwxqSAmEu5NUHT8eWGBLDs+xZgLhKo6eLJrpM4 Ri34weT5Nhqjg== Message-ID: <1e93deeb-8633-4e16-8711-c67fd048fbdd@kernel.org> Date: Thu, 3 Dec 2026 12:26:05 +0100 X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] media: stm32: dcmipp: pixelproc: Fix width limit for downsize block To: Alain Volmat Cc: Lin Huiyi , hugues.fruchet@foss.st.com, mchehab@kernel.org, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-media@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org References: From: Hans Verkuil Content-Language: en-US, nl In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 02/12/2026 09:40, Alain Volmat wrote: > Hi Hans, > > On Tue, Dec 01, 2026 at 01:42:42PM +0100, Hans Verkuil wrote: >> Alain, >> >> Can you review this? It sounds plausible, but someone with the datasheet should >> verify this. > > Indeed, 4096 is too big for this field. However 4095 is also too big > since the maximum value is 4094. As a matter of fact I have a downstream > kernel commit fixing that and have in my todo to push it but just haven't > done it yet since I am currently focusing on preparation of the ISP > statistics and control block upstreaming. OK, in that case I'll drop this patch and wait for your patch. Regards, Hans > > Regards, > Alain > >> >> Regards, >> >> Hans >> >> On 29/11/2026 18:42, Lin Huiyi wrote: >>> The pixelproc subdev advertises a maximum width of >>> DCMIPP_FRAME_MAX_WIDTH (4096), but the downsize block target size >>> register DCMIPP_PxDSSZR stores the width in a 12-bit field >>> (GENMASK(11,0)) which can hold at most 4095. Composing a full >>> 4096-pixel wide stream therefore writes 4096 into the register, >>> setting bit 12 outside of the HSIZE field and leaving the field >>> itself at 0. >>> >>> Clamp the pixelproc width to the largest value the field can >>> represent (4095). >>> >>> Fixes: 239cf9e5fda1 ("media: stm32: dcmipp: pixelproc: addition of dcmipp-pixelproc subdev") >>> Signed-off-by: Lin Huiyi >>> --- >>> .../platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c | 8 +++++++- >>> 1 file changed, 7 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c >>> index 7d8e5f0863..779c898793 100644 >>> --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c >>> +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c >>> @@ -455,8 +455,14 @@ dcmipp_pixelproc_adjust_fmt(struct dcmipp_pixelproc_device *pixelproc, >>> if (!vpix) >>> fmt->code = PIXELPROC_MEDIA_BUS_FMT_DEFAULT; >>> >>> + /* >>> + * The downsize target size register DCMIPP_PxDSSZR stores the >>> + * output width in a 12-bit field which can not hold >>> + * DCMIPP_FRAME_MAX_WIDTH, clamp the width to the largest value >>> + * the field can represent. >>> + */ >>> fmt->width = clamp_t(u32, fmt->width, DCMIPP_FRAME_MIN_WIDTH, >>> - DCMIPP_FRAME_MAX_WIDTH); >>> + DCMIPP_PxDSSZR_HSIZE_MASK); >>> fmt->height = clamp_t(u32, fmt->height, DCMIPP_FRAME_MIN_HEIGHT, >>> DCMIPP_FRAME_MAX_HEIGHT); >>> >> >