linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: CK Hu <ck.hu@mediatek.com>
To: <yongqiang.niu@mediatek.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	devicetree@vger.kernel.org,
	Philipp Zabel <p.zabel@pengutronix.de>,
	David Airlie <airlied@linux.ie>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Rob Herring <robh+dt@kernel.org>,
	linux-mediatek@lists.infradead.org,
	Daniel Vetter <daniel@ffwll.ch>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v1, 1/2] drm/mediatek: Fixup external display black screen issue
Date: Tue, 3 Dec 2019 13:48:21 +0800	[thread overview]
Message-ID: <1575352101.2457.8.camel@mtksdaap41> (raw)
In-Reply-To: <1574817475-22378-2-git-send-email-yongqiang.niu@mediatek.com>

Hi, Yongqiang:

On Wed, 2019-11-27 at 09:17 +0800, yongqiang.niu@mediatek.com wrote:
> From: Yongqiang Niu <yongqiang.niu@mediatek.com>
> 
> Problem:
> overlay hangup when external display hotplut test
> 
> Fix:
> disable overlay when crtc disable

I think you do two things in this patch. The first is to config layer
before component start, and the second is disable layer when crtc
disable. So separate to two patches.

> 
> Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 39 +++++++++++++++++++++------------
>  1 file changed, 25 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index 4fb346c..7eca02f 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -369,6 +369,20 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc)
>  	mtk_disp_mutex_add_comp(mtk_crtc->mutex, mtk_crtc->ddp_comp[i]->id);
>  	mtk_disp_mutex_enable(mtk_crtc->mutex);
>  
> +	/* Initially configure all planes */
> +	for (i = 0; i < mtk_crtc->layer_nr; i++) {
> +		struct drm_plane *plane = &mtk_crtc->planes[i];
> +		struct mtk_plane_state *plane_state;
> +		struct mtk_ddp_comp *comp;
> +		unsigned int local_layer;
> +
> +		plane_state = to_mtk_plane_state(plane->state);
> +		comp = mtk_drm_ddp_comp_for_plane(crtc, plane, &local_layer);
> +		if (comp)
> +			mtk_ddp_comp_layer_config(comp, local_layer,
> +						  plane_state, NULL);
> +	}
> +
>  	for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) {
>  		struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[i];
>  		enum mtk_ddp_comp_id prev;
> @@ -385,20 +399,6 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc)
>  		mtk_ddp_comp_start(comp);
>  	}
>  
> -	/* Initially configure all planes */
> -	for (i = 0; i < mtk_crtc->layer_nr; i++) {
> -		struct drm_plane *plane = &mtk_crtc->planes[i];
> -		struct mtk_plane_state *plane_state;
> -		struct mtk_ddp_comp *comp;
> -		unsigned int local_layer;
> -
> -		plane_state = to_mtk_plane_state(plane->state);
> -		comp = mtk_drm_ddp_comp_for_plane(crtc, plane, &local_layer);
> -		if (comp)
> -			mtk_ddp_comp_layer_config(comp, local_layer,
> -						  plane_state, NULL);
> -	}
> -
>  	return 0;
>  
>  err_mutex_unprepare:
> @@ -607,10 +607,21 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
>  	for (i = 0; i < mtk_crtc->layer_nr; i++) {
>  		struct drm_plane *plane = &mtk_crtc->planes[i];
>  		struct mtk_plane_state *plane_state;
> +		struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0];
> +		unsigned int comp_layer_nr = mtk_ddp_comp_layer_nr(comp);
> +		unsigned int local_layer;
>  
>  		plane_state = to_mtk_plane_state(plane->state);
>  		plane_state->pending.enable = false;
>  		plane_state->pending.config = true;
> +
> +		if (i >= comp_layer_nr) {
> +			comp = mtk_crtc->ddp_comp[1];
> +			local_layer = i - comp_layer_nr;
> +		} else
> +			local_layer = i;
> +		mtk_ddp_comp_layer_config(comp, local_layer,
> +					  plane_state, NULL);

I'm confused with this part. The design of this loop is to set
plane_state->pending.enable = false and wait for irq handler to write
register. Why do you directly write register?

Regards,
CK

>  	}
>  	mtk_crtc->pending_planes = true;
>  

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

  reply	other threads:[~2019-12-03  5:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27  1:17 [PATCH v1, 0/2] drm/mediatek: Fix external display issue yongqiang.niu
2019-11-27  1:17 ` [PATCH v1, 1/2] drm/mediatek: Fixup external display black screen issue yongqiang.niu
2019-12-03  5:48   ` CK Hu [this message]
2019-12-03  7:43     ` Yongqiang Niu
2019-12-03  8:25       ` CK Hu
2019-12-05  6:15   ` [v1,1/2] " Hsin-Yi Wang
2019-12-05  7:12     ` Yongqiang Niu
2019-12-05  8:44       ` Hsin-Yi Wang
2019-11-27  1:17 ` [PATCH v1, 2/2] drm/mediatek: Fix external display vblank timeout issue yongqiang.niu
2019-12-03  7:07   ` CK Hu

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=1575352101.2457.8.camel@mtksdaap41 \
    --to=ck.hu@mediatek.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=yongqiang.niu@mediatek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).