eaf01ee5ba
Implement job submission ioctl. Job scheduling is implemented using
drm_sched.
Jobs are submitted in a stream format. This is intended to allow the UAPI
data format to be independent of the actual FWIF structures in use, which
vary depending on the GPU in use.
The stream formats are documented at:
f8d2b42ae6/src/imagination/csbgen/rogue_kmd_stream.xml
Changes since v8:
- Updated for upstreamed DRM scheduler changes
- Removed workaround code for the pending_list previously being updated
after run_job() returned
- Fixed null deref in pvr_queue_cleanup_fw_context() for bad stream ptr
given to create_context ioctl
- Corrected license identifiers
Changes since v7:
- Updated for v8 "DRM scheduler changes for XE" patchset
Changes since v6:
- Fix fence handling in pvr_sync_signal_array_add()
- Add handling for SUBMIT_JOB_FRAG_CMD_DISABLE_PIXELMERGE flag
- Fix missing dma_resv locking in job submit path
Changes since v5:
- Fix leak in job creation error path
Changes since v4:
- Use a regular workqueue for job scheduling
Changes since v3:
- Support partial render jobs
- Add job timeout handler
- Split sync handling out of job code
- Use drm_dev_{enter,exit}
Changes since v2:
- Use drm_sched for job scheduling
Co-developed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Co-developed-by: Donald Robson <donald.robson@imgtec.com>
Signed-off-by: Donald Robson <donald.robson@imgtec.com>
Signed-off-by: Sarah Walker <sarah.walker@imgtec.com>
Link: https://lore.kernel.org/r/c98dab7a5f5fb891fbed7e4990d19b5d13964365.1700668843.git.donald.robson@imgtec.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
85 lines
2.1 KiB
C
85 lines
2.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
|
|
/* Copyright (c) 2023 Imagination Technologies Ltd. */
|
|
|
|
#ifndef PVR_SYNC_H
|
|
#define PVR_SYNC_H
|
|
|
|
#include <uapi/drm/pvr_drm.h>
|
|
|
|
/* Forward declaration from <linux/xarray.h>. */
|
|
struct xarray;
|
|
|
|
/* Forward declaration from <drm/drm_file.h>. */
|
|
struct drm_file;
|
|
|
|
/* Forward declaration from <drm/gpu_scheduler.h>. */
|
|
struct drm_sched_job;
|
|
|
|
/* Forward declaration from "pvr_device.h". */
|
|
struct pvr_file;
|
|
|
|
/**
|
|
* struct pvr_sync_signal - Object encoding a syncobj signal operation
|
|
*
|
|
* The job submission logic collects all signal operations in an array of
|
|
* pvr_sync_signal objects. This array also serves as a cache to get the
|
|
* latest dma_fence when multiple jobs are submitted at once, and one job
|
|
* signals a syncobj point that's later waited on by a subsequent job.
|
|
*/
|
|
struct pvr_sync_signal {
|
|
/** @handle: Handle of the syncobj to signal. */
|
|
u32 handle;
|
|
|
|
/**
|
|
* @point: Point to signal in the syncobj.
|
|
*
|
|
* Only relevant for timeline syncobjs.
|
|
*/
|
|
u64 point;
|
|
|
|
/** @syncobj: Syncobj retrieved from the handle. */
|
|
struct drm_syncobj *syncobj;
|
|
|
|
/**
|
|
* @chain: Chain object used to link the new fence with the
|
|
* existing timeline syncobj.
|
|
*
|
|
* Should be zero when manipulating a regular syncobj.
|
|
*/
|
|
struct dma_fence_chain *chain;
|
|
|
|
/**
|
|
* @fence: New fence object to attach to the syncobj.
|
|
*
|
|
* This pointer starts with the current fence bound to
|
|
* the <handle,point> pair.
|
|
*/
|
|
struct dma_fence *fence;
|
|
};
|
|
|
|
void
|
|
pvr_sync_signal_array_cleanup(struct xarray *array);
|
|
|
|
int
|
|
pvr_sync_signal_array_collect_ops(struct xarray *array,
|
|
struct drm_file *file,
|
|
u32 sync_op_count,
|
|
const struct drm_pvr_sync_op *sync_ops);
|
|
|
|
int
|
|
pvr_sync_signal_array_update_fences(struct xarray *array,
|
|
u32 sync_op_count,
|
|
const struct drm_pvr_sync_op *sync_ops,
|
|
struct dma_fence *done_fence);
|
|
|
|
void
|
|
pvr_sync_signal_array_push_fences(struct xarray *array);
|
|
|
|
int
|
|
pvr_sync_add_deps_to_job(struct pvr_file *pvr_file, struct drm_sched_job *job,
|
|
u32 sync_op_count,
|
|
const struct drm_pvr_sync_op *sync_ops,
|
|
struct xarray *signal_array);
|
|
|
|
#endif /* PVR_SYNC_H */
|