linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Lowry Li (Arm Technology China)" <Lowry.Li@arm.com>
To: Liviu Dudau <Liviu.Dudau@arm.com>,
	"james qian wang (Arm Technology China)"
	<james.qian.wang@arm.com>,
	"maarten.lankhorst@linux.intel.com" 
	<maarten.lankhorst@linux.intel.com>,
	"seanpaul@chromium.org" <seanpaul@chromium.org>,
	"airlied@linux.ie" <airlied@linux.ie>,
	"daniel@ffwll.ch" <daniel@ffwll.ch>,
	Brian Starkey <Brian.Starkey@arm.com>
Cc: "Julien Yin (Arm Technology China)" <Julien.Yin@arm.com>,
	"maxime.ripard@bootlin.com" <maxime.ripard@bootlin.com>,
	"eric@anholt.net" <eric@anholt.net>,
	"kieran.bingham+renesas@ideasonboard.com" 
	<kieran.bingham+renesas@ideasonboard.com>,
	"sean@poorly.run" <sean@poorly.run>,
	"laurent.pinchart@ideasonboard.com" 
	<laurent.pinchart@ideasonboard.com>,
	"Jonathan Chai (Arm Technology China)" <Jonathan.Chai@arm.com>,
	Ayan Halder <Ayan.Halder@arm.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>, nd <nd@arm.com>
Subject: [PATCH v1 2/2] drm: Clear the fence pointer when writeback job signaled
Date: Wed, 31 Jul 2019 11:04:45 +0000	[thread overview]
Message-ID: <1564571048-15029-3-git-send-email-lowry.li@arm.com> (raw)
In-Reply-To: <1564571048-15029-1-git-send-email-lowry.li@arm.com>

During it signals the completion of a writeback job, after releasing
the out_fence, we'd clear the pointer.

Check if fence left over in drm_writeback_cleanup_job(), release it.

Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@arm.com>
---
 drivers/gpu/drm/drm_writeback.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c
index ff138b6..43d9e3b 100644
--- a/drivers/gpu/drm/drm_writeback.c
+++ b/drivers/gpu/drm/drm_writeback.c
@@ -324,6 +324,9 @@ void drm_writeback_cleanup_job(struct drm_writeback_job *job)
 	if (job->fb)
 		drm_framebuffer_put(job->fb);
 
+	if (job->out_fence)
+		dma_fence_put(job->out_fence);
+
 	kfree(job);
 }
 EXPORT_SYMBOL(drm_writeback_cleanup_job);
@@ -366,25 +369,29 @@ static void cleanup_work(struct work_struct *work)
 {
 	unsigned long flags;
 	struct drm_writeback_job *job;
+	struct dma_fence *out_fence;
 
 	spin_lock_irqsave(&wb_connector->job_lock, flags);
 	job = list_first_entry_or_null(&wb_connector->job_queue,
 				       struct drm_writeback_job,
 				       list_entry);
-	if (job) {
+	if (job)
 		list_del(&job->list_entry);
-		if (job->out_fence) {
-			if (status)
-				dma_fence_set_error(job->out_fence, status);
-			dma_fence_signal(job->out_fence);
-			dma_fence_put(job->out_fence);
-		}
-	}
+
 	spin_unlock_irqrestore(&wb_connector->job_lock, flags);
 
 	if (WARN_ON(!job))
 		return;
 
+	out_fence = job->out_fence;
+	if (out_fence) {
+		if (status)
+			dma_fence_set_error(out_fence, status);
+		dma_fence_signal(out_fence);
+		dma_fence_put(out_fence);
+		job->out_fence = NULL;
+	}
+
 	INIT_WORK(&job->cleanup_work, cleanup_work);
 	queue_work(system_long_wq, &job->cleanup_work);
 }
-- 
1.9.1


  parent reply	other threads:[~2019-07-31 11:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-23 14:30 [PATCH] dt-bindings: timer: renesas: tmu: Document r8a774b1 bindings Biju Das
2019-07-31 11:04 ` [PATCH v1 0/2] Free the writeback_job when it with an empty fb Lowry Li (Arm Technology China)
2019-07-31 11:04   ` [PATCH v1 1/2] drm: " Lowry Li (Arm Technology China)
2019-07-31 13:03     ` Liviu Dudau
2019-09-23  7:24     ` [v1,1/2] " james qian wang (Arm Technology China)
2019-07-31 11:04   ` Lowry Li (Arm Technology China) [this message]
2019-07-31 13:15     ` [PATCH v1 2/2] drm: Clear the fence pointer when writeback job signaled Liviu Dudau
     [not found]       ` <20190801063055.GA17887@lowry.li@arm.com>
2019-08-01  9:58         ` Liviu Dudau
2019-07-31 13:20     ` Brian Starkey
     [not found]       ` <20190801063351.GB17887@lowry.li@arm.com>
2019-08-02  9:29         ` Brian Starkey
2019-08-02  9:43           ` Daniel Vetter
2019-08-02  9:45             ` Daniel Vetter
2019-08-02 10:09               ` Brian Starkey
2019-08-02 14:06                 ` Daniel Vetter
2019-08-02 10:09           ` james qian wang (Arm Technology China)
2019-08-05 13:10     ` Brian Starkey
2019-09-23  7:25     ` [v1,2/2] " james qian wang (Arm Technology China)
2019-12-09 10:33   ` Patchwork summary for: linux-renesas-soc patchwork-bot+linux-renesas-soc
2019-09-26 12:33 ` [PATCH] dt-bindings: timer: renesas: tmu: Document r8a774b1 bindings Geert Uytterhoeven
2019-10-02 14:19 ` Rob Herring
2019-10-03  4:09 ` Daniel Lezcano
2019-10-03  6:38   ` Biju Das
2019-10-03  6:39     ` Daniel Lezcano
2019-10-03  6:50   ` Geert Uytterhoeven
2019-11-21  8:52     ` Biju Das
2019-11-21  8:55       ` Geert Uytterhoeven
2019-12-09 10:17         ` Geert Uytterhoeven

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=1564571048-15029-3-git-send-email-lowry.li@arm.com \
    --to=lowry.li@arm.com \
    --cc=Ayan.Halder@arm.com \
    --cc=Brian.Starkey@arm.com \
    --cc=Jonathan.Chai@arm.com \
    --cc=Julien.Yin@arm.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric@anholt.net \
    --cc=james.qian.wang@arm.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=nd@arm.com \
    --cc=sean@poorly.run \
    --cc=seanpaul@chromium.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).