xref: /openbsd-src/sys/dev/pci/drm/amd/display/modules/inc/mod_stats.h (revision ce56d183a2e55b240b637240db5c89579baa0df3)
1fb4d8502Sjsg /*
2fb4d8502Sjsg  * Copyright 2016 Advanced Micro Devices, Inc.
3fb4d8502Sjsg  *
4fb4d8502Sjsg  * Permission is hereby granted, free of charge, to any person obtaining a
5fb4d8502Sjsg  * copy of this software and associated documentation files (the "Software"),
6fb4d8502Sjsg  * to deal in the Software without restriction, including without limitation
7fb4d8502Sjsg  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8fb4d8502Sjsg  * and/or sell copies of the Software, and to permit persons to whom the
9fb4d8502Sjsg  * Software is furnished to do so, subject to the following conditions:
10fb4d8502Sjsg  *
11fb4d8502Sjsg  * The above copyright notice and this permission notice shall be included in
12fb4d8502Sjsg  * all copies or substantial portions of the Software.
13fb4d8502Sjsg  *
14fb4d8502Sjsg  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15fb4d8502Sjsg  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16fb4d8502Sjsg  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17fb4d8502Sjsg  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18fb4d8502Sjsg  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19fb4d8502Sjsg  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20fb4d8502Sjsg  * OTHER DEALINGS IN THE SOFTWARE.
21fb4d8502Sjsg  *
22fb4d8502Sjsg  * Authors: AMD
23fb4d8502Sjsg  *
24fb4d8502Sjsg  */
25fb4d8502Sjsg 
26fb4d8502Sjsg #ifndef MODULES_INC_MOD_STATS_H_
27fb4d8502Sjsg #define MODULES_INC_MOD_STATS_H_
28fb4d8502Sjsg 
29fb4d8502Sjsg #include "dm_services.h"
30fb4d8502Sjsg 
31fb4d8502Sjsg struct mod_stats {
32fb4d8502Sjsg 	int dummy;
33fb4d8502Sjsg };
34fb4d8502Sjsg 
35fb4d8502Sjsg struct mod_stats_caps {
36fb4d8502Sjsg 	bool dummy;
37fb4d8502Sjsg };
38fb4d8502Sjsg 
39ad8b1aafSjsg struct mod_stats_init_params {
40ad8b1aafSjsg 	unsigned int stats_enable;
41ad8b1aafSjsg 	unsigned int stats_entries;
42ad8b1aafSjsg };
43ad8b1aafSjsg 
44ad8b1aafSjsg struct mod_stats *mod_stats_create(struct dc *dc,
45ad8b1aafSjsg 		struct mod_stats_init_params *init_params);
46fb4d8502Sjsg 
47fb4d8502Sjsg void mod_stats_destroy(struct mod_stats *mod_stats);
48fb4d8502Sjsg 
49fb4d8502Sjsg bool mod_stats_init(struct mod_stats *mod_stats);
50fb4d8502Sjsg 
51fb4d8502Sjsg void mod_stats_dump(struct mod_stats *mod_stats);
52fb4d8502Sjsg 
53fb4d8502Sjsg void mod_stats_reset_data(struct mod_stats *mod_stats);
54fb4d8502Sjsg 
55fb4d8502Sjsg void mod_stats_update_event(struct mod_stats *mod_stats,
56fb4d8502Sjsg 		char *event_string,
57fb4d8502Sjsg 		unsigned int length);
58fb4d8502Sjsg 
59fb4d8502Sjsg void mod_stats_update_flip(struct mod_stats *mod_stats,
60*ce56d183Sjsg 		unsigned long long timestamp_in_ns);
61fb4d8502Sjsg 
62fb4d8502Sjsg void mod_stats_update_vupdate(struct mod_stats *mod_stats,
63*ce56d183Sjsg 		unsigned long long timestamp_in_ns);
64fb4d8502Sjsg 
65fb4d8502Sjsg void mod_stats_update_freesync(struct mod_stats *mod_stats,
66fb4d8502Sjsg 		unsigned int v_total_min,
67fb4d8502Sjsg 		unsigned int v_total_max,
68fb4d8502Sjsg 		unsigned int event_triggers,
69fb4d8502Sjsg 		unsigned int window_min,
70fb4d8502Sjsg 		unsigned int window_max,
71fb4d8502Sjsg 		unsigned int lfc_mid_point_in_us,
72fb4d8502Sjsg 		unsigned int inserted_frames,
73fb4d8502Sjsg 		unsigned int inserted_frame_duration_in_us);
74fb4d8502Sjsg 
75fb4d8502Sjsg #endif /* MODULES_INC_MOD_STATS_H_ */
76