From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753833AbcHRAur (ORCPT ); Wed, 17 Aug 2016 20:50:47 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:34412 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753699AbcHRAud (ORCPT ); Wed, 17 Aug 2016 20:50:33 -0400 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-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, Steve Longerbeam Subject: [PATCH v4 4/4] gpu: ipu-ic: allow multiple handles to ic Date: Wed, 17 Aug 2016 17:50:19 -0700 Message-Id: <1471481419-5917-5-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471481419-5917-1-git-send-email-steve_longerbeam@mentor.com> References: <1471481419-5917-1-git-send-email-steve_longerbeam@mentor.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- v4: no changes v3: no changes v2: no changes --- 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 01b1b56..c44aeba 100644 --- a/drivers/gpu/ipu-v3/ipu-ic.c +++ b/drivers/gpu/ipu-v3/ipu-ic.c @@ -338,7 +338,6 @@ struct ipu_ic { enum ipu_color_space out_cs; bool graphics; bool rotation; - bool in_use; struct image_converter cvt; @@ -2370,38 +2369,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); -- 1.9.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Longerbeam Date: Thu, 18 Aug 2016 00:50:19 +0000 Subject: [PATCH v4 4/4] gpu: ipu-ic: allow multiple handles to ic Message-Id: <1471481419-5917-5-git-send-email-steve_longerbeam@mentor.com> List-Id: References: <1471481419-5917-1-git-send-email-steve_longerbeam@mentor.com> In-Reply-To: <1471481419-5917-1-git-send-email-steve_longerbeam@mentor.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: p.zabel@pengutronix.de, plagnioj@jcrosoft.com, tomi.valkeinen@ti.com Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, Steve Longerbeam 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 --- v4: no changes v3: no changes v2: no changes --- 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 01b1b56..c44aeba 100644 --- a/drivers/gpu/ipu-v3/ipu-ic.c +++ b/drivers/gpu/ipu-v3/ipu-ic.c @@ -338,7 +338,6 @@ struct ipu_ic { enum ipu_color_space out_cs; bool graphics; bool rotation; - bool in_use; struct image_converter cvt; @@ -2370,38 +2369,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); -- 1.9.1