All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Longerbeam <slongerbeam@gmail.com>
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 <steve_longerbeam@mentor.com>
Subject: [PATCH v2 12/13] gpu: ipu-ic: allow multiple handles to ic
Date: Tue, 19 Jul 2016 18:11:10 -0700	[thread overview]
Message-ID: <1468977071-29240-13-git-send-email-steve_longerbeam@mentor.com> (raw)
In-Reply-To: <1468977071-29240-1-git-send-email-steve_longerbeam@mentor.com>

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 <steve_longerbeam@mentor.com>
---
 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);
 
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Steve Longerbeam <slongerbeam@gmail.com>
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 <steve_longerbeam@mentor.com>
Subject: [PATCH v2 12/13] gpu: ipu-ic: allow multiple handles to ic
Date: Wed, 20 Jul 2016 01:11:10 +0000	[thread overview]
Message-ID: <1468977071-29240-13-git-send-email-steve_longerbeam@mentor.com> (raw)
In-Reply-To: <1468977071-29240-1-git-send-email-steve_longerbeam@mentor.com>

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 <steve_longerbeam@mentor.com>
---
 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);
 
-- 
1.9.1


  parent reply	other threads:[~2016-07-20  1:12 UTC|newest]

Thread overview: 119+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-07 23:03 [PATCH 00/16] IPUv3 prep for i.MX5/6 v4l2 staging drivers Steve Longerbeam
2016-07-07 23:03 ` [PATCH 01/16] gpu: ipu-v3: Add Video Deinterlacer unit Steve Longerbeam
2016-07-11  0:02   ` Paul Gortmaker
2016-07-15 22:35     ` Steve Longerbeam
2016-07-07 23:03 ` [PATCH 02/16] gpu: ipu-cpmem: Add ipu_cpmem_set_uv_offset() Steve Longerbeam
2016-07-08 17:34   ` Philipp Zabel
2016-07-08 17:34     ` Philipp Zabel
2016-07-13 22:54     ` Steve Longerbeam
2016-07-13 22:54       ` Steve Longerbeam
2016-07-15 12:45       ` Philipp Zabel
2016-07-07 23:03 ` [PATCH 03/16] gpu: ipu-cpmem: Add ipu_cpmem_get_burstsize() Steve Longerbeam
2016-07-07 23:03 ` [PATCH 04/16] gpu: ipu-v3: Add ipu_get_num() Steve Longerbeam
2016-07-15 12:45   ` Philipp Zabel
2016-07-07 23:03 ` [PATCH 05/16] gpu: ipu-v3: Add IDMA channel linking support Steve Longerbeam
2016-07-08 17:34   ` Philipp Zabel
2016-07-08 17:34     ` Philipp Zabel
2016-07-13 22:55     ` Steve Longerbeam
2016-07-13 22:55       ` Steve Longerbeam
2016-07-07 23:03 ` [PATCH 06/16] gpu: ipu-v3: Add ipu_set_vdi_src_mux() Steve Longerbeam
2016-07-15 12:48   ` Philipp Zabel
2016-07-15 12:48     ` Philipp Zabel
2016-07-15 21:33     ` Steve Longerbeam
2016-07-15 21:33       ` Steve Longerbeam
2016-07-07 23:03 ` [PATCH 07/16] gpu: ipu-v3: Add VDI input IDMAC channels Steve Longerbeam
2016-07-15 12:45   ` Philipp Zabel
2016-07-15 12:45     ` Philipp Zabel
2016-07-15 21:34     ` Steve Longerbeam
2016-07-15 21:34       ` Steve Longerbeam
2016-07-07 23:03 ` [PATCH 08/16] gpu: ipu-v3: Add ipu_csi_set_src() Steve Longerbeam
2016-07-15 12:49   ` Philipp Zabel
2016-07-15 21:45     ` Steve Longerbeam
2016-07-15 21:45       ` Steve Longerbeam
2016-07-07 23:03 ` [PATCH 09/16] gpu: ipu-v3: Add ipu_ic_set_src() Steve Longerbeam
2016-07-15 12:45   ` Philipp Zabel
2016-07-15 21:57     ` Steve Longerbeam
2016-07-15 21:57       ` Steve Longerbeam
2016-07-07 23:03 ` [PATCH 10/16] gpu: ipu-v3: set correct full sensor frame for PAL/NTSC Steve Longerbeam
2016-07-07 23:03 ` [PATCH 11/16] gpu: ipu-v3: Fix CSI data format for 16-bit media bus formats Steve Longerbeam
2016-07-08 17:38   ` Philipp Zabel
2016-07-08 17:38     ` Philipp Zabel
2016-07-07 23:03 ` [PATCH 12/16] gpu: ipu-v3: Fix CSI0 blur in NTSC format Steve Longerbeam
2016-07-08 17:34   ` Philipp Zabel
2016-07-08 17:34     ` Philipp Zabel
2016-07-10 16:33     ` Steve Longerbeam
2016-07-10 16:33       ` Steve Longerbeam
2016-07-13 23:02       ` Steve Longerbeam
2016-07-13 23:02         ` Steve Longerbeam
2016-07-15 12:58         ` Philipp Zabel
2016-07-15 12:58           ` Philipp Zabel
2016-07-15 23:09           ` Steve Longerbeam
2016-07-15 23:09             ` Steve Longerbeam
2016-07-16 20:24             ` Steve Longerbeam
2016-07-16 20:24               ` Steve Longerbeam
2016-07-19 13:32               ` Philipp Zabel
2016-07-19 13:32                 ` Philipp Zabel
2016-07-20  0:07                 ` Steve Longerbeam
2016-07-20  0:07                   ` Steve Longerbeam
2016-07-07 23:03 ` [PATCH 13/16] gpu: ipu-v3: Fix IRT usage Steve Longerbeam
2016-07-07 23:03 ` [PATCH 14/16] gpu: ipu-ic: Add complete image conversion support with tiling Steve Longerbeam
2016-07-07 23:03 ` [PATCH 15/16] gpu: ipu-ic: allow multiple handles to ic Steve Longerbeam
2016-07-07 23:03 ` [PATCH 16/16] gpu: ipu-v3: rename CSI client device Steve Longerbeam
2016-07-08 17:34 ` [PATCH 00/16] IPUv3 prep for i.MX5/6 v4l2 staging drivers Philipp Zabel
2016-07-08 17:34   ` Philipp Zabel
2016-07-20  1:10 ` [PATCH v2 00/13] IPUv3 prep for i.MX5/6 v4l2 staging drivers, v2 Steve Longerbeam
2016-07-20  1:10   ` Steve Longerbeam
2016-07-20  1:10   ` [PATCH v2 01/13] gpu: ipu-v3: Add Video Deinterlacer unit Steve Longerbeam
2016-07-20  1:10     ` Steve Longerbeam
2016-07-25  6:06     ` kbuild test robot
2016-07-25  6:06       ` kbuild test robot
2016-07-25  6:06       ` kbuild test robot
2016-07-26 10:06     ` Philipp Zabel
2016-07-26 10:06       ` Philipp Zabel
2016-07-20  1:11   ` [PATCH v2 02/13] gpu: ipu-cpmem: Add ipu_cpmem_set_uv_offset() Steve Longerbeam
2016-07-20  1:11     ` Steve Longerbeam
2016-07-20  1:11   ` [PATCH v2 03/13] gpu: ipu-cpmem: Add ipu_cpmem_get_burstsize() Steve Longerbeam
2016-07-20  1:11     ` Steve Longerbeam
2016-07-20  1:11   ` [PATCH v2 04/13] gpu: ipu-v3: Add ipu_get_num() Steve Longerbeam
2016-07-20  1:11     ` Steve Longerbeam
2016-07-20  1:11   ` [PATCH v2 05/13] gpu: ipu-v3: Add IDMA channel linking support Steve Longerbeam
2016-07-20  1:11     ` Steve Longerbeam
2016-07-26 10:06     ` Philipp Zabel
2016-07-26 10:06       ` Philipp Zabel
2016-07-26 10:06       ` Philipp Zabel
2016-07-28 23:40       ` Steve Longerbeam
2016-07-28 23:40         ` Steve Longerbeam
2016-07-28 23:40         ` Steve Longerbeam
2016-07-20  1:11   ` [PATCH v2 06/13] gpu: ipu-v3: Add ipu_set_vdi_src_mux() Steve Longerbeam
2016-07-20  1:11     ` Steve Longerbeam
2016-07-20  1:11   ` [PATCH v2 07/13] gpu: ipu-v3: Add VDI input IDMAC channels Steve Longerbeam
2016-07-20  1:11     ` Steve Longerbeam
2016-07-20  1:11   ` [PATCH v2 08/13] gpu: ipu-v3: set correct full sensor frame for PAL/NTSC Steve Longerbeam
2016-07-20  1:11     ` Steve Longerbeam
2016-07-20  1:11   ` [PATCH v2 09/13] gpu: ipu-v3: Fix CSI data format for 16-bit media bus formats Steve Longerbeam
2016-07-20  1:11     ` Steve Longerbeam
2016-07-20  1:11   ` [PATCH v2 10/13] gpu: ipu-v3: Fix IRT usage Steve Longerbeam
2016-07-20  1:11     ` Steve Longerbeam
2016-07-20  1:11   ` [PATCH v2 11/13] gpu: ipu-ic: Add complete image conversion support with tiling Steve Longerbeam
2016-07-20  1:11     ` Steve Longerbeam
2016-07-26 10:08     ` Philipp Zabel
2016-07-26 10:08       ` Philipp Zabel
2016-07-28 23:09       ` Steve Longerbeam
2016-07-28 23:09         ` Steve Longerbeam
2016-07-28 23:09         ` Steve Longerbeam
2016-08-01  9:29         ` Philipp Zabel
2016-08-01  9:29           ` Philipp Zabel
2016-08-01  9:29           ` Philipp Zabel
2016-08-04  0:18           ` Steve Longerbeam
2016-08-04  0:18             ` Steve Longerbeam
2016-08-04  0:18             ` Steve Longerbeam
2016-08-12 14:56             ` Philipp Zabel
2016-08-12 14:56               ` Philipp Zabel
2016-08-12 14:56               ` Philipp Zabel
2016-07-20  1:11   ` Steve Longerbeam [this message]
2016-07-20  1:11     ` [PATCH v2 12/13] gpu: ipu-ic: allow multiple handles to ic Steve Longerbeam
2016-07-20  1:11   ` [PATCH v2 13/13] gpu: ipu-v3: rename CSI client device Steve Longerbeam
2016-07-20  1:11     ` Steve Longerbeam
2016-07-26 10:06   ` [PATCH v2 00/13] IPUv3 prep for i.MX5/6 v4l2 staging drivers, v2 Philipp Zabel
2016-07-26 10:06     ` Philipp Zabel
2016-07-26 10:06     ` Philipp Zabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1468977071-29240-13-git-send-email-steve_longerbeam@mentor.com \
    --to=slongerbeam@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=plagnioj@jcrosoft.com \
    --cc=steve_longerbeam@mentor.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.