Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp726397pxu; Thu, 3 Dec 2020 11:02:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3kJBtQb1ouW+jVHwe7Iev58NA6s8WEqnl2aa7204d6ZYLwDuS5otxktrfQaXZe9eMV7+X X-Received: by 2002:a5d:400a:: with SMTP id n10mr690168wrp.362.1607022159530; Thu, 03 Dec 2020 11:02:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607022159; cv=none; d=google.com; s=arc-20160816; b=O30rrv8ebP1x817cBBLURXQtyJbn1B7ZS+v6E7ilJbFP9QPyNe6ZpsC1270Zz3ggBb wByMxaRUXJgcEIHrJgdm002+iMKyr5ijJoMdeg3bXix2ICdSj3tvsId956cRR1NCRBSP k2M5f2yEYRHnWiGK6Lag6vEVtam1zaDkfSHmrUYSSLnxO9jqXmrnCZeDKVJKXOhKKgta jJCVkO57Rzboiffn/rmgexzihz/9q8n705u3WGflsK6OvWq7OnZUjfdTHz10GTexqa43 tpssSg2Tly2L7o1caaAC8X6jqs3H58BSdko/11IHGf14kFk0IrEZH/u1LtyQ/0NmERPb 5sWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=KU4kkKyfxjB47xZSqJdcMrFYTj+ssTxcvqFUoz12xtg=; b=ijZxpNFDD1ozkrEwWd5Ep1QIBWMMhXa0ut5FOUuKuf/S5jyeMywFCMiH3FzQ0FagSo 4gIy2K3kXxCF0OF19wl2xaeLUSr7v9sw1reC8d5NZPDa06KNTmxHTLL+CA/rXZ4HiV3Q UDMyf/ETL9z/4VsXCnbw4g2mrd2Wp7gmCOuW+et2CCUULsbIDK5nienYRTTbDKAtJMZ8 t1ujKBA0o+xWG3muKQQiQRVxax7YvQzC7j/baZJlJiay148MKfq5Hy2i3EzWsDCCEx+L VCiHt0kdbfd6EzjAM4KE2YqEnPjSEUQ3LCsi0kJ/ek2cDaJt2crSPbh3ohXXI/cv3orN qeqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="ImQ8f5t/"; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i33si1456555edi.93.2020.12.03.11.02.16; Thu, 03 Dec 2020 11:02:39 -0800 (PST) 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=@nvidia.com header.s=n1 header.b="ImQ8f5t/"; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731666AbgLCTAu (ORCPT + 99 others); Thu, 3 Dec 2020 14:00:50 -0500 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:18309 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727718AbgLCTAt (ORCPT ); Thu, 3 Dec 2020 14:00:49 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 03 Dec 2020 11:00:08 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 3 Dec 2020 19:00:05 +0000 Received: from skomatineni-linux.nvidia.com (172.20.13.39) by mail.nvidia.com (172.20.187.15) with Microsoft SMTP Server id 15.0.1473.3 via Frontend Transport; Thu, 3 Dec 2020 19:00:04 +0000 From: Sowjanya Komatineni To: , , , , , CC: , , , , , Subject: [PATCH v3 04/13] media: tegra-video: Add support for V4L2_PIX_FMT_NV16 Date: Thu, 3 Dec 2020 10:59:53 -0800 Message-ID: <1607022002-26575-5-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1607022002-26575-1-git-send-email-skomatineni@nvidia.com> References: <1607022002-26575-1-git-send-email-skomatineni@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1607022008; bh=KU4kkKyfxjB47xZSqJdcMrFYTj+ssTxcvqFUoz12xtg=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:X-NVConfidentiality:MIME-Version:Content-Type; b=ImQ8f5t/c41iPkMOLFI9rTPRcfEQwElpk45j2M7bJ49+hBz8QMXz05vMDkjhxzmi+ uR5diDl6kTwE1ypebPQf0BG5+jI5yohcDSprgOY4lFhWpi6WgtZucD1XVcgenQGO5x vRTwRp07qSs1iJuCbSy+Jd6gPgSNyzE0hJceaOUtzpRm82RbiSqyLU9UmxVPSkbcsx 6cvohCP2Uh29D33hl1FQjd2q922IHYv8OKxexNIhNcELcYvfWRWc6Lp0i0kD9KLIgn Cqr9XAWaPwdAQvipH8Fga6vF3q27WTyNiFhACyj8RGnuLkwv9LA/3R0KtMqPTmF4X2 JjBkXGQWSd3kQ== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org NV16 are two-plane versions of YUV422 format. VI/CSI surface0 registers corresponds to first Y plane and surface1 registers corresponds to seconds UV plane. This patch updates image size for NV16 format to include both planes and programs VI/CSI surface1 registers for UV plane capture. Signed-off-by: Sowjanya Komatineni --- drivers/staging/media/tegra-video/tegra210.c | 13 +++++++++++++ drivers/staging/media/tegra-video/vi.c | 2 ++ 2 files changed, 15 insertions(+) diff --git a/drivers/staging/media/tegra-video/tegra210.c b/drivers/staging/media/tegra-video/tegra210.c index 68f09e4..b731aa5 100644 --- a/drivers/staging/media/tegra-video/tegra210.c +++ b/drivers/staging/media/tegra-video/tegra210.c @@ -287,6 +287,7 @@ static int tegra_channel_capture_frame(struct tegra_vi_channel *chan, { u32 thresh, value, frame_start, mw_ack_done; int bytes_per_line = chan->format.bytesperline; + u32 sizeimage = chan->format.sizeimage; int err; /* program buffer address by using surface 0 */ @@ -296,6 +297,18 @@ static int tegra_channel_capture_frame(struct tegra_vi_channel *chan, vi_csi_write(chan, TEGRA_VI_CSI_SURFACE0_STRIDE, bytes_per_line); /* + * Program surface 1 for UV plane with offset sizeimage from Y plane. + */ + if (chan->fmtinfo->fourcc == V4L2_PIX_FMT_NV16) { + vi_csi_write(chan, TEGRA_VI_CSI_SURFACE1_OFFSET_MSB, + ((u64)buf->addr + sizeimage / 2) >> 32); + vi_csi_write(chan, TEGRA_VI_CSI_SURFACE1_OFFSET_LSB, + buf->addr + sizeimage / 2); + vi_csi_write(chan, TEGRA_VI_CSI_SURFACE1_STRIDE, + bytes_per_line); + } + + /* * Tegra VI block interacts with host1x syncpt for synchronizing * programmed condition of capture state and hardware operation. * Frame start and Memory write acknowledge syncpts has their own diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c index 7edd35c..525c087 100644 --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c @@ -484,6 +484,8 @@ static void tegra_channel_fmt_align(struct tegra_vi_channel *chan, pix->bytesperline = clamp(bpl, min_bpl, max_bpl); pix->sizeimage = pix->bytesperline * pix->height; + if (pix->pixelformat == V4L2_PIX_FMT_NV16) + pix->sizeimage *= 2; } static int __tegra_channel_try_format(struct tegra_vi_channel *chan, -- 2.7.4