From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 A466825FA29 for ; Mon, 27 Oct 2025 16:50:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761583812; cv=none; b=E7Z0cO+8Q3/dppigXTI/WzTujr5M/UdQi1OQ7XOrL3jPu46uACfLV8UmpMx8TfEe/yo+KPmHseAQ+6A9J6fWQDjCWq2bmPXG/mnH4+Lh49GXI0TPCAtGTi9yMppmkybQmrDp67vT14LfUoTcGZKLt/dveRiGcx0AOhld03a2DKU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761583812; c=relaxed/simple; bh=f9gyr+50VXCzFRqzh5h2Eocs+kwwPbsfidV5wgRt5Ys=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=thOVdm6Dyjtfs2QrdmSim3E8lEzN5Za2o0UTD55ZOjckO8+FKrFGip40ROevgYwN4QOWb7TzqjxFjaAipeo+fW6G8kHl5nOlsOj+dS3muJU2V9ekdp8hL9u3+nAQKK5C51cLDcEvr9dkZspdKGTermCgVBal8jcrmQHjqFzg3gI= 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=ff/jTan1; arc=none smtp.client-ip=209.85.221.44 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="ff/jTan1" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3ee12807d97so4262904f8f.0 for ; Mon, 27 Oct 2025 09:50:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761583809; x=1762188609; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=llXiWHJLf2syx3blZo0CXJGIyiry1LJYTByzcLi8/h0=; b=ff/jTan1lkgWUNpwMGoLzGON5a2N4mfXOajPZajkFvH4cHFDFH+FASZNEuimReQO6t h0XaH+V4MjEnkv28OfQ38Tvg38vlkJkkq4RD92MGqt/zQzWhEXU9Bnvg1i80vEXdEdfA cPku+D2MAL+xeB9+xGkOr3NIEkdA9WjcUHW/zNNC01W5n8bMhqxRohJO2bTq8sDwdKg/ TP51AnWBRMZtN4dZo+3KFvGCIG8D3ae6YO8rH91kqj9XOGkFJFFhWjSakU6jYCOY5FpC zC7XbRmD/bv7A9azMVoI1YHeqMiVCcNUVfG5RDf6ZRtAqWq+FH1HTRInCvxfxnB2DpZy 38FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761583809; x=1762188609; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=llXiWHJLf2syx3blZo0CXJGIyiry1LJYTByzcLi8/h0=; b=NmBZU6fAF8RuEoSOsfg3IedUTGbeaEP998zx+k0ECkdNQYsEKJf2MFOvrWYpk0HDRR Apn6r9dABz3ArsyFteSk1HgCzNVVwC1U2EUT0sit+Cw7pbPCrATMjnhPT4qGsqGIeXtL XueCqDbJQ77ZkTx3YOZNs3pngUodMJ/jtTuzMDzmyLUXl5QPSvqG0TJpaK7K2SMpnTsi OXWOK+tEJYn20730nQYp+sreef2AyXuzao9rYhkbAbrCl4psObtF3heXkl/KNi2xv/cc K4/hHKg80sEQ9uPZYS/7P4syqcbSSHBbfRp0MfEmYxeu2SpzG3nUTy8C/v2lDUeCFC1j HQDw== X-Forwarded-Encrypted: i=1; AJvYcCXoZ2tqaGK0AwMuoaolHP1RjBbX5q6WdSo9SmPSO4Yuxm+fFfcIMNVTh2oMIPAsFiCVrDHV6lKJRbog@vger.kernel.org X-Gm-Message-State: AOJu0YyAkxpulu9uOPpzvtxXkFkpUh2y0AlR/5QSUGT2QDg+l9gN65W3 k757w3TWjNC/olwdSubdISQ/DZHssWxFL+SYSDjMc5QLC4sv/XXyBppCNv7Ht8DuCRhguIjzTLo jRNDyaRhgyYPNSUmxA6xbDXGGUthEBnU= X-Gm-Gg: ASbGnctO8yBeN/NSO+d4JSpb9ZSph/FaHcPcQuqKHQstK/cR0SX7l782T4MbO8xgtPy /MI3Jnw4UAfU4RtmrNM5jHVVGTQY7wUDoK4qQTWa3Hfjf3lEvANH7zzo8othLc2GwtBVT4yKzYp icnpYv3usWVC93zGiEKXAUQwOY4yvW7TUdlchsn7Lxa/PItrQufW/qPGbxuk6MSWCftSJCKni+8 E7JNYPLbv3jZAVTYtlNf5FWzlvi9wiRNEX3CJk9IPFkHyRR6GVm52UDrAW9Rg== X-Google-Smtp-Source: AGHT+IH4XlaBzxcnNj5YFZ0kloDrzQaT1eJpLjTjeIpDU2XpK4VeABDkTozkzcR3WZnwD6TgVQ+f15BePNjDYvfetA4= X-Received: by 2002:a05:6000:186e:b0:428:476e:e0ab with SMTP id ffacd0b85a97d-429a7e97661mr333005f8f.60.1761583808872; Mon, 27 Oct 2025 09:50:08 -0700 (PDT) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251022142051.70400-1-clamor95@gmail.com> <20251022142051.70400-7-clamor95@gmail.com> In-Reply-To: From: Svyatoslav Ryhel Date: Mon, 27 Oct 2025 18:49:57 +0200 X-Gm-Features: AWmQ_blgGtMyE7YToN26_Q2JZoB8VDufuUc2Jv2Dui7Z-P7sPMVoiu7__HneWyw Message-ID: Subject: Re: [PATCH v5 06/23] staging: media: tegra-video: vi: adjust get_selection op check To: Hans Verkuil Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , Prashant Gaikwad , Michael Turquette , Stephen Boyd , Mikko Perttunen , Mauro Carvalho Chehab , Greg Kroah-Hartman , =?UTF-8?Q?Jonas_Schw=C3=B6bel?= , Dmitry Osipenko , Charan Pedumuru , Diogo Ivo , Aaron Kling , Arnd Bergmann , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-clk@vger.kernel.org, linux-staging@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =D0=BF=D0=BD, 27 =D0=B6=D0=BE=D0=B2=D1=82. 2025=E2=80=AF=D1=80. =D0=BE 17:4= 4 Hans Verkuil =D0=BF=D0=B8=D1=88=D0=B5: > > Hi Svyatoslav, > > On 22/10/2025 16:20, Svyatoslav Ryhel wrote: > > Get_selection operation may be implemented only for sink pad and may > > return error code. Set try_crop to 0 instead of returning error. > > Can you mention why try_crop is set to 0 instead of returning an error? > > That would be good to have in the commit log. And in fact, it's not > clear to me either why you want this. > > > > > Signed-off-by: Svyatoslav Ryhel > > --- > > drivers/staging/media/tegra-video/vi.c | 8 ++------ > > 1 file changed, 2 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/m= edia/tegra-video/vi.c > > index 7c44a3448588..856b7c18b551 100644 > > --- a/drivers/staging/media/tegra-video/vi.c > > +++ b/drivers/staging/media/tegra-video/vi.c > > @@ -476,15 +476,11 @@ static int __tegra_channel_try_format(struct tegr= a_vi_channel *chan, > > fse.code =3D fmtinfo->code; > > ret =3D v4l2_subdev_call(subdev, pad, enum_frame_size, sd_state, = &fse); > > if (ret) { > > - if (!v4l2_subdev_has_op(subdev, pad, get_selection)) { > > + if (!v4l2_subdev_has_op(subdev, pad, get_selection) || > > + v4l2_subdev_call(subdev, pad, get_selection, NULL, &s= dsel)) { > > try_crop->width =3D 0; > > try_crop->height =3D 0; > > This looks all a bit magical. Which subdev is queried here? I.e. what is = the corresponding > subdev driver that implements get_selection? > Camera sensor subdev, Tegra VI driver directly interacts with camera sensor= . > > } else { > > - ret =3D v4l2_subdev_call(subdev, pad, get_selecti= on, > > - NULL, &sdsel); > > - if (ret) > > - return -EINVAL; > > - > > try_crop->width =3D sdsel.r.width; > > try_crop->height =3D sdsel.r.height; > > } > > It looks odd (esp. setting try_crop to 0), and I wonder if this code path= has been tested. > Yes it was tested. Original code checked if the camera sensor has get_selection implemented and if such operation is supported then it applies width and height from get_selection, else zeroes. This works just fine with most cameras and v4l2 compliance tests pass fine, with most but not with mt9m114 which implements get_selection only for its ifp source pad while sink pad always returns -EINVAL, hence VI driver fails with -EINVAL too. To address drivers like mt9m114 instead of just fail with -EINVAL if get_selection returns error try_crop width and height will be set the same as get_selection is not implemented. > Regards, > > Hans