xref: /linux/drivers/gpu/drm/xe/xe_guc_capture.h (revision 25768de50b1f2dbb6ea44bd5148a87fe2c9c3688)
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 "xe_guc.h"
12 #include "xe_guc_fwif.h"
13 
14 struct xe_guc;
15 struct xe_hw_engine;
16 struct xe_hw_engine_snapshot;
17 struct xe_sched_job;
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 	default:
32 		XE_WARN_ON(class);
33 		return GUC_CAPTURE_LIST_CLASS_MAX;
34 	}
35 }
36 
37 static inline enum guc_capture_list_class_type
38 xe_engine_class_to_guc_capture_class(enum xe_engine_class class)
39 {
40 	return xe_guc_class_to_capture_class(xe_engine_class_to_guc_class(class));
41 }
42 
43 void xe_guc_capture_process(struct xe_guc *guc);
44 int xe_guc_capture_getlist(struct xe_guc *guc, u32 owner, u32 type,
45 			   enum guc_capture_list_class_type capture_class, void **outptr);
46 int xe_guc_capture_getlistsize(struct xe_guc *guc, u32 owner, u32 type,
47 			       enum guc_capture_list_class_type capture_class, size_t *size);
48 int xe_guc_capture_getnullheader(struct xe_guc *guc, void **outptr, size_t *size);
49 size_t xe_guc_capture_ads_input_worst_size(struct xe_guc *guc);
50 const struct __guc_mmio_reg_descr_group *
51 xe_guc_capture_get_reg_desc_list(struct xe_gt *gt, u32 owner, u32 type,
52 				 enum guc_capture_list_class_type capture_class, bool is_ext);
53 struct __guc_capture_parsed_output *xe_guc_capture_get_matching_and_lock(struct xe_sched_job *job);
54 void xe_engine_manual_capture(struct xe_hw_engine *hwe, struct xe_hw_engine_snapshot *snapshot);
55 void xe_engine_snapshot_print(struct xe_hw_engine_snapshot *snapshot, struct drm_printer *p);
56 void xe_engine_snapshot_capture_for_job(struct xe_sched_job *job);
57 void xe_guc_capture_steered_list_init(struct xe_guc *guc);
58 void xe_guc_capture_put_matched_nodes(struct xe_guc *guc);
59 int xe_guc_capture_init(struct xe_guc *guc);
60 
61 #endif
62