From patchwork Sat Mar 22 10:57:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 3877331 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 14BF5BF549 for ; Sat, 22 Mar 2014 10:59:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0735D2018A for ; Sat, 22 Mar 2014 10:59:25 +0000 (UTC) Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E53BB20172 for ; Sat, 22 Mar 2014 10:59:22 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s2MAwHIc013494; Sat, 22 Mar 2014 05:58:18 -0500 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 s2MAwGZG003473; Sat, 22 Mar 2014 05:58:16 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Sat, 22 Mar 2014 05:58:15 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2MAwFC4023903; Sat, 22 Mar 2014 05:58:15 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id DE14D80627; Sat, 22 Mar 2014 04:58:14 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dlelxv84.itg.ti.com (dlelxv84.itg.ti.com [172.17.0.246]) by linux.omap.com (Postfix) with ESMTP id C401380626 for ; Sat, 22 Mar 2014 04:58:13 -0600 (CST) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dlelxv84.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2MAwDFl011799 for ; Sat, 22 Mar 2014 05:58:13 -0500 Received: from mail6.bemta12.messagelabs.com (mail6.bemta12.messagelabs.com [216.82.250.247]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id s2MAwDxP018820 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 22 Mar 2014 05:58:13 -0500 Received: from [216.82.250.51:12028] by server-12.bemta-12.messagelabs.com id 7B/04-07335-5CC6D235; Sat, 22 Mar 2014 10:58:13 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-16.tower-108.messagelabs.com!1395485891!8077513!1 X-Originating-IP: [209.85.220.52] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG, ML_RADAR_SPEW_LINKS_14,spamassassin: X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 18478 invoked from network); 22 Mar 2014 10:58:12 -0000 Received: from mail-pa0-f52.google.com (HELO mail-pa0-f52.google.com) (209.85.220.52) by server-16.tower-108.messagelabs.com with RC4-SHA encrypted SMTP; 22 Mar 2014 10:58:12 -0000 Received: by mail-pa0-f52.google.com with SMTP id rd3so3479951pab.11 for ; Sat, 22 Mar 2014 03:58:11 -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; bh=fZNflUL2ZHAs327ObuYuKBr/74wdZIpiNQDUzOC64C4=; b=eQMXKZY5O+3TPo1zwexwNxwYFW4+7qoM8LBrwPFiig6hdZsbs5C1QIdoWDTVzUg3Xm Fv6+qnlR56pouShi3HTELWw1qVU/TW9JWR94ctoHFW0bL8Hd2oWhOyJRWm49DaS3LtuR AfK3zs8yj4FLBLmoo7NHhEkBouupWbt3jfFZ6xsLhZ9Qh5Fy5ZBhDEzJo8rMQen3ZBPi N+SknMesFDGaNEg1aWhGDv4I4MOawCSuDkcVBgTn0BaZyw/mRHJrYUo402r5ISxrbpEv nb1ld9eT7XEkfQ/BdIgHbZgwu/DBd8Z21qx3f/WRSjCvsiLnkUdGtP6u1MSGtbvWQfDT 17Lg== X-Received: by 10.66.155.133 with SMTP id vw5mr41283304pab.124.1395485890936; Sat, 22 Mar 2014 03:58:10 -0700 (PDT) Received: from tango-charlie.vayavyatech.com ([122.166.13.141]) by mx.google.com with ESMTPSA id vg1sm15001358pbc.44.2014.03.22.03.58.05 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 22 Mar 2014 03:58:10 -0700 (PDT) From: "Lad, Prabhakar" To: LMML Subject: [PATCH] media: davinci: vpbe: use v4l2_fh for priority handling Date: Sat, 22 Mar 2014 16:27:59 +0530 Message-ID: <1395485879-14991-1-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.9.5 CC: DLOS , Hans Verkuil , LKML , Mauro Carvalho Chehab 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=ham 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: "Lad, Prabhakar" This patch migrates the vpbe driver to use v4l2_fh for priority handling. This also fixes v4l2-compliance test. Signed-off-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpbe_display.c | 39 +++++-------------------- include/media/davinci/vpbe_display.h | 6 ++-- 2 files changed, 9 insertions(+), 36 deletions(-) diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 6567082..a9ad949 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c @@ -680,29 +680,6 @@ static int vpbe_try_format(struct vpbe_display *disp_dev, return 0; } -static int vpbe_display_g_priority(struct file *file, void *priv, - enum v4l2_priority *p) -{ - struct vpbe_fh *fh = file->private_data; - struct vpbe_layer *layer = fh->layer; - - *p = v4l2_prio_max(&layer->prio); - - return 0; -} - -static int vpbe_display_s_priority(struct file *file, void *priv, - enum v4l2_priority p) -{ - struct vpbe_fh *fh = file->private_data; - struct vpbe_layer *layer = fh->layer; - int ret; - - ret = v4l2_prio_change(&layer->prio, &fh->prio, p); - - return ret; -} - static int vpbe_display_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { @@ -1492,6 +1469,7 @@ static int vpbe_display_open(struct file *file) { struct vpbe_fh *fh = NULL; struct vpbe_layer *layer = video_drvdata(file); + struct video_device *vdev = video_devdata(file); struct vpbe_display *disp_dev = layer->disp_dev; struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; struct osd_state *osd_device = disp_dev->osd_device; @@ -1504,6 +1482,7 @@ static int vpbe_display_open(struct file *file) "unable to allocate memory for file handle object\n"); return -ENOMEM; } + v4l2_fh_init(&fh->fh, vdev); v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe display open plane = %d\n", layer->device_id); @@ -1532,9 +1511,7 @@ static int vpbe_display_open(struct file *file) layer->usrs++; /* Set io_allowed member to false */ fh->io_allowed = 0; - /* Initialize priority of this instance to default priority */ - fh->prio = V4L2_PRIORITY_UNSET; - v4l2_prio_open(&layer->prio, &fh->prio); + v4l2_fh_add(&fh->fh); v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe display device opened successfully\n"); return 0; @@ -1589,8 +1566,9 @@ static int vpbe_display_release(struct file *file) osd_device->ops.release_layer(osd_device, layer->layer_info.id); } - /* Close the priority */ - v4l2_prio_close(&layer->prio, fh->prio); + + v4l2_fh_del(&fh->fh); + v4l2_fh_exit(&fh->fh); file->private_data = NULL; mutex_unlock(&layer->opslock); @@ -1618,8 +1596,6 @@ static const struct v4l2_ioctl_ops vpbe_ioctl_ops = { .vidioc_cropcap = vpbe_display_cropcap, .vidioc_g_crop = vpbe_display_g_crop, .vidioc_s_crop = vpbe_display_s_crop, - .vidioc_g_priority = vpbe_display_g_priority, - .vidioc_s_priority = vpbe_display_s_priority, .vidioc_s_std = vpbe_display_s_std, .vidioc_g_std = vpbe_display_g_std, .vidioc_enum_output = vpbe_display_enum_output, @@ -1699,8 +1675,6 @@ static int init_vpbe_layer(int i, struct vpbe_display *disp_dev, vpbe_display_layer->layer_info.id = ((i == VPBE_DISPLAY_DEVICE_0) ? WIN_VID0 : WIN_VID1); - /* Initialize prio member of layer object */ - v4l2_prio_init(&vpbe_display_layer->prio); return 0; } @@ -1727,6 +1701,7 @@ static int register_device(struct vpbe_layer *vpbe_display_layer, vpbe_display_layer->disp_dev = disp_dev; /* set the driver data in platform device */ platform_set_drvdata(pdev, disp_dev); + set_bit(V4L2_FL_USE_FH_PRIO, &vpbe_display_layer->video_dev.flags); video_set_drvdata(&vpbe_display_layer->video_dev, vpbe_display_layer); diff --git a/include/media/davinci/vpbe_display.h b/include/media/davinci/vpbe_display.h index 8dffffe..637749a 100644 --- a/include/media/davinci/vpbe_display.h +++ b/include/media/davinci/vpbe_display.h @@ -16,6 +16,7 @@ /* Header files */ #include #include +#include #include #include #include @@ -94,8 +95,6 @@ struct vpbe_layer { * has selected */ enum v4l2_memory memory; - /* Used to keep track of state of the priority */ - struct v4l2_prio_state prio; /* Used to store pixel format */ struct v4l2_pix_format pix_fmt; enum v4l2_field buf_field; @@ -134,14 +133,13 @@ struct vpbe_display { /* File handle structure */ struct vpbe_fh { + struct v4l2_fh fh; /* vpbe device structure */ struct vpbe_display *disp_dev; /* pointer to layer object for opened device */ struct vpbe_layer *layer; /* Indicates whether this file handle is doing IO */ unsigned char io_allowed; - /* Used to keep track priority of this instance */ - enum v4l2_priority prio; }; struct buf_config_params {