From patchwork Tue Jan 29 16:00:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10786523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F35E217E9 for ; Tue, 29 Jan 2019 16:00:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2A88291EE for ; Tue, 29 Jan 2019 16:00:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D68D32D152; Tue, 29 Jan 2019 16:00:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 697BE2D159 for ; Tue, 29 Jan 2019 16:00:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726913AbfA2QA1 (ORCPT ); Tue, 29 Jan 2019 11:00:27 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:53870 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726298AbfA2QA1 (ORCPT ); Tue, 29 Jan 2019 11:00:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=696h5dEItVGLUJjaWq/e86n6ScvucQYWrO9+DOhIgmw=; b=vAQFGp39Y4Ae3EfkJi9/Id6Ofz 9Zj2GEXrFsrnM87XC4m/PFwVwjF4M/BoToij5Ms2QOahnleguXc43aq1ojHSTktyikTbgVF4Z21ON HwFG5aw/XPPvI1/9FNwB5s2FVoQzRAEBvmsnFD6md2s2szvD0ub3ZBXRs3peoBmah3FPd38lsZ/In L8fBmbC0NZaztz69fYtBQj7TfBx7RoZrfExDFRa0TJ66oUquY48WPWl2QbwpRNSM+eafLB7EWQ8bB NpzGxKMRaINhIv+259eZNV+7HTDk1LdnpcU7ozG1kn6/Hs3D1AdlKRIVvb+nx4PJQDc+/OpMEbaTi JIlkNXQg==; Received: from 177.43.31.175.dynamic.adsl.gvt.net.br ([177.43.31.175] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1goVoI-0006oB-R9; Tue, 29 Jan 2019 16:00:26 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.91) (envelope-from ) id 1goVoD-0006UV-Bh; Tue, 29 Jan 2019 14:00:21 -0200 From: Mauro Carvalho Chehab To: Linux Media Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , Linux Doc Mailing List , Hans Verkuil , Ezequiel Garcia , Tomasz Figa , Sakari Ailus , Anton Leontiev Subject: [PATCH 3/3] media: vim2m: allow setting the default transaction time via parameter Date: Tue, 29 Jan 2019 14:00:17 -0200 Message-Id: <24e5cd4c01e918ef09a14352fc5f9afbe3b1fd3b.1548776693.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While there's a control to allow setting it at runtime, as the control handler is per file handler, only the application setting the m2m device can change it. As this is a custom control, it is unlikely that existing apps would be able to set it. Due to that, and due to the fact that v4l2-mem2mem serializes all accesses to a m2m device, trying to setup two GStreamer v4l2videoconvert instance at the same time will cause frame drops. So, add an alternate way of setting its default via a modprobe parameter. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vim2m.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c index a9e43070567e..0e7814b2327e 100644 --- a/drivers/media/platform/vim2m.c +++ b/drivers/media/platform/vim2m.c @@ -41,6 +41,12 @@ static unsigned debug; module_param(debug, uint, 0644); MODULE_PARM_DESC(debug, "activates debug info"); +/* Default transaction time in msec */ +static unsigned default_transtime = 40; /* Max 25 fps */ +module_param(default_transtime, uint, 0644); +MODULE_PARM_DESC(default_transtime, "default transaction time in ms"); + + #define MIN_W 32 #define MIN_H 32 #define MAX_W 640 @@ -58,9 +64,6 @@ MODULE_PARM_DESC(debug, "activates debug info"); /* In bytes, per queue */ #define MEM2MEM_VID_MEM_LIMIT (16 * 1024 * 1024) -/* Default transaction time in msec */ -#define MEM2MEM_DEF_TRANSTIME 40 - /* Flags that indicate processing mode */ #define MEM2MEM_HFLIP (1 << 0) #define MEM2MEM_VFLIP (1 << 1) @@ -764,6 +767,8 @@ static int vim2m_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_TRANS_TIME_MSEC: ctx->transtime = ctrl->val; + if (ctx->transtime < 1) + ctx->transtime = 1; break; case V4L2_CID_TRANS_NUM_BUFS: @@ -961,12 +966,11 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *ds return vb2_queue_init(dst_vq); } -static const struct v4l2_ctrl_config vim2m_ctrl_trans_time_msec = { +static struct v4l2_ctrl_config vim2m_ctrl_trans_time_msec = { .ops = &vim2m_ctrl_ops, .id = V4L2_CID_TRANS_TIME_MSEC, .name = "Transaction Time (msec)", .type = V4L2_CTRL_TYPE_INTEGER, - .def = MEM2MEM_DEF_TRANSTIME, .min = 1, .max = 10001, .step = 1, @@ -1008,6 +1012,8 @@ static int vim2m_open(struct file *file) v4l2_ctrl_handler_init(hdl, 4); v4l2_ctrl_new_std(hdl, &vim2m_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); v4l2_ctrl_new_std(hdl, &vim2m_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0); + + vim2m_ctrl_trans_time_msec.def = default_transtime; v4l2_ctrl_new_custom(hdl, &vim2m_ctrl_trans_time_msec, NULL); v4l2_ctrl_new_custom(hdl, &vim2m_ctrl_trans_num_bufs, NULL); if (hdl->error) {