drm_writeback.c (97eb9eaeb95ba8eb3c7a77a7ec7786d47a1bcaee) drm_writeback.c (e482ae9b5fdc01a343f22f52930e85a6cfdf85eb)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * (C) COPYRIGHT 2016 ARM Limited. All rights reserved.
4 * Author: Brian Starkey <brian.starkey@arm.com>
5 *
6 * This program is free software and is provided to you under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation, and any use by you of this program is subject to the terms

--- 259 unchanged lines hidden (view full) ---

268 conn_state->writeback_job = NULL;
269
270 spin_lock_irqsave(&wb_connector->job_lock, flags);
271 list_add_tail(&job->list_entry, &wb_connector->job_queue);
272 spin_unlock_irqrestore(&wb_connector->job_lock, flags);
273}
274EXPORT_SYMBOL(drm_writeback_queue_job);
275
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * (C) COPYRIGHT 2016 ARM Limited. All rights reserved.
4 * Author: Brian Starkey <brian.starkey@arm.com>
5 *
6 * This program is free software and is provided to you under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation, and any use by you of this program is subject to the terms

--- 259 unchanged lines hidden (view full) ---

268 conn_state->writeback_job = NULL;
269
270 spin_lock_irqsave(&wb_connector->job_lock, flags);
271 list_add_tail(&job->list_entry, &wb_connector->job_queue);
272 spin_unlock_irqrestore(&wb_connector->job_lock, flags);
273}
274EXPORT_SYMBOL(drm_writeback_queue_job);
275
276void drm_writeback_cleanup_job(struct drm_writeback_job *job)
277{
278 if (job->fb)
279 drm_framebuffer_put(job->fb);
280
281 kfree(job);
282}
283EXPORT_SYMBOL(drm_writeback_cleanup_job);
284
276/*
277 * @cleanup_work: deferred cleanup of a writeback job
278 *
279 * The job cannot be cleaned up directly in drm_writeback_signal_completion,
280 * because it may be called in interrupt context. Dropping the framebuffer
281 * reference can sleep, and so the cleanup is deferred to a workqueue.
282 */
283static void cleanup_work(struct work_struct *work)
284{
285 struct drm_writeback_job *job = container_of(work,
286 struct drm_writeback_job,
287 cleanup_work);
285/*
286 * @cleanup_work: deferred cleanup of a writeback job
287 *
288 * The job cannot be cleaned up directly in drm_writeback_signal_completion,
289 * because it may be called in interrupt context. Dropping the framebuffer
290 * reference can sleep, and so the cleanup is deferred to a workqueue.
291 */
292static void cleanup_work(struct work_struct *work)
293{
294 struct drm_writeback_job *job = container_of(work,
295 struct drm_writeback_job,
296 cleanup_work);
288 drm_framebuffer_put(job->fb);
289 kfree(job);
297
298 drm_writeback_cleanup_job(job);
290}
291
299}
300
292
293/**
294 * drm_writeback_signal_completion - Signal the completion of a writeback job
295 * @wb_connector: The writeback connector whose job is complete
296 * @status: Status code to set in the writeback out_fence (0 for success)
297 *
298 * Drivers should call this to signal the completion of a previously queued
299 * writeback job. It should be called as soon as possible after the hardware
300 * has finished writing, and may be called from interrupt context.

--- 58 unchanged lines hidden ---
301/**
302 * drm_writeback_signal_completion - Signal the completion of a writeback job
303 * @wb_connector: The writeback connector whose job is complete
304 * @status: Status code to set in the writeback out_fence (0 for success)
305 *
306 * Drivers should call this to signal the completion of a previously queued
307 * writeback job. It should be called as soon as possible after the hardware
308 * has finished writing, and may be called from interrupt context.

--- 58 unchanged lines hidden ---