From patchwork Fri Nov 18 23:20:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benoit Parrot X-Patchwork-Id: 9437643 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D7A6060238 for ; Fri, 18 Nov 2016 23:28:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C73DB29A51 for ; Fri, 18 Nov 2016 23:28:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB87429A56; Fri, 18 Nov 2016 23:28:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5531629A51 for ; Fri, 18 Nov 2016 23:28:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754165AbcKRX2J (ORCPT ); Fri, 18 Nov 2016 18:28:09 -0500 Received: from lelnx194.ext.ti.com ([198.47.27.80]:14818 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753462AbcKRXVK (ORCPT ); Fri, 18 Nov 2016 18:21:10 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id uAINL9Zf020178; Fri, 18 Nov 2016 17:21:09 -0600 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id uAINL9mD030230; Fri, 18 Nov 2016 17:21:09 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Fri, 18 Nov 2016 17:21:08 -0600 Received: from uda0869644a.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id uAINKqVq001882; Fri, 18 Nov 2016 17:21:09 -0600 From: Benoit Parrot To: , Hans Verkuil CC: , Tomi Valkeinen , Jyri Sarha , Peter Ujfalusi , Benoit Parrot Subject: [Patch v2 15/35] media: ti-vpe: vpe: configure line mode separately Date: Fri, 18 Nov 2016 17:20:25 -0600 Message-ID: <20161118232045.24665-16-bparrot@ti.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161118232045.24665-1-bparrot@ti.com> References: <20161118232045.24665-1-bparrot@ti.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nikhil Devshatwar 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 Signed-off-by: Benoit Parrot Acked-by: Hans Verkuil --- 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; }