Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2296444pxa; Mon, 3 Aug 2020 12:24:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0yAKdlR6nvnlV3du7TzgMCLsoR2+SlwSlU87BQPS/Oa5SPAJ91S7xdWtMV5RBV5AZq4mI X-Received: by 2002:aa7:d350:: with SMTP id m16mr16518997edr.169.1596482659736; Mon, 03 Aug 2020 12:24:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596482659; cv=none; d=google.com; s=arc-20160816; b=mWf9gcktziBrX9uxZmoUvPIa361u5f07njqtBGbG41GKZb7D0CnTspNPRc4+LwwQQ2 YcyzG27f1U4rxwjCtMpWaQlJ39sroGag2JLkaWtujXsApsFWXP/mnKvnFCQmie7LLzmm RAzH1SGxGytvmqrh9QTR3cGTjsIE+wXNShMjyNJBaNxlvnfYSXnOFNOqhC0qNRse+/aj xESeBYQbhXjpRDk4n4jUWieb/YXXujSV2X42p7xuqJutsMRMkKOSSava4crbL0Z7XjIO cKRsi2CeoYhwuzLrI3P0DtThhhYMIVV/8E3xPWYa0fYxUsft5O5mQWDN2gnUoB921INe ufbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dq93D4eYKRlwEpphUZG+JqVe46lHekIPQvei+XVFGC0=; b=j2hR7dSh2csD3lHGeUaRgyeuSIopBmoOPY0LW3okSiz7KI0LathNWX54KTbDaaJVir uiLs7Sc27zF0d9Y3bpPzBuvBGpw5hvMrZarrvW9EKgV1fv2BsF5YA7wwsJLkWgLV6dL+ 9EnIiwGqgU4s23laN6zzd9t+AJhognJtBJfF6n5WWoHERZfq8k+MEhTrD5Dh9N2L6HVL MKAkYVS1WZeJdvRWRiwbG/aa81OJUZijWi+zIlYuBYFJ5EKwfRDByXdc6joaPn24n8pl F00sk+rZ5Z/Nfls3mfhPBjTXn3GkPkgjSuepHUsx3b7OrDoBDfVf1QJOFwxmicERQMoE qDOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ragnatech-se.20150623.gappssmtp.com header.s=20150623 header.b=kh2E9KHQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si12052532edv.457.2020.08.03.12.23.56; Mon, 03 Aug 2020 12:24:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ragnatech-se.20150623.gappssmtp.com header.s=20150623 header.b=kh2E9KHQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727899AbgHCTVM (ORCPT + 99 others); Mon, 3 Aug 2020 15:21:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726948AbgHCTVL (ORCPT ); Mon, 3 Aug 2020 15:21:11 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F8DCC061757 for ; Mon, 3 Aug 2020 12:21:11 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id w25so5452811ljo.12 for ; Mon, 03 Aug 2020 12:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=dq93D4eYKRlwEpphUZG+JqVe46lHekIPQvei+XVFGC0=; b=kh2E9KHQE/XA0rLX/iC/gPSSg8GAI6bxQ/3ToX/6wlqrLLyzRl/IvlgX8y6idUVwvM fXACsuXASck6iTy2GRLvfo30VY5Y45ulGDfEvWdR1+g7mhrIhVG5qg7WH4bhAd4Nz5P1 yOQmwo3u2cxAj9Z9L34d1ZVkvJG9NaWAH3lpeetGso8HH2W9RSptF3cWB8VEBiPsMaCE lAnKtsrxinzo4m+lMMKSUq+0dhGeUjIK6SbXR+dAzd684ycDvPAvUKrhiujO3g5IqTkm WqWoyCtBWRCYUK78icUxHyO5wq4xABKyzVPX+g9PSzlkPpMdHLggbswqeoTtW8NXYlDP OcYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=dq93D4eYKRlwEpphUZG+JqVe46lHekIPQvei+XVFGC0=; b=pjvIkv/CUQKCJaKXKNQtIJ4DTXTR2WqF2arS6TUuqhLa6CTE0ddTOnKtCYvKDoP9Gj 9fAJ9XYr38dWuDPXZfHw3KtsOsU3FdY3ZT8wo5/P6PYFbH6svdl61EFWznFnkbxg89oo zY+i27hmAnstQ2MlaoE+cB8unkdCNJR/kRsL0137MwbZSOddhDItAov1UwnfSFL9uUHN 9vF8mwlq6av+ckdIj/7ThhxFLeTY1H4q4jj/dVZe3HeMhJcJJJsvznrrMu427cKKvsOz +FD4bL+IZ89vP0y8myDaSij4fVNEaAl8+OuuyCa7N1+ZOh1ANKSGdDuokFE/NiSycaIV APvg== X-Gm-Message-State: AOAM530YtEsTKH8Y0192cKq0Qy4Z60vVAbmLRrUntSqsQ7Lwcy/qkE3U J/MY5d7HDpGqeF8n3R4uIepBZQ== X-Received: by 2002:a2e:5801:: with SMTP id m1mr8351358ljb.281.1596482469687; Mon, 03 Aug 2020 12:21:09 -0700 (PDT) Received: from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203]) by smtp.gmail.com with ESMTPSA id v26sm4555934lji.65.2020.08.03.12.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 12:21:08 -0700 (PDT) Date: Mon, 3 Aug 2020 21:21:08 +0200 From: Niklas To: "Lad, Prabhakar" Cc: Hans Verkuil , Laurent Pinchart , Lad Prabhakar , Mauro Carvalho Chehab , Kieran Bingham , linux-media , Linux-Renesas , LKML , Biju Das Subject: Re: [PATCH] media: rcar-vin: Update crop and compose settings for every s_fmt call Message-ID: <20200803192108.GB2297236@oden.dyn.berto.se> References: <1596187745-31596-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> <20200801090456.GB1379367@oden.dyn.berto.se> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lad, Hans, On 2020-08-03 19:11:32 +0100, Lad, Prabhakar wrote: > Hi Hans, > > On Sat, Aug 1, 2020 at 10:04 AM Niklas wrote: > > > > Hi Lad, > > > > Thanks for your work. > > > > On 2020-07-31 10:29:05 +0100, Lad Prabhakar wrote: > > > The crop and compose settings for VIN in non mc mode werent updated > > > in s_fmt call this resulted in captured images being clipped. > > > > > > With the below sequence on the third capture where size is set to > > > 640x480 resulted in clipped image of size 320x240. > > > > > > high(640x480) -> low (320x240) -> high (640x480) > > > > > > This patch makes sure the VIN crop and compose settings are updated. > > > > This is clearly an inconsistency in the VIN driver that should be fixed. > > But I think the none-mc mode implements the correct behavior. That is > > that S_FMT should not modify the crop/compose rectangles other then make > > sure they don't go out of bounds. This is an area we tried to clarify in > > the past but I'm still not sure what the correct answer to. > > > What should be the exact behaviour of the bridge driver for s_fmt > call. Should the crop/compose settings be updated for every s_fmt > callback or should they be only updated on s_selection callback. > Currently the non-mc rcar-vin doesnt update the crop/compose setting > in s_fmt callback due to which I see the above issue as mentioned. This is not entirely correct. It does update the crop and compose rectangles on s_fmt, it makes sure they are not out-of-bounds for the new format if it's accepted by s_fmt. See v4l2_rect_map_inside() calls in the snippet bellow. That being said there is a difference how this is handled in the VIN driver between it's MC and non-MC modes and I would love to learn the correct mode of operation and seeing VIN being updated to doing it correct in both cases. Thanks Lad for dealing with this! > > Cheers, > Prabhakar > > > > > > > Fixes: 104464f573d ("media: rcar-vin: Do not reset the crop and compose rectangles in s_fmt") > > > Signed-off-by: Lad Prabhakar > > > Reviewed-by: Biju Das > > > --- > > > drivers/media/platform/rcar-vin/rcar-v4l2.c | 6 ++++++ > > > 1 file changed, 6 insertions(+) > > > > > > diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c > > > index f421e25..a9b13d9 100644 > > > --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c > > > +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c > > > @@ -319,6 +319,12 @@ static int rvin_s_fmt_vid_cap(struct file *file, void *priv, > > > fmt_rect.width = vin->format.width; > > > fmt_rect.height = vin->format.height; > > > > > > + vin->crop.top = 0; > > > + vin->crop.left = 0; > > > + vin->crop.width = vin->format.width; > > > + vin->crop.height = vin->format.height; > > > + vin->compose = vin->crop; > > > + > > > v4l2_rect_map_inside(&vin->crop, &src_rect); > > > v4l2_rect_map_inside(&vin->compose, &fmt_rect); > > > vin->src_rect = src_rect; > > > -- > > > 2.7.4 > > > > > > > -- > > Regards, > > Niklas S?derlund -- Regards, Niklas S?derlund