From patchwork Wed Jul 20 01:11:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 9238613 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 F03E36075D for ; Wed, 20 Jul 2016 01:12:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEE1026A4D for ; Wed, 20 Jul 2016 01:12:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC2A22624C; Wed, 20 Jul 2016 01:12:52 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 6CED12624C for ; Wed, 20 Jul 2016 01:12:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752962AbcGTBMH (ORCPT ); Tue, 19 Jul 2016 21:12:07 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34415 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753259AbcGTBLd (ORCPT ); Tue, 19 Jul 2016 21:11:33 -0400 Received: by mail-pf0-f193.google.com with SMTP id g202so2345446pfb.1; Tue, 19 Jul 2016 18:11:32 -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=ULFj3LJAs7nqZPdgtjfEGrPb4pVWtlh65MYU/dGLmkI=; b=eWtkXt7J+803t509Nk4P5261aWSjhAERDpMYQp4xoaT40kKh3JusPvesiwtnqWUCGm 2YL6v+o6OvlP/Rde4P7oVtp93IHSLnbRkVSsQ8oEJXv4nXqXFc0b/w20TEBLIeWjzcbI lpysMcWIQkDnZeBmv11D4RMFa6acM7KGeWkuQLulsVemEt9XKUcfACeHkg1oSy+OvNJr ltrQE4qY9V75FPj+6bFLbrMp2qu2sUgUTEUG27Uwe5jlp7BKAV28H1G1qbfe3OKZdGGZ cm5ZpMB5q2TSobni/yo2hEGjGZHzBel83WRI9TjP0CK+vwkNfdpoIrAH/XdZctNJtqTv dYxg== 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=ULFj3LJAs7nqZPdgtjfEGrPb4pVWtlh65MYU/dGLmkI=; b=gv89NK3myedU86vIbOG6Fbo/pS+0QZ9uWCquJ2Vu0wEmcsd7jr5Ny7nej2+JIUXgf5 Bp8sX14VhInz/BI2AfNBH3ad2e4tiSV6khoH654inLl2czV1KxmJuIcadY4ZnllMMoeW hUQ4sLRWhHxLPJmxDWVjiOjYJvroA/iGIDedD+AAue08wERWi1xlK714AZGxEpeS3qOD S84qouYgcK8WTNuSyNOzcVNKemoiH/wxG4JQYX98YDAdfCgAM/uafuAyv9PeCa5J9kIe vSDTQkiFqPtd1O9BmbtPybf38BO1oYfPQdLCg35t1BmqNSPCbbPNZmuj6jLXJ/8KXY+/ 7f1g== X-Gm-Message-State: ALyK8tL6d57+CyC4NHPbd9/djqIzS7h3CHMqfn5600CKar2kXNRYzhl9Tig6jIdMQ/DUGA== X-Received: by 10.98.70.199 with SMTP id o68mr60189792pfi.17.1468977092084; Tue, 19 Jul 2016 18:11:32 -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 d1sm84277pas.48.2016.07.19.18.11.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 18:11:31 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: p.zabel@pengutronix.de, plagnioj@jcrosoft.com, tomi.valkeinen@ti.com Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Steve Longerbeam Subject: [PATCH v2 12/13] gpu: ipu-ic: allow multiple handles to ic Date: Tue, 19 Jul 2016 18:11:10 -0700 Message-Id: <1468977071-29240-13-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468977071-29240-1-git-send-email-steve_longerbeam@mentor.com> References: <1467932621-358-1-git-send-email-steve_longerbeam@mentor.com> <1468977071-29240-1-git-send-email-steve_longerbeam@mentor.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 5471b72..cc0780b 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; @@ -2367,38 +2366,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);