All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Chunming Zhou <zhoucm1@amd.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Alex Deucher <alexander.deucher@amd.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [PATCH 1/3] dma-buf: add dma_fence_get_stub
Date: Mon, 3 Dec 2018 14:40:37 +0100	[thread overview]
Message-ID: <ec4e9c80-7489-9fec-dea1-67a63af2b308@gmail.com> (raw)
In-Reply-To: <e753355c-ab21-abd6-4cc6-4df785d31889@amd.com>

Am 03.12.18 um 14:33 schrieb Chunming Zhou:
> The series is Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
>
> for patch#2, please remove my Signed-off-by, it's new when using stub
> from dma-fence.

Yeah, ok. There is indeed nothing left from your original code.

Alex, Daniel, Chris any objections that I push the first two patches in 
this series to drm-misc-next?

Shouldn't be any functional change,
Christian.

>
>
> -David
>
>
> 在 2018/12/3 21:07, Christian König 写道:
>> Extract of useful code from the timeline work. This provides a function
>> to return a stub or dummy fence which is always signaled.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>>    drivers/dma-buf/dma-fence.c | 36 +++++++++++++++++++++++++++++++++++-
>>    include/linux/dma-fence.h   |  1 +
>>    2 files changed, 36 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
>> index 1551ca7df394..136ec04d683f 100644
>> --- a/drivers/dma-buf/dma-fence.c
>> +++ b/drivers/dma-buf/dma-fence.c
>> @@ -30,13 +30,16 @@
>>    EXPORT_TRACEPOINT_SYMBOL(dma_fence_emit);
>>    EXPORT_TRACEPOINT_SYMBOL(dma_fence_enable_signal);
>>    
>> +static DEFINE_SPINLOCK(dma_fence_stub_lock);
>> +static struct dma_fence dma_fence_stub;
>> +
>>    /*
>>     * fence context counter: each execution context should have its own
>>     * fence context, this allows checking if fences belong to the same
>>     * context or not. One device can have multiple separate contexts,
>>     * and they're used if some engine can run independently of another.
>>     */
>> -static atomic64_t dma_fence_context_counter = ATOMIC64_INIT(0);
>> +static atomic64_t dma_fence_context_counter = ATOMIC64_INIT(1);
>>    
>>    /**
>>     * DOC: DMA fences overview
>> @@ -68,6 +71,37 @@ static atomic64_t dma_fence_context_counter = ATOMIC64_INIT(0);
>>     *   &dma_buf.resv pointer.
>>     */
>>    
>> +static const char *dma_fence_stub_get_name(struct dma_fence *fence)
>> +{
>> +        return "stub";
>> +}
>> +
>> +static const struct dma_fence_ops dma_fence_stub_ops = {
>> +	.get_driver_name = dma_fence_stub_get_name,
>> +	.get_timeline_name = dma_fence_stub_get_name,
>> +};
>> +
>> +/**
>> + * dma_fence_get_stub - return a signaled fence
>> + *
>> + * Return a stub fence which is already signaled.
>> + */
>> +struct dma_fence *dma_fence_get_stub(void)
>> +{
>> +	spin_lock(&dma_fence_stub_lock);
>> +	if (!dma_fence_stub.ops) {
>> +		dma_fence_init(&dma_fence_stub,
>> +			       &dma_fence_stub_ops,
>> +			       &dma_fence_stub_lock,
>> +			       0, 0);
>> +		dma_fence_signal_locked(&dma_fence_stub);
>> +	}
>> +	spin_unlock(&dma_fence_stub_lock);
>> +
>> +	return dma_fence_get(&dma_fence_stub);
>> +}
>> +EXPORT_SYMBOL(dma_fence_get_stub);
>> +
>>    /**
>>     * dma_fence_context_alloc - allocate an array of fence contexts
>>     * @num: amount of contexts to allocate
>> diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
>> index 02dba8cd033d..999e4b104410 100644
>> --- a/include/linux/dma-fence.h
>> +++ b/include/linux/dma-fence.h
>> @@ -541,6 +541,7 @@ static inline signed long dma_fence_wait(struct dma_fence *fence, bool intr)
>>    	return ret < 0 ? ret : 0;
>>    }
>>    
>> +struct dma_fence *dma_fence_get_stub(void);
>>    u64 dma_fence_context_alloc(unsigned num);
>>    
>>    #define DMA_FENCE_TRACE(f, fmt, args...) \
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

  reply	other threads:[~2018-12-03 13:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03 13:07 [PATCH 1/3] dma-buf: add dma_fence_get_stub Christian König
2018-12-03 13:07 ` [PATCH 2/3] drm/syncobj: use dma_fence_get_stub Christian König
     [not found]   ` <20181203130759.10226-2-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-12-03 16:05     ` Chris Wilson
2018-12-03 13:07 ` [PATCH 3/3] drm/amdgpu: fix NULL fence handling in amdgpu_cs_fence_to_handle_ioctl Christian König
2018-12-03 13:33 ` [PATCH 1/3] dma-buf: add dma_fence_get_stub Chunming Zhou
2018-12-03 13:40   ` Christian König [this message]
2018-12-03 15:53     ` Alex Deucher
2018-12-03 16:07       ` Chris Wilson
     [not found] ` <20181203130759.10226-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-12-03 16:04   ` Chris Wilson
2018-12-03 16:08   ` Eric Anholt
2018-12-03 16:12     ` Christian König
     [not found]       ` <bd9e0b64-4fb0-400b-ce27-439bc54bf315-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-12-03 17:01         ` Eric Anholt
2018-12-03 17:06         ` Chris Wilson
2018-12-03 18:35           ` Christian König
     [not found]     ` <878t16fv93.fsf-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>
2018-12-03 16:12       ` Chris Wilson

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=ec4e9c80-7489-9fec-dea1-67a63af2b308@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=zhoucm1@amd.com \
    /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.