19c8c7a7eSZhanjun Dong /* SPDX-License-Identifier: MIT */ 29c8c7a7eSZhanjun Dong /* 39c8c7a7eSZhanjun Dong * Copyright © 2021-2024 Intel Corporation 49c8c7a7eSZhanjun Dong */ 59c8c7a7eSZhanjun Dong 69c8c7a7eSZhanjun Dong #ifndef _XE_GUC_CAPTURE_H 79c8c7a7eSZhanjun Dong #define _XE_GUC_CAPTURE_H 89c8c7a7eSZhanjun Dong 99c8c7a7eSZhanjun Dong #include <linux/types.h> 109c8c7a7eSZhanjun Dong #include "abi/guc_capture_abi.h" 119c8c7a7eSZhanjun Dong #include "xe_guc.h" 129c8c7a7eSZhanjun Dong #include "xe_guc_fwif.h" 139c8c7a7eSZhanjun Dong 149c8c7a7eSZhanjun Dong struct xe_guc; 15ecb63364SZhanjun Dong struct xe_hw_engine; 16ecb63364SZhanjun Dong struct xe_hw_engine_snapshot; 17ecb63364SZhanjun Dong struct xe_sched_job; 189c8c7a7eSZhanjun Dong 199c8c7a7eSZhanjun Dong static inline enum guc_capture_list_class_type xe_guc_class_to_capture_class(u16 class) 209c8c7a7eSZhanjun Dong { 219c8c7a7eSZhanjun Dong switch (class) { 229c8c7a7eSZhanjun Dong case GUC_RENDER_CLASS: 239c8c7a7eSZhanjun Dong case GUC_COMPUTE_CLASS: 249c8c7a7eSZhanjun Dong return GUC_CAPTURE_LIST_CLASS_RENDER_COMPUTE; 259c8c7a7eSZhanjun Dong case GUC_GSC_OTHER_CLASS: 269c8c7a7eSZhanjun Dong return GUC_CAPTURE_LIST_CLASS_GSC_OTHER; 279c8c7a7eSZhanjun Dong case GUC_VIDEO_CLASS: 289c8c7a7eSZhanjun Dong case GUC_VIDEOENHANCE_CLASS: 299c8c7a7eSZhanjun Dong case GUC_BLITTER_CLASS: 309c8c7a7eSZhanjun Dong return class; 319c8c7a7eSZhanjun Dong default: 329c8c7a7eSZhanjun Dong XE_WARN_ON(class); 339c8c7a7eSZhanjun Dong return GUC_CAPTURE_LIST_CLASS_MAX; 349c8c7a7eSZhanjun Dong } 359c8c7a7eSZhanjun Dong } 369c8c7a7eSZhanjun Dong 379c8c7a7eSZhanjun Dong static inline enum guc_capture_list_class_type 389c8c7a7eSZhanjun Dong xe_engine_class_to_guc_capture_class(enum xe_engine_class class) 399c8c7a7eSZhanjun Dong { 409c8c7a7eSZhanjun Dong return xe_guc_class_to_capture_class(xe_engine_class_to_guc_class(class)); 419c8c7a7eSZhanjun Dong } 429c8c7a7eSZhanjun Dong 438bfc4963SZhanjun Dong void xe_guc_capture_process(struct xe_guc *guc); 449c8c7a7eSZhanjun Dong int xe_guc_capture_getlist(struct xe_guc *guc, u32 owner, u32 type, 459c8c7a7eSZhanjun Dong enum guc_capture_list_class_type capture_class, void **outptr); 469c8c7a7eSZhanjun Dong int xe_guc_capture_getlistsize(struct xe_guc *guc, u32 owner, u32 type, 479c8c7a7eSZhanjun Dong enum guc_capture_list_class_type capture_class, size_t *size); 489c8c7a7eSZhanjun Dong int xe_guc_capture_getnullheader(struct xe_guc *guc, void **outptr, size_t *size); 499c8c7a7eSZhanjun Dong size_t xe_guc_capture_ads_input_worst_size(struct xe_guc *guc); 50ecb63364SZhanjun Dong const struct __guc_mmio_reg_descr_group * 51ecb63364SZhanjun Dong xe_guc_capture_get_reg_desc_list(struct xe_gt *gt, u32 owner, u32 type, 52ecb63364SZhanjun Dong enum guc_capture_list_class_type capture_class, bool is_ext); 53ecb63364SZhanjun Dong struct __guc_capture_parsed_output *xe_guc_capture_get_matching_and_lock(struct xe_sched_job *job); 54*0f1fdf55SZhanjun Dong void xe_engine_manual_capture(struct xe_hw_engine *hwe, struct xe_hw_engine_snapshot *snapshot); 55*0f1fdf55SZhanjun Dong void xe_engine_snapshot_print(struct xe_hw_engine_snapshot *snapshot, struct drm_printer *p); 56ecb63364SZhanjun Dong void xe_engine_snapshot_capture_for_job(struct xe_sched_job *job); 57b170d696SZhanjun Dong void xe_guc_capture_steered_list_init(struct xe_guc *guc); 58ecb63364SZhanjun Dong void xe_guc_capture_put_matched_nodes(struct xe_guc *guc); 599c8c7a7eSZhanjun Dong int xe_guc_capture_init(struct xe_guc *guc); 609c8c7a7eSZhanjun Dong 619c8c7a7eSZhanjun Dong #endif 62