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, 43ab5220bbSDmytro Laktyushkin DML_PROJECT_DCN315, 44d56e38d5SNicholas Kazlauskas DML_PROJECT_DCN314, 45dda4fb85SAurabindo Pillai DML_PROJECT_DCN32, 46728c0698SHarry Wentland }; 47728c0698SHarry Wentland 48776c1f56SLeo Li struct display_mode_lib; 49776c1f56SLeo Li 50728c0698SHarry Wentland struct dml_funcs { 51728c0698SHarry Wentland void (*rq_dlg_get_dlg_reg)( 52728c0698SHarry Wentland struct display_mode_lib *mode_lib, 53728c0698SHarry Wentland display_dlg_regs_st *dlg_regs, 54728c0698SHarry Wentland display_ttu_regs_st *ttu_regs, 5522667e6eSHarry Wentland const display_e2e_pipe_params_st *e2e_pipe_param, 56728c0698SHarry Wentland const unsigned int num_pipes, 57728c0698SHarry Wentland const unsigned int pipe_idx, 58728c0698SHarry Wentland const bool cstate_en, 59f82c916cSCharlene Liu const bool pstate_en, 60f82c916cSCharlene Liu const bool vm_en, 61f82c916cSCharlene Liu const bool ignore_viewport_pos, 62f82c916cSCharlene Liu const bool immediate_flip_support); 63728c0698SHarry Wentland void (*rq_dlg_get_rq_reg)( 64728c0698SHarry Wentland struct display_mode_lib *mode_lib, 65728c0698SHarry Wentland display_rq_regs_st *rq_regs, 6622667e6eSHarry Wentland const display_pipe_params_st *pipe_param); 67dda4fb85SAurabindo Pillai // DLG interfaces have different function parameters in DCN32. 68dda4fb85SAurabindo Pillai // Create new function pointers to address the changes 69dda4fb85SAurabindo Pillai void (*rq_dlg_get_dlg_reg_v2)( 70dda4fb85SAurabindo Pillai struct display_mode_lib *mode_lib, 71dda4fb85SAurabindo Pillai display_dlg_regs_st *dlg_regs, 72dda4fb85SAurabindo Pillai display_ttu_regs_st *ttu_regs, 73dda4fb85SAurabindo Pillai display_e2e_pipe_params_st *e2e_pipe_param, 74dda4fb85SAurabindo Pillai const unsigned int num_pipes, 75dda4fb85SAurabindo Pillai const unsigned int pipe_idx); 76dda4fb85SAurabindo Pillai void (*rq_dlg_get_rq_reg_v2)(display_rq_regs_st *rq_regs, 77dda4fb85SAurabindo Pillai struct display_mode_lib *mode_lib, 78dda4fb85SAurabindo Pillai const display_e2e_pipe_params_st *e2e_pipe_param, 79dda4fb85SAurabindo Pillai const unsigned int num_pipes, 80dda4fb85SAurabindo Pillai const unsigned int pipe_idx); 81728c0698SHarry Wentland void (*recalculate)(struct display_mode_lib *mode_lib); 82728c0698SHarry Wentland void (*validate)(struct display_mode_lib *mode_lib); 83061bfa06SHarry Wentland }; 84061bfa06SHarry Wentland 85061bfa06SHarry Wentland struct display_mode_lib { 86061bfa06SHarry Wentland struct _vcs_dpi_ip_params_st ip; 87061bfa06SHarry Wentland struct _vcs_dpi_soc_bounding_box_st soc; 88061bfa06SHarry Wentland enum dml_project project; 89728c0698SHarry Wentland struct vba_vars_st vba; 90061bfa06SHarry Wentland struct dal_logger *logger; 91728c0698SHarry Wentland struct dml_funcs funcs; 92d26c4ffbSJun Lei struct _vcs_dpi_display_e2e_pipe_params_st dml_pipe_state[6]; 93*3a9c6f9aSIlya Bakoulin bool validate_max_state; 94061bfa06SHarry Wentland }; 95061bfa06SHarry Wentland 96fbaf207fSDmytro Laktyushkin void dml_init_instance(struct display_mode_lib *lib, 970f1a6ad7SJun Lei const struct _vcs_dpi_soc_bounding_box_st *soc_bb, 980f1a6ad7SJun Lei const struct _vcs_dpi_ip_params_st *ip_params, 990f1a6ad7SJun Lei enum dml_project project); 1000f1a6ad7SJun Lei 10138684e46SEric Bernstein const char *dml_get_status_message(enum dm_validation_status status); 10238684e46SEric Bernstein 1036725a88fSBhawanpreet Lakha void dml_log_pipe_params( 1046725a88fSBhawanpreet Lakha struct display_mode_lib *mode_lib, 1056725a88fSBhawanpreet Lakha display_e2e_pipe_params_st *pipes, 1066725a88fSBhawanpreet Lakha int pipe_cnt); 1076725a88fSBhawanpreet Lakha 1086725a88fSBhawanpreet Lakha void dml_log_mode_support_params(struct display_mode_lib *mode_lib); 109061bfa06SHarry Wentland #endif 110