From patchwork Tue Mar 17 15:48:10 2015
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Philipp Zabel
X-Patchwork-Id: 6032581
Return-Path:
X-Original-To: patchwork-dri-devel@patchwork.kernel.org
Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org
Received: from mail.kernel.org (mail.kernel.org [198.145.29.136])
by patchwork2.web.kernel.org (Postfix) with ESMTP id 132DDBF90F
for ;
Tue, 17 Mar 2015 15:48:43 +0000 (UTC)
Received: from mail.kernel.org (localhost [127.0.0.1])
by mail.kernel.org (Postfix) with ESMTP id F12EA20416
for ;
Tue, 17 Mar 2015 15:48:40 +0000 (UTC)
Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177])
by mail.kernel.org (Postfix) with ESMTP id D4ED72041B
for ;
Tue, 17 Mar 2015 15:48:37 +0000 (UTC)
Received: from gabe.freedesktop.org (localhost [127.0.0.1])
by gabe.freedesktop.org (Postfix) with ESMTP id DF0647206A;
Tue, 17 Mar 2015 08:48:34 -0700 (PDT)
X-Original-To: dri-devel@lists.freedesktop.org
Delivered-To: dri-devel@lists.freedesktop.org
Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de
[92.198.50.35])
by gabe.freedesktop.org (Postfix) with ESMTP id 5A4706E717
for ;
Tue, 17 Mar 2015 08:48:33 -0700 (PDT)
Received: from dude.hi.4.pengutronix.de ([10.1.0.7]
helo=dude.pengutronix.de.)
by metis.ext.pengutronix.de with esmtp (Exim 4.72)
(envelope-from )
id 1YXtjM-00013v-29; Tue, 17 Mar 2015 16:48:32 +0100
From: Philipp Zabel
To: linux-media@vger.kernel.org
Subject: [PATCH 5/5] [media] imx-ipu: Add i.MX IPUv3 scaler driver
Date: Tue, 17 Mar 2015 16:48:10 +0100
Message-Id: <1426607290-13380-6-git-send-email-p.zabel@pengutronix.de>
X-Mailer: git-send-email 2.1.4
In-Reply-To: <1426607290-13380-1-git-send-email-p.zabel@pengutronix.de>
References: <1426607290-13380-1-git-send-email-p.zabel@pengutronix.de>
X-SA-Exim-Connect-IP: 10.1.0.7
X-SA-Exim-Mail-From: p.zabel@pengutronix.de
X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de);
SAEximRunCond expanded to false
X-PTX-Original-Recipient: dri-devel@lists.freedesktop.org
Cc: Mauro Carvalho Chehab ,
dri-devel@lists.freedesktop.org, Hans Verkuil ,
kernel@pengutronix.de, Steve Longerbeam ,
Jean-Michel Hautbois ,
Michael Olbrich
X-BeenThere: dri-devel@lists.freedesktop.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: Direct Rendering Infrastructure - Development
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
MIME-Version: 1.0
Errors-To: dri-devel-bounces@lists.freedesktop.org
Sender: "dri-devel"
X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED,
T_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: Sascha Hauer
This patch adds support for hardware accelerated scaling and color
space conversion between memory buffers using the IPUv3 IC.
Since the maximum output size of the IC unit is 1024x1024 pixels, multiple
IC tasks with overlapping tiles are used internally to scale and convert
larger frames.
The IC operates with a burst size of at least 8 pixels. Depending on the
frame width and scaling factor, up to 7 junk pixels may be written after
the end of the frame. The sizeimage is increased accordingly.
Signed-off-by: Sascha Hauer
Signed-off-by: Michael Olbrich
Signed-off-by: Philipp Zabel
Acked-by: Kamil Debski
---
drivers/gpu/ipu-v3/ipu-ic.c | 28 +-
drivers/media/platform/imx/Kconfig | 9 +
drivers/media/platform/imx/Makefile | 1 +
drivers/media/platform/imx/imx-ipu-scaler.c | 869 ++++++++++++++++++++++++++++
drivers/media/platform/imx/imx-ipu.c | 2 +-
drivers/media/platform/imx/imx-ipu.h | 1 +
6 files changed, 882 insertions(+), 28 deletions(-)
create mode 100644 drivers/media/platform/imx/imx-ipu-scaler.c
diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c
index 39ee388..984f68f 100644
--- a/drivers/gpu/ipu-v3/ipu-ic.c
+++ b/drivers/gpu/ipu-v3/ipu-ic.c
@@ -701,7 +701,6 @@ static struct image_convert_ctx *ipu_image_convert_next(struct ipu_ic *ic)
{
struct ipu_ic_priv *priv = ic->priv;
struct ipuv3_channel *ch_in = ic->input_channel;
- struct ipuv3_channel *ch_in_p, *ch_in_n;
struct ipuv3_channel *ch_out = ic->output_channel;
struct image_convert_ctx *ctx;
struct ipu_image *in_p, *in, *in_n;
@@ -748,32 +747,7 @@ static struct image_convert_ctx *ipu_image_convert_next(struct ipu_ic *ic)
ipu_cpmem_set_burstsize(ch_in, inburst);
ipu_cpmem_set_burstsize(ch_out, outburst);
- if (ctx->deinterlace) {
- ch_in_p = ic->input_channel_p;
- ch_in_n = ic->input_channel_n;
-
- ipu_cpmem_zero(ch_in_p);
- ipu_cpmem_zero(ch_in_n);
-
- ipu_ic_task_idma_init(ic, ic->input_channel_p,
- in_p->rect.width, in_p->rect.height,
- inburst, IPU_ROTATE_NONE);
- ipu_ic_task_idma_init(ic, ic->input_channel_n,
- in_n->rect.width, in_n->rect.height,
- inburst, IPU_ROTATE_NONE);
-
- ipu_cpmem_set_image(ch_in_p, &ctx->in_p);
- ipu_cpmem_set_image(ch_in_n, &ctx->in_n);
-
- ipu_cpmem_set_burstsize(ch_in_p, inburst);
- ipu_cpmem_set_burstsize(ch_in_n, inburst);
- }
-
-
- if (ctx->deinterlace)
- in_height = in->rect.height * 2;
- else
- in_height = in->rect.height;
+ in_height = in->rect.height;
dev_dbg(priv->ipu->dev, "%s: %dx%d(%dx%d@%d,%d) -> %dx%d(%dx%d@%d,%d)\n",
__func__, in->pix.width, in->pix.height,
diff --git a/drivers/media/platform/imx/Kconfig b/drivers/media/platform/imx/Kconfig
index a90c973..4694367 100644
--- a/drivers/media/platform/imx/Kconfig
+++ b/drivers/media/platform/imx/Kconfig
@@ -1,2 +1,11 @@
config VIDEO_IMX_IPU_COMMON
tristate
+
+config VIDEO_IMX_IPU_SCALER
+ tristate "i.MX5/6 IPUv3 based image scaler driver"
+ depends on VIDEO_DEV && IMX_IPUV3_CORE
+ select VIDEOBUF2_DMA_CONTIG
+ select VIDEO_IMX_IPU_COMMON
+ select V4L2_MEM2MEM_DEV
+ ---help---
+ This is a v4l2 scaler video driver for the IPUv3 on i.MX5/6.
diff --git a/drivers/media/platform/imx/Makefile b/drivers/media/platform/imx/Makefile
index 5de119c..f20aa0b 100644
--- a/drivers/media/platform/imx/Makefile
+++ b/drivers/media/platform/imx/Makefile
@@ -1 +1,2 @@
obj-$(CONFIG_VIDEO_IMX_IPU_COMMON) += imx-ipu.o
+obj-$(CONFIG_VIDEO_IMX_IPU_SCALER) += imx-ipu-scaler.o
diff --git a/drivers/media/platform/imx/imx-ipu-scaler.c b/drivers/media/platform/imx/imx-ipu-scaler.c
new file mode 100644
index 0000000..9cf8a70
--- /dev/null
+++ b/drivers/media/platform/imx/imx-ipu-scaler.c
@@ -0,0 +1,869 @@
+/*
+ * i.MX IPUv3 scaler driver
+ *
+ * Copyright (C) 2011 Sascha Hauer, Pengutronix
+ *
+ * based on the mem2mem test driver
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+#include