[PATCH] gpu: ipu-v3: image-convert: Wait for channels before disabling

Steve Longerbeam slongerbeam at gmail.com
Wed Jun 10 00:51:10 UTC 2020


Call ipu_idmac_wait_busy() on each idmac channel to busy wait for the
channel to be idle before disabling. Otherwise it was found that a
conversion would stall after the completion of a tile and the start
of the next tile.

Fixes: 0537db801bb01 ("gpu: ipu-v3: image-convert: reconfigure IC per tile")
Signed-off-by: Steve Longerbeam <slongerbeam at gmail.com>
---
 drivers/gpu/ipu-v3/ipu-image-convert.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c
index eeca50d9a1ee..f0938015d2fd 100644
--- a/drivers/gpu/ipu-v3/ipu-image-convert.c
+++ b/drivers/gpu/ipu-v3/ipu-image-convert.c
@@ -1251,6 +1251,19 @@ static int get_run_count(struct ipu_image_convert_ctx *ctx,
 	return count;
 }
 
+static void stop_channel(struct ipu_image_convert_chan *chan,
+			 struct ipuv3_channel *channel)
+{
+	struct ipu_image_convert_priv *priv = chan->priv;
+	int ret;
+
+	ret = ipu_idmac_wait_busy(channel, 1);
+	if (ret == -ETIMEDOUT)
+		dev_warn(priv->ipu->dev, "IDMAC timeout\n");
+
+	ipu_idmac_disable_channel(channel);
+}
+
 static void convert_stop(struct ipu_image_convert_run *run)
 {
 	struct ipu_image_convert_ctx *ctx = run->ctx;
@@ -1262,12 +1275,12 @@ static void convert_stop(struct ipu_image_convert_run *run)
 
 	/* disable IC tasks and the channels */
 	ipu_ic_task_disable(chan->ic);
-	ipu_idmac_disable_channel(chan->in_chan);
-	ipu_idmac_disable_channel(chan->out_chan);
+	stop_channel(chan, chan->in_chan);
+	stop_channel(chan, chan->out_chan);
 
 	if (ipu_rot_mode_is_irt(ctx->rot_mode)) {
-		ipu_idmac_disable_channel(chan->rotation_in_chan);
-		ipu_idmac_disable_channel(chan->rotation_out_chan);
+		stop_channel(chan, chan->rotation_in_chan);
+		stop_channel(chan, chan->rotation_out_chan);
 		ipu_idmac_unlink(chan->out_chan, chan->rotation_in_chan);
 	}
 
-- 
2.17.1



More information about the dri-devel mailing list