All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Pekka Paalanen <ppaalanen@gmail.com>
Cc: andrealmeid@igalia.com, Simon Ser <contact@emersion.fr>,
	dri-devel@lists.freedesktop.org,
	wayland-devel@lists.freedesktop.org, mwen@igalia.com,
	amd-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch,
	alexander.deucher@amd.com, hwentlan@amd.com,
	nicholas.kazlauskas@amd.com, joshua@froggi.es
Subject: Re: KMS atomic state sets, full vs. minimal (Re: [PATCH v3 0/6] Add support for atomic async page-flips)
Date: Mon, 3 Oct 2022 12:04:29 +0300	[thread overview]
Message-ID: <YzqlnYrg+yAZ/SNt@intel.com> (raw)
In-Reply-To: <20221003114849.09265089@eldfell>

On Mon, Oct 03, 2022 at 11:48:49AM +0300, Pekka Paalanen wrote:
> On Fri, 30 Sep 2022 18:45:09 +0300
> Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> 
> > On Fri, Sep 30, 2022 at 06:37:00PM +0300, Pekka Paalanen wrote:
> > > On Fri, 30 Sep 2022 18:09:55 +0300
> > > Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > >   
> > > > That would actively discourage people from even attempting the
> > > > "just dump all the state into the ioctl" approach with async flips
> > > > since even the props whose value isn't even changing would be rejected.  
> > > 
> > > About that.
> > > 
> > > To me it looks like just a classic case of broken communication.
> > > 
> > > The kernel developers assume that of course userspace will minimize the
> > > state set to only those properties that change, because...?
> > > 
> > > Userspace developers think that of course the kernel will optimize the
> > > state set into minimal changes, because the kernel actually has the
> > > authoritative knowledge of what the current state is, and the driver
> > > actually knows which properties are costly and need to be optimized and
> > > which ones don't matter. It has never even occurred to me that the
> > > kernel would not compare next state to current state.
> > > 
> > > No-one ever documented any expectations, did they?  
> > 
> > Do you really want that for async flips? Async flips can't be
> > done atomically with anything else, so why are you even asking
> > the kernel to do that?
> 
> I'm not talking about async flips only.
> 
> I'm talking about atomic commits in general. I don't think it's a good
> idea to make async atomic commits behave fundamentally different from
> sync atomic commits wrt. what non-changing state you are allowed to
> list in your state set or not.
> 
> Isn't there common DRM code to convert an atomic commit state set into
> state objects? It probably starts by copying the current state, and
> then playing through the commit state set, setting all listed
> properties to their new values? Why wouldn't that loop maintain the
> knowledge of what actually changed?

Any such book keeping is entirely ad-hoc atm. It's also not super
obvious how much of it is actually useful.

You have to do a real commit on the crtc anyway if the crtc (or
on any of its associated objects) is listed in the commit, so
there's not necessarily much to be gained by tracking chages in
all properties.

And that behaviour again enters very muddy waters when combined
with the async flip flag for the entire commit. The current approach
being proposed seems to suggest that we can instead short circuit
async commits when nothing has changed. That is not at all how
sync atomic commits work.

> When you copy the current data, reset all changed-flags to false. When
> you apply each property from the commit set, compare the value and set
> the changed-flag only if the value changes.
> 
> This manufacturing of the new tentative state set happens at atomic
> commit ioctl time before the ioctl returns, right? So the current state
> is well-defined: any previous atomic sync or async commit can be assumed to
> have succeeded even if it hasn't applied in hardware yet if the commit
> ioctl for it succeeded, right?

Yes. We could certainly try to fully track all changes in
properties, but no has measured if there's any real benefit
of doing so.

-- 
Ville Syrjälä
Intel

WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Pekka Paalanen <ppaalanen@gmail.com>
Cc: andrealmeid@igalia.com, dri-devel@lists.freedesktop.org,
	wayland-devel@lists.freedesktop.org, mwen@igalia.com,
	amd-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch,
	alexander.deucher@amd.com, hwentlan@amd.com,
	nicholas.kazlauskas@amd.com, joshua@froggi.es
Subject: Re: KMS atomic state sets, full vs. minimal (Re: [PATCH v3 0/6] Add support for atomic async page-flips)
Date: Mon, 3 Oct 2022 12:04:29 +0300	[thread overview]
Message-ID: <YzqlnYrg+yAZ/SNt@intel.com> (raw)
In-Reply-To: <20221003114849.09265089@eldfell>

On Mon, Oct 03, 2022 at 11:48:49AM +0300, Pekka Paalanen wrote:
> On Fri, 30 Sep 2022 18:45:09 +0300
> Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> 
> > On Fri, Sep 30, 2022 at 06:37:00PM +0300, Pekka Paalanen wrote:
> > > On Fri, 30 Sep 2022 18:09:55 +0300
> > > Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > >   
> > > > That would actively discourage people from even attempting the
> > > > "just dump all the state into the ioctl" approach with async flips
> > > > since even the props whose value isn't even changing would be rejected.  
> > > 
> > > About that.
> > > 
> > > To me it looks like just a classic case of broken communication.
> > > 
> > > The kernel developers assume that of course userspace will minimize the
> > > state set to only those properties that change, because...?
> > > 
> > > Userspace developers think that of course the kernel will optimize the
> > > state set into minimal changes, because the kernel actually has the
> > > authoritative knowledge of what the current state is, and the driver
> > > actually knows which properties are costly and need to be optimized and
> > > which ones don't matter. It has never even occurred to me that the
> > > kernel would not compare next state to current state.
> > > 
> > > No-one ever documented any expectations, did they?  
> > 
> > Do you really want that for async flips? Async flips can't be
> > done atomically with anything else, so why are you even asking
> > the kernel to do that?
> 
> I'm not talking about async flips only.
> 
> I'm talking about atomic commits in general. I don't think it's a good
> idea to make async atomic commits behave fundamentally different from
> sync atomic commits wrt. what non-changing state you are allowed to
> list in your state set or not.
> 
> Isn't there common DRM code to convert an atomic commit state set into
> state objects? It probably starts by copying the current state, and
> then playing through the commit state set, setting all listed
> properties to their new values? Why wouldn't that loop maintain the
> knowledge of what actually changed?

Any such book keeping is entirely ad-hoc atm. It's also not super
obvious how much of it is actually useful.

You have to do a real commit on the crtc anyway if the crtc (or
on any of its associated objects) is listed in the commit, so
there's not necessarily much to be gained by tracking chages in
all properties.

And that behaviour again enters very muddy waters when combined
with the async flip flag for the entire commit. The current approach
being proposed seems to suggest that we can instead short circuit
async commits when nothing has changed. That is not at all how
sync atomic commits work.

> When you copy the current data, reset all changed-flags to false. When
> you apply each property from the commit set, compare the value and set
> the changed-flag only if the value changes.
> 
> This manufacturing of the new tentative state set happens at atomic
> commit ioctl time before the ioctl returns, right? So the current state
> is well-defined: any previous atomic sync or async commit can be assumed to
> have succeeded even if it hasn't applied in hardware yet if the commit
> ioctl for it succeeded, right?

Yes. We could certainly try to fully track all changes in
properties, but no has measured if there's any real benefit
of doing so.

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2022-10-03  9:04 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29 18:43 [PATCH v3 0/6] Add support for atomic async page-flips Simon Ser
2022-09-29 18:43 ` Simon Ser
2022-09-29 18:43 ` [PATCH v3 1/6] drm: document DRM_MODE_PAGE_FLIP_ASYNC Simon Ser
2022-09-29 18:43   ` Simon Ser
2022-09-29 18:43 ` [PATCH v3 2/6] amd/display: only accept async flips for fast updates Simon Ser
2022-09-29 18:43   ` Simon Ser
2022-09-29 18:43 ` [PATCH v3 3/6] drm: introduce drm_mode_config.atomic_async_page_flip_not_supported Simon Ser
2022-09-29 18:43   ` Simon Ser
2022-09-30 13:53   ` Ville Syrjälä
2022-09-30 13:56     ` Simon Ser
2022-09-30 14:02       ` Ville Syrjälä
2022-09-29 18:43 ` [PATCH v3 4/6] drm: allow DRM_MODE_PAGE_FLIP_ASYNC for atomic commits Simon Ser
2022-09-29 18:43   ` Simon Ser
2022-09-29 18:43 ` [PATCH v3 5/6] drm: introduce DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP Simon Ser
2022-09-29 18:43   ` Simon Ser
2022-09-29 18:44 ` [PATCH v3 6/6] amd/display: indicate support for atomic async page-flips on DC Simon Ser
2022-09-29 18:44   ` Simon Ser
2022-09-30 13:42 ` [PATCH v3 0/6] Add support for atomic async page-flips Harry Wentland
2022-09-30 13:42   ` Harry Wentland
2022-09-30 13:52 ` Ville Syrjälä
2022-09-30 14:19   ` Ville Syrjälä
2022-09-30 15:09     ` Ville Syrjälä
2022-09-30 15:37       ` KMS atomic state sets, full vs. minimal (Re: [PATCH v3 0/6] Add support for atomic async page-flips) Pekka Paalanen
2022-09-30 15:37         ` Pekka Paalanen
2022-09-30 15:45         ` Ville Syrjälä
2022-09-30 15:45           ` Ville Syrjälä
2022-09-30 15:58           ` Ville Syrjälä
2022-10-03  8:48           ` Pekka Paalanen
2022-10-03  8:48             ` Pekka Paalanen
2022-10-03  9:04             ` Ville Syrjälä [this message]
2022-10-03  9:04               ` Ville Syrjälä
2022-10-13 16:02       ` [PATCH v3 0/6] Add support for atomic async page-flips Simon Ser
2022-10-17 14:35         ` André Almeida
2022-10-17 14:35           ` André Almeida
2022-10-28 12:36         ` André Almeida
2022-10-28 12:36           ` André Almeida
2022-11-17  8:58         ` Simon Ser
2023-01-05 16:01           ` Simon Ser

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=YzqlnYrg+yAZ/SNt@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andrealmeid@igalia.com \
    --cc=contact@emersion.fr \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hwentlan@amd.com \
    --cc=joshua@froggi.es \
    --cc=mwen@igalia.com \
    --cc=nicholas.kazlauskas@amd.com \
    --cc=ppaalanen@gmail.com \
    --cc=wayland-devel@lists.freedesktop.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.