xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/amd/display/dc/dml/display_mode_lib.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: display_mode_lib.h,v 1.2 2021/12/18 23:45:04 riastradh Exp $	*/
2 
3 /*
4  * Copyright 2017 Advanced Micro Devices, Inc.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22  * OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * Authors: AMD
25  *
26  */
27 #ifndef __DISPLAY_MODE_LIB_H__
28 #define __DISPLAY_MODE_LIB_H__
29 
30 
31 #include "dml_common_defs.h"
32 #include "display_mode_vba.h"
33 
34 enum dml_project {
35 	DML_PROJECT_UNDEFINED,
36 	DML_PROJECT_RAVEN1,
37 	DML_PROJECT_NAVI10,
38 	DML_PROJECT_NAVI10v2,
39 	DML_PROJECT_DCN21,
40 };
41 
42 struct display_mode_lib;
43 
44 struct dml_funcs {
45 	void (*rq_dlg_get_dlg_reg)(
46 			struct display_mode_lib *mode_lib,
47 			display_dlg_regs_st *dlg_regs,
48 			display_ttu_regs_st *ttu_regs,
49 			display_e2e_pipe_params_st *e2e_pipe_param,
50 			const unsigned int num_pipes,
51 			const unsigned int pipe_idx,
52 			const bool cstate_en,
53 			const bool pstate_en,
54 			const bool vm_en,
55 			const bool ignore_viewport_pos,
56 			const bool immediate_flip_support);
57 	void (*rq_dlg_get_rq_reg)(
58 		struct display_mode_lib *mode_lib,
59 		display_rq_regs_st *rq_regs,
60 		const display_pipe_params_st pipe_param);
61 	void (*recalculate)(struct display_mode_lib *mode_lib);
62 	void (*validate)(struct display_mode_lib *mode_lib);
63 };
64 
65 struct display_mode_lib {
66 	struct _vcs_dpi_ip_params_st ip;
67 	struct _vcs_dpi_soc_bounding_box_st soc;
68 	enum dml_project project;
69 	struct vba_vars_st vba;
70 	struct dal_logger *logger;
71 	struct dml_funcs funcs;
72 };
73 
74 void dml_init_instance(struct display_mode_lib *lib,
75 		const struct _vcs_dpi_soc_bounding_box_st *soc_bb,
76 		const struct _vcs_dpi_ip_params_st *ip_params,
77 		enum dml_project project);
78 
79 const char *dml_get_status_message(enum dm_validation_status status);
80 
81 #endif
82