Re: [PATCH] drm/atomic-helpers: Clear up cleanup_done a bit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 15, 2016 at 12:08:29PM +0200, Daniel Vetter wrote:
> It's not obvious at first sight that this is a fastpath, make that
> clearer with a goto. Fallout from a discussion with Liviu on irc.
> 
> Cc: Liviu.Dudau@xxxxxxx
> Acked-by: Liviu.Dudau@xxxxxxx

Nope, I did not agree to *all* those changes, only the drm_atomic_helper.c one :)

Best regards,
Liviu

> Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>
> ---
>  .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.h  |  4 ++--
>  drivers/gpu/drm/amd/amdkfd/kfd_priv.h              |  3 ---
>  drivers/gpu/drm/drm_atomic_helper.c                |  8 +++-----
>  include/drm/drm_crtc.h                             | 23 ++++------------------
>  4 files changed, 9 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
> index ec4036a09f3e..a625b9137da2 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
> @@ -187,12 +187,12 @@ int init_pipelines(struct device_queue_manager *dqm,
>  unsigned int get_first_pipe(struct device_queue_manager *dqm);
>  unsigned int get_pipes_num(struct device_queue_manager *dqm);
>  
> -extern inline unsigned int get_sh_mem_bases_32(struct kfd_process_device *pdd)
> +static inline unsigned int get_sh_mem_bases_32(struct kfd_process_device *pdd)
>  {
>  	return (pdd->lds_base >> 16) & 0xFF;
>  }
>  
> -extern inline unsigned int
> +static inline unsigned int
>  get_sh_mem_bases_nybble_64(struct kfd_process_device *pdd)
>  {
>  	return (pdd->lds_base >> 60) & 0x0E;
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> index d0d5f4baf72d..80113c335966 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> @@ -617,10 +617,7 @@ int kgd2kfd_resume(struct kfd_dev *kfd);
>  int kfd_init_apertures(struct kfd_process *process);
>  
>  /* Queue Context Management */
> -inline uint32_t lower_32(uint64_t x);
> -inline uint32_t upper_32(uint64_t x);
>  struct cik_sdma_rlc_registers *get_sdma_mqd(void *mqd);
> -inline uint32_t get_sdma_base_addr(struct cik_sdma_rlc_registers *m);
>  
>  int init_queue(struct queue **q, struct queue_properties properties);
>  void uninit_queue(struct queue *q);
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 716aa535eb98..0556c95b7ddb 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1579,11 +1579,8 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state)
>  		/* commit_list borrows our reference, need to remove before we
>  		 * clean up our drm_atomic_state. But only after it actually
>  		 * completed, otherwise subsequent commits won't stall properly. */
> -		if (try_wait_for_completion(&commit->flip_done)) {
> -			list_del(&commit->commit_entry);
> -			spin_unlock(&crtc->commit_lock);
> -			continue;
> -		}
> +		if (try_wait_for_completion(&commit->flip_done))
> +			goto del_commit:
>  
>  		spin_unlock(&crtc->commit_lock);
>  
> @@ -1597,6 +1594,7 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state)
>  				  crtc->base.id, crtc->name);
>  
>  		spin_lock(&crtc->commit_lock);
> +del_commit:
>  		list_del(&commit->commit_entry);
>  		spin_unlock(&crtc->commit_lock);
>  	}
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 3c84ddc7e4c8..a39e1f17a20e 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -2820,29 +2820,14 @@ static inline void drm_connector_unreference(struct drm_connector *connector)
>  #define drm_for_each_crtc(crtc, dev) \
>  	list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head)
>  
> -static inline void
> -assert_drm_connector_list_read_locked(struct drm_mode_config *mode_config)
> -{
> -	/*
> -	 * The connector hotadd/remove code currently grabs both locks when
> -	 * updating lists. Hence readers need only hold either of them to be
> -	 * safe and the check amounts to
> -	 *
> -	 * WARN_ON(not_holding(A) && not_holding(B)).
> -	 */
> -	WARN_ON(!mutex_is_locked(&mode_config->mutex) &&
> -		!drm_modeset_is_locked(&mode_config->connection_mutex));
> -}
> -
>  #define drm_for_each_connector(connector, dev) \
>  	/* loop to wrap everything into a srcu read-side critical section */	\
> -	for (bool __conn_loop_srcu = true,					\
> -	     int __conn_loop_srcu_ret = srcu_read_lock(&drm_connector_list_srcu);\
> -	     __conn_loop_srcu; __conn_loop_srcu = false,			\
> +	for (int __conn_loop_srcu = 1,					\
> +	     __conn_loop_srcu_ret = srcu_read_lock(&drm_connector_list_srcu);\
> +	     __conn_loop_srcu; __conn_loop_srcu = 0,			\
>  	     srcu_read_unlock(&drm_connector_list_srcu, __conn_loop_srcu_ret))	\
>  	/* loop to iterate over the connector_list, rcu-protected */		\
> -	for (assert_drm_connector_list_read_locked(&(dev)->mode_config),	\
> -	     connector = list_entry_rcu((dev)->mode_config.connector_list.next,	\
> +	for (connector = list_entry_rcu((dev)->mode_config.connector_list.next,	\
>  					struct drm_connector, head);		\
>  	     &connector->head != (&(dev)->mode_config.connector_list);		\
>  	     connector = list_entry_rcu(connector->head.next,			\
> -- 
> 2.8.1
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux