Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1950974pxb; Sun, 31 Oct 2021 04:32:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaGBZK4n8ExzLEsoVW0vUq/NQ0Eb+tCx+ZPKMtliF7mc+uX1+UhxTbWV615UFnD/mkOjre X-Received: by 2002:a05:6e02:198e:: with SMTP id g14mr15919969ilf.204.1635679932834; Sun, 31 Oct 2021 04:32:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635679932; cv=none; d=google.com; s=arc-20160816; b=P5q9qZyc3/y6ib5aANXsnEMMWlMY3SQnyfVhpi7FILA9BjqNjgbVFqwUwLCDHIbSy9 aXARsNfrFCMObgDq6LLQlv4TIto+TNvobbuOgI7QR1EnJVduKwiZppnyaYFyKzkKQqbp yjs2iez7DSeaFL79/fAhpPnTYda+CAZE4AwdST3JPyn912H11WSTGDMOBtNiL/Yn81uQ n6Y/3F0cSQo81J7ENHeCDT8EcllxQ1wSm/jN17O1Z9PTTVreHXduASwRMnDUkVppy8PP 7W4N69/mFYNjFk9sayH+wrbElWOMRaRo953+/EUImRrxhvUcwIv5WVTpFjb6waIb5xdo p5/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=p1hg3JQRA1kDxJAZCRsAXbgMhMceIBOOajURLJF6K48=; b=zO0DYn/g3P2ccGffjsDzUfmU8iU+03xaxl2qJ2CL0mMIe3SdECCbCRfQYNlIv8pu+R wqVi6S2B4HqKUIfj8aNXlRrwc3XpfO+UczX6EW9/texvugA5ikl3jxPipsGx9I5+1+Am Zh7oqtZxrvcP0waHsIf6vFvu+yqJK9MRXWioniosrLVT+VxjqlLNjWuUOMCN1z7KdwEd mWWFi/meBWqGMs9WTSzjS2kfGSDQvJBdMVFJkWHpflbuFuTDxIzVrwYOA1QgadNFafIV tnlksilrEhbEqEUya++/G+rCkEKTSE3FAgae8BzpbMXLs4hD1nNeSU6vNoG1IYjTTsay sxfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b="rIT/1xHU"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t10si20830308ilu.81.2021.10.31.04.32.00; Sun, 31 Oct 2021 04:32:12 -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=fail header.i=@kernel.org header.s=k20201202 header.b="rIT/1xHU"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231394AbhJaL1l (ORCPT + 99 others); Sun, 31 Oct 2021 07:27:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:47148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230388AbhJaL1i (ORCPT ); Sun, 31 Oct 2021 07:27:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 721AC60F9E; Sun, 31 Oct 2021 11:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635679506; bh=yWrx6iv06r2GqFH4VQZjTHiT5ccrn4b5I9ePck+bYns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rIT/1xHUV33yKbZdHVRcC5DI/obAHQdv3K3Ns3AQ38ka19ofrevwnDmgctC7QDeVU I0ZyynsCtqjYN+KLD/qtSxNF7VZJftjp9UDyjJBc/4E+Gzeoav5vOkNVbMRtfLd45q hOLQDCI8YFsoHidyyevq/dHJwWqIAOhMd9+KqqCfL6NEveD+ncIHIy9X+fXZuwV9bR o+me66FB6xiF2z5AYNvLNv/Q93Dha57DBFvB7E3uvKplKTOT5nBnTbzd9rLbOPE0zF w1oxZBzTvbXCTvjRPfl5SCJVeAqr4WDe6+PPWkzIcnSxvsK4zeQ4wHL1Ax+4jyLZly uq+phd7/vGaGg== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1mh8xT-003wZM-EC; Sun, 31 Oct 2021 11:25:03 +0000 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Arnd Bergmann , Dan Carpenter , Greg Kroah-Hartman , Ingo Molnar , Kaixu Xia , Mauro Carvalho Chehab , Peter Zijlstra , Sakari Ailus , Tsuchiya Yuto , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 2/3] media: atomisp: report the visible resolution Date: Sun, 31 Oct 2021 11:25:01 +0000 Message-Id: <3a7f0de1edeca8d3e4d91f25f42339580d34a6e0.1635679495.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The atomisp sensors and logic adds an extra pad lines/columns, called "dvs envelope". It also uses an extra 12 lines/columns at the sensor for BYT. As those are not visible to userspace, the V4L2 API should decrement such values when reporting the current resolution. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 8f0a9a69f075..d92d41dd0ade 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -876,6 +876,20 @@ static int atomisp_g_fmt_cap(struct file *file, void *fh, v4l2_fill_pix_format(&f->fmt.pix, &fmt.format); f->fmt.pix.pixelformat = fmtdesc.pixelformat; + + /* + * HACK: The atomisp does something different here, as it + * seems to set the sensor to a slightly higher resolution than + * the visible ones. That seems to be needed by atomisp's ISP + * in order to properly handle the frames. So, s_fmt adds 16 + * extra columns/lines. See atomisp_subdev_set_selection(). + * + * Yet, the V4L2 userspace API doesn't expect those, so it + * needs to be decremented when reporting the visible + * resolution to userspace. + */ + f->fmt.pix.width -= pad_w; + f->fmt.pix.height -= pad_h; } depth = atomisp_get_pixel_depth(f->fmt.pix.pixelformat); -- 2.31.1