From patchwork Wed May 4 20:19:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 754882 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p44KJfFF029530 for ; Wed, 4 May 2011 20:19:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755488Ab1EDUTe (ORCPT ); Wed, 4 May 2011 16:19:34 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:40719 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754411Ab1EDUTY (ORCPT ); Wed, 4 May 2011 16:19:24 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id AC9D71C00A0B; Wed, 4 May 2011 22:19:22 +0200 (CEST) X-Auth-Info: GgAD+sjmylV/YH+gjrKoSNYW5VJMjYPyplypYwgJRzI= Received: from localhost (p4FDE7B94.dip.t-dialin.net [79.222.123.148]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 470DC1C000A6; Wed, 4 May 2011 22:19:22 +0200 (CEST) From: Anatolij Gustschin To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab Subject: [PATCH] fsl_viu: add VIDIOC_OVERLAY ioctl Date: Wed, 4 May 2011 22:19:28 +0200 Message-Id: <1304540368-6818-1-git-send-email-agust@denx.de> X-Mailer: git-send-email 1.7.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 04 May 2011 20:19:42 +0000 (UTC) Currently the driver enables overlay when running VIDIOC_S_FMT ioctl with fmt type V4L2_BUF_TYPE_VIDEO_OVERLAY. Actually, this is wrong. Add proper VIDIOC_OVERLAY support instead of using VIDIOC_S_FMT for overlay enable. Signed-off-by: Anatolij Gustschin --- drivers/media/video/fsl-viu.c | 32 +++++++++++++++++++++++++------- 1 files changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c index ab05a09..908d701 100644 --- a/drivers/media/video/fsl-viu.c +++ b/drivers/media/video/fsl-viu.c @@ -766,7 +766,7 @@ inline void viu_activate_overlay(struct viu_reg *viu_reg) out_be32(&vr->picture_count, reg_val.picture_count); } -static int viu_start_preview(struct viu_dev *dev, struct viu_fh *fh) +static int viu_setup_preview(struct viu_dev *dev, struct viu_fh *fh) { int bpp; @@ -805,11 +805,6 @@ static int viu_start_preview(struct viu_dev *dev, struct viu_fh *fh) /* setup the base address of the overlay buffer */ reg_val.field_base_addr = (u32)dev->ovbuf.base; - dev->ovenable = 1; - viu_activate_overlay(dev->vr); - - /* start dma */ - viu_start_dma(dev); return 0; } @@ -828,7 +823,7 @@ static int vidioc_s_fmt_overlay(struct file *file, void *priv, fh->win = f->fmt.win; spin_lock_irqsave(&dev->slock, flags); - viu_start_preview(dev, fh); + viu_setup_preview(dev, fh); spin_unlock_irqrestore(&dev->slock, flags); return 0; } @@ -839,6 +834,28 @@ static int vidioc_try_fmt_overlay(struct file *file, void *priv, return 0; } +static int vidioc_overlay(struct file *file, void *priv, unsigned int on) +{ + struct viu_fh *fh = priv; + struct viu_dev *dev = (struct viu_dev *)fh->dev; + unsigned long flags; + + if (on) { + spin_lock_irqsave(&dev->slock, flags); + viu_activate_overlay(dev->vr); + dev->ovenable = 1; + + /* start dma */ + viu_start_dma(dev); + spin_unlock_irqrestore(&dev->slock, flags); + } else { + viu_stop_dma(dev); + dev->ovenable = 0; + } + + return 0; +} + int vidioc_g_fbuf(struct file *file, void *priv, struct v4l2_framebuffer *arg) { struct viu_fh *fh = priv; @@ -1418,6 +1435,7 @@ static const struct v4l2_ioctl_ops viu_ioctl_ops = { .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_overlay, .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_overlay, .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_overlay, + .vidioc_overlay = vidioc_overlay, .vidioc_g_fbuf = vidioc_g_fbuf, .vidioc_s_fbuf = vidioc_s_fbuf, .vidioc_reqbufs = vidioc_reqbufs,