diff options
Diffstat (limited to 'drivers/gpu/drm/amd/scheduler/gpu_scheduler.h')
-rw-r--r-- | drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h index 2af0e4d4d817..80b64dc22214 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | |||
@@ -38,13 +38,15 @@ struct amd_sched_rq; | |||
38 | */ | 38 | */ |
39 | struct amd_sched_entity { | 39 | struct amd_sched_entity { |
40 | struct list_head list; | 40 | struct list_head list; |
41 | struct amd_sched_rq *belongto_rq; | 41 | struct amd_sched_rq *rq; |
42 | atomic_t fence_seq; | 42 | struct amd_gpu_scheduler *sched; |
43 | /* the job_queue maintains the jobs submitted by clients */ | 43 | |
44 | struct kfifo job_queue; | ||
45 | spinlock_t queue_lock; | 44 | spinlock_t queue_lock; |
46 | struct amd_gpu_scheduler *scheduler; | 45 | struct kfifo job_queue; |
46 | |||
47 | atomic_t fence_seq; | ||
47 | uint64_t fence_context; | 48 | uint64_t fence_context; |
49 | |||
48 | struct fence *dependency; | 50 | struct fence *dependency; |
49 | struct fence_cb cb; | 51 | struct fence_cb cb; |
50 | }; | 52 | }; |
@@ -62,13 +64,13 @@ struct amd_sched_rq { | |||
62 | 64 | ||
63 | struct amd_sched_fence { | 65 | struct amd_sched_fence { |
64 | struct fence base; | 66 | struct fence base; |
65 | struct amd_gpu_scheduler *scheduler; | 67 | struct fence_cb cb; |
68 | struct amd_gpu_scheduler *sched; | ||
66 | spinlock_t lock; | 69 | spinlock_t lock; |
67 | void *owner; | 70 | void *owner; |
68 | }; | 71 | }; |
69 | 72 | ||
70 | struct amd_sched_job { | 73 | struct amd_sched_job { |
71 | struct fence_cb cb; | ||
72 | struct amd_gpu_scheduler *sched; | 74 | struct amd_gpu_scheduler *sched; |
73 | struct amd_sched_entity *s_entity; | 75 | struct amd_sched_entity *s_entity; |
74 | struct amd_sched_fence *s_fence; | 76 | struct amd_sched_fence *s_fence; |
@@ -91,32 +93,29 @@ static inline struct amd_sched_fence *to_amd_sched_fence(struct fence *f) | |||
91 | * these functions should be implemented in driver side | 93 | * these functions should be implemented in driver side |
92 | */ | 94 | */ |
93 | struct amd_sched_backend_ops { | 95 | struct amd_sched_backend_ops { |
94 | struct fence *(*dependency)(struct amd_sched_job *job); | 96 | struct fence *(*dependency)(struct amd_sched_job *sched_job); |
95 | struct fence *(*run_job)(struct amd_sched_job *job); | 97 | struct fence *(*run_job)(struct amd_sched_job *sched_job); |
96 | void (*process_job)(struct amd_sched_job *job); | ||
97 | }; | 98 | }; |
98 | 99 | ||
99 | /** | 100 | /** |
100 | * One scheduler is implemented for each hardware ring | 101 | * One scheduler is implemented for each hardware ring |
101 | */ | 102 | */ |
102 | struct amd_gpu_scheduler { | 103 | struct amd_gpu_scheduler { |
103 | struct task_struct *thread; | 104 | struct amd_sched_backend_ops *ops; |
105 | uint32_t hw_submission_limit; | ||
106 | const char *name; | ||
104 | struct amd_sched_rq sched_rq; | 107 | struct amd_sched_rq sched_rq; |
105 | struct amd_sched_rq kernel_rq; | 108 | struct amd_sched_rq kernel_rq; |
106 | atomic_t hw_rq_count; | ||
107 | struct amd_sched_backend_ops *ops; | ||
108 | uint32_t ring_id; | ||
109 | wait_queue_head_t wake_up_worker; | 109 | wait_queue_head_t wake_up_worker; |
110 | wait_queue_head_t job_scheduled; | 110 | wait_queue_head_t job_scheduled; |
111 | uint32_t hw_submission_limit; | 111 | atomic_t hw_rq_count; |
112 | char name[20]; | 112 | struct task_struct *thread; |
113 | void *priv; | ||
114 | }; | 113 | }; |
115 | 114 | ||
116 | struct amd_gpu_scheduler * | 115 | int amd_sched_init(struct amd_gpu_scheduler *sched, |
117 | amd_sched_create(struct amd_sched_backend_ops *ops, | 116 | struct amd_sched_backend_ops *ops, |
118 | uint32_t ring, uint32_t hw_submission, void *priv); | 117 | uint32_t hw_submission, const char *name); |
119 | int amd_sched_destroy(struct amd_gpu_scheduler *sched); | 118 | void amd_sched_fini(struct amd_gpu_scheduler *sched); |
120 | 119 | ||
121 | int amd_sched_entity_init(struct amd_gpu_scheduler *sched, | 120 | int amd_sched_entity_init(struct amd_gpu_scheduler *sched, |
122 | struct amd_sched_entity *entity, | 121 | struct amd_sched_entity *entity, |