All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
To: "Chris Wilson"
	<chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>,
	"Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>,
	"Mario Kleiner"
	<mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH] drm/i915: Before pageflip, also wait for shared dmabuf fences.
Date: Tue, 13 Sep 2016 14:52:01 +0200	[thread overview]
Message-ID: <9c0f86d0-eb23-7110-c663-01859132ac83@vodafone.de> (raw)
In-Reply-To: <20160913093945.GA25204-aII6DKEyn0pWYbfKqPwjAkR8Iwp7RQ6xAL8bYrjMMd8@public.gmane.org>

Am 13.09.2016 um 11:39 schrieb Chris Wilson:
> On Tue, Sep 13, 2016 at 10:44:11AM +0200, Christian König wrote:
>> Am 09.09.2016 um 03:15 schrieb Michel Dänzer:
>>> On 09/09/16 01:23 AM, Chris Wilson wrote:
>>>> On Thu, Sep 08, 2016 at 05:21:42PM +0200, Mario Kleiner wrote:
>>>>> On 09/08/2016 08:30 AM, Chris Wilson wrote:
>>>>>> On Thu, Sep 08, 2016 at 02:14:43AM +0200, Mario Kleiner wrote:
>>>>>>> amdgpu-kms uses shared fences for its prime exported dmabufs,
>>>>>>> instead of an exclusive fence. Therefore we need to wait for
>>>>>>> all fences of the dmabuf reservation object to prevent
>>>>>>> unsynchronized rendering and flipping.
>>>>>> No. Fix the root cause as this affects not just flips but copies -
>>>>>> this implies that everybody using the resv object must wait for all
>>>>>> fences. The resv object is not just used for prime, but all fencing, so
>>>>>> this breaks the ability to schedule parallel operations across engine.
>>>>>> -Chris
>>>>>>
>>>>> Ok. I think i now understand the difference, but let's check: The
>>>>> exclusive fence is essentially acting a bit like a write-lock, and
>>>>> the shared fences as readers-locks? So you can have multiple readers
>>>>> but only one writer at a time?
>>>> That's how we (i915.ko and I hope the rest of the world) are using them.
>>>> In the model where here is just one reservation object on the GEM
>>>> object, that reservation object is then shared between internal driver
>>>> scheduling and external. We are reliant on being able to use buffers on
>>>> multiple engines through the virtue of the shared fences, and to serialise
>>>> after writes by waiting on the exclusive fence. (So we can have concurrent
>>>> reads on the display engine, render engines and on the CPU - or
>>>> alternatively an exclusive writer.)
>>>>
>>>> In the near future, i915 flips will wait on the common reservation object
>>>> not only for dma-bufs, but also its own GEM objects.
>>>>> Ie.:
>>>>>
>>>>> Writer must wait for all fences before starting write access to a
>>>>> buffer, then attach the exclusive fence and signal it on end of
>>>>> write access. E.g., write to renderbuffer, write to texture etc.
>>>> Yes.
>>>>> Readers must wait for exclusive fence, then attach a shared fence
>>>>> per reader and signal it on end of read access? E.g., read from
>>>>> texture, fb, scanout?
>>>> Yes.
>>>>> Is that correct? In that case we'd have a missing exclusive fence in
>>>>> amdgpu for the linear target dmabuf? Probably beyond my level of
>>>>> knowledge to fix this?
>>>> i915.ko requires the client to mark which buffers are written to.
>>>>
>>>> In ttm, there are ttm_validate_buffer objects which mark whether they
>>>> should be using shared or exclusive fences. Afaict, in amdgpu they are
>>>> all set to shared, the relevant user interface seems to be
>>>> amdgpu_bo_list_set().
>>> This all makes sense to me.
>>>
>>> Christian, why is amdgpu setting only shared fences? Can we fix that?
>> No, amdgpu relies on the fact that we even allow concurrent write
>> accesses by userspace.
>>
>> E.g. one part of the buffer can be rendered by one engine while
>> another part could be rendered by another engine.
>>
>> Just imagine X which is composing a buffer with both the 3D engine
>> as well as the DMA engine.
>>
>> All engines need to run in parallel and you need to wait for all of
>> them to finish before scanout.
>>
>> Everybody which needs exclusive access to the reservation object
>> (like scanouts do) needs to wait for all fences, not just the
>> exclusive one.
>>
>> The Intel driver clearly needs to be fixed here.
> If you are not using implicit fencing, you have to pass explicit fences
> instead.

Which is exactly what we do, but only for the driver internally command 
submissions.

All command submissions from the same process can run concurrently with 
amdgpu, only when we see a fence from another driver or process we wait 
for it to complete before starting to run a command submission.

Other drivers can't make any assumption on what a shared access is 
actually doing (e.g. writing or reading) with a buffer.

So the model i915.ko is using the reservation object and it's shared 
fences is certainly not correct and needs to be fixed.

Regards,
Christian.

> -Chris
>

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2016-09-13 12:52 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08  0:14 [PATCH] drm/i915: Before pageflip, also wait for shared dmabuf fences Mario Kleiner
2016-09-08  6:30 ` Chris Wilson
2016-09-08 15:21   ` Mario Kleiner
2016-09-08 16:23     ` Chris Wilson
     [not found]       ` <20160908162346.GA5479-aII6DKEyn0pWYbfKqPwjAkR8Iwp7RQ6xAL8bYrjMMd8@public.gmane.org>
2016-09-09  1:15         ` Michel Dänzer
     [not found]           ` <abccc8ac-10c6-ab22-c59d-f43ee48ba78d-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-13  8:44             ` Christian König
2016-09-13  9:39               ` Chris Wilson
     [not found]                 ` <20160913093945.GA25204-aII6DKEyn0pWYbfKqPwjAkR8Iwp7RQ6xAL8bYrjMMd8@public.gmane.org>
2016-09-13 12:52                   ` Christian König [this message]
2016-09-21  9:56                     ` Michel Dänzer
     [not found]                       ` <7aafce92-8bcf-1c5c-45de-9e8ecda85239-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-21 10:30                         ` Christian König
2016-09-21 11:04                           ` Daniel Vetter
     [not found]                             ` <CAKMK7uG3j54NzwjxmWuSmP787r+QN-Cu5T8R-naX6S9RvvKemw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-21 11:19                               ` Christian König
2016-09-21 12:56                                 ` Daniel Vetter
     [not found]                                   ` <CAKMK7uH6N2Kgwkf-11iwdqDAUrFmreYKLLeTGXmEh+N0DQ4tJg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-21 15:07                                     ` Michel Dänzer
     [not found]                                       ` <9d1f4872-cabd-bd1b-7f10-6e4230a1f58c-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-21 15:15                                         ` Christian König
     [not found]                                           ` <5c2048ff-0e20-ddf3-2d73-9a3acb38e7ff-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-09-21 15:29                                             ` Michel Dänzer
2016-09-21 16:23                                               ` Christian König
2016-09-22  6:36                                                 ` Daniel Vetter
     [not found]                                                   ` <20160922063625.GD22164-XQyZGdhdUcTMwUGJfOwWj/ooFf0ArEBIu+b9c/7xato@public.gmane.org>
2016-09-22 10:55                                                     ` Christian König
2016-09-22 12:26                                                       ` Daniel Vetter
2016-09-22 12:44                                                         ` Christian König
2016-09-22 13:05                                                           ` Daniel Vetter
2016-09-22 13:22                                                             ` Christian König
     [not found]                                                               ` <d2430ff8-43bd-bff2-9b02-847cabfd56c0-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-09-23 10:00                                                                 ` Michel Dänzer
2016-09-23 12:09                                                                   ` Daniel Vetter
2016-09-26  0:48                                                                     ` Michel Dänzer
2016-09-26  8:04                                                                       ` Daniel Vetter
     [not found]                                                                         ` <20160926080419.GV20761-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2016-10-07 12:34                                                                           ` Mike Lothian
     [not found]                                                                             ` <CAHbf0-HZ6EotqwgvkxRTdRF97xB3qBA=DRKAzaAXguV_PR_P8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-11  3:58                                                                               ` Michel Dänzer
     [not found]                                                                                 ` <d74d34a7-5221-d282-d9d1-b0e1007fc0c7-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-10-11 12:04                                                                                   ` Christian König
     [not found]                                                                                     ` <c77a2cb9-1f0e-f1a3-aedd-a111cd6ba8e8-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-10-12  0:40                                                                                       ` Michel Dänzer
2016-10-27 13:33                                                                                         ` Mike Lothian
     [not found]                                                                                           ` <CAHbf0-GGMWZrhB+PKpc-QbD__6fqB4pQVFfN+gzLWNhi+DuG3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-28  1:34                                                                                             ` Michel Dänzer
2016-10-28 17:37                                                                                               ` Mario Kleiner
     [not found]                                                                                                 ` <7eb19a73-a558-d2e6-bd8d-34fe95045dfd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-10-28 17:48                                                                                                   ` Christian König
2016-11-05  1:17                                                                                                     ` Mario Kleiner
2016-10-31  6:41                                                                                                   ` Michel Dänzer
2016-10-28 18:37                                                                                                 ` Mike Lothian
2016-10-29 13:58                                                                                                   ` Mike Lothian
     [not found]                                                                                                     ` <CAHbf0-EY2OM_HgxTjmMi4-f5TQ8fkqf5XYBxHZtJVsnSpxPyyA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-31  6:44                                                                                                       ` Michel Dänzer
     [not found]                                                                                                         ` <c45e2f4c-c075-47b6-7e02-3bd98748c83a-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-10-31  8:00                                                                                                           ` Christian König
2016-10-31  8:06                                                                                                             ` Michel Dänzer
2016-09-22  6:33                                         ` Daniel Vetter
2016-09-21 15:13                           ` Michel Dänzer
     [not found]                             ` <f0e034f9-db22-6577-97c7-dd8d3e851226-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-21 15:21                               ` Christian König
2016-09-21 15:28                                 ` Michel Dänzer

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=9c0f86d0-eb23-7110-c663-01859132ac83@vodafone.de \
    --to=deathsimple-antagkrnahcb1svskn2v4q@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=michel-otUistvHUpPR7s880joybQ@public.gmane.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.