From: Pekka Paalanen <ppaalanen@gmail.com>
To: Rob Clark <robdclark@gmail.com>
Cc: "Luben Tuikov" <luben.tuikov@amd.com>,
"Rob Clark" <robdclark@chromium.org>,
"Gustavo Padovan" <gustavo@padovan.org>,
"Tvrtko Ursulin" <tvrtko.ursulin@intel.com>,
"Christian König" <ckoenig.leichtzumerken@gmail.com>,
"Michel Dänzer" <michel@daenzer.net>,
"open list" <linux-kernel@vger.kernel.org>,
dri-devel@lists.freedesktop.org,
"Christian König" <christian.koenig@amd.com>,
"moderated list:DMA BUFFER SHARING FRAMEWORK"
<linaro-mm-sig@lists.linaro.org>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
freedreno@lists.freedesktop.org,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"open list:SYNC FILE FRAMEWORK" <linux-media@vger.kernel.org>
Subject: Re: [PATCH v4 06/14] dma-buf/sync_file: Support (E)POLLPRI
Date: Thu, 23 Feb 2023 11:38:14 +0200 [thread overview]
Message-ID: <20230223113814.3010cedc@eldfell> (raw)
In-Reply-To: <CAF6AEGs1_75gg+LCBj6=PH8Jn60PXiE+Kx_2636nP-+pajN8Hg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4694 bytes --]
On Wed, 22 Feb 2023 07:37:26 -0800
Rob Clark <robdclark@gmail.com> wrote:
> On Wed, Feb 22, 2023 at 1:49 AM Pekka Paalanen <ppaalanen@gmail.com> wrote:
> >
> > On Tue, 21 Feb 2023 09:53:56 -0800
> > Rob Clark <robdclark@gmail.com> wrote:
> >
> > > On Tue, Feb 21, 2023 at 8:48 AM Luben Tuikov <luben.tuikov@amd.com> wrote:
> > > >
> > > > On 2023-02-20 11:14, Rob Clark wrote:
> > > > > On Mon, Feb 20, 2023 at 12:53 AM Pekka Paalanen <ppaalanen@gmail.com> wrote:
> > > > >>
> > > > >> On Sat, 18 Feb 2023 13:15:49 -0800
> > > > >> Rob Clark <robdclark@gmail.com> wrote:
> > > > >>
> > > > >>> From: Rob Clark <robdclark@chromium.org>
> > > > >>>
> > > > >>> Allow userspace to use the EPOLLPRI/POLLPRI flag to indicate an urgent
> > > > >>> wait (as opposed to a "housekeeping" wait to know when to cleanup after
> > > > >>> some work has completed). Usermode components of GPU driver stacks
> > > > >>> often poll() on fence fd's to know when it is safe to do things like
> > > > >>> free or reuse a buffer, but they can also poll() on a fence fd when
> > > > >>> waiting to read back results from the GPU. The EPOLLPRI/POLLPRI flag
> > > > >>> lets the kernel differentiate these two cases.
> > > > >>>
> > > > >>> Signed-off-by: Rob Clark <robdclark@chromium.org>
> > > > >>
> > > > >> Hi,
> > > > >>
> > > > >> where would the UAPI documentation of this go?
> > > > >> It seems to be missing.
> > > > >
> > > > > Good question, I am not sure. The poll() man page has a description,
> > > > > but my usage doesn't fit that _exactly_ (but OTOH the description is a
> > > > > bit vague).
> > > > >
> > > > >> If a Wayland compositor is polling application fences to know which
> > > > >> client buffer to use in its rendering, should the compositor poll with
> > > > >> PRI or not? If a compositor polls with PRI, then all fences from all
> > > > >> applications would always be PRI. Would that be harmful somehow or
> > > > >> would it be beneficial?
> > > > >
> > > > > I think a compositor would rather use the deadline ioctl and then poll
> > > > > without PRI. Otherwise you are giving an urgency signal to the fence
> > > > > signaller which might not necessarily be needed.
> > > > >
> > > > > The places where I expect PRI to be useful is more in mesa (things
> > > > > like glFinish(), readpix, and other similar sorts of blocking APIs)
> > > > Hi,
> > > >
> > > > Hmm, but then user-space could do the opposite, namely, submit work as usual--never
> > > > using the SET_DEADLINE ioctl, and then at the end, poll using (E)POLLPRI. That seems
> > > > like a possible usage pattern, unintended--maybe, but possible. Do we want to discourage
> > > > this? Wouldn't SET_DEADLINE be enough? I mean, one can call SET_DEADLINE with the current
> > > > time, and then wouldn't that be equivalent to (E)POLLPRI?
> > >
> > > Yeah, (E)POLLPRI isn't strictly needed if we have SET_DEADLINE. It is
> > > slightly more convenient if you want an immediate deadline (single
> > > syscall instead of two), but not strictly needed. OTOH it piggy-backs
> > > on existing UABI.
> >
> > In that case, I would be conservative, and not add the POLLPRI
> > semantics. An UAPI addition that is not strictly needed and somewhat
> > unclear if it violates any design principles is best not done, until it
> > is proven to be beneficial.
> >
> > Besides, a Wayland compositor does not necessary need to add the fd
> > to its main event loop for poll. It could just SET_DEADLINE, and then
> > when it renders simply check if the fence passed or not already. Not
> > polling means the compositor does not need to wake up at the moment the
> > fence signals to just record a flag.
>
> poll(POLLPRI) isn't intended for wayland.. but is a thing I want in
> mesa for fence waits. I _could_ use SET_DEADLINE but it is two
> syscalls and correspondingly more code ;-)
But is it actually beneficial? "More code" seems quite irrelevant.
Would there be a hundred or more of those per frame? Or would it be
always limited to one or two? Or totally depend on what the application
is doing? Is it a significant impact?
> > On another matter, if the application uses SET_DEADLINE with one
> > timestamp, and the compositor uses SET_DEADLINE on the same thing with
> > another timestamp, what should happen?
>
> The expectation is that many deadline hints can be set on a fence.
> The fence signaller should track the soonest deadline.
You need to document that as UAPI, since it is observable to userspace.
It would be bad if drivers or subsystems would differ in behaviour.
Thanks,
pq
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-02-23 9:39 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-18 21:15 [PATCH v4 00/14] dma-fence: Deadline awareness Rob Clark
2023-02-18 21:15 ` [PATCH v4 01/14] dma-buf/dma-fence: Add deadline awareness Rob Clark
2023-02-22 10:23 ` Tvrtko Ursulin
2023-02-22 15:28 ` Christian König
2023-02-22 17:04 ` Tvrtko Ursulin
2023-02-22 17:16 ` Rob Clark
2023-02-22 17:33 ` Tvrtko Ursulin
2023-02-22 18:57 ` Rob Clark
2023-02-22 11:01 ` Luben Tuikov
2023-02-18 21:15 ` [PATCH v4 02/14] dma-buf/fence-array: Add fence deadline support Rob Clark
2023-02-18 21:15 ` [PATCH v4 03/14] dma-buf/fence-chain: " Rob Clark
2023-02-22 10:27 ` Tvrtko Ursulin
2023-02-22 15:55 ` Rob Clark
2023-02-18 21:15 ` [PATCH v4 04/14] dma-buf/dma-resv: Add a way to set fence deadline Rob Clark
2023-02-20 8:16 ` Christian König
2023-02-18 21:15 ` [PATCH v4 05/14] dma-buf/sync_file: Add SET_DEADLINE ioctl Rob Clark
2023-02-20 8:27 ` Christian König
2023-02-20 16:09 ` Rob Clark
2023-02-21 8:41 ` Pekka Paalanen
2023-02-23 9:19 ` Christian König
2023-02-20 8:48 ` Pekka Paalanen
2023-02-18 21:15 ` [PATCH v4 06/14] dma-buf/sync_file: Support (E)POLLPRI Rob Clark
2023-02-20 8:31 ` Christian König
2023-02-21 8:38 ` Pekka Paalanen
2023-02-20 8:53 ` Pekka Paalanen
2023-02-20 16:14 ` Rob Clark
2023-02-21 8:37 ` Pekka Paalanen
2023-02-21 16:01 ` Sebastian Wick
2023-02-21 17:55 ` Rob Clark
2023-02-21 16:48 ` Luben Tuikov
2023-02-21 17:53 ` Rob Clark
2023-02-22 9:49 ` Pekka Paalanen
2023-02-22 10:26 ` Luben Tuikov
2023-02-22 15:37 ` Rob Clark
2023-02-23 9:38 ` Pekka Paalanen [this message]
2023-02-23 18:51 ` Rob Clark
2023-02-24 9:26 ` Pekka Paalanen
2023-02-24 9:41 ` Tvrtko Ursulin
2023-02-24 10:24 ` Pekka Paalanen
2023-02-24 10:50 ` Tvrtko Ursulin
2023-02-24 11:00 ` Pekka Paalanen
2023-02-24 11:37 ` Tvrtko Ursulin
2023-02-24 15:26 ` Luben Tuikov
2023-02-24 17:59 ` Rob Clark
2023-02-27 21:35 ` Rodrigo Vivi
2023-02-27 22:20 ` Rob Clark
2023-02-27 22:44 ` Sebastian Wick
2023-02-27 23:48 ` Rob Clark
2023-02-28 14:30 ` Sebastian Wick
2023-02-28 22:52 ` Rob Clark
2023-03-01 15:31 ` Sebastian Wick
2023-03-01 16:02 ` Rob Clark
2023-03-01 15:45 ` Rodrigo Vivi
2023-02-24 16:59 ` Rob Clark
2023-02-24 19:44 ` Rob Clark
2023-02-27 9:34 ` Pekka Paalanen
2023-02-27 18:43 ` Rob Clark
2023-02-18 21:15 ` [PATCH v4 07/14] dma-buf/sw_sync: Add fence deadline support Rob Clark
2023-02-20 8:29 ` Christian König
2023-02-18 21:15 ` [PATCH v4 08/14] drm/scheduler: " Rob Clark
2023-02-21 19:40 ` Luben Tuikov
2023-02-18 21:15 ` [PATCH v4 12/14] drm/msm: Add deadline based boost support Rob Clark
2023-02-18 21:15 ` [PATCH v4 14/14] drm/i915: " Rob Clark
2023-02-20 15:46 ` Tvrtko Ursulin
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=20230223113814.3010cedc@eldfell \
--to=ppaalanen@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=gustavo@padovan.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=michel@daenzer.net \
--cc=robdclark@chromium.org \
--cc=robdclark@gmail.com \
--cc=rodrigo.vivi@intel.com \
--cc=sumit.semwal@linaro.org \
--cc=tvrtko.ursulin@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox