All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Alan Liu <HaoPing.Liu@amd.com>
Cc: stylon.wang@amd.com, Sunpeng.Li@amd.com,
	Bhawanpreet.Lakha@amd.com, qingqing.zhuo@amd.com,
	Rodrigo.Siqueira@amd.com, roman.li@amd.com,
	amd-gfx@lists.freedesktop.org, solomon.chiu@amd.com,
	Aurabindo.Pillai@amd.com, Alvin Lee <Alvin.Lee2@amd.com>,
	wayne.lin@amd.com, Jun Lei <Jun.Lei@amd.com>,
	Harry.Wentland@amd.com, agustin.gutierrez@amd.com,
	pavle.kotarac@amd.com
Subject: Re: [PATCH 11/22] drm/amd/display: Disable phantom OTG after enable for plane disable
Date: Thu, 10 Nov 2022 08:39:02 -0700	[thread overview]
Message-ID: <Y20bFlEcKX3gbge8@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20221102160117.506511-12-HaoPing.Liu@amd.com>

Hi Alan,

On Thu, Nov 03, 2022 at 12:01:06AM +0800, Alan Liu wrote:
> From: Alvin Lee <Alvin.Lee2@amd.com>
> 
> [Description]
> - Need to disable phantom OTG after it's enabled
>   in order to restore it to it's original state.
> - If it's enabled and then an MCLK switch comes in
>   we may not prefetch the correct data since the phantom
>   OTG could already be in the middle of the frame.
> 
> Reviewed-by: Jun Lei <Jun.Lei@amd.com>
> Acked-by: Alan Liu <HaoPing.Liu@amd.com>
> Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
> ---
>  drivers/gpu/drm/amd/display/dc/core/dc.c           | 14 +++++++++++++-
>  drivers/gpu/drm/amd/display/dc/dcn32/dcn32_optc.c  |  8 ++++++++
>  .../drm/amd/display/dc/inc/hw/timing_generator.h   |  1 +
>  3 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> index da808996e21d..9c3704c4d7e4 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> @@ -1055,6 +1055,7 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context)
>  	struct dc_state *dangling_context = dc_create_state(dc);
>  	struct dc_state *current_ctx;
>  	struct pipe_ctx *pipe;
> +	struct timing_generator *tg;
>  
>  	if (dangling_context == NULL)
>  		return;
> @@ -1098,6 +1099,7 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context)
>  
>  		if (should_disable && old_stream) {
>  			pipe = &dc->current_state->res_ctx.pipe_ctx[i];
> +			tg = pipe->stream_res.tg;
>  			/* When disabling plane for a phantom pipe, we must turn on the
>  			 * phantom OTG so the disable programming gets the double buffer
>  			 * update. Otherwise the pipe will be left in a partially disabled
> @@ -1105,7 +1107,8 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context)
>  			 * again for different use.
>  			 */
>  			if (old_stream->mall_stream_config.type == SUBVP_PHANTOM) {
> -				pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg);
> +				if (tg->funcs->enable_crtc)
> +					tg->funcs->enable_crtc(tg);
>  			}
>  			dc_rem_all_planes_for_stream(dc, old_stream, dangling_context);
>  			disable_all_writeback_pipes_for_stream(dc, old_stream, dangling_context);
> @@ -1122,6 +1125,15 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context)
>  				dc->hwss.interdependent_update_lock(dc, dc->current_state, false);
>  				dc->hwss.post_unlock_program_front_end(dc, dangling_context);
>  			}
> +			/* We need to put the phantom OTG back into it's default (disabled) state or we
> +			 * can get corruption when transition from one SubVP config to a different one.
> +			 * The OTG is set to disable on falling edge of VUPDATE so the plane disable
> +			 * will still get it's double buffer update.
> +			 */
> +			if (old_stream->mall_stream_config.type == SUBVP_PHANTOM) {
> +				if (tg->funcs->disable_phantom_crtc)
> +					tg->funcs->disable_phantom_crtc(tg);
> +			}
>  		}
>  	}
>  
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_optc.c b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_optc.c
> index 2b33eeb213e2..2ee798965bc2 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_optc.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_optc.c
> @@ -167,6 +167,13 @@ static void optc32_phantom_crtc_post_enable(struct timing_generator *optc)
>  	REG_WAIT(OTG_CLOCK_CONTROL, OTG_BUSY, 0, 1, 100000);
>  }
>  
> +static void optc32_disable_phantom_otg(struct timing_generator *optc)
> +{
> +	struct optc *optc1 = DCN10TG_FROM_TG(optc);
> +
> +	REG_UPDATE(OTG_CONTROL, OTG_MASTER_EN, 0);
> +}
> +
>  static void optc32_set_odm_bypass(struct timing_generator *optc,
>  		const struct dc_crtc_timing *dc_crtc_timing)
>  {
> @@ -260,6 +267,7 @@ static struct timing_generator_funcs dcn32_tg_funcs = {
>  		.enable_crtc = optc32_enable_crtc,
>  		.disable_crtc = optc32_disable_crtc,
>  		.phantom_crtc_post_enable = optc32_phantom_crtc_post_enable,
> +		.disable_phantom_crtc = optc32_disable_phantom_otg,
>  		/* used by enable_timing_synchronization. Not need for FPGA */
>  		.is_counter_moving = optc1_is_counter_moving,
>  		.get_position = optc1_get_position,
> diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h b/drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h
> index 65f18f9dad34..43eb61961e0f 100644
> --- a/drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h
> +++ b/drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h
> @@ -184,6 +184,7 @@ struct timing_generator_funcs {
>  	bool (*disable_crtc)(struct timing_generator *tg);
>  #ifdef CONFIG_DRM_AMD_DC_DCN
>  	void (*phantom_crtc_post_enable)(struct timing_generator *tg);
> +	void (*disable_phantom_crtc)(struct timing_generator *tg);
>  #endif
>  	bool (*immediate_disable_crtc)(struct timing_generator *tg);
>  	bool (*is_counter_moving)(struct timing_generator *tg);
> -- 
> 2.25.1
> 
> 

This breaks the build without CONFIG_DRM_AMD_DC_DCN:

  drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:1134:20: error: no member named 'disable_phantom_crtc' in 'struct timing_generator_funcs'
                                  if (tg->funcs->disable_phantom_crtc)
                                      ~~~~~~~~~  ^
  drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:1135:17: error: no member named 'disable_phantom_crtc' in 'struct timing_generator_funcs'
                                          tg->funcs->disable_phantom_crtc(tg);
                                          ~~~~~~~~~  ^
  2 errors generated.

Cheers,
Nathan

  reply	other threads:[~2022-11-10 15:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 16:00 [PATCH 00/22] DC Patches Nov 2, 2022 Alan Liu
2022-11-02 16:00 ` [PATCH 01/22] drm/amd/display: Wait for VBLANK during pipe programming Alan Liu
2022-11-02 16:00 ` [PATCH 02/22] drm/amd/display: Adding HDMI SCDC DEVICE_ID define Alan Liu
2022-11-02 16:00 ` [PATCH 03/22] drm/amd/display: Cursor update refactor: PSR-SU support condition Alan Liu
2022-11-02 16:00 ` [PATCH 04/22] drm/amd/display: Update 709 gamma to 2.222 as stated in the standerd Alan Liu
2022-11-02 16:01 ` [PATCH 05/22] drm/amd/display: Consider dp cable id only when data is non zero Alan Liu
2022-11-02 16:01 ` [PATCH 06/22] drm/amd/display: Waiting for 1 frame to fix the flash issue on PSR1 Alan Liu
2022-11-02 16:01 ` [PATCH 07/22] drm/amd/display: Update SR watermarks for DCN314 Alan Liu
2022-11-02 16:01 ` [PATCH 08/22] drm/amd/display: Allow tuning DCN314 bounding box Alan Liu
2022-11-02 16:01 ` [PATCH 09/22] drm/amd/display: Zeromem mypipe heap struct before using it Alan Liu
2022-11-02 16:01 ` [PATCH 10/22] drm/amd/display: Use min transition for SubVP into MPO Alan Liu
2022-11-02 16:01 ` [PATCH 11/22] drm/amd/display: Disable phantom OTG after enable for plane disable Alan Liu
2022-11-10 15:39   ` Nathan Chancellor [this message]
2022-11-10 17:35     ` Liu, HaoPing (Alan)
2022-11-02 16:01 ` [PATCH 12/22] drm/amd/display: Disable DRR actions during state commit Alan Liu
2022-11-02 16:01 ` [PATCH 13/22] drm/amd/display: Fix fallback issues for DP LL 1.4a tests Alan Liu
2022-11-02 16:01 ` [PATCH 14/22] drm/amd/display: Fix FCLK deviation and tool compile issues Alan Liu
2022-11-02 16:01 ` [PATCH 15/22] drm/amd/display: Fix reg timeout in enc314_enable_fifo Alan Liu
2022-11-02 16:01 ` [PATCH 16/22] drm/amd/display: Fix gpio port mapping issue Alan Liu
2022-11-02 16:01 ` [PATCH 17/22] drm/amd/display: Only update link settings after successful MST link train Alan Liu
2022-11-02 16:01 ` [PATCH 18/22] drm/amd/display: Enforce minimum prefetch time for low memclk on DCN32 Alan Liu
2022-11-02 16:01 ` [PATCH 19/22] drm/amd/display: Set correct EOTF and Gamut flag in VRR info Alan Liu
2022-11-02 16:01 ` [PATCH 20/22] drm/amd/display: Add margin for max vblank time for SubVP + DRR Alan Liu
2022-11-02 16:01 ` [PATCH 21/22] drm/amd/display: Populate DP2.0 output type for DML pipe Alan Liu
2022-11-02 16:01 ` [PATCH 22/22] drm/amd/display: 3.2.211 Alan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y20bFlEcKX3gbge8@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=Alvin.Lee2@amd.com \
    --cc=Aurabindo.Pillai@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=HaoPing.Liu@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Jun.Lei@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=agustin.gutierrez@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=pavle.kotarac@amd.com \
    --cc=qingqing.zhuo@amd.com \
    --cc=roman.li@amd.com \
    --cc=solomon.chiu@amd.com \
    --cc=stylon.wang@amd.com \
    --cc=wayne.lin@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.