1 // SPDX-License-Identifier: MIT 2 // 3 // Copyright 2024 Advanced Micro Devices, Inc. 4 5 6 #ifndef _DML21_WRAPPER_H_ 7 #define _DML21_WRAPPER_H_ 8 9 #include "os_types.h" 10 #include "dml_top_soc_parameter_types.h" 11 12 struct dc; 13 struct dc_state; 14 struct dml2_configuration_options; 15 struct dml2_context; 16 17 /** 18 * dml2_create - Creates dml21_context. 19 * @in_dc: dc. 20 * @dml2: Created dml21 context. 21 * @config: dml21 configuration options. 22 * 23 * Create of DML21 is done as part of dc_state creation. 24 * DML21 IP, SOC and STATES are initialized at 25 * creation time. 26 * 27 * Return: True if dml2 is successfully created, false otherwise. 28 */ 29 bool dml21_create(const struct dc *in_dc, struct dml2_context **dml_ctx, const struct dml2_configuration_options *config); 30 void dml21_destroy(struct dml2_context *dml2); 31 void dml21_copy(struct dml2_context *dst_dml_ctx, 32 struct dml2_context *src_dml_ctx); 33 bool dml21_create_copy(struct dml2_context **dst_dml_ctx, 34 struct dml2_context *src_dml_ctx); 35 void dml21_reinit(const struct dc *in_dc, struct dml2_context **dml_ctx, const struct dml2_configuration_options *config); 36 37 /** 38 * dml21_validate - Determines if a display configuration is supported or not. 39 * @in_dc: dc. 40 * @context: dc_state to be validated. 41 * @fast_validate: Fast validate will not populate context.res_ctx. 42 * 43 * Based on fast_validate option internally would call: 44 * 45 * -dml21_mode_check_and_programming - for non fast_validate option 46 * Calculates if dc_state can be supported on the input display 47 * configuration. If supported, generates the necessary HW 48 * programming for the new dc_state. 49 * 50 * -dml21_check_mode_support - for fast_validate option 51 * Calculates if dc_state can be supported for the input display 52 * config. 53 54 * Context: Two threads may not invoke this function concurrently unless they reference 55 * separate dc_states for validation. 56 * Return: True if mode is supported, false otherwise. 57 */ 58 bool dml21_validate(const struct dc *in_dc, struct dc_state *context, struct dml2_context *dml_ctx, bool fast_validate); 59 60 /* Prepare hubp mcache_regs for hubp mcache ID and split coordinate programming */ 61 void dml21_prepare_mcache_programming(struct dc *in_dc, struct dc_state *context, struct dml2_context *dml_ctx); 62 63 /* Structure for inputting external SOCBB and DCNIP values for tool based debugging. */ 64 struct socbb_ip_params_external { 65 struct dml2_ip_capabilities ip_params; 66 struct dml2_soc_bb soc_bb; 67 }; 68 #endif 69