Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1456912

Re: [PATCH v5 5/5] dma-buf/sync_file: only enable fence signalling on poll()

From Chris Wilson <chris@chris-wilson.co.uk>
Newsgroups linux.kernel
Subject Re: [PATCH v5 5/5] dma-buf/sync_file: only enable fence signalling on poll()
Date 2016-08-05 09:30 +0200
Message-ID <s2HJU-4rz-23@gated-at.bofh.it> (permalink)
References <s2D3z-1uF-1@gated-at.bofh.it> <s2D3z-1uF-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Aug 04, 2016 at 11:24:14PM -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> Signalling doesn't need to be enabled at sync_file creation, it is only
> required if userspace waiting the fence to signal through poll().
> 
> Thus we delay fence_add_callback() until poll is called. It only adds the
> callback the first time poll() is called. This avoid re-adding the same
> callback multiple times.
> 
> v2: rebase and update to work with new fence support for sync_file
> 
> v3: use atomic operation to set enabled and protect fence_add_callback()
> 
> v4: use user bit from fence flags (comment from Chris Wilson)
> 
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
> +	if (!test_and_set_bit(POLL_ENABLED, &sync_file->fence->flags)) {
> +		if (fence_add_callback(sync_file->fence, &sync_file->cb,
> +				   fence_check_cb_func) < 0)
> +			wake_up_all(&sync_file->wq);
> +	}
> +
>  	status = fence_is_signaled(sync_file->fence);

status can only be true/false here.
	return fence_is_signaled(sync_file->fence) ? POLLIN : 0;

Reviwed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5 1/5] dma-buf/fence-array: add fence_is_array() Gustavo Padovan <gustavo@padovan.org> - 2016-08-05 04:30 +0200
  [PATCH v5 4/5] Documentation: add doc for sync_file_get_fence() Gustavo Padovan <gustavo@padovan.org> - 2016-08-05 04:30 +0200
    Re: [PATCH v5 4/5] Documentation: add doc for sync_file_get_fence() Chris Wilson <chris@chris-wilson.co.uk> - 2016-08-05 09:30 +0200
  [PATCH v5 5/5] dma-buf/sync_file: only enable fence signalling on poll() Gustavo Padovan <gustavo@padovan.org> - 2016-08-05 04:30 +0200
    Re: [PATCH v5 5/5] dma-buf/sync_file: only enable fence signalling  on poll() Chris Wilson <chris@chris-wilson.co.uk> - 2016-08-05 09:30 +0200
      Re: [PATCH v5 5/5] dma-buf/sync_file: only enable fence signalling  on poll() Chris Wilson <chris@chris-wilson.co.uk> - 2016-08-05 09:50 +0200
  [PATCH v5 2/5] dma-buf/sync_file: refactor fence storage in struct sync_file Gustavo Padovan <gustavo@padovan.org> - 2016-08-05 04:30 +0200
  [PATCH v5 3/5] dma-buf/sync_file: add sync_file_get_fence() Gustavo Padovan <gustavo@padovan.org> - 2016-08-05 04:40 +0200

csiph-web