Linux Audio

Check our new training course

Loading...
Note: File does not exist in v4.6.
 1/* SPDX-License-Identifier: MIT */
 2/*
 3 * Copyright © 2021 Intel Corporation
 4 */
 5
 6#ifndef _XE_SCHED_JOB_H_
 7#define _XE_SCHED_JOB_H_
 8
 9#include "xe_sched_job_types.h"
10
11struct xe_vm;
12
13#define XE_SCHED_HANG_LIMIT 1
14#define XE_SCHED_JOB_TIMEOUT LONG_MAX
15
16int xe_sched_job_module_init(void);
17void xe_sched_job_module_exit(void);
18
19struct xe_sched_job *xe_sched_job_create(struct xe_exec_queue *q,
20					 u64 *batch_addr);
21void xe_sched_job_destroy(struct kref *ref);
22
23/**
24 * xe_sched_job_get - get reference to XE schedule job
25 * @job: XE schedule job object
26 *
27 * Increment XE schedule job's reference count
28 */
29static inline struct xe_sched_job *xe_sched_job_get(struct xe_sched_job *job)
30{
31	kref_get(&job->refcount);
32	return job;
33}
34
35/**
36 * xe_sched_job_put - put reference to XE schedule job
37 * @job: XE schedule job object
38 *
39 * Decrement XE schedule job's reference count, call xe_sched_job_destroy when
40 * reference count == 0.
41 */
42static inline void xe_sched_job_put(struct xe_sched_job *job)
43{
44	kref_put(&job->refcount, xe_sched_job_destroy);
45}
46
47void xe_sched_job_set_error(struct xe_sched_job *job, int error);
48static inline bool xe_sched_job_is_error(struct xe_sched_job *job)
49{
50	return job->fence->error < 0;
51}
52
53bool xe_sched_job_started(struct xe_sched_job *job);
54bool xe_sched_job_completed(struct xe_sched_job *job);
55
56void xe_sched_job_arm(struct xe_sched_job *job);
57void xe_sched_job_push(struct xe_sched_job *job);
58
59int xe_sched_job_last_fence_add_dep(struct xe_sched_job *job, struct xe_vm *vm);
60
61static inline struct xe_sched_job *
62to_xe_sched_job(struct drm_sched_job *drm)
63{
64	return container_of(drm, struct xe_sched_job, drm);
65}
66
67static inline u32 xe_sched_job_seqno(struct xe_sched_job *job)
68{
69	return job->fence->seqno;
70}
71
72static inline void
73xe_sched_job_add_migrate_flush(struct xe_sched_job *job, u32 flags)
74{
75	job->migrate_flush_flags = flags;
76}
77
78bool xe_sched_job_is_migration(struct xe_exec_queue *q);
79
80#endif