linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sowjanya Komatineni <skomatineni@nvidia.com>
To: <skomatineni@nvidia.com>, <thierry.reding@gmail.com>,
	<jonathanh@nvidia.com>, <hverkuil@xs4all.nl>
Cc: <mchehab@kernel.org>, <linux-media@vger.kernel.org>,
	<linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v2 02/10] media: tegra-video: Enable VI pixel transform for YUV and RGB formats
Date: Mon, 26 Oct 2020 20:19:15 -0700	[thread overview]
Message-ID: <1603768763-25590-3-git-send-email-skomatineni@nvidia.com> (raw)
In-Reply-To: <1603768763-25590-1-git-send-email-skomatineni@nvidia.com>

VI Pixel transforms converts source pixel data to selected
destination pixel formats in memory and aligns properly.

YUV and RGB formats need this pixel transform to be enabled.

RAW formats use T_R16_I destination pixel format in memory and
does not need pixel transform as they support direct write to
memory.

So, this patch enables pixel transform for YUV and RGB and keeps
it bypass for RAW formats.

Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
---
 drivers/staging/media/tegra-video/tegra210.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/tegra-video/tegra210.c b/drivers/staging/media/tegra-video/tegra210.c
index ac066c0..6b23aa7 100644
--- a/drivers/staging/media/tegra-video/tegra210.c
+++ b/drivers/staging/media/tegra-video/tegra210.c
@@ -178,10 +178,23 @@ static int tegra_channel_capture_setup(struct tegra_vi_channel *chan)
 	u32 format = chan->fmtinfo->img_fmt;
 	u32 data_type = chan->fmtinfo->img_dt;
 	u32 word_count = (width * chan->fmtinfo->bit_width) / 8;
+	u32 bypass_pixel_transform = BIT(BYPASS_PXL_TRANSFORM_OFFSET);
+
+	/*
+	 * VI Pixel transformation unit converts source pixels data format
+	 * into selected destination pixel format and aligns properly while
+	 * interfacing with memory packer.
+	 * This pixel transformation should be enabled for YUV and RGB
+	 * formats and should be bypassed for RAW formats as RAW formats
+	 * only support direct to memory.
+	 */
+	if (chan->pg_mode || data_type == TEGRA_IMAGE_DT_YUV422_8 ||
+	    data_type == TEGRA_IMAGE_DT_RGB888)
+		bypass_pixel_transform = 0;
 
 	vi_csi_write(chan, TEGRA_VI_CSI_ERROR_STATUS, 0xffffffff);
 	vi_csi_write(chan, TEGRA_VI_CSI_IMAGE_DEF,
-		     ((chan->pg_mode ? 0 : 1) << BYPASS_PXL_TRANSFORM_OFFSET) |
+		     bypass_pixel_transform |
 		     (format << IMAGE_DEF_FORMAT_OFFSET) |
 		     IMAGE_DEF_DEST_MEM);
 	vi_csi_write(chan, TEGRA_VI_CSI_IMAGE_DT, data_type);
-- 
2.7.4


  parent reply	other threads:[~2020-10-27  3:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27  3:19 [PATCH v2 00/10] media: tegra-video: Add support for capturing from HDMI-to-CSI bridge Sowjanya Komatineni
2020-10-27  3:19 ` [PATCH v2 01/10] media: tegra-video: Use zero crop settings if subdev has no get_selection Sowjanya Komatineni
2020-10-27  3:19 ` Sowjanya Komatineni [this message]
2020-10-27  3:19 ` [PATCH v2 03/10] media: tegra-video: Fix V4L2 pixel format for RGB888_1X24 Sowjanya Komatineni
2020-11-09 12:51   ` Hans Verkuil
2020-10-27  3:19 ` [PATCH v2 04/10] media: tegra-video: Add support for V4L2_PIX_FMT_NV16 Sowjanya Komatineni
2020-10-27  3:19 ` [PATCH v2 05/10] media: tegra-video: Add DV timing support Sowjanya Komatineni
2020-10-27  3:19 ` [PATCH v2 06/10] media: tegra-video: Add support for EDID ioctl ops Sowjanya Komatineni
2020-10-27  3:19 ` [PATCH v2 07/10] media: tegra-video: Add support for VIDIOC_LOG_STATUS ioctl Sowjanya Komatineni
2020-10-27  3:19 ` [PATCH v2 08/10] media: tegra-video: Add support for V4L2_EVENT_SOURCE_CHANGE Sowjanya Komatineni
2020-10-27  3:19 ` [PATCH v2 09/10] media: tegra-video: Implement V4L2 device notify callback Sowjanya Komatineni
2020-10-27  3:19 ` [PATCH v2 10/10] media: tegra-video: Add support for x8 captures with gang ports Sowjanya Komatineni
2020-11-09 13:04   ` Hans Verkuil
2020-11-09 16:22     ` Sowjanya Komatineni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1603768763-25590-3-git-send-email-skomatineni@nvidia.com \
    --to=skomatineni@nvidia.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).