1061bfa06SHarry Wentland /*
2061bfa06SHarry Wentland  * Copyright 2017 Advanced Micro Devices, Inc.
3061bfa06SHarry Wentland  *
4061bfa06SHarry Wentland  * Permission is hereby granted, free of charge, to any person obtaining a
5061bfa06SHarry Wentland  * copy of this software and associated documentation files (the "Software"),
6061bfa06SHarry Wentland  * to deal in the Software without restriction, including without limitation
7061bfa06SHarry Wentland  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8061bfa06SHarry Wentland  * and/or sell copies of the Software, and to permit persons to whom the
9061bfa06SHarry Wentland  * Software is furnished to do so, subject to the following conditions:
10061bfa06SHarry Wentland  *
11061bfa06SHarry Wentland  * The above copyright notice and this permission notice shall be included in
12061bfa06SHarry Wentland  * all copies or substantial portions of the Software.
13061bfa06SHarry Wentland  *
14061bfa06SHarry Wentland  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15061bfa06SHarry Wentland  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16061bfa06SHarry Wentland  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17061bfa06SHarry Wentland  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18061bfa06SHarry Wentland  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19061bfa06SHarry Wentland  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20061bfa06SHarry Wentland  * OTHER DEALINGS IN THE SOFTWARE.
21061bfa06SHarry Wentland  *
22061bfa06SHarry Wentland  * Authors: AMD
23061bfa06SHarry Wentland  *
24061bfa06SHarry Wentland  */
25061bfa06SHarry Wentland #ifndef __DISPLAY_MODE_LIB_H__
26061bfa06SHarry Wentland #define __DISPLAY_MODE_LIB_H__
27061bfa06SHarry Wentland 
28c38606abSRodrigo Siqueira #include "dm_services.h"
29c38606abSRodrigo Siqueira #include "dc_features.h"
30c38606abSRodrigo Siqueira #include "display_mode_structs.h"
31c38606abSRodrigo Siqueira #include "display_mode_enums.h"
32728c0698SHarry Wentland #include "display_mode_vba.h"
33061bfa06SHarry Wentland 
34061bfa06SHarry Wentland enum dml_project {
35061bfa06SHarry Wentland 	DML_PROJECT_UNDEFINED,
36728c0698SHarry Wentland 	DML_PROJECT_RAVEN1,
37728c0698SHarry Wentland 	DML_PROJECT_NAVI10,
38057fc695SJun Lei 	DML_PROJECT_NAVI10v2,
393f68c01bSZhan Liu 	DML_PROJECT_DCN201,
40b04641a3SBhawanpreet Lakha 	DML_PROJECT_DCN21,
416725a88fSBhawanpreet Lakha 	DML_PROJECT_DCN30,
4274458c08SNicholas Kazlauskas 	DML_PROJECT_DCN31,
4374458c08SNicholas Kazlauskas 	DML_PROJECT_DCN31_FPGA,
44728c0698SHarry Wentland };
45728c0698SHarry Wentland 
46776c1f56SLeo Li struct display_mode_lib;
47776c1f56SLeo Li 
48728c0698SHarry Wentland struct dml_funcs {
49728c0698SHarry Wentland 	void (*rq_dlg_get_dlg_reg)(
50728c0698SHarry Wentland 			struct display_mode_lib *mode_lib,
51728c0698SHarry Wentland 			display_dlg_regs_st *dlg_regs,
52728c0698SHarry Wentland 			display_ttu_regs_st *ttu_regs,
5322667e6eSHarry Wentland 			const display_e2e_pipe_params_st *e2e_pipe_param,
54728c0698SHarry Wentland 			const unsigned int num_pipes,
55728c0698SHarry Wentland 			const unsigned int pipe_idx,
56728c0698SHarry Wentland 			const bool cstate_en,
57f82c916cSCharlene Liu 			const bool pstate_en,
58f82c916cSCharlene Liu 			const bool vm_en,
59f82c916cSCharlene Liu 			const bool ignore_viewport_pos,
60f82c916cSCharlene Liu 			const bool immediate_flip_support);
61728c0698SHarry Wentland 	void (*rq_dlg_get_rq_reg)(
62728c0698SHarry Wentland 		struct display_mode_lib *mode_lib,
63728c0698SHarry Wentland 		display_rq_regs_st *rq_regs,
6422667e6eSHarry Wentland 		const display_pipe_params_st *pipe_param);
65728c0698SHarry Wentland 	void (*recalculate)(struct display_mode_lib *mode_lib);
66728c0698SHarry Wentland 	void (*validate)(struct display_mode_lib *mode_lib);
67061bfa06SHarry Wentland };
68061bfa06SHarry Wentland 
69061bfa06SHarry Wentland struct display_mode_lib {
70061bfa06SHarry Wentland 	struct _vcs_dpi_ip_params_st ip;
71061bfa06SHarry Wentland 	struct _vcs_dpi_soc_bounding_box_st soc;
72061bfa06SHarry Wentland 	enum dml_project project;
73728c0698SHarry Wentland 	struct vba_vars_st vba;
74061bfa06SHarry Wentland 	struct dal_logger *logger;
75728c0698SHarry Wentland 	struct dml_funcs funcs;
76*d26c4ffbSJun Lei 	struct _vcs_dpi_display_e2e_pipe_params_st dml_pipe_state[6];
77061bfa06SHarry Wentland };
78061bfa06SHarry Wentland 
79fbaf207fSDmytro Laktyushkin void dml_init_instance(struct display_mode_lib *lib,
800f1a6ad7SJun Lei 		const struct _vcs_dpi_soc_bounding_box_st *soc_bb,
810f1a6ad7SJun Lei 		const struct _vcs_dpi_ip_params_st *ip_params,
820f1a6ad7SJun Lei 		enum dml_project project);
830f1a6ad7SJun Lei 
8438684e46SEric Bernstein const char *dml_get_status_message(enum dm_validation_status status);
8538684e46SEric Bernstein 
866725a88fSBhawanpreet Lakha void dml_log_pipe_params(
876725a88fSBhawanpreet Lakha 		struct display_mode_lib *mode_lib,
886725a88fSBhawanpreet Lakha 		display_e2e_pipe_params_st *pipes,
896725a88fSBhawanpreet Lakha 		int pipe_cnt);
906725a88fSBhawanpreet Lakha 
916725a88fSBhawanpreet Lakha void dml_log_mode_support_params(struct display_mode_lib *mode_lib);
92061bfa06SHarry Wentland #endif
93