xref: /linux/drivers/gpu/drm/amd/display/dc/dc_probe.h (revision 4e69c1856bfd9ffb7e9d335a25842fa211628929)
1 // SPDX-License-Identifier: MIT
2 //
3 // Copyright 2025 Advanced Micro Devices, Inc.
4 
5 #ifndef _DC_PROBE_H_
6 #define _DC_PROBE_H_
7 
8 #include "os_types.h"
9 
10 /**
11  * enum dc_probe_type - What DM wants to probe.
12  *
13  * Each value names a measurable quantity as an abstraction. DC resolves it to
14  * whatever HW measurement block fulfills it. DM never selects the HW block.
15  */
16 enum dc_probe_type {
17 	DC_PROBE_PEAK_MEM_BW = 0,
18 	DC_PROBE_AVG_MEM_BW,
19 	DC_PROBE_MEM_LATENCY,
20 	DC_PROBE_URGENT_RAMP_LATENCY,
21 	DC_PROBE_URGENT_ASSERTION_COUNT,
22 	DC_PROBE_PREFETCH_DATA_SIZE,
23 };
24 
25 /**
26  * enum dc_probe_target_state - Target lifecycle state DM wants DC to reach.
27  *
28  * DM sets this to describe the final state DC must reach by the end of the
29  * commit. DC performs whatever HW transition sequence is needed.
30  *
31  * @DC_PROBE_NOT_MEASURING: probe inactive, no valid data available.
32  * @DC_PROBE_MEASURING:     probe runs continuously. The latest value can be
33  *   read back at any time and may differ on each read.
34  * @DC_PROBE_MEASURED:      probe performed one shot. The result is latched and
35  *   stays valid until DM transitions back to DC_PROBE_NOT_MEASURING.
36  */
37 enum dc_probe_target_state {
38 	DC_PROBE_NOT_MEASURING = 0,
39 	DC_PROBE_MEASURING,
40 	DC_PROBE_MEASURED,
41 };
42 
43 /**
44  * enum dc_probe_scope_type - What the probe is scoped to.
45  * @DC_PROBE_SCOPE_GLOBAL: whole memory subsystem, no stream/plane selector.
46  *
47  * Only GLOBAL is implemented. Per-stream/plane scoping must select targets by
48  * stable id, not object pointer — dc_state copy semantics would dangle a raw
49  * pointer when the absolute-set commit removes or replaces the target.
50  */
51 enum dc_probe_scope_type {
52 	DC_PROBE_SCOPE_GLOBAL = 0,
53 };
54 
55 /**
56  * struct dc_probe_scope - Selects what a probe measures against.
57  * @type: scope kind, only DC_PROBE_SCOPE_GLOBAL is implemented.
58  */
59 struct dc_probe_scope {
60 	enum dc_probe_scope_type type;
61 };
62 
63 /**
64  * struct dc_probe_state - DM-authored descriptor of a single probe.
65  *
66  * A plain inline value with copy semantics: no allocation, no refcount. DC
67  * resolves each descriptor to a HW measurement instance and diffs the desired
68  * set against the committed set to plan the transition.
69  *
70  * @type:         what to measure.
71  * @target_state: desired lifecycle state for this probe.
72  * @scope:        what the probe is scoped to (GLOBAL only for now).
73  */
74 struct dc_probe_state {
75 	enum dc_probe_type         type;
76 	enum dc_probe_target_state target_state;
77 	struct dc_probe_scope      scope;
78 };
79 
80 #define MAX_PROBES 1
81 
82 /**
83  * struct dc_probe_updates - Absolute set of probes DM wants active.
84  *
85  * Mirrors the plane/stream absolute-set model: the array is the complete
86  * desired set. DC compares it against the committed set to add, remove, or
87  * transition probes.
88  *
89  * @probes:      desired probe descriptors.
90  * @probe_count: number of valid entries in @probes.
91  */
92 struct dc_probe_updates {
93 	struct dc_probe_state probes[MAX_PROBES];
94 	int                   probe_count;
95 };
96 
97 #endif /* _DC_PROBE_H_ */
98