From patchwork Sun Oct 12 20:40:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 5072111 Return-Path: X-Original-To: patchwork-davinci@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 911289F1EE for ; Sun, 12 Oct 2014 20:49:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A623520179 for ; Sun, 12 Oct 2014 20:49:15 +0000 (UTC) Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 92DD020176 for ; Sun, 12 Oct 2014 20:49:14 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9CKm1ni019559; Sun, 12 Oct 2014 15:48:01 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9CKm1qq019671; Sun, 12 Oct 2014 15:48:01 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Sun, 12 Oct 2014 15:48:00 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9CKlxIt025175; Sun, 12 Oct 2014 15:47:59 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 9255D80626; Sun, 12 Oct 2014 15:47:59 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflxv17.itg.ti.com (dflxv17.itg.ti.com [128.247.5.93]) by linux.omap.com (Postfix) with ESMTP id 9B3B880626 for ; Sun, 12 Oct 2014 15:41:11 -0500 (CDT) Received: from neches.ext.ti.com (neches.ext.ti.com [192.91.81.29]) by dflxv17.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9CKfBeP029851 for ; Sun, 12 Oct 2014 15:41:11 -0500 Received: from mail6.bemta12.messagelabs.com (mail6.bemta12.messagelabs.com [216.82.250.247]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9CKfBTC002756 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 12 Oct 2014 15:41:11 -0500 Received: from [216.82.250.99:61582] by server-7.bemta-12.messagelabs.com id A9/F5-10811-767EA345; Sun, 12 Oct 2014 20:41:11 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-12.tower-126.messagelabs.com!1413146468!18742631!1 X-Originating-IP: [209.85.212.177] X-SpamReason: No, hits=0.2 required=7.0 tests=RCVD_ILLEGAL_IP X-StarScan-Received: X-StarScan-Version: 6.12.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8125 invoked from network); 12 Oct 2014 20:41:09 -0000 Received: from mail-wi0-f177.google.com (HELO mail-wi0-f177.google.com) (209.85.212.177) by server-12.tower-126.messagelabs.com with RC4-SHA encrypted SMTP; 12 Oct 2014 20:41:09 -0000 Received: by mail-wi0-f177.google.com with SMTP id fb4so5944817wid.4 for ; Sun, 12 Oct 2014 13:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=r0rBsCFRBgwriBmhh35xYhOarDyNuuzl6nuzMc0KQ5M=; b=jNn3oji5+pbp3F46n4q7EPMJMrO8tTAl2Q7GeEheM6R5woUqKtcEf7mNGEgg1uLv/5 AIcLhsbHOYYJnBiP3ZfBodR5Pobd1Vij3+tmDfGra+hyC0gLnH0SLDmZfnPAn+yMZ4Ci dURragNTK+lKqVKv4NS78HVNuXCOAUN1ljyOUGBcF+//Ebs2NjLBX1ADdzhO/mnHMSxg u0wjFrmV5IUKohAH+GdxiMZkdY3qrRPBMODyEIUStAWjt3QK3OBx3BR2VLe197XryJ0f R2gJOjYpE53ioZhxTFclktdl/vUunlE2Ww87/01UfA2Ajw0oMgxBroDcyZ/48V++hY43 hVGQ== X-Received: by 10.180.19.1 with SMTP id a1mr16879129wie.5.1413146467830; Sun, 12 Oct 2014 13:41:07 -0700 (PDT) Received: from tango-charlie.Home ([2.127.193.40]) by mx.google.com with ESMTPSA id y5sm9970930wix.10.2014.10.12.13.41.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 12 Oct 2014 13:41:07 -0700 (PDT) From: "Lad, Prabhakar" To: LMML Subject: [PATCH 12/15] media: davinci: vpbe: use helpers provided by core if streaming is started Date: Sun, 12 Oct 2014 21:40:42 +0100 Message-ID: <1413146445-7304-13-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413146445-7304-1-git-send-email-prabhakar.csengg@gmail.com> References: <1413146445-7304-1-git-send-email-prabhakar.csengg@gmail.com> CC: DLOS , LKML X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, 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 this patch uses vb2_is_busy() helper to check if streaming is actually started, instead of driver managing it. Signed-off-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpbe_display.c | 34 ++++++++------------------- include/media/davinci/vpbe_display.h | 4 ---- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 378f31b..b57fa68 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c @@ -152,8 +152,8 @@ static irqreturn_t venc_isr(int irq, void *arg) for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) { layer = disp_dev->dev[i]; - /* If streaming is started in this layer */ - if (!layer->started) + + if (!vb2_start_streaming_called(&layer->buffer_queue)) continue; if (layer->layer_first_int) { @@ -314,7 +314,6 @@ static int vpbe_start_streaming(struct vb2_queue *vq, unsigned int count) * if request format is yuv420 semiplanar, need to * enable both video windows */ - layer->started = 1; layer->layer_first_int = 1; return ret; @@ -829,11 +828,9 @@ static int vpbe_display_s_fmt(struct file *file, void *priv, "VIDIOC_S_FMT, layer id = %d\n", layer->device_id); - /* If streaming is started, return error */ - if (layer->started) { - v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n"); + if (vb2_is_busy(&layer->buffer_queue)) return -EBUSY; - } + if (V4L2_BUF_TYPE_VIDEO_OUTPUT != fmt->type) { v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "invalid type\n"); return -EINVAL; @@ -937,11 +934,9 @@ static int vpbe_display_s_std(struct file *file, void *priv, v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_STD\n"); - /* If streaming is started, return error */ - if (layer->started) { - v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n"); + if (vb2_is_busy(&layer->buffer_queue)) return -EBUSY; - } + if (NULL != vpbe_dev->ops.s_std) { ret = vpbe_dev->ops.s_std(vpbe_dev, std_id); if (ret) { @@ -1021,11 +1016,10 @@ static int vpbe_display_s_output(struct file *file, void *priv, int ret; v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_OUTPUT\n"); - /* If streaming is started, return error */ - if (layer->started) { - v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n"); + + if (vb2_is_busy(&layer->buffer_queue)) return -EBUSY; - } + if (NULL == vpbe_dev->ops.set_output) return -EINVAL; @@ -1102,12 +1096,8 @@ vpbe_display_s_dv_timings(struct file *file, void *priv, v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_DV_TIMINGS\n"); - - /* If streaming is started, return error */ - if (layer->started) { - v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n"); + if (vb2_is_busy(&layer->buffer_queue)) return -EBUSY; - } /* Set the given standard in the encoder */ if (!vpbe_dev->ops.s_dv_timings) @@ -1212,13 +1202,9 @@ static int vpbe_display_release(struct file *file) v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_release\n"); mutex_lock(&layer->opslock); - /* Reset io_usrs member of layer object */ - layer->io_usrs = 0; osd_device->ops.disable_layer(osd_device, layer->layer_info.id); - layer->started = 0; - /* Decrement layer usrs counter */ layer->usrs--; /* If this file handle has initialize encoder device, reset it */ diff --git a/include/media/davinci/vpbe_display.h b/include/media/davinci/vpbe_display.h index 06ea815..de0843d 100644 --- a/include/media/davinci/vpbe_display.h +++ b/include/media/davinci/vpbe_display.h @@ -106,12 +106,8 @@ struct vpbe_layer { unsigned char window_enable; /* number of open instances of the layer */ unsigned int usrs; - /* number of users performing IO */ - unsigned int io_usrs; /* Indicates id of the field which is being displayed */ unsigned int field_id; - /* Indicates whether streaming started */ - unsigned char started; /* Identifies device object */ enum vpbe_display_device_id device_id; /* facilitation of ioctl ops lock by v4l2*/