| 1 | /* SPDX-License-Identifier: GPL-2.0 or MIT */ |
| 2 | /* Copyright 2023 Collabora ltd. */ |
| 3 | |
| 4 | #ifndef __PANTHOR_SCHED_H__ |
| 5 | #define __PANTHOR_SCHED_H__ |
| 6 | |
| 7 | struct drm_exec; |
| 8 | struct dma_fence; |
| 9 | struct drm_file; |
| 10 | struct drm_gem_object; |
| 11 | struct drm_sched_job; |
| 12 | struct drm_memory_stats; |
| 13 | struct drm_panthor_group_create; |
| 14 | struct drm_panthor_queue_create; |
| 15 | struct drm_panthor_group_get_state; |
| 16 | struct drm_panthor_queue_submit; |
| 17 | struct panthor_device; |
| 18 | struct panthor_file; |
| 19 | struct panthor_group_pool; |
| 20 | struct panthor_job; |
| 21 | |
| 22 | int panthor_group_create(struct panthor_file *pfile, |
| 23 | const struct drm_panthor_group_create *group_args, |
| 24 | const struct drm_panthor_queue_create *queue_args, |
| 25 | u64 drm_client_id); |
| 26 | int panthor_group_destroy(struct panthor_file *pfile, u32 group_handle); |
| 27 | int panthor_group_get_state(struct panthor_file *pfile, |
| 28 | struct drm_panthor_group_get_state *get_state); |
| 29 | |
| 30 | struct drm_sched_job * |
| 31 | panthor_job_create(struct panthor_file *pfile, |
| 32 | u16 group_handle, |
| 33 | const struct drm_panthor_queue_submit *qsubmit, |
| 34 | u64 drm_client_id); |
| 35 | struct drm_sched_job *panthor_job_get(struct drm_sched_job *job); |
| 36 | struct panthor_vm *panthor_job_vm(struct drm_sched_job *sched_job); |
| 37 | void panthor_job_put(struct drm_sched_job *job); |
| 38 | void panthor_job_update_resvs(struct drm_exec *exec, struct drm_sched_job *job); |
| 39 | |
| 40 | int panthor_group_pool_create(struct panthor_file *pfile); |
| 41 | void panthor_group_pool_destroy(struct panthor_file *pfile); |
| 42 | void panthor_fdinfo_gather_group_mem_info(struct panthor_file *pfile, |
| 43 | struct drm_memory_stats *stats); |
| 44 | |
| 45 | int panthor_sched_init(struct panthor_device *ptdev); |
| 46 | void panthor_sched_unplug(struct panthor_device *ptdev); |
| 47 | void panthor_sched_pre_reset(struct panthor_device *ptdev); |
| 48 | void panthor_sched_post_reset(struct panthor_device *ptdev, bool reset_failed); |
| 49 | void panthor_sched_suspend(struct panthor_device *ptdev); |
| 50 | void panthor_sched_resume(struct panthor_device *ptdev); |
| 51 | |
| 52 | void panthor_sched_report_mmu_fault(struct panthor_device *ptdev); |
| 53 | void panthor_sched_report_fw_events(struct panthor_device *ptdev, u32 events); |
| 54 | |
| 55 | void panthor_fdinfo_gather_group_samples(struct panthor_file *pfile); |
| 56 | |
| 57 | #endif |
| 58 | |