Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Bibby Hsieh <bibby.hsieh@mediatek.com>
Cc: linux-kernel@vger.kernel.org,
	Sascha Hauer <kernel@pengutronix.de>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Cawa Cheng <cawa.cheng@mediatek.com>,
	dri-devel@lists.freedesktop.org,
	Mao Huang <littlecvr@chromium.org>,
	linux-mediatek@lists.infradead.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Yingjoe Chen <yingjoe.chen@mediatek.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 7/7] drm/mediatek: Fix mtk_atomic_complete for runtime_pm
Date: Thu, 4 Aug 2016 12:42:23 +0200	[thread overview]
Message-ID: <20160804104222.GE6232@phenom.ffwll.local> (raw)
In-Reply-To: <1470279597-60453-8-git-send-email-bibby.hsieh@mediatek.com>

On Thu, Aug 04, 2016 at 10:59:57AM +0800, Bibby Hsieh wrote:
> To properly implement atomic w/ runtime pm, we move
> drm_atomic_helper_commit_modeset_enables() above
> drm_atomic_helper_commit_planes() to ensure CRTCs are enabled before
> modifying plane registers, and set active_only to true to filter out
> plane update notifications when the CRTC is disabled.
> 
> According to the document from linux kernel:
> Set the active_only parameters to true in order not to receive plane
> update notifications related to a disabled CRTC. This avoids the need
> to manually ignore plane updates in driver code when the driver and/or
> hardware can't or just don't need to deal with updates on disabled
> CRTCs, for example when supporting runtime PM.
> 
> Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>

btw if you want to clean up some more code, would be neat to switch
mediatek to the generic nonblocking support in the atomic helpers instead
of rolling your own.
-Daniel

> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c |   17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index b1223d5..507392a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -61,10 +61,25 @@ static void mtk_atomic_complete(struct mtk_drm_private *private,
>  
>  	mtk_atomic_wait_for_fences(state);
>  
> +	/*
> +	 * Mediatek drm supports runtime PM, so plane registers cannot be
> +	 * written when their crtc is disabled.
> +	 *
> +	 * The comment for drm_atomic_helper_commit states:
> +	 *     For drivers supporting runtime PM the recommended sequence is
> +	 *
> +	 *     drm_atomic_helper_commit_modeset_disables(dev, state);
> +	 *     drm_atomic_helper_commit_modeset_enables(dev, state);
> +	 *     drm_atomic_helper_commit_planes(dev, state, true);
> +	 *
> +	 * See the kerneldoc entries for these three functions for more details.
> +	 */
>  	drm_atomic_helper_commit_modeset_disables(drm, state);
> -	drm_atomic_helper_commit_planes(drm, state, false);
>  	drm_atomic_helper_commit_modeset_enables(drm, state);
> +	drm_atomic_helper_commit_planes(drm, state, true);
> +
>  	drm_atomic_helper_wait_for_vblanks(drm, state);
> +
>  	drm_atomic_helper_cleanup_planes(drm, state);
>  	drm_atomic_state_free(state);
>  }
> -- 
> 1.7.9.5
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-08-04 10:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04  2:59 [PATCH v2 0/7] drm/mediatek: cleaning up and refine Bibby Hsieh
2016-08-04  2:59 ` [PATCH v2 1/7] drm/mediatek: Remove mtk_drm_crtc_check_flush Bibby Hsieh
2016-08-04  2:59 ` [PATCH v2 2/7] drm/mediatek: plane: Remove plane zpos/index Bibby Hsieh
2016-08-04  2:59 ` [PATCH v2 3/7] drm/mediatek: Remove mtk_drm_plane Bibby Hsieh
2016-08-04  2:59 ` [PATCH v2 4/7] drm/mediatek: Use drm_atomic destroy_state helpers Bibby Hsieh
2016-08-04  2:59 ` [PATCH v2 5/7] drm/mediatek: plane: Merge mtk_plane_enable into mtk_plane_atomic_update Bibby Hsieh
     [not found] ` <1470279597-60453-1-git-send-email-bibby.hsieh-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-08-04  2:59   ` [PATCH v2 6/7] drm/mediatek: plane: Use FB's format's cpp to compute x offset Bibby Hsieh
2016-08-04  2:59   ` [PATCH v2 7/7] drm/mediatek: Fix mtk_atomic_complete for runtime_pm Bibby Hsieh
2016-08-04 10:42     ` Daniel Vetter [this message]
2016-08-04 18:27 ` [PATCH v2 0/7] drm/mediatek: cleaning up and refine Sean Paul
2016-08-11  7:33 ` Philipp Zabel
2016-08-11  8:51   ` Daniel Vetter
2016-08-11  9:09     ` Philipp Zabel

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=20160804104222.GE6232@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=bibby.hsieh@mediatek.com \
    --cc=cawa.cheng@mediatek.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=littlecvr@chromium.org \
    --cc=matthias.bgg@gmail.com \
    --cc=yingjoe.chen@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