linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benoit Parrot <bparrot@ti.com>
To: <linux-media@vger.kernel.org>, Hans Verkuil <hverkuil@xs4all.nl>
Cc: <linux-kernel@vger.kernel.org>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Jyri Sarha <jsarha@ti.com>,
	Peter Ujfalusi <peter.ujfalusi@ti.com>,
	Benoit Parrot <bparrot@ti.com>
Subject: [Patch v2 15/35] media: ti-vpe: vpe: configure line mode separately
Date: Fri, 18 Nov 2016 17:20:25 -0600	[thread overview]
Message-ID: <20161118232045.24665-16-bparrot@ti.com> (raw)
In-Reply-To: <20161118232045.24665-1-bparrot@ti.com>

From: Nikhil Devshatwar <nikhil.nd@ti.com>

Current driver configures the line mode of the DEI clients
from the open function directly. Even if the newly created context
is not yet scheduled, it updates some of the VPDMA registers.
This causes a problem in multi instance use case where just opening
the m2m device second time causes the running job to stall. This
happens especially if the source buffers used are NV12.

While all other configuration is being written to context specific
shadow registers, only line mode configuration is happening directly.

As there is no shadow register for line mode configuration, it's better
to separate the config_mode setting and line_mode setting. Call the
new "set_line_modes" functions only when actually loading the mmrs.
This makes sure that no non-running job will write to the registers
directly.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/platform/ti-vpe/vpe.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c
index 6fcdd0ea50e4..c79137b404ea 100644
--- a/drivers/media/platform/ti-vpe/vpe.c
+++ b/drivers/media/platform/ti-vpe/vpe.c
@@ -660,14 +660,13 @@ static void set_us_coefficients(struct vpe_ctx *ctx)
 /*
  * Set the upsampler config mode and the VPDMA line mode in the shadow MMRs.
  */
-static void set_cfg_and_line_modes(struct vpe_ctx *ctx)
+static void set_cfg_modes(struct vpe_ctx *ctx)
 {
 	struct vpe_fmt *fmt = ctx->q_data[Q_DATA_SRC].fmt;
 	struct vpe_mmr_adb *mmr_adb = ctx->mmr_adb.addr;
 	u32 *us1_reg0 = &mmr_adb->us1_regs[0];
 	u32 *us2_reg0 = &mmr_adb->us2_regs[0];
 	u32 *us3_reg0 = &mmr_adb->us3_regs[0];
-	int line_mode = 1;
 	int cfg_mode = 1;
 
 	/*
@@ -675,15 +674,24 @@ static void set_cfg_and_line_modes(struct vpe_ctx *ctx)
 	 * Cfg Mode 1: YUV422 source, disable upsampler, DEI is de-interlacing.
 	 */
 
-	if (fmt->fourcc == V4L2_PIX_FMT_NV12) {
+	if (fmt->fourcc == V4L2_PIX_FMT_NV12)
 		cfg_mode = 0;
-		line_mode = 0;		/* double lines to line buffer */
-	}
 
 	write_field(us1_reg0, cfg_mode, VPE_US_MODE_MASK, VPE_US_MODE_SHIFT);
 	write_field(us2_reg0, cfg_mode, VPE_US_MODE_MASK, VPE_US_MODE_SHIFT);
 	write_field(us3_reg0, cfg_mode, VPE_US_MODE_MASK, VPE_US_MODE_SHIFT);
 
+	ctx->load_mmrs = true;
+}
+
+static void set_line_modes(struct vpe_ctx *ctx)
+{
+	struct vpe_fmt *fmt = ctx->q_data[Q_DATA_SRC].fmt;
+	int line_mode = 1;
+
+	if (fmt->fourcc == V4L2_PIX_FMT_NV12)
+		line_mode = 0;		/* double lines to line buffer */
+
 	/* regs for now */
 	vpdma_set_line_mode(ctx->dev->vpdma, line_mode, VPE_CHAN_CHROMA1_IN);
 	vpdma_set_line_mode(ctx->dev->vpdma, line_mode, VPE_CHAN_CHROMA2_IN);
@@ -708,8 +716,6 @@ static void set_cfg_and_line_modes(struct vpe_ctx *ctx)
 	/* frame start for MV in client */
 	vpdma_set_frame_start_event(ctx->dev->vpdma, VPDMA_FSEVENT_CHANNEL_ACTIVE,
 		VPE_CHAN_MV_IN);
-
-	ctx->load_mmrs = true;
 }
 
 /*
@@ -868,7 +874,7 @@ static int set_srcdst_params(struct vpe_ctx *ctx)
 	if (ret)
 		return ret;
 
-	set_cfg_and_line_modes(ctx);
+	set_cfg_modes(ctx);
 	set_dei_regs(ctx);
 
 	csc_set_coeff(ctx->dev->csc, &mmr_adb->csc_regs[0],
@@ -1184,6 +1190,9 @@ static void device_run(void *priv)
 	if (ctx->dev->loaded_mmrs != ctx->mmr_adb.dma_addr || ctx->load_mmrs) {
 		vpdma_map_desc_buf(ctx->dev->vpdma, &ctx->mmr_adb);
 		vpdma_add_cfd_adb(&ctx->desc_list, CFD_MMR_CLIENT, &ctx->mmr_adb);
+
+		set_line_modes(ctx);
+
 		ctx->dev->loaded_mmrs = ctx->mmr_adb.dma_addr;
 		ctx->load_mmrs = false;
 	}
-- 
2.9.0


  parent reply	other threads:[~2016-11-18 23:21 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-18 23:20 [Patch v2 00/35] media: ti-vpe: fixes and enhancements Benoit Parrot
2016-11-18 23:20 ` [Patch v2 01/35] media: ti-vpe: vpdma: Make vpdma library into its own module Benoit Parrot
2016-11-18 23:20 ` [Patch v2 02/35] media: ti-vpe: vpdma: Add multi-instance and multi-client support Benoit Parrot
2016-11-18 23:20 ` [Patch v2 03/35] media: ti-vpe: vpdma: Add helper to set a background color Benoit Parrot
2016-11-18 23:20 ` [Patch v2 04/35] media: ti-vpe: vpdma: Fix bus error when vpdma is writing a descriptor Benoit Parrot
2016-11-18 23:20 ` [Patch v2 05/35] media: ti-vpe: Use line average de-interlacing for first 2 frames Benoit Parrot
2016-11-18 23:20 ` [Patch v2 06/35] media: ti-vpe: vpe: Do not perform job transaction atomically Benoit Parrot
2016-11-18 23:20 ` [Patch v2 07/35] media: ti-vpe: Add support for SEQ_TB buffers Benoit Parrot
2016-11-18 23:20 ` [Patch v2 08/35] media: ti-vpe: Increasing max buffer height and width Benoit Parrot
2016-11-18 23:20 ` [Patch v2 09/35] media: ti-vpe: vpe: Return NULL for invalid buffer type Benoit Parrot
2016-11-18 23:20 ` [Patch v2 10/35] media: ti-vpe: Free vpdma buffers in vpe_release Benoit Parrot
2016-11-18 23:20 ` [Patch v2 11/35] media: ti-vpe: vpdma: Add support for setting max width height Benoit Parrot
2016-11-18 23:20 ` [Patch v2 12/35] media: ti-vpe: vpdma: Add abort channel desc and cleanup APIs Benoit Parrot
2016-11-18 23:20 ` [Patch v2 13/35] media: ti-vpe: vpdma: Make list post atomic operation Benoit Parrot
2016-11-18 23:20 ` [Patch v2 14/35] media: ti-vpe: vpdma: Clear IRQs for individual lists Benoit Parrot
2016-11-18 23:20 ` Benoit Parrot [this message]
2016-11-18 23:20 ` [Patch v2 16/35] media: ti-vpe: vpe: Setup srcdst parameters in start_streaming Benoit Parrot
2016-11-18 23:20 ` [Patch v2 17/35] media: ti-vpe: vpe: Post next descriptor only for list complete IRQ Benoit Parrot
2016-11-18 23:20 ` [Patch v2 18/35] media: ti-vpe: vpe: Add RGB565 and RGB5551 support Benoit Parrot
2016-11-18 23:20 ` [Patch v2 19/35] media: ti-vpe: vpdma: allocate and maintain hwlist Benoit Parrot
2016-11-18 23:20 ` [Patch v2 20/35] media: ti-vpe: vpe: Added MODULE_DEVICE_TABLE hint Benoit Parrot
2016-11-18 23:20 ` [Patch v2 21/35] media: ti-vpe: vpdma: Corrected YUV422 data type label Benoit Parrot
2016-11-18 23:20 ` [Patch v2 22/35] media: ti-vpe: vpdma: RGB data type yield inverted data Benoit Parrot
2016-11-18 23:20 ` [Patch v2 23/35] media: ti-vpe: sc: Fix incorrect optimization Benoit Parrot
2016-11-18 23:20 ` [Patch v2 24/35] media: ti-vpe: vpe: Fix vb2 buffer cleanup Benoit Parrot
2016-11-18 23:20 ` [Patch v2 25/35] media: ti-vpe: vpdma: Fix race condition for firmware loading Benoit Parrot
2016-11-18 23:20 ` [Patch v2 26/35] media: ti-vpe: vpdma: Use bidirectional cached buffers Benoit Parrot
2016-11-18 23:20 ` [Patch v2 27/35] media: ti-vpe: vpe: Fix line stride for output motion vector Benoit Parrot
2016-11-18 23:20 ` [Patch v2 28/35] media: ti-vpe: vpe: Enable DMABUF export Benoit Parrot
2016-11-18 23:20 ` [Patch v2 29/35] media: ti-vpe: Make scaler library into its own module Benoit Parrot
2016-11-18 23:20 ` [Patch v2 30/35] media: ti-vpe: scaler: Add debug support for multi-instance Benoit Parrot
2016-11-18 23:20 ` [Patch v2 31/35] media: ti-vpe: vpe: Make sure frame size dont exceed scaler capacity Benoit Parrot
2016-11-18 23:20 ` [Patch v2 32/35] media: ti-vpe: vpdma: Add RAW8 and RAW16 data types Benoit Parrot
2016-11-18 23:20 ` [Patch v2 33/35] media: ti-vpe: Make colorspace converter library into its own module Benoit Parrot
2016-11-18 23:20 ` [Patch v2 34/35] media: ti-vpe: csc: Add debug support for multi-instance Benoit Parrot
2016-11-18 23:20 ` [Patch v2 35/35] media: ti-vpe: vpe: Add proper support single and multi-plane buffer Benoit Parrot

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=20161118232045.24665-16-bparrot@ti.com \
    --to=bparrot@ti.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jsarha@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=peter.ujfalusi@ti.com \
    --cc=tomi.valkeinen@ti.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).