All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Padovan <gustavo@padovan.org>
To: Brian Starkey <brian.starkey@arm.com>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-media@vger.kernel.org
Subject: Re: [RFC PATCH v2 7/9] drm: atomic: factor out common out-fence operations
Date: Wed, 26 Oct 2016 19:45:14 -0200	[thread overview]
Message-ID: <20161026214514.GI12629@joana> (raw)
In-Reply-To: <1477472108-27222-8-git-send-email-brian.starkey@arm.com>

2016-10-26 Brian Starkey <brian.starkey@arm.com>:

> Some parts of setting up the CRTC out-fence can be re-used for
> writeback out-fences. Factor this out into a separate function.
> 
> Signed-off-by: Brian Starkey <brian.starkey@arm.com>
> ---
>  drivers/gpu/drm/drm_atomic.c |   64 +++++++++++++++++++++++++++---------------
>  1 file changed, 42 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index f434f34..3f8fc97 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1693,37 +1693,46 @@ void drm_atomic_clean_old_fb(struct drm_device *dev,
>  }
>  EXPORT_SYMBOL(drm_atomic_clean_old_fb);
>  
> -static int crtc_setup_out_fence(struct drm_crtc *crtc,
> -				struct drm_crtc_state *crtc_state,
> -				struct drm_out_fence_state *fence_state)
> +static struct fence *get_crtc_fence(struct drm_crtc *crtc,
> +				    struct drm_crtc_state *crtc_state)
>  {
>  	struct fence *fence;
>  
> -	fence_state->fd = get_unused_fd_flags(O_CLOEXEC);
> -	if (fence_state->fd < 0) {
> -		return fence_state->fd;
> -	}
> -
> -	fence_state->out_fence_ptr = crtc_state->out_fence_ptr;
> -	crtc_state->out_fence_ptr = NULL;
> -
> -	if (put_user(fence_state->fd, fence_state->out_fence_ptr))
> -		return -EFAULT;
> -
>  	fence = kzalloc(sizeof(*fence), GFP_KERNEL);
>  	if (!fence)
> -		return -ENOMEM;
> +		return NULL;
>  
>  	fence_init(fence, &drm_crtc_fence_ops, &crtc->fence_lock,
>  		   crtc->fence_context, ++crtc->fence_seqno);
>  
> +	crtc_state->event->base.fence = fence_get(fence);
> +
> +	return fence;
> +}
> +
> +static int setup_out_fence(struct drm_out_fence_state *fence_state,
> +			   u64 __user *out_fence_ptr,
> +			   struct fence *fence)
> +{
> +	int ret;
> +
> +	DRM_DEBUG_ATOMIC("Putting out-fence %p into user ptr: %p\n",
> +			 fence, out_fence_ptr);

%p should be kept for your internal debug only. Make sure to remove
anything that exposes kernel address when sending patches.

Gustavo

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

WARNING: multiple messages have this Message-ID (diff)
From: Gustavo Padovan <gustavo@padovan.org>
To: Brian Starkey <brian.starkey@arm.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org
Subject: Re: [RFC PATCH v2 7/9] drm: atomic: factor out common out-fence operations
Date: Wed, 26 Oct 2016 19:45:14 -0200	[thread overview]
Message-ID: <20161026214514.GI12629@joana> (raw)
In-Reply-To: <1477472108-27222-8-git-send-email-brian.starkey@arm.com>

2016-10-26 Brian Starkey <brian.starkey@arm.com>:

> Some parts of setting up the CRTC out-fence can be re-used for
> writeback out-fences. Factor this out into a separate function.
> 
> Signed-off-by: Brian Starkey <brian.starkey@arm.com>
> ---
>  drivers/gpu/drm/drm_atomic.c |   64 +++++++++++++++++++++++++++---------------
>  1 file changed, 42 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index f434f34..3f8fc97 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1693,37 +1693,46 @@ void drm_atomic_clean_old_fb(struct drm_device *dev,
>  }
>  EXPORT_SYMBOL(drm_atomic_clean_old_fb);
>  
> -static int crtc_setup_out_fence(struct drm_crtc *crtc,
> -				struct drm_crtc_state *crtc_state,
> -				struct drm_out_fence_state *fence_state)
> +static struct fence *get_crtc_fence(struct drm_crtc *crtc,
> +				    struct drm_crtc_state *crtc_state)
>  {
>  	struct fence *fence;
>  
> -	fence_state->fd = get_unused_fd_flags(O_CLOEXEC);
> -	if (fence_state->fd < 0) {
> -		return fence_state->fd;
> -	}
> -
> -	fence_state->out_fence_ptr = crtc_state->out_fence_ptr;
> -	crtc_state->out_fence_ptr = NULL;
> -
> -	if (put_user(fence_state->fd, fence_state->out_fence_ptr))
> -		return -EFAULT;
> -
>  	fence = kzalloc(sizeof(*fence), GFP_KERNEL);
>  	if (!fence)
> -		return -ENOMEM;
> +		return NULL;
>  
>  	fence_init(fence, &drm_crtc_fence_ops, &crtc->fence_lock,
>  		   crtc->fence_context, ++crtc->fence_seqno);
>  
> +	crtc_state->event->base.fence = fence_get(fence);
> +
> +	return fence;
> +}
> +
> +static int setup_out_fence(struct drm_out_fence_state *fence_state,
> +			   u64 __user *out_fence_ptr,
> +			   struct fence *fence)
> +{
> +	int ret;
> +
> +	DRM_DEBUG_ATOMIC("Putting out-fence %p into user ptr: %p\n",
> +			 fence, out_fence_ptr);

%p should be kept for your internal debug only. Make sure to remove
anything that exposes kernel address when sending patches.

Gustavo


  parent reply	other threads:[~2016-10-26 21:45 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26  8:54 [RFC PATCH v2 0/9] Introduce writeback connectors Brian Starkey
2016-10-26  8:54 ` Brian Starkey
2016-10-26  8:55 ` [RFC PATCH v2 1/9] drm: Add writeback connector type Brian Starkey
2016-10-26  8:55   ` Brian Starkey
2016-10-26 11:00   ` Daniel Vetter
2016-10-26 12:42     ` Brian Starkey
2016-10-26 13:05       ` Daniel Vetter
2016-10-26  8:55 ` [RFC PATCH v2 2/9] drm: mali-dp: Clear CVAL when leaving config mode Brian Starkey
2016-10-26  8:55 ` [RFC PATCH v2 3/9] drm: mali-dp: Rename malidp_input_format Brian Starkey
2016-10-26  8:55   ` Brian Starkey
2016-10-26  8:55 ` [RFC PATCH v2 4/9] drm: mali-dp: Add RGB writeback formats for DP550/DP650 Brian Starkey
2016-10-26  8:55   ` Brian Starkey
2016-10-26  8:55 ` [RFC PATCH v2 5/9] drm: mali-dp: Add support for writeback on DP550/DP650 Brian Starkey
2016-10-26  8:55   ` Brian Starkey
2016-10-26  8:55 ` [RFC PATCH v2 6/9] drm: mali-dp: Add writeback connector Brian Starkey
2016-10-26  8:55   ` Brian Starkey
2016-10-26  8:55 ` [RFC PATCH v2 7/9] drm: atomic: factor out common out-fence operations Brian Starkey
2016-10-26  8:55   ` Brian Starkey
2016-10-26 11:01   ` Daniel Vetter
2016-10-26 11:01     ` Daniel Vetter
2016-10-26 11:10   ` Brian Starkey
2016-10-26 11:10     ` Brian Starkey
2016-10-26 21:30   ` Gustavo Padovan
2016-10-26 21:30     ` Gustavo Padovan
2016-10-26 21:45   ` Gustavo Padovan [this message]
2016-10-26 21:45     ` Gustavo Padovan
2016-10-27  8:28     ` Brian Starkey
2016-10-27  8:28       ` Brian Starkey
2016-10-26  8:55 ` [RFC PATCH v2 8/9] drm: writeback: Add out-fences for writeback connectors Brian Starkey
2016-10-26  8:55   ` Brian Starkey
2016-10-26 11:09   ` Daniel Vetter
2016-10-26 12:46   ` Brian Starkey
2016-10-26 21:40   ` Gustavo Padovan
2016-10-27 10:07     ` Brian Starkey
2016-10-27 10:07       ` Brian Starkey
2016-10-26  8:55 ` [RFC PATCH v2 9/9] drm: mali-dp: Add writeback out-fence support Brian Starkey
2016-10-26  8:55   ` Brian Starkey
2016-10-26 21:43   ` Gustavo Padovan
2016-10-26 21:43     ` Gustavo Padovan
2016-10-27 10:18     ` Brian Starkey
2016-10-27 10:18       ` Brian Starkey
2016-10-27 11:25       ` Gustavo Padovan
2016-10-27 11:25         ` Gustavo Padovan
2016-10-27 14:11         ` Daniel Vetter
2016-10-27 14:11           ` Daniel Vetter

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=20161026214514.GI12629@joana \
    --to=gustavo@padovan.org \
    --cc=brian.starkey@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    /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.