/* SPDX-License-Identifier: MIT */ /* * Copyright 2023 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: AMD * */ #ifndef _DML2_WRAPPER_H_ #define _DML2_WRAPPER_H_ #include "os_types.h" #define DML2_MAX_NUM_DPM_LVL … struct dml2_context; struct display_mode_lib_st; struct dc; struct pipe_ctx; struct dc_plane_state; struct dc_sink; struct dc_stream_state; struct resource_context; struct display_stream_compressor; // Configuration of the MALL on the SoC struct dml2_soc_mall_info { … }; // Output of DML2 for clock requirements struct dml2_dcn_clocks { … }; struct dml2_dc_callbacks { … }; struct dml2_dc_svp_callbacks { … }; struct dml2_clks_table_entry { … }; struct dml2_clks_num_entries { … }; struct dml2_clks_limit_table { … }; // Various overrides, per ASIC or per SKU specific, or for debugging purpose when/if available struct dml2_soc_bbox_overrides { … }; enum dml2_force_pstate_methods { … }; struct dml2_configuration_options { … }; /* * dml2_create - Creates dml2_context. * @in_dc: dc. * @config: dml2 configuration options. * @dml2: Created dml2 context. * * Create and destroy of DML2 is done as part of dc_state creation * and dc_state_free. DML2 IP, SOC and STATES are initialized at * creation time. * * Return: True if dml2 is successfully created, false otherwise. */ bool dml2_create(const struct dc *in_dc, const struct dml2_configuration_options *config, struct dml2_context **dml2); void dml2_destroy(struct dml2_context *dml2); void dml2_copy(struct dml2_context *dst_dml2, struct dml2_context *src_dml2); bool dml2_create_copy(struct dml2_context **dst_dml2, struct dml2_context *src_dml2); void dml2_reinit(const struct dc *in_dc, const struct dml2_configuration_options *config, struct dml2_context **dml2); /* * dml2_validate - Determines if a display configuration is supported or not. * @in_dc: dc. * @context: dc_state to be validated. * @fast_validate: Fast validate will not populate context.res_ctx. * * DML1.0 compatible interface for validation. * * Based on fast_validate option internally would call: * * -dml2_validate_and_build_resource - for non fast_validate option * Calculates if dc_state can be supported on the SOC, and attempts to * optimize the power management feature supports versus minimum clocks. * If supported, also builds out_new_hw_state to represent the hw programming * for the new dc state. * * -dml2_validate_only - for fast_validate option * Calculates if dc_state can be supported on the SOC (i.e. at maximum * clocks) with all mandatory power features enabled. * Context: Two threads may not invoke this function concurrently unless they reference * separate dc_states for validation. * Return: True if mode is supported, false otherwise. */ bool dml2_validate(const struct dc *in_dc, struct dc_state *context, struct dml2_context *dml2, bool fast_validate); /* * dml2_extract_dram_and_fclk_change_support - Extracts the FCLK and UCLK change support info. * @dml2: input dml2 context pointer. * @fclk_change_support: output pointer holding the fclk change support info (vactive, vblank, unsupported). * @dram_clk_change_support: output pointer holding the uclk change support info (vactive, vblank, unsupported). */ void dml2_extract_dram_and_fclk_change_support(struct dml2_context *dml2, unsigned int *fclk_change_support, unsigned int *dram_clk_change_support); void dml2_prepare_mcache_programming(struct dc *in_dc, struct dc_state *context, struct dml2_context *dml2); #endif //_DML2_WRAPPER_H_