From patchwork Fri Oct 10 14:27:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikhil Devshatwar X-Patchwork-Id: 5066001 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9709C9F295 for ; Fri, 10 Oct 2014 14:27:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC2792021A for ; Fri, 10 Oct 2014 14:27:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C95242020F for ; Fri, 10 Oct 2014 14:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755418AbaJJO1N (ORCPT ); Fri, 10 Oct 2014 10:27:13 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:46789 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754645AbaJJO1K (ORCPT ); Fri, 10 Oct 2014 10:27:10 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9AER9a1015619; Fri, 10 Oct 2014 09:27:09 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9AER9JI025825; Fri, 10 Oct 2014 09:27:09 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Fri, 10 Oct 2014 09:27:09 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9AER45U013256; Fri, 10 Oct 2014 09:27:08 -0500 From: Nikhil Devshatwar To: , CC: Subject: [RFC PATCH 2/4] [media] ti-vpe: Use line average de-interlacing for first 2 frames Date: Fri, 10 Oct 2014 19:57:01 +0530 Message-ID: <1412951223-4711-3-git-send-email-nikhil.nd@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1412951223-4711-1-git-send-email-nikhil.nd@ti.com> References: <1412951223-4711-1-git-send-email-nikhil.nd@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Archit Taneja For n input fields, the VPE de-interlacer creates n - 2 progressive frames. To support this, we use line average mode of de-interlacer for the first 2 input fields to generate 2 progressive frames. We then revert back to the preferred EDI method, and create n - 2 frames, creating a sum of n frames. Signed-off-by: Archit Taneja Signed-off-by: Nikhil Devshatwar --- drivers/media/platform/ti-vpe/vpe.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c index 4c3ef48..a11044f 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -807,6 +807,23 @@ static void set_dei_shadow_registers(struct vpe_ctx *ctx) ctx->load_mmrs = true; } +static void config_edi_input_mode(struct vpe_ctx *ctx, int mode) +{ + struct vpe_mmr_adb *mmr_adb = ctx->mmr_adb.addr; + u32 *edi_config_reg = &mmr_adb->dei_regs[3]; + + if (mode & 0x2) + write_field(edi_config_reg, 1, 1, 2); /* EDI_ENABLE_3D */ + + if (mode & 0x3) + write_field(edi_config_reg, 1, 1, 3); /* EDI_CHROMA_3D */ + + write_field(edi_config_reg, mode, VPE_EDI_INP_MODE_MASK, + VPE_EDI_INP_MODE_SHIFT); + + ctx->load_mmrs = true; +} + /* * Set the shadow registers whose values are modified when either the * source or destination format is changed. @@ -1119,6 +1136,15 @@ static void device_run(void *priv) ctx->dst_vb = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx); WARN_ON(ctx->dst_vb == NULL); + if (ctx->deinterlacing) { + /* + * we have output the first 2 frames through line average, we + * now switch to EDI de-interlacer + */ + if (ctx->sequence == 2) + config_edi_input_mode(ctx, 0x3); /* EDI (Y + UV) */ + } + /* config descriptors */ if (ctx->dev->loaded_mmrs != ctx->mmr_adb.dma_addr || ctx->load_mmrs) { vpdma_map_desc_buf(ctx->dev->vpdma, &ctx->mmr_adb); @@ -1780,6 +1806,9 @@ static int vpe_streamon(struct file *file, void *priv, enum v4l2_buf_type type) { struct vpe_ctx *ctx = file2ctx(file); + if (ctx->deinterlacing) + config_edi_input_mode(ctx, 0x0); + return v4l2_m2m_streamon(file, ctx->m2m_ctx, type); }