drm: Clear the fence pointer when writeback job signaled

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: default avatarLowry Li (Arm Technology China) <lowry.li@arm.com>
Reviewed-by: default avatarBrian Starkey <brian.starkey@arm.com>
Reviewed-by: default avatarJames Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
Signed-off-by: default avatarjames qian wang (Arm Technology China) <james.qian.wang@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1564571048-15029-3-git-send-email-lowry.li@arm.com
parent 8581d510
...@@ -324,6 +324,9 @@ void drm_writeback_cleanup_job(struct drm_writeback_job *job) ...@@ -324,6 +324,9 @@ void drm_writeback_cleanup_job(struct drm_writeback_job *job)
if (job->fb) if (job->fb)
drm_framebuffer_put(job->fb); drm_framebuffer_put(job->fb);
if (job->out_fence)
dma_fence_put(job->out_fence);
kfree(job); kfree(job);
} }
EXPORT_SYMBOL(drm_writeback_cleanup_job); EXPORT_SYMBOL(drm_writeback_cleanup_job);
...@@ -366,25 +369,29 @@ drm_writeback_signal_completion(struct drm_writeback_connector *wb_connector, ...@@ -366,25 +369,29 @@ drm_writeback_signal_completion(struct drm_writeback_connector *wb_connector,
{ {
unsigned long flags; unsigned long flags;
struct drm_writeback_job *job; struct drm_writeback_job *job;
struct dma_fence *out_fence;
spin_lock_irqsave(&wb_connector->job_lock, flags); spin_lock_irqsave(&wb_connector->job_lock, flags);
job = list_first_entry_or_null(&wb_connector->job_queue, job = list_first_entry_or_null(&wb_connector->job_queue,
struct drm_writeback_job, struct drm_writeback_job,
list_entry); list_entry);
if (job) { if (job)
list_del(&job->list_entry); 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); spin_unlock_irqrestore(&wb_connector->job_lock, flags);
if (WARN_ON(!job)) if (WARN_ON(!job))
return; 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); INIT_WORK(&job->cleanup_work, cleanup_work);
queue_work(system_long_wq, &job->cleanup_work); queue_work(system_long_wq, &job->cleanup_work);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment