All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Pekka Paalanen <ppaalanen@gmail.com>
Cc: "Michel Dänzer" <michel@daenzer.net>,
	"Christian König" <ckoenig.leichtzumerken@gmail.com>,
	"Rob Clark" <robdclark@chromium.org>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Jack Zhang" <Jack.Zhang1@amd.com>,
	"Gustavo Padovan" <gustavo@padovan.org>,
	"open list" <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"moderated list:DMA BUFFER SHARING FRAMEWORK"
	<linaro-mm-sig@lists.linaro.org>,
	"Luben Tuikov" <luben.tuikov@amd.com>,
	"Roy Sun" <Roy.Sun@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Tian Tao" <tiantao6@hisilicon.com>,
	"Lee Jones" <lee.jones@linaro.org>,
	"open list:DMA BUFFER SHARING FRAMEWORK"
	<linux-media@vger.kernel.org>
Subject: Re: [RFC 0/4] dma-fence: Deadline awareness
Date: Thu, 29 Jul 2021 10:43:16 +0200	[thread overview]
Message-ID: <3675d530-c9fc-7ec9-e157-b6abeeec7c2a@amd.com> (raw)
In-Reply-To: <20210729112358.237651ff@eldfell>

Am 29.07.21 um 10:23 schrieb Pekka Paalanen:
> On Wed, 28 Jul 2021 16:30:13 +0200
> Christian König <christian.koenig@amd.com> wrote:
>
>> Am 28.07.21 um 15:57 schrieb Pekka Paalanen:
>>> On Wed, 28 Jul 2021 15:31:41 +0200
>>> Christian König <christian.koenig@amd.com> wrote:
>>>   
>>>> Am 28.07.21 um 15:24 schrieb Michel Dänzer:
>>>>> On 2021-07-28 3:13 p.m., Christian König wrote:
>>>>>> Am 28.07.21 um 15:08 schrieb Michel Dänzer:
>>>>>>> On 2021-07-28 1:36 p.m., Christian König wrote:
>>>>>>>> At least AMD hardware is already capable of flipping frames on GPU events like finishing rendering (or uploading etc).
>>>>>>>>
>>>>>>>> By waiting in userspace on the CPU before send the frame to the hardware you are completely killing of such features.
>>>>>>>>
>>>>>>>> For composing use cases that makes sense, but certainly not for full screen applications as far as I can see.
>>>>>>> Even for fullscreen, the current KMS API only allows queuing a single page flip per CRTC, with no way to cancel or otherwise modify it. Therefore, a Wayland compositor has to set a deadline for the next refresh cycle, and when the deadline passes, it has to select the best buffer available for the fullscreen surface. To make sure the flip will not miss the next refresh cycle, the compositor has to pick an idle buffer. If it picks a non-idle buffer, and the pending rendering does not finish in time for vertical blank, the flip will be delayed by at least one refresh cycle, which results in visible stuttering.
>>>>>>>
>>>>>>> (Until the deadline passes, the Wayland compositor can't even know if a previously fullscreen surface will still be fullscreen for the next refresh cycle)
>>>>>> Well then let's extend the KMS API instead of hacking together workarounds in userspace.
>>>>> That's indeed a possible solution for the fullscreen / direct scanout case.
>>>>>
>>>>> Not for the general compositing case though, since a compositor does not want to composite multiple output frames per display refresh cycle, so it has to make sure the one frame hits the target.
>>>> Yeah, that's true as well.
>>>>
>>>> At least as long as nobody invents a mechanism to do this decision on
>>>> the GPU instead.
>>> That would mean putting the whole window manager into the GPU.
>> Not really. You only need to decide if you want to use the new backing
>> store or the old one based on if the new surface is ready or not.
> Except that a window content update in Wayland must be synchronised with
> all the possible and arbitrary other window system state changes, that
> will affect how and where other windows will get drawn *this frame*,
> how input events are routed, and more.
>
> But, if the window manager made sure that *only* window contents are
> about to change and *all* other state remains as it was, then it would
> be possible to let the GPU decide which frame it uses. As long as it
> also tells back which one it actually did, so that presentation
> feedback etc. can trigger the right Wayland events.
>
> Wayland has "atomic commits" to windows, and arbitrary protocol
> extensions can add arbitrary state to be tracked with it. A bit like KMS
> properties. Even atomic commits affecting multiple windows together are
> a thing, and they must be latched either all or none.
>
> So it's quite a lot of work to determine if one can allow the GPU to
> choose the buffer it will texture from, or not.

But how does it then help to wait on the CPU instead?

See what I'm proposing is to either render the next state of the window 
or compose from the old state (including all atomic properties).

E.g. what do you do if you timeout and can't have the new window content 
on time? What's the fallback here?

Regards,
Christian.

>
>
> Thanks,
> pq


WARNING: multiple messages have this Message-ID (diff)
From: "Christian König" <christian.koenig@amd.com>
To: Pekka Paalanen <ppaalanen@gmail.com>
Cc: "Rob Clark" <robdclark@chromium.org>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Jack Zhang" <Jack.Zhang1@amd.com>,
	"Christian König" <ckoenig.leichtzumerken@gmail.com>,
	"Michel Dänzer" <michel@daenzer.net>,
	"open list" <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"moderated list:DMA BUFFER SHARING FRAMEWORK"
	<linaro-mm-sig@lists.linaro.org>,
	"Luben Tuikov" <luben.tuikov@amd.com>,
	"Roy Sun" <Roy.Sun@amd.com>,
	"Gustavo Padovan" <gustavo@padovan.org>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Tian Tao" <tiantao6@hisilicon.com>,
	"Lee Jones" <lee.jones@linaro.org>,
	"open list:DMA BUFFER SHARING FRAMEWORK"
	<linux-media@vger.kernel.org>
Subject: Re: [RFC 0/4] dma-fence: Deadline awareness
Date: Thu, 29 Jul 2021 10:43:16 +0200	[thread overview]
Message-ID: <3675d530-c9fc-7ec9-e157-b6abeeec7c2a@amd.com> (raw)
In-Reply-To: <20210729112358.237651ff@eldfell>

Am 29.07.21 um 10:23 schrieb Pekka Paalanen:
> On Wed, 28 Jul 2021 16:30:13 +0200
> Christian König <christian.koenig@amd.com> wrote:
>
>> Am 28.07.21 um 15:57 schrieb Pekka Paalanen:
>>> On Wed, 28 Jul 2021 15:31:41 +0200
>>> Christian König <christian.koenig@amd.com> wrote:
>>>   
>>>> Am 28.07.21 um 15:24 schrieb Michel Dänzer:
>>>>> On 2021-07-28 3:13 p.m., Christian König wrote:
>>>>>> Am 28.07.21 um 15:08 schrieb Michel Dänzer:
>>>>>>> On 2021-07-28 1:36 p.m., Christian König wrote:
>>>>>>>> At least AMD hardware is already capable of flipping frames on GPU events like finishing rendering (or uploading etc).
>>>>>>>>
>>>>>>>> By waiting in userspace on the CPU before send the frame to the hardware you are completely killing of such features.
>>>>>>>>
>>>>>>>> For composing use cases that makes sense, but certainly not for full screen applications as far as I can see.
>>>>>>> Even for fullscreen, the current KMS API only allows queuing a single page flip per CRTC, with no way to cancel or otherwise modify it. Therefore, a Wayland compositor has to set a deadline for the next refresh cycle, and when the deadline passes, it has to select the best buffer available for the fullscreen surface. To make sure the flip will not miss the next refresh cycle, the compositor has to pick an idle buffer. If it picks a non-idle buffer, and the pending rendering does not finish in time for vertical blank, the flip will be delayed by at least one refresh cycle, which results in visible stuttering.
>>>>>>>
>>>>>>> (Until the deadline passes, the Wayland compositor can't even know if a previously fullscreen surface will still be fullscreen for the next refresh cycle)
>>>>>> Well then let's extend the KMS API instead of hacking together workarounds in userspace.
>>>>> That's indeed a possible solution for the fullscreen / direct scanout case.
>>>>>
>>>>> Not for the general compositing case though, since a compositor does not want to composite multiple output frames per display refresh cycle, so it has to make sure the one frame hits the target.
>>>> Yeah, that's true as well.
>>>>
>>>> At least as long as nobody invents a mechanism to do this decision on
>>>> the GPU instead.
>>> That would mean putting the whole window manager into the GPU.
>> Not really. You only need to decide if you want to use the new backing
>> store or the old one based on if the new surface is ready or not.
> Except that a window content update in Wayland must be synchronised with
> all the possible and arbitrary other window system state changes, that
> will affect how and where other windows will get drawn *this frame*,
> how input events are routed, and more.
>
> But, if the window manager made sure that *only* window contents are
> about to change and *all* other state remains as it was, then it would
> be possible to let the GPU decide which frame it uses. As long as it
> also tells back which one it actually did, so that presentation
> feedback etc. can trigger the right Wayland events.
>
> Wayland has "atomic commits" to windows, and arbitrary protocol
> extensions can add arbitrary state to be tracked with it. A bit like KMS
> properties. Even atomic commits affecting multiple windows together are
> a thing, and they must be latched either all or none.
>
> So it's quite a lot of work to determine if one can allow the GPU to
> choose the buffer it will texture from, or not.

But how does it then help to wait on the CPU instead?

See what I'm proposing is to either render the next state of the window 
or compose from the old state (including all atomic properties).

E.g. what do you do if you timeout and can't have the new window content 
on time? What's the fallback here?

Regards,
Christian.

>
>
> Thanks,
> pq


  reply	other threads:[~2021-07-29  8:43 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-26 23:38 [RFC 0/4] dma-fence: Deadline awareness Rob Clark
2021-07-26 23:38 ` Rob Clark
2021-07-26 23:38 ` [RFC 1/4] dma-fence: Add deadline awareness Rob Clark
2021-07-26 23:38   ` Rob Clark
2021-07-27  7:11   ` Christian König
2021-07-27  7:11     ` Christian König
2021-07-27 14:25     ` Rob Clark
2021-07-27 14:25       ` Rob Clark
2021-07-28  7:03       ` Christian König
2021-07-28  7:03         ` Christian König
2021-07-28 11:37         ` Christian König
2021-07-28 11:37           ` Christian König
2021-07-28 15:15           ` Rob Clark
2021-07-28 15:15             ` Rob Clark
2021-07-28 17:23             ` Christian König
2021-07-28 17:23               ` Christian König
2021-07-28 17:58               ` Rob Clark
2021-07-28 17:58                 ` Rob Clark
2021-07-29  7:03                 ` Daniel Vetter
2021-07-29  7:03                   ` Daniel Vetter
2021-07-29 15:23                   ` Rob Clark
2021-07-29 15:23                     ` Rob Clark
2021-07-29 16:18                     ` Daniel Vetter
2021-07-29 16:18                       ` Daniel Vetter
2021-07-29 17:32                       ` Rob Clark
2021-07-29 17:32                         ` Rob Clark
2021-07-26 23:38 ` [RFC 2/4] drm/vblank: Add helper to get next vblank time Rob Clark
2021-07-26 23:38   ` Rob Clark
2021-07-26 23:38 ` [RFC 3/4] drm/atomic-helper: Set fence deadline for vblank Rob Clark
2021-07-26 23:38   ` Rob Clark
2021-07-27 10:44   ` Michel Dänzer
2021-07-27 10:44     ` Michel Dänzer
2021-07-27 14:33     ` Rob Clark
2021-07-27 14:33       ` Rob Clark
2021-07-26 23:38 ` [RFC 4/4] drm/scheduler: Add fence deadline support Rob Clark
2021-07-26 23:38   ` Rob Clark
2021-07-26 23:51 ` [RFC 0/4] dma-fence: Deadline awareness Rob Clark
2021-07-26 23:51   ` Rob Clark
2021-07-27 14:41 ` Michel Dänzer
2021-07-27 14:41   ` Michel Dänzer
2021-07-27 15:12   ` Rob Clark
2021-07-27 15:12     ` Rob Clark
2021-07-27 15:19     ` Michel Dänzer
2021-07-27 15:37       ` Rob Clark
2021-07-27 15:37         ` Rob Clark
2021-07-28 11:36         ` Christian König
2021-07-28 11:36           ` Christian König
2021-07-28 13:08           ` Michel Dänzer
2021-07-28 13:13             ` Christian König
2021-07-28 13:13               ` Christian König
2021-07-28 13:24               ` Michel Dänzer
2021-07-28 13:24                 ` Michel Dänzer
2021-07-28 13:31                 ` Christian König
2021-07-28 13:31                   ` Christian König
2021-07-28 13:57                   ` Pekka Paalanen
2021-07-28 13:57                     ` Pekka Paalanen
2021-07-28 14:30                     ` Christian König
2021-07-28 14:30                       ` Christian König
2021-07-29  8:08                       ` Michel Dänzer
2021-07-29  8:23                       ` Pekka Paalanen
2021-07-29  8:23                         ` Pekka Paalanen
2021-07-29  8:43                         ` Christian König [this message]
2021-07-29  8:43                           ` Christian König
2021-07-29  9:15                           ` Pekka Paalanen
2021-07-29  9:15                             ` Pekka Paalanen
2021-07-29 10:14                             ` Christian König
2021-07-29 10:14                               ` Christian König
2021-07-29 10:28                               ` Michel Dänzer
2021-07-29 10:28                                 ` Michel Dänzer
2021-07-29 11:00                               ` Pekka Paalanen
2021-07-29 11:00                                 ` Pekka Paalanen
2021-07-29 11:43                                 ` Christian König
2021-07-29 11:43                                   ` Christian König
2021-07-29 12:49                                   ` Pekka Paalanen
2021-07-29 12:49                                     ` Pekka Paalanen
2021-07-29 13:41                                     ` Christian König
2021-07-29 13:41                                       ` Christian König
2021-07-29 14:10                                       ` Pekka Paalanen
2021-07-29 14:10                                         ` Pekka Paalanen
2021-07-28 15:27                     ` Rob Clark
2021-07-28 15:27                       ` Rob Clark
2021-07-28 17:20                       ` Christian König
2021-07-28 15:34                 ` Rob Clark
2021-07-28 15:34                   ` Rob Clark
2021-07-29  7:09                   ` Daniel Vetter
2021-07-29  7:09                     ` Daniel Vetter
2021-07-29  8:17                     ` Michel Dänzer
2021-07-29  8:17                       ` Michel Dänzer
2021-07-29  9:03                       ` Daniel Vetter
2021-07-29  9:03                         ` Daniel Vetter
2021-07-29  9:37                         ` Pekka Paalanen
2021-07-29  9:37                           ` Pekka Paalanen
2021-07-29 12:18                           ` Daniel Vetter
2021-07-29 12:18                             ` Daniel Vetter
2021-07-29 12:59                             ` Pekka Paalanen
2021-07-29 12:59                               ` Pekka Paalanen
2021-07-29 14:05                               ` Daniel Vetter
2021-07-29 14:05                                 ` Daniel Vetter
2021-07-27 21:17 ` [RFC 5/4] drm/msm: Add deadline based boost support Rob Clark
2021-07-27 21:17   ` Rob Clark

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=3675d530-c9fc-7ec9-e157-b6abeeec7c2a@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Jack.Zhang1@amd.com \
    --cc=Roy.Sun@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=lee.jones@linaro.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=luben.tuikov@amd.com \
    --cc=matthew.brost@intel.com \
    --cc=michel@daenzer.net \
    --cc=ppaalanen@gmail.com \
    --cc=robdclark@chromium.org \
    --cc=tiantao6@hisilicon.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.