From patchwork Thu Jul 7 23:03:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 9220049 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3480B60574 for ; Fri, 8 Jul 2016 05:27:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26F5A2840B for ; Fri, 8 Jul 2016 05:27:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B89128411; Fri, 8 Jul 2016 05:27:12 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A59142840B for ; Fri, 8 Jul 2016 05:27:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 807966E884; Fri, 8 Jul 2016 05:27:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-x244.google.com (mail-pa0-x244.google.com [IPv6:2607:f8b0:400e:c03::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7B7D46E837 for ; Thu, 7 Jul 2016 23:04:26 +0000 (UTC) Received: by mail-pa0-x244.google.com with SMTP id us13so2841209pab.1 for ; Thu, 07 Jul 2016 16:04:26 -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=vkIlGCqrI8pyn01NqXHjpAhGQy1IcYVWMvJ0n1hzS7E=; b=JETu/pgYgzqungu+zpFH0HnoOTDAlmqT5GKGKLtcRwazOjz5jd2oTgLMZwlAm+Az3D J61DYztAt2UJfkn2Iadoru20b8dA6jLzll1qRG8JIvgrtU2/pqPFsQKHrZUBF/71GY7v 0+YxKzURrGD+uWmmPMb3C/RyTfe/3A5uXOche1NG11jAIeKDVPTf/haoFueRVvvRCMAR etbodLRyEqNXhFD/Jv5fw+5DnFpOyBnE7iyt8v4tWbKwXWsnu02rcVVzFvlUo/9f2Z96 +UxWiuhGNLrUSIXfFTGDPjSvgnXgz+HnuzOQotC2PzTrfLInPyOjThYo73oI/jacKwGp B49g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vkIlGCqrI8pyn01NqXHjpAhGQy1IcYVWMvJ0n1hzS7E=; b=DE+9NncRfUpXVSmHzrgSJUHzEctLXL1Xy+yofd4KPw25Sh9avj7xHFxed2aGScafuN 1BwESauXAqd3zWHWsCG27T3WB3YJ/kQcy9EE/TzBPJrgNw1ijpO+DDqqYKJRdmxmDtkn e/TsMXnhwm81xZfkiXZx6ivkX/IyrqFcXO9n/FBissTNxmO02rdhU2crGns4aKJRNsUF YMAjBvLPKLu8j7k4TZnmD5MZvuPYYniJmzxlqUdnZ0hiOBTgFT6nIXs9HKShQ/wYywKA j4xQPc2Slhz9pbiJmI307JWvokr4CyCXhVBVqyRiu7Q6ClwrbFD3G2FiaO2aG/whnuJR gG2g== X-Gm-Message-State: ALyK8tLXcOiFgDrYBDGZLkT1lBGYBB8GfFeu8S08MOqblLYL/QSl7DB6km1T4PYR8oecpg== X-Received: by 10.66.65.109 with SMTP id w13mr4566188pas.142.1467932665751; Thu, 07 Jul 2016 16:04:25 -0700 (PDT) Received: from mothership.sklembedded.com (c-73-241-2-21.hsd1.ca.comcast.net. [73.241.2.21]) by smtp.googlemail.com with ESMTPSA id z29sm6846719pff.0.2016.07.07.16.04.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jul 2016 16:04:25 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: p.zabel@pengutronix.de Subject: [PATCH 15/16] gpu: ipu-ic: allow multiple handles to ic Date: Thu, 7 Jul 2016 16:03:40 -0700 Message-Id: <1467932621-358-16-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467932621-358-1-git-send-email-steve_longerbeam@mentor.com> References: <1467932621-358-1-git-send-email-steve_longerbeam@mentor.com> X-Mailman-Approved-At: Fri, 08 Jul 2016 05:26:19 +0000 Cc: Steve Longerbeam , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org 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-Virus-Scanned: ClamAV using ClamSMTP The image converter kernel API supports conversion contexts and job queues, so we should allow more than one handle to the IC, so that multiple users can add jobs to the queue. Note however that users that control the IC manually (that do not use the image converter APIs but setup the IC task by hand via calls to ipu_ic_task_enable(), ipu_ic_enable(), etc.) must still be careful not to share the IC handle with other threads. At this point, the only user that still controls the IC manually is the i.mx capture driver. In that case the capture driver only allows one open context to get a handle to the IC at a time, so we should be ok there. Signed-off-by: Steve Longerbeam --- drivers/gpu/ipu-v3/ipu-ic.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c index f6a1125..51e34a1 100644 --- a/drivers/gpu/ipu-v3/ipu-ic.c +++ b/drivers/gpu/ipu-v3/ipu-ic.c @@ -342,7 +342,6 @@ struct ipu_ic { enum ipu_color_space out_cs; bool graphics; bool rotation; - bool in_use; struct image_converter cvt; @@ -2380,38 +2379,16 @@ EXPORT_SYMBOL_GPL(ipu_ic_disable); struct ipu_ic *ipu_ic_get(struct ipu_soc *ipu, enum ipu_ic_task task) { struct ipu_ic_priv *priv = ipu->ic_priv; - unsigned long flags; - struct ipu_ic *ic, *ret; if (task >= IC_NUM_TASKS) return ERR_PTR(-EINVAL); - ic = &priv->task[task]; - - spin_lock_irqsave(&priv->lock, flags); - - if (ic->in_use) { - ret = ERR_PTR(-EBUSY); - goto unlock; - } - - ic->in_use = true; - ret = ic; - -unlock: - spin_unlock_irqrestore(&priv->lock, flags); - return ret; + return &priv->task[task]; } EXPORT_SYMBOL_GPL(ipu_ic_get); void ipu_ic_put(struct ipu_ic *ic) { - struct ipu_ic_priv *priv = ic->priv; - unsigned long flags; - - spin_lock_irqsave(&priv->lock, flags); - ic->in_use = false; - spin_unlock_irqrestore(&priv->lock, flags); } EXPORT_SYMBOL_GPL(ipu_ic_put);