xref: /linux/drivers/gpu/drm/xe/xe_guc_capture.h (revision 3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2021-2024 Intel Corporation
4  */
5 
6 #ifndef _XE_GUC_CAPTURE_H_
7 #define _XE_GUC_CAPTURE_H_
8 
9 #include <linux/types.h>
10 #include "abi/guc_capture_abi.h"
11 #include "abi/guc_scheduler_abi.h"
12 #include "xe_guc.h"
13 
14 struct xe_exec_queue;
15 struct xe_guc;
16 struct xe_hw_engine;
17 struct xe_hw_engine_snapshot;
18 
19 static inline enum guc_capture_list_class_type xe_guc_class_to_capture_class(u16 class)
20 {
21 	switch (class) {
22 	case GUC_RENDER_CLASS:
23 	case GUC_COMPUTE_CLASS:
24 		return GUC_CAPTURE_LIST_CLASS_RENDER_COMPUTE;
25 	case GUC_GSC_OTHER_CLASS:
26 		return GUC_CAPTURE_LIST_CLASS_GSC_OTHER;
27 	case GUC_VIDEO_CLASS:
28 	case GUC_VIDEOENHANCE_CLASS:
29 	case GUC_BLITTER_CLASS:
30 		return class;
31 	case GUC_PAGING_CLASS:
32 		return GUC_CAPTURE_LIST_CLASS_PAGING;
33 	default:
34 		XE_WARN_ON(class);
35 		return GUC_CAPTURE_LIST_CLASS_MAX;
36 	}
37 }
38 
39 static inline enum guc_capture_list_class_type
40 xe_hwe_to_guc_capture_class(struct xe_hw_engine *hwe)
41 {
42 	return xe_guc_class_to_capture_class(xe_hwe_to_guc_class(hwe));
43 }
44 
45 void xe_guc_capture_process(struct xe_guc *guc);
46 int xe_guc_capture_getlist(struct xe_guc *guc, u32 owner, u32 type,
47 			   enum guc_capture_list_class_type capture_class, void **outptr);
48 int xe_guc_capture_getlistsize(struct xe_guc *guc, u32 owner, u32 type,
49 			       enum guc_capture_list_class_type capture_class, size_t *size);
50 int xe_guc_capture_getnullheader(struct xe_guc *guc, void **outptr, size_t *size);
51 size_t xe_guc_capture_ads_input_worst_size(struct xe_guc *guc);
52 const struct __guc_mmio_reg_descr_group *
53 xe_guc_capture_get_reg_desc_list(struct xe_gt *gt, u32 owner, u32 type,
54 				 enum guc_capture_list_class_type capture_class, bool is_ext);
55 struct __guc_capture_parsed_output *xe_guc_capture_get_matching_and_lock(struct xe_exec_queue *q);
56 void xe_engine_manual_capture(struct xe_hw_engine *hwe, struct xe_hw_engine_snapshot *snapshot);
57 void xe_engine_snapshot_print(struct xe_hw_engine_snapshot *snapshot, struct drm_printer *p);
58 void xe_engine_snapshot_capture_for_queue(struct xe_exec_queue *q);
59 void xe_guc_capture_steered_list_init(struct xe_guc *guc);
60 void xe_guc_capture_put_matched_nodes(struct xe_guc *guc);
61 int xe_guc_capture_init(struct xe_guc *guc);
62 
63 #endif
64