All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joonyoung Shim <jy0922.shim@samsung.com>
To: Gustavo Padovan <gustavo@padovan.org>, linux-samsung-soc@vger.kernel.org
Cc: tjakobi@math.uni-bielefeld.de,
	Gustavo Padovan <gustavo.padovan@collabora.co.uk>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v7 12/13] drm/exynos: atomic dpms support
Date: Wed, 27 May 2015 17:34:47 +0900	[thread overview]
Message-ID: <556581A7.30606@samsung.com> (raw)
In-Reply-To: <1432309253-18572-13-git-send-email-gustavo@padovan.org>

Hi Gustavo,

Sorry, i was missing some review points.

On 05/23/2015 12:40 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> Run dpms operations through the atomic intefaces. This basically removes
> the .dpms() callback from econders and crtcs and use .disable() and
> .enable() to turn the crtc on and off.
> 
> v2: Address comments by Joonyoung:
> 	- make hdmi code call ->disable() instead of ->dpms()
> 	- do not use WARN_ON on crtc enable/disable
> 
> v3: - Fix build failure after the hdmi change in v2
>     - Change dpms helper of ptn3460 bridge
> 
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> Reviewed-by: Joonyoung Shim <jy0922.shim@samsung.com>
> Tested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
> ---
>  drivers/gpu/drm/bridge/ps8622.c             |  2 +-
>  drivers/gpu/drm/bridge/ptn3460.c            |  2 +-
>  drivers/gpu/drm/exynos/exynos_dp_core.c     |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c    | 95 ++++++++++++++++-------------
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c     |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_drv.h     |  4 +-
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c     |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++------
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c    |  2 +-
>  drivers/gpu/drm/exynos/exynos_hdmi.c        |  6 +-
>  10 files changed, 69 insertions(+), 75 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
> index b604326..d686235 100644
> --- a/drivers/gpu/drm/bridge/ps8622.c
> +++ b/drivers/gpu/drm/bridge/ps8622.c
> @@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct drm_connector *connector)
>  }
>  
>  static const struct drm_connector_funcs ps8622_connector_funcs = {
> -	.dpms = drm_helper_connector_dpms,
> +	.dpms = drm_atomic_helper_connector_dpms,
>  	.fill_modes = drm_helper_probe_single_connector_modes,
>  	.detect = ps8622_detect,
>  	.destroy = ps8622_connector_destroy,
> diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
> index 8ed3617..260bc9f 100644
> --- a/drivers/gpu/drm/bridge/ptn3460.c
> +++ b/drivers/gpu/drm/bridge/ptn3460.c
> @@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct drm_connector *connector)
>  }
>  
>  static struct drm_connector_funcs ptn3460_connector_funcs = {
> -	.dpms = drm_helper_connector_dpms,
> +	.dpms = drm_atomic_helper_connector_dpms,
>  	.fill_modes = drm_helper_probe_single_connector_modes,
>  	.detect = ptn3460_detect,
>  	.destroy = ptn3460_connector_destroy,
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
> index 195fe60..c9995b1 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> @@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct drm_connector *connector)
>  }
>  
>  static struct drm_connector_funcs exynos_dp_connector_funcs = {
> -	.dpms = drm_helper_connector_dpms,
> +	.dpms = drm_atomic_helper_connector_dpms,
>  	.fill_modes = drm_helper_probe_single_connector_modes,
>  	.detect = exynos_dp_detect,
>  	.destroy = exynos_dp_connector_destroy,
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index fd5ef2c..ca501a9 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -22,48 +22,54 @@
>  #include "exynos_drm_encoder.h"
>  #include "exynos_drm_plane.h"
>  
> -static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
> +static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
>  {
>  	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
> +	struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);
>  
> -	DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode);
> -
> -	if (exynos_crtc->dpms == mode) {
> -		DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
> +	if (exynos_crtc->enabled)
>  		return;
> -	}
> -
> -	if (mode > DRM_MODE_DPMS_ON) {
> -		/* wait for the completion of page flip. */
> -		if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
> -				(exynos_crtc->event == NULL), HZ/20))
> -			exynos_crtc->event = NULL;
> -		drm_crtc_vblank_off(crtc);
> -	}
>  
>  	if (exynos_crtc->ops->dpms)
> -		exynos_crtc->ops->dpms(exynos_crtc, mode);
> +		exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_ON);
>  
> -	exynos_crtc->dpms = mode;
> +	exynos_crtc->enabled = true;
>  
> -	if (mode == DRM_MODE_DPMS_ON)
> -		drm_crtc_vblank_on(crtc);
> -}
> +	drm_crtc_vblank_on(crtc);
>  
> -static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
> -{
> -	/* drm framework doesn't check NULL. */
> +	if (exynos_crtc->ops->win_commit)
> +		exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);

Unnecessary also? because be called by exynos_plane_atomic_update
already.

>  }
>  
> -static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
> +static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
>  {
>  	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
> -	struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);
> +	struct drm_plane *plane;
> +	int ret;
>  
> -	exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
> +	if (!exynos_crtc->enabled)
> +		return;
>  
> -	if (exynos_crtc->ops->win_commit)
> -		exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
> +	/* wait for the completion of page flip. */
> +	if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
> +				(exynos_crtc->event == NULL), HZ/20))
> +		exynos_crtc->event = NULL;
> +
> +	drm_crtc_vblank_off(crtc);
> +
> +	if (exynos_crtc->ops->dpms)
> +		exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_OFF);
> +
> +	exynos_crtc->enabled = false;
> +
> +	drm_for_each_legacy_plane(plane, &crtc->dev->mode_config.plane_list) {
> +		if (plane->crtc != crtc)
> +			continue;
> +
> +		ret = plane->funcs->disable_plane(plane);
> +		if (ret)
> +			DRM_ERROR("Failed to disable plane %d\n", ret);
> +	}
>  }
>  
>  static bool
> @@ -92,32 +98,36 @@ exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
>  		exynos_crtc->ops->commit(exynos_crtc);
>  }
>  
> -static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
> +static int exynos_crtc_atomic_check(struct drm_crtc *crtc,
> +				     struct drm_crtc_state *state)
>  {
> -	struct drm_plane *plane;
> +	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
>  	int ret;
>  
> -	exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
> +	if (exynos_crtc->event)
> +		return -EBUSY;
>  
> -	drm_for_each_legacy_plane(plane, &crtc->dev->mode_config.plane_list) {
> -		if (plane->crtc != crtc)
> -			continue;
> +	if (state->event) {
> +		ret = drm_vblank_get(crtc->dev, exynos_crtc->pipe);
> +		if (ret) {
> +			DRM_ERROR("failed to acquire vblank counter\n");
> +			return ret;
> +		}
>  
> -		ret = plane->funcs->disable_plane(plane);
> -		if (ret)
> -			DRM_ERROR("Failed to disable plane %d\n", ret);
> +		exynos_crtc->event = state->event;
>  	}
> +
> +	return 0;

Should this go to .atomic_begin? Then you are missing drm_vblank_get
from a patch "drm/exynos: atomic phase 3: convert page flips"?

>  }
>  
>  static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
> -	.dpms		= exynos_drm_crtc_dpms,
> -	.prepare	= exynos_drm_crtc_prepare,
> -	.commit		= exynos_drm_crtc_commit,

This .prepare and .prepare of encoder_helper_funcs are not used by
drm_atomic_helper_set_config so you can remove them from "drm/exynos:
atomic phase 3: use atomic .set_config helper"?

> +	.enable		= exynos_drm_crtc_enable,
> +	.disable	= exynos_drm_crtc_disable,
>  	.mode_fixup	= exynos_drm_crtc_mode_fixup,
>  	.mode_set	= drm_helper_crtc_mode_set,
>  	.mode_set_nofb	= exynos_drm_crtc_mode_set_nofb,
>  	.mode_set_base	= drm_helper_crtc_mode_set_base,
> -	.disable	= exynos_drm_crtc_disable,

Could you make a split patch to move exynos_drm_crtc_disable function?
If not, we are difficult to understand code changes via diff.

Thanks.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-05-27  8:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22 15:40 [PATCH v7 00/13] drm/exynos: atomic modesetting support Gustavo Padovan
2015-05-22 15:40 ` [PATCH v7 01/13] drm/exynos: fix source data argument for plane Gustavo Padovan
2015-05-22 15:40 ` [PATCH v7 02/13] drm/exynos: atomic phase 1: use drm_plane_helper_update() Gustavo Padovan
2015-05-27  8:35   ` Joonyoung Shim
2015-05-27 18:48     ` Gustavo Padovan
2015-05-22 15:40 ` [PATCH v7 03/13] drm/exynos: atomic phase 1: use drm_plane_helper_disable() Gustavo Padovan
2015-05-22 15:40 ` [PATCH v7 04/13] drm/exynos: atomic phase 1: add .mode_set_nofb() callback Gustavo Padovan
2015-05-22 15:40 ` [PATCH v7 05/13] drm/exynos: atomic phase 2: wire up state reset(), duplicate() and destroy() Gustavo Padovan
2015-05-22 15:40 ` [PATCH v7 06/13] drm/exynos: atomic phase 2: keep track of framebuffer pointer Gustavo Padovan
2015-05-22 15:40 ` [PATCH v7 07/13] drm/exynos: atomic phase 3: atomic updates of planes Gustavo Padovan
2015-05-22 15:40 ` [PATCH v7 08/13] drm/exynos: atomic phase 3: use atomic .set_config helper Gustavo Padovan
2015-05-22 15:40 ` [PATCH v7 09/13] drm/exynos: atomic phase 3: convert page flips Gustavo Padovan
2015-05-22 15:40 ` [PATCH v7 10/13] drm/exynos: remove exported functions from exynos_drm_plane Gustavo Padovan
2015-05-22 15:40 ` [PATCH v7 11/13] drm/exynos: don't disable unused functions at init Gustavo Padovan
2015-05-22 15:40 ` [PATCH v7 12/13] drm/exynos: atomic dpms support Gustavo Padovan
2015-05-27  8:34   ` Joonyoung Shim [this message]
2015-05-27 19:26     ` Gustavo Padovan
2015-05-27 12:27   ` Inki Dae
2015-05-27 20:27     ` Gustavo Padovan
2015-05-28  5:39       ` Inki Dae
2015-05-28  8:24         ` Joonyoung Shim
2015-05-28 11:53           ` Joonyoung Shim
2015-05-28 21:36             ` Gustavo Padovan
2015-05-29  6:20               ` Joonyoung Shim
2015-05-29 21:33                 ` Gustavo Padovan
2015-06-01  2:52                   ` Joonyoung Shim
2015-05-22 15:40 ` [PATCH v7 13/13] drm/exynos: remove unnecessary calls to disable_plane() Gustavo Padovan

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=556581A7.30606@samsung.com \
    --to=jy0922.shim@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=gustavo@padovan.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=tjakobi@math.uni-bielefeld.de \
    /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.