From patchwork Tue Jun 14 22:49:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 9177087 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 27EE46021C for ; Tue, 14 Jun 2016 22:51:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1894B282F9 for ; Tue, 14 Jun 2016 22:51:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DAD82833B; Tue, 14 Jun 2016 22:51:26 +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 92507282F9 for ; Tue, 14 Jun 2016 22:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753005AbcFNWvW (ORCPT ); Tue, 14 Jun 2016 18:51:22 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35613 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752793AbcFNWvQ (ORCPT ); Tue, 14 Jun 2016 18:51:16 -0400 Received: by mail-pf0-f195.google.com with SMTP id t190so301899pfb.2 for ; Tue, 14 Jun 2016 15:51:16 -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=C+GunUzqfkTFFkpL7yAiiEmvdqu/7m0WaAtgznU87qlMw0nkYihW8ywwBH4ImKa3gF DWhZhxG0KrohNNNGXmesLcgDpBn3GFyW/fQSYLSEynM8gBy1qDDFQsAasqV8YKdUHMBX w1TAZpu1gT/9c6M+noH1J2OgDWCf7H5phe2gxxJcB1Ky3LHodZLiuA3S4uH7/C6Hl+LS baMOOyz8E/RqT6j0cl40VeWAd+Vg68ZCriKup+enX6ti+w6k+jMm5SVTPoNDwLeSgapv nmdZnSk0Ddl8aVsakiFxiV7tl/lLHSOwRISMAjxMTJ9YngQpf4Wy45TOK6aHKX216G2M in2g== 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=OsK8SmmD0A7i9lRZNo/ayUQPW+cpH+ZPMh6rubFvnknlNV94FkQZMcJfqPLnaXQWev 6vPZnJte3fJ4ZDHIiCtWIC4sven2ufQ7XP8ssP9AwfzcdW7PcaY7vFiSM+ma+2bL9Gmn seU3R+CzjYpXdKGt0bCaFIwnsHQQylR4t62W0VGI6Nht3/kG1gXBVr8uuDDZCOlcpTaa XrDvclHElmb3LYm1sXVofnj3yPS8DDz2bQ7HsIsmGqqnHQcjgs6P+XJq7ThKRYtkS4JE cemDj+r/6YZtm/WwpFDuK7pexWRQEcGDWSN4wU0MD4rMpdS/fJbrU0CmGX7jLb8CLebv DIiQ== X-Gm-Message-State: ALyK8tIYt1wZZRqQ+1xfKNVSKqaWSoizHvVQa+raifCl6wNiHmElRQZ1ETPdHTI0d9Ot7Q== X-Received: by 10.98.21.4 with SMTP id 4mr82860pfv.92.1465944675532; Tue, 14 Jun 2016 15:51:15 -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 v184sm47829999pfb.24.2016.06.14.15.51.14 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 14 Jun 2016 15:51:15 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Steve Longerbeam Subject: [PATCH 15/38] gpu: ipu-ic: allow multiple handles to ic Date: Tue, 14 Jun 2016 15:49:11 -0700 Message-Id: <1465944574-15745-16-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465944574-15745-1-git-send-email-steve_longerbeam@mentor.com> References: <1465944574-15745-1-git-send-email-steve_longerbeam@mentor.com> 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 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);