From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 533AB3191CA for ; Fri, 10 Apr 2026 07:27:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775806062; cv=none; b=mw/I5D1qHl3fPs6oCGujB05S5K88B3bwSnOsn0BhlLjnXlsLJKXaLhhW7GrHhaDNP+rSQui+t4pshKCTI3Sb9p4J7CFdw6lCLOXWeeLAAMx4tHFObmPoRp5mPEvK0mxWtI5rFcy+VnhMslCsFE33AcILoKEGKRnwOLYKd4t+xE0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775806062; c=relaxed/simple; bh=rnb4gzBgIKnMeAPvla/z4PpYUBc4RoIaproSRAdK3+o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qBVBimvYyepWnA10bLmUas2udZCxW0daMZdm8EOxsed9c3DUDL3r2cMVMeu/FfUxztow6ZNX04wh4ZGRz0xzQTzZEhgmkwCn2w06ki3P1hUwOFeB9YqYx63Kc6VL9OSAUb7Z7uK1dTH8sOkCNAXY+PK3nQMqM8Lb2zdGI64qUlM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=N43XqmHZ; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="N43XqmHZ" Received: from ideasonboard.com (net-93-65-100-155.cust.vodafonedsl.it [93.65.100.155]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7FC5C1E7; Fri, 10 Apr 2026 09:26:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1775805968; bh=rnb4gzBgIKnMeAPvla/z4PpYUBc4RoIaproSRAdK3+o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N43XqmHZGCqaZjkUu43rf80ich9x//QsRfqGnn2RlUzZZvHKT8tBxCU3i1auyjfF9 6pWiIPt29iAWDBz9toJ4CtkuSxclSzEeaHmps5u6vi947zC3mU1drjNrPhp6ZtIK2s HyTGoqMN5Kqgq8B2LySrlW5hoedje+Gzt999/c8I= Date: Fri, 10 Apr 2026 09:27:34 +0200 From: Jacopo Mondi To: Sakari Ailus Cc: linux-media@vger.kernel.org, hans@jjverkuil.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Dave Stevenson , Tommaso Merciai , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , Stefan Klug , Mirela Rabulea , =?utf-8?B?QW5kcsOp?= Apitzsch , Heimir Thor Sverrisson , Kieran Bingham , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede , Jacopo Mondi , Tomi Valkeinen , David Plowman , "Yu, Ong Hock" , "Ng, Khai Wen" , Jai Luthra , Rishikesh Donadkar Subject: Re: [PATCH v4 03/29] media: imx219: Set horizontal blanking on mode change Message-ID: References: <20260408153939.969381-1-sakari.ailus@linux.intel.com> <20260408153939.969381-4-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260408153939.969381-4-sakari.ailus@linux.intel.com> Hi Sakari On Wed, Apr 08, 2026 at 06:39:12PM +0300, Sakari Ailus wrote: > The driver UAPI is mode-based, allowing the user to choose a mode from a > small list based on the output size. The vertical blanking is set based on > the mode, do the same for horizontal blanking so the frame rate obtained > is constant. > > Additionally, it's best to use a known-good horizontal blanking value as > choosing the value freely may affect image quality. While the minimum > value may not be the best value for horizontal blanking, at least it is > constant rather than a minimum value of a different configuration. As Dave suggested, we should probably better define the desired behaviour. As far as I can see the driver doesn't specify a line lenght in the supported_modes array, and I guess we're always running with the min valid blanking. From a libcamera perspective only RPi changes the HBLANK control value, all other pipelines use the default, so if Dave's fine with this, I'm fine as well. > > Signed-off-by: Sakari Ailus > Reviewed-by: Dave Stevenson Reviewed-by: Jacopo Mondi > --- > drivers/media/i2c/imx219.c | 15 +++------------ > 1 file changed, 3 insertions(+), 12 deletions(-) > > diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c > index 89061dc1842d..62a23541b1dc 100644 > --- a/drivers/media/i2c/imx219.c > +++ b/drivers/media/i2c/imx219.c > @@ -837,11 +837,9 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd, > struct v4l2_mbus_framefmt *format; > struct v4l2_rect *crop; > u8 bin_h, bin_v, binning; > - u32 prev_line_len; > int ret; > > format = v4l2_subdev_state_get_format(state, 0); > - prev_line_len = format->width + imx219->hblank->val; > > /* > * Adjust the requested format to match the closest mode. The Bayer > @@ -882,7 +880,7 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd, > if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { > int exposure_max; > int exposure_def; > - int hblank, llp_min; > + int llp_min; > int pixel_rate; > > /* Update limits and set FPS to default */ > @@ -924,15 +922,8 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd, > llp_min - mode->width); > if (ret) > return ret; > - /* > - * Retain PPL setting from previous mode so that the > - * line time does not change on a mode change. > - * Limits have to be recomputed as the controls define > - * the blanking only, so PPL values need to have the > - * mode width subtracted. > - */ > - hblank = prev_line_len - mode->width; > - ret = __v4l2_ctrl_s_ctrl(imx219->hblank, hblank); > + > + ret = __v4l2_ctrl_s_ctrl(imx219->hblank, llp_min - mode->width); > if (ret) > return ret; > > -- > 2.47.3 > >