Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Add kernel doc for commit sequence

Add basic kernel-doc that describes some of the struct and functions
that are part of the DC commit sequence..

Tested-by: Mark Broadworth <mark.broadworth@amd.com>
Reviewed-by: Aurabindo Pillai <Aurabindo.Pillai@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Rodrigo Siqueira and committed by
Alex Deucher
6a0114e0 fa0fc4fb

+79 -11
+53 -10
drivers/gpu/drm/amd/display/dc/core/dc.c
··· 1714 1714 dc->hwss.z10_save_init(dc); 1715 1715 } 1716 1716 1717 - /* 1718 - * Applies given context to HW and copy it into current context. 1717 + /** 1718 + * dc_commit_state_no_check - Apply context to the hardware 1719 + * 1720 + * @dc: DC object with the current status to be updated 1721 + * @context: New state that will become the current status at the end of this function 1722 + * 1723 + * Applies given context to the hardware and copy it into current context. 1719 1724 * It's up to the user to release the src context afterwards. 1720 1725 */ 1721 1726 static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *context) ··· 3656 3651 } 3657 3652 } 3658 3653 3659 - /* Determines if the incoming context requires a applying transition state with unnecessary 3660 - * pipe splitting and ODM disabled, due to hardware limitations. In a case where 3661 - * the OPP associated with an MPCC might change due to plane additions, this function 3654 + /** 3655 + * could_mpcc_tree_change_for_active_pipes - Check if an OPP associated with MPCC might change 3656 + * 3657 + * @dc: Used to get the current state status 3658 + * @stream: Target stream, which we want to remove the attached planes 3659 + * @surface_count: Number of surface update 3660 + * @is_plane_addition: [in] Fill out with true if it is a plane addition case 3661 + * 3662 + * DCN32x and newer support a feature named Dynamic ODM which can conflict with 3663 + * the MPO if used simultaneously in some specific configurations (e.g., 3664 + * 4k@144). This function checks if the incoming context requires applying a 3665 + * transition state with unnecessary pipe splitting and ODM disabled to 3666 + * circumvent our hardware limitations to prevent this edge case. If the OPP 3667 + * associated with an MPCC might change due to plane additions, this function 3662 3668 * returns true. 3669 + * 3670 + * Return: 3671 + * Return true if OPP and MPCC might change, otherwise, return false. 3663 3672 */ 3664 3673 static bool could_mpcc_tree_change_for_active_pipes(struct dc *dc, 3665 3674 struct dc_stream_state *stream, ··· 3748 3729 return force_minimal_pipe_splitting; 3749 3730 } 3750 3731 3732 + /** 3733 + * commit_minimal_transition_state - Create a transition pipe split state 3734 + * 3735 + * @dc: Used to get the current state status 3736 + * @transition_base_context: New transition state 3737 + * 3738 + * In some specific configurations, such as pipe split on multi-display with 3739 + * MPO and/or Dynamic ODM, removing a plane may cause unsupported pipe 3740 + * programming when moving to new planes. To mitigate those types of problems, 3741 + * this function adds a transition state that minimizes pipe usage before 3742 + * programming the new configuration. When adding a new plane, the current 3743 + * state requires the least pipes, so it is applied without splitting. When 3744 + * removing a plane, the new state requires the least pipes, so it is applied 3745 + * without splitting. 3746 + * 3747 + * Return: 3748 + * Return false if something is wrong in the transition state. 3749 + */ 3751 3750 static bool commit_minimal_transition_state(struct dc *dc, 3752 3751 struct dc_state *transition_base_context) 3753 3752 { ··· 3779 3742 3780 3743 if (!transition_context) 3781 3744 return false; 3745 + /* Setup: 3746 + * Store the current ODM and MPC config in some temp variables to be 3747 + * restored after we commit the transition state. 3748 + */ 3782 3749 3783 3750 /* check current pipes in use*/ 3784 3751 for (i = 0; i < dc->res_pool->pipe_count; i++) { ··· 3818 3777 3819 3778 dc_resource_state_copy_construct(transition_base_context, transition_context); 3820 3779 3821 - //commit minimal state 3780 + /* commit minimal state */ 3822 3781 if (dc->res_pool->funcs->validate_bandwidth(dc, transition_context, false)) { 3823 3782 for (i = 0; i < transition_context->stream_count; i++) { 3824 3783 struct dc_stream_status *stream_status = &transition_context->stream_status[i]; ··· 3836 3795 ret = dc_commit_state_no_check(dc, transition_context); 3837 3796 } 3838 3797 3839 - /*always release as dc_commit_state_no_check retains in good case*/ 3798 + /* always release as dc_commit_state_no_check retains in good case */ 3840 3799 dc_release_state(transition_context); 3841 3800 3842 - /*restore previous pipe split and odm policy*/ 3801 + /* TearDown: 3802 + * Restore original configuration for ODM and MPO. 3803 + */ 3843 3804 if (!dc->config.is_vmin_only_asic) 3844 3805 dc->debug.pipe_split_policy = tmp_mpc_policy; 3845 3806 ··· 3849 3806 dc->debug.force_disable_subvp = temp_subvp_policy; 3850 3807 3851 3808 if (ret != DC_OK) { 3852 - /*this should never happen*/ 3809 + /* this should never happen */ 3853 3810 BREAK_TO_DEBUGGER(); 3854 3811 return false; 3855 3812 } 3856 3813 3857 - /*force full surface update*/ 3814 + /* force full surface update */ 3858 3815 for (i = 0; i < dc->current_state->stream_count; i++) { 3859 3816 for (j = 0; j < dc->current_state->stream_status[i].plane_count; j++) { 3860 3817 dc->current_state->stream_status[i].plane_states[j]->update_flags.raw = 0xFFFFFFFF;
+11
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 1768 1768 return true; 1769 1769 } 1770 1770 1771 + /** 1772 + * dc_rem_all_planes_for_stream - Remove planes attached to the target stream. 1773 + * 1774 + * @dc: Current dc state. 1775 + * @stream: Target stream, which we want to remove the attached plans. 1776 + * @context: New context. 1777 + * 1778 + * Return: 1779 + * Return true if DC was able to remove all planes from the target 1780 + * stream, otherwise, return false. 1781 + */ 1771 1782 bool dc_rem_all_planes_for_stream( 1772 1783 const struct dc *dc, 1773 1784 struct dc_stream_state *stream,
+15 -1
drivers/gpu/drm/amd/display/dc/inc/core_types.h
··· 420 420 421 421 struct pll_settings pll_settings; 422 422 423 - /* link config records software decision for what link config should be 423 + /** 424 + * @link_config: 425 + * 426 + * link config records software decision for what link config should be 424 427 * enabled given current link capability and stream during hw resource 425 428 * mapping. This is to decouple the dependency on link capability during 426 429 * dc commit or update. ··· 545 542 546 543 /** 547 544 * @bw_ctx: The output from bandwidth and watermark calculations and the DML 545 + * 546 + * Each context must have its own instance of VBA, and in order to 547 + * initialize and obtain IP and SOC, the base DML instance from DC is 548 + * initially copied into every context. 548 549 */ 549 550 struct bw_context bw_ctx; 550 551 ··· 566 559 567 560 struct clk_mgr *clk_mgr; 568 561 562 + /** 563 + * @refcount: refcount reference 564 + * 565 + * Notice that dc_state is used around the code to capture the current 566 + * context, so we need to pass it everywhere. That's why we want to use 567 + * kref in this struct. 568 + */ 569 569 struct kref refcount; 570 570 571 571 struct {