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 2/9] drm/exynos: add atomic asynchronous commit
Date: Wed, 10 Jun 2015 18:45:02 +0900	[thread overview]
Message-ID: <5578071E.9000700@samsung.com> (raw)
In-Reply-To: <1433341832-2686-2-git-send-email-gustavo@padovan.org>

On 06/03/2015 11:30 PM, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> The atomic modesetting interfaces supports async commits that should be
> implemented by the drivers. If drm core requests an async commit
> exynos_atomic_commit() will schedule a work task to run the update later.
> It also waits to an update to finishes to schedule a new one.
> 
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.c |  6 ++++
>  drivers/gpu/drm/exynos/exynos_drm_drv.h |  6 ++++
>  drivers/gpu/drm/exynos/exynos_drm_fb.c  | 51 ++++++++++++++++++++++++++-------
>  3 files changed, 52 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 08b9a8c..8ccff36 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -60,6 +60,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
>  	if (!private)
>  		return -ENOMEM;
>  
> +	INIT_WORK(&private->work, exynos_drm_atomic_work);
> +	private->dev = dev;
> +
>  	dev_set_drvdata(dev->dev, dev);
>  	dev->dev_private = (void *)private;
>  
> @@ -140,6 +143,8 @@ err_free_private:
>  
>  static int exynos_drm_unload(struct drm_device *dev)
>  {
> +	struct exynos_drm_private *private = dev->dev_private;
> +
>  	exynos_drm_device_subdrv_remove(dev);
>  
>  	exynos_drm_fbdev_fini(dev);
> @@ -150,6 +155,7 @@ static int exynos_drm_unload(struct drm_device *dev)
>  	drm_mode_config_cleanup(dev);
>  	drm_release_iommu_mapping(dev);
>  
> +	flush_work(&private->work);
>  	kfree(dev->dev_private);
>  	dev->dev_private = NULL;
>  
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> index 1c66f65..552ca4a 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> @@ -255,6 +255,10 @@ struct exynos_drm_private {
>  	unsigned long da_space_size;
>  
>  	unsigned int pipe;
> +
> +	struct drm_device *dev;
> +	struct work_struct work;
> +	struct drm_atomic_state *state;
>  };
>  
>  /*
> @@ -324,6 +328,8 @@ static inline int exynos_drm_probe_vidi(void) { return 0; }
>  static inline void exynos_drm_remove_vidi(void) {}
>  #endif
>  
> +void exynos_drm_atomic_work(struct work_struct *work);
> +
>  /* This function creates a encoder and a connector, and initializes them. */
>  int exynos_drm_create_enc_conn(struct drm_device *dev,
>  				struct exynos_drm_display *display);
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> index 789db6f..28626db 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> @@ -267,20 +267,18 @@ static void exynos_drm_output_poll_changed(struct drm_device *dev)
>  		exynos_drm_fbdev_init(dev);
>  }
>  
> -static int exynos_atomic_commit(struct drm_device *dev,
> -				struct drm_atomic_state *state,
> -				bool async)
> +static void exynos_atomic_commit_schedule(struct drm_device *dev,
> +				struct drm_atomic_state *state)
>  {
> -	int ret;
> -
> -	ret = drm_atomic_helper_prepare_planes(dev, state);
> -	if (ret)
> -		return ret;
> -
> -	/* This is the point of no return */
> +	struct exynos_drm_private *private = dev->dev_private;
>  
> -	drm_atomic_helper_swap_state(dev, state);
> +	private->state = state;
> +	schedule_work(&private->work);
> +}
>  
> +static void exynos_atomic_commit_complete(struct drm_device *dev,
> +					  struct drm_atomic_state *state)
> +{
>  	drm_atomic_helper_commit_modeset_disables(dev, state);
>  
>  	drm_atomic_helper_commit_modeset_enables(dev, state);
> @@ -300,6 +298,37 @@ static int exynos_atomic_commit(struct drm_device *dev,
>  	drm_atomic_helper_cleanup_planes(dev, state);
>  
>  	drm_atomic_state_free(state);
> +}
> +
> +void exynos_drm_atomic_work(struct work_struct *work)
> +{
> +	struct exynos_drm_private *private = container_of(work,
> +				struct exynos_drm_private, work);
> +
> +	exynos_atomic_commit_complete(private->dev, private->state);
> +}
> +
> +static int exynos_atomic_commit(struct drm_device *dev,
> +				struct drm_atomic_state *state,
> +				bool async)
> +{
> +	struct exynos_drm_private *private = dev->dev_private;
> +	int ret;
> +
> +	ret = drm_atomic_helper_prepare_planes(dev, state);
> +	if (ret)
> +		return ret;
> +
> +	/* This is the point of no return */
> +
> +	drm_atomic_helper_swap_state(dev, state);
> +
> +	flush_work(&private->work);

It seems be wrong to swap state before flush work.

I'm not sure whether need locking but other drivers changed to atomic
modeset feature use locking here.

> +
> +	if (async)
> +		exynos_atomic_commit_schedule(dev, state);
> +	else
> +		exynos_atomic_commit_complete(dev, state);
>  
>  	return 0;
>  }
> 

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

  reply	other threads:[~2015-06-10  9:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-03 14:30 [PATCH 1/9] drm/exynos: add error messages if clks failed to get enabled Gustavo Padovan
2015-06-03 14:30 ` [PATCH 2/9] drm/exynos: add atomic asynchronous commit Gustavo Padovan
2015-06-10  9:45   ` Joonyoung Shim [this message]
2015-06-03 14:30 ` [PATCH 3/9] drm/exynos: rename win_commit/disable to atomic-like names Gustavo Padovan
2015-06-03 14:30 ` [PATCH 4/9] drm/exynos: don't disable planes already disabled Gustavo Padovan
2015-06-03 14:30 ` [PATCH 5/9] drm/exynos: pass struct exynos_drm_plane in update/enable Gustavo Padovan
2015-06-03 14:30 ` [PATCH 6/9] drm/exynos: remove duplicated check for suspend Gustavo Padovan
2015-06-03 14:30 ` [PATCH 7/9] drm/exynos: use drm atomic state directly Gustavo Padovan
2015-06-03 14:30 ` [PATCH 8/9] drm/exynos: remove unused fields from struct exynos_drm_plane Gustavo Padovan
2015-06-03 14:30 ` [PATCH 9/9] drm/exynos: unify exynos_drm_plane names with drm core Gustavo Padovan
2015-06-09 14:27   ` Gustavo Padovan
2015-06-10  9:46     ` Joonyoung Shim
2015-06-10 10:42     ` Inki Dae
2015-06-10 10:48       ` Inki Dae
2015-06-03 16:59 ` [PATCH 1/9] drm/exynos: add error messages if clks failed to get enabled Alexey Klimov
2015-06-03 17:09   ` Alexey Klimov
2015-06-03 18:13   ` Gustavo Padovan
2015-06-03 20:17 ` [PATCH v2] " Gustavo Padovan
2015-06-11 14:12   ` Inki Dae

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=5578071E.9000700@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.