Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1430846pxu; Sat, 12 Dec 2020 12:34:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAFGMAEB8bhyMcAJnLUBgjlE7oafzfX/DSS+59DYq36MgCk4gARh9//Tf8IvZGafBx/K9R X-Received: by 2002:a50:e848:: with SMTP id k8mr3565088edn.77.1607805255524; Sat, 12 Dec 2020 12:34:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607805255; cv=none; d=google.com; s=arc-20160816; b=w2Kq2awx/RVgYO5QiqxWNIobkVf9ihtKFy+wpwJQziQcE2b/wH8DYqq8+Q03yD7mX7 fqNcwHNgz3NpTJBu2jeFnB+Wbr2oHLCtsw6N7c5QDQrfKzT3kVRK36HSZg8Whatey92t /9TRINAvZLvDfjVIkoBpkjjy4MkI9o9xYs8nnT0gMcIeyz4cdW08foysy0YWkEp0W+Cl c+K4V2uvvsavhYwxg5a33lkk1dvPyxQcz1xeYI9oixuurtw8PJcZtlnOUNB+gqNIct9S 8/Z5zaqTY8GKRof6Me8/BuPEyX/KqImz0eItb9wlWJbR4BNTNAuznWalnFtUhe0g4uxr A/Kg== 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=iTqOS0H6PVTsvVoSiL95/e4CDKhSxEejxtXUJQkXRb5SW/Ca2rcuzSzE3zgDcJAiLe fjXFlc2kGQ6vLTKmLSQEUmKOCEQbAh5XNpidzKEOb//sf8tuetOjaaJjZMKvSSSXImvw TcywLyNziH8/W17/CX84V0oXBwditbuIAsu7x5b7pb9fZ4xXk0wyePHwAOAa4n+RaO6y qXABi8uZa9PRLKIF9kMEwF46gJaHe9/juo9R0ION4zXj3Fi3PhC1h9eSCnLjzQI5f61O l6srl7bhB5kNx5bdr7YXKoeujK0QPPVzdFkXwq6mk6MOOrpoz+rvEJYuAyOKHLzCISx1 0AEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=ABaHukVU; 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 gs31si7213943ejc.337.2020.12.12.12.33.51; Sat, 12 Dec 2020 12:34:15 -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=ABaHukVU; 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 S2405289AbgLKRER (ORCPT + 99 others); Fri, 11 Dec 2020 12:04:17 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:5325 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393569AbgLKRDw (ORCPT ); Fri, 11 Dec 2020 12:03:52 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Fri, 11 Dec 2020 09:02:50 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 11 Dec 2020 17:02:50 +0000 Received: from skomatineni-linux.nvidia.com (172.20.145.6) by mail.nvidia.com (172.20.187.15) with Microsoft SMTP Server id 15.0.1473.3 via Frontend Transport; Fri, 11 Dec 2020 17:02:49 +0000 From: Sowjanya Komatineni To: , , , , , CC: , , , , Subject: [PATCH v4 04/13] media: tegra-video: Add support for V4L2_PIX_FMT_NV16 Date: Fri, 11 Dec 2020 09:02:33 -0800 Message-ID: <1607706162-1548-5-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1607706162-1548-1-git-send-email-skomatineni@nvidia.com> References: <1607706162-1548-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=1607706170; bh=KU4kkKyfxjB47xZSqJdcMrFYTj+ssTxcvqFUoz12xtg=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:X-NVConfidentiality:MIME-Version:Content-Type; b=ABaHukVU4Xw2KaV01j2NGOy1SpqVHzk0Exabkc/i9WLHnIxIQ7KF+grQvvoRkYi4b Vko6c304ochmhGtLc25M34t2MmYhS+c5gZt96ydeTSiTuK5rHgiGXfqoRYMyonTPC2 MP0XX0sd7RYnmrHKUBaFPl1xSRYxIr4u6qH83JAXlFrVuMDXnELFdtFksJUjPygpsk qNZTE+HFgrDm4urgBnjMCqlKxj/tgAG8WU3cwcbi5fdEMW4z8Yu9Yl4faEp+6StbGD g2U8lMDCmPCAUd3x0ujZg1sUUhxAXmgOHVjcojgdi+KxB7Dhk5pha/4aDSAIRBWiwT Trp5BfIOl4ZwQ== 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