From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Jonas Ådahl" <jadahl@redhat.com>
Cc: Pekka Paalanen <pekka.paalanen@collabora.com>,
Simon Ser <contact@emersion.fr>,
intel-gfx@lists.freedesktop.org,
Daniel Stone <daniel@fooishbar.org>,
dri-devel@lists.freedesktop.org,
Harry Wentland <harry.wentland@amd.com>
Subject: Re: [Intel-gfx] [PATCH v2 1/2] drm: Introduce plane SIZE_HINTS property
Date: Tue, 14 Feb 2023 13:19:51 +0200 [thread overview]
Message-ID: <Y+tuV91XeDoXXp3t@intel.com> (raw)
In-Reply-To: <Y+tqHZQ/sg3u/VxR@redhat.com>
On Tue, Feb 14, 2023 at 12:01:49PM +0100, Jonas Ådahl wrote:
> On Tue, Feb 14, 2023 at 12:28:44PM +0200, Ville Syrjälä wrote:
> > On Tue, Feb 14, 2023 at 10:54:27AM +0100, Jonas Ådahl wrote:
> > > On Tue, Feb 14, 2023 at 11:25:56AM +0200, Ville Syrjälä wrote:
> > > > On Thu, Feb 09, 2023 at 03:16:23PM +0100, Jonas Ådahl wrote:
> > > > > On Wed, Feb 08, 2023 at 11:10:16PM +0200, Ville Syrjala wrote:
> > > > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > > >
> > > > > > Add a new immutable plane property by which a plane can advertise
> > > > > > a handful of recommended plane sizes. This would be mostly exposed
> > > > > > by cursor planes as a slightly more capable replacement for
> > > > > > the DRM_CAP_CURSOR_WIDTH/HEIGHT caps, which can only declare
> > > > > > a one size fits all limit for the whole device.
> > > > > >
> > > > > > Currently eg. amdgpu/i915/nouveau just advertize the max cursor
> > > > > > size via the cursor size caps. But always using the max sized
> > > > > > cursor can waste a surprising amount of power, so a better
> > > > > > stragey is desirable.
> > > > > >
> > > > > > Most other drivers don't specify any cursor size at all, in
> > > > > > which case the ioctl code just claims that 64x64 is a great
> > > > > > choice. Whether that is actually true is debatable.
> > > > > >
> > > > > > A poll of various compositor developers informs us that
> > > > > > blindly probing with setcursor/atomic ioctl to determine
> > > > > > suitable cursor sizes is not acceptable, thus the
> > > > > > introduction of the new property to supplant the cursor
> > > > > > size caps. The compositor will now be free to select a
> > > > > > more optimal cursor size from the short list of options.
> > > > > >
> > > > > > Note that the reported sizes (either via the property or the
> > > > > > caps) make no claims about things such as plane scaling. So
> > > > > > these things should only really be consulted for simple
> > > > > > "cursor like" use cases.
> > > > > >
> > > > > > v2: Try to add some docs
> > > > > >
> > > > > > Cc: Simon Ser <contact@emersion.fr>
> > > > > > Cc: Jonas Ådahl <jadahl@redhat.com>
> > > > > > Cc: Daniel Stone <daniel@fooishbar.org>
> > > > > > Cc: Pekka Paalanen <pekka.paalanen@collabora.com>
> > > > > > Acked-by: Harry Wentland <harry.wentland@amd.com>
> > > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > > > ---
> > > > > > drivers/gpu/drm/drm_mode_config.c | 7 +++++
> > > > > > drivers/gpu/drm/drm_plane.c | 48 +++++++++++++++++++++++++++++++
> > > > > > include/drm/drm_mode_config.h | 5 ++++
> > > > > > include/drm/drm_plane.h | 4 +++
> > > > > > include/uapi/drm/drm_mode.h | 11 +++++++
> > > > > > 5 files changed, 75 insertions(+)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> > > > > > index 87eb591fe9b5..21860f94a18c 100644
> > > > > > --- a/drivers/gpu/drm/drm_mode_config.c
> > > > > > +++ b/drivers/gpu/drm/drm_mode_config.c
> > > > > > @@ -374,6 +374,13 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
> > > > > > return -ENOMEM;
> > > > > > dev->mode_config.modifiers_property = prop;
> > > > > >
> > > > > > + prop = drm_property_create(dev,
> > > > > > + DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_BLOB,
> > > > > > + "SIZE_HINTS", 0);
> > > > > > + if (!prop)
> > > > > > + return -ENOMEM;
> > > > > > + dev->mode_config.size_hints_property = prop;
> > > > > > +
> > > > > > return 0;
> > > > > > }
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > > > > > index 24e7998d1731..ae51b1f83755 100644
> > > > > > --- a/drivers/gpu/drm/drm_plane.c
> > > > > > +++ b/drivers/gpu/drm/drm_plane.c
> > > > > > @@ -140,6 +140,21 @@
> > > > > > * DRM_FORMAT_MOD_LINEAR. Before linux kernel release v5.1 there have been
> > > > > > * various bugs in this area with inconsistencies between the capability
> > > > > > * flag and per-plane properties.
> > > > > > + *
> > > > > > + * SIZE_HINTS:
> > > > > > + * Blob property which contains the set of recommended plane size
> > > > > > + * which can used for simple "cursor like" use cases (eg. no scaling).
> > > > > > + * Using these hints frees userspace from extensive probing of
> > > > > > + * supported plane sizes through atomic/setcursor ioctls.
> > > > > > + *
> > > > > > + * For optimal usage userspace should pick the smallest size
> > > > > > + * that satisfies its own requirements.
> > > > > > + *
> > > > > > + * The blob contains an array of struct drm_plane_size_hint.
> > > > > > + *
> > > > > > + * Drivers should only attach this property to planes that
> > > > > > + * support a very limited set of sizes (eg. cursor planes
> > > > > > + * on typical hardware).
> > > > >
> > > > > This is a bit awkward since problematic drivers would only expose
> > > > > this property if they are new enough.
> > > > >
> > > > > A way to avoid this is for all new drivers expose this property, but
> > > > > special case the size 0x0 as "everything below the max limit goes". Then
> > > > > userspace can do (ignoring the missing cap fallback).
> > > >
> > > > I don't think there are any drivers that need that.
> > > > So I'm thinking we can just ignore that for now.
> > >
> > > None the less, userspace not seeing SIZE_HINTS will be required to
> > > indefinitely use the existing "old" behavior using the size cap as the
> > > buffer size with a fallback, and drivers without any size limitations
> > > that, i.e. details that are hard to express with a set of accepted
> > > sizes, will still use the inoptimal buffer sizes.
> > >
> > > If I read [1] correctly, AMD has no particular size limitations other
> > > than a size limit, but without a SIZE_HINTS, userspace still needs to
> > > use the maximum size.
> >
> > Simon pointed out they have pretty much the same exact limits as i915.
> > Ie. only a few power of two sizes, and stride must match width.
>
> How about various ARM drivers, where the cursor plane is a regular
> overlay plane with an artificial 'cursor' stamp on it?
They don't even bother with the size cap currently. So the
generic ioctl code currently just decides that 64x64 is good
enough for them.
>
> Either way, the documentation creates an impossible expectation -
> drivers, existing of future, that does not "support for a very limited
> set of sizes" but actually any size below a limit, can't communicate to
> userspace that it can handle cursor buffers with an arbitrary sizes,
> without userspace breaking on todays kernels.
I don't see how anything would break. You just won't get a 100%
optimal result potentially if you don't declare any smaller
sizes. And I think we can always specify that magic 0x0 value
later (or a new cap/etc) should an actual user for it appear.
I guess to play it safe we could specify 0x0 as a value that
might become valid in the future, so userspace should check
for it and treat it the same as not having the prop at all.
--
Ville Syrjälä
Intel
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Jonas Ådahl" <jadahl@redhat.com>
Cc: Pekka Paalanen <pekka.paalanen@collabora.com>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 1/2] drm: Introduce plane SIZE_HINTS property
Date: Tue, 14 Feb 2023 13:19:51 +0200 [thread overview]
Message-ID: <Y+tuV91XeDoXXp3t@intel.com> (raw)
In-Reply-To: <Y+tqHZQ/sg3u/VxR@redhat.com>
On Tue, Feb 14, 2023 at 12:01:49PM +0100, Jonas Ådahl wrote:
> On Tue, Feb 14, 2023 at 12:28:44PM +0200, Ville Syrjälä wrote:
> > On Tue, Feb 14, 2023 at 10:54:27AM +0100, Jonas Ådahl wrote:
> > > On Tue, Feb 14, 2023 at 11:25:56AM +0200, Ville Syrjälä wrote:
> > > > On Thu, Feb 09, 2023 at 03:16:23PM +0100, Jonas Ådahl wrote:
> > > > > On Wed, Feb 08, 2023 at 11:10:16PM +0200, Ville Syrjala wrote:
> > > > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > > >
> > > > > > Add a new immutable plane property by which a plane can advertise
> > > > > > a handful of recommended plane sizes. This would be mostly exposed
> > > > > > by cursor planes as a slightly more capable replacement for
> > > > > > the DRM_CAP_CURSOR_WIDTH/HEIGHT caps, which can only declare
> > > > > > a one size fits all limit for the whole device.
> > > > > >
> > > > > > Currently eg. amdgpu/i915/nouveau just advertize the max cursor
> > > > > > size via the cursor size caps. But always using the max sized
> > > > > > cursor can waste a surprising amount of power, so a better
> > > > > > stragey is desirable.
> > > > > >
> > > > > > Most other drivers don't specify any cursor size at all, in
> > > > > > which case the ioctl code just claims that 64x64 is a great
> > > > > > choice. Whether that is actually true is debatable.
> > > > > >
> > > > > > A poll of various compositor developers informs us that
> > > > > > blindly probing with setcursor/atomic ioctl to determine
> > > > > > suitable cursor sizes is not acceptable, thus the
> > > > > > introduction of the new property to supplant the cursor
> > > > > > size caps. The compositor will now be free to select a
> > > > > > more optimal cursor size from the short list of options.
> > > > > >
> > > > > > Note that the reported sizes (either via the property or the
> > > > > > caps) make no claims about things such as plane scaling. So
> > > > > > these things should only really be consulted for simple
> > > > > > "cursor like" use cases.
> > > > > >
> > > > > > v2: Try to add some docs
> > > > > >
> > > > > > Cc: Simon Ser <contact@emersion.fr>
> > > > > > Cc: Jonas Ådahl <jadahl@redhat.com>
> > > > > > Cc: Daniel Stone <daniel@fooishbar.org>
> > > > > > Cc: Pekka Paalanen <pekka.paalanen@collabora.com>
> > > > > > Acked-by: Harry Wentland <harry.wentland@amd.com>
> > > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > > > ---
> > > > > > drivers/gpu/drm/drm_mode_config.c | 7 +++++
> > > > > > drivers/gpu/drm/drm_plane.c | 48 +++++++++++++++++++++++++++++++
> > > > > > include/drm/drm_mode_config.h | 5 ++++
> > > > > > include/drm/drm_plane.h | 4 +++
> > > > > > include/uapi/drm/drm_mode.h | 11 +++++++
> > > > > > 5 files changed, 75 insertions(+)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> > > > > > index 87eb591fe9b5..21860f94a18c 100644
> > > > > > --- a/drivers/gpu/drm/drm_mode_config.c
> > > > > > +++ b/drivers/gpu/drm/drm_mode_config.c
> > > > > > @@ -374,6 +374,13 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
> > > > > > return -ENOMEM;
> > > > > > dev->mode_config.modifiers_property = prop;
> > > > > >
> > > > > > + prop = drm_property_create(dev,
> > > > > > + DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_BLOB,
> > > > > > + "SIZE_HINTS", 0);
> > > > > > + if (!prop)
> > > > > > + return -ENOMEM;
> > > > > > + dev->mode_config.size_hints_property = prop;
> > > > > > +
> > > > > > return 0;
> > > > > > }
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> > > > > > index 24e7998d1731..ae51b1f83755 100644
> > > > > > --- a/drivers/gpu/drm/drm_plane.c
> > > > > > +++ b/drivers/gpu/drm/drm_plane.c
> > > > > > @@ -140,6 +140,21 @@
> > > > > > * DRM_FORMAT_MOD_LINEAR. Before linux kernel release v5.1 there have been
> > > > > > * various bugs in this area with inconsistencies between the capability
> > > > > > * flag and per-plane properties.
> > > > > > + *
> > > > > > + * SIZE_HINTS:
> > > > > > + * Blob property which contains the set of recommended plane size
> > > > > > + * which can used for simple "cursor like" use cases (eg. no scaling).
> > > > > > + * Using these hints frees userspace from extensive probing of
> > > > > > + * supported plane sizes through atomic/setcursor ioctls.
> > > > > > + *
> > > > > > + * For optimal usage userspace should pick the smallest size
> > > > > > + * that satisfies its own requirements.
> > > > > > + *
> > > > > > + * The blob contains an array of struct drm_plane_size_hint.
> > > > > > + *
> > > > > > + * Drivers should only attach this property to planes that
> > > > > > + * support a very limited set of sizes (eg. cursor planes
> > > > > > + * on typical hardware).
> > > > >
> > > > > This is a bit awkward since problematic drivers would only expose
> > > > > this property if they are new enough.
> > > > >
> > > > > A way to avoid this is for all new drivers expose this property, but
> > > > > special case the size 0x0 as "everything below the max limit goes". Then
> > > > > userspace can do (ignoring the missing cap fallback).
> > > >
> > > > I don't think there are any drivers that need that.
> > > > So I'm thinking we can just ignore that for now.
> > >
> > > None the less, userspace not seeing SIZE_HINTS will be required to
> > > indefinitely use the existing "old" behavior using the size cap as the
> > > buffer size with a fallback, and drivers without any size limitations
> > > that, i.e. details that are hard to express with a set of accepted
> > > sizes, will still use the inoptimal buffer sizes.
> > >
> > > If I read [1] correctly, AMD has no particular size limitations other
> > > than a size limit, but without a SIZE_HINTS, userspace still needs to
> > > use the maximum size.
> >
> > Simon pointed out they have pretty much the same exact limits as i915.
> > Ie. only a few power of two sizes, and stride must match width.
>
> How about various ARM drivers, where the cursor plane is a regular
> overlay plane with an artificial 'cursor' stamp on it?
They don't even bother with the size cap currently. So the
generic ioctl code currently just decides that 64x64 is good
enough for them.
>
> Either way, the documentation creates an impossible expectation -
> drivers, existing of future, that does not "support for a very limited
> set of sizes" but actually any size below a limit, can't communicate to
> userspace that it can handle cursor buffers with an arbitrary sizes,
> without userspace breaking on todays kernels.
I don't see how anything would break. You just won't get a 100%
optimal result potentially if you don't declare any smaller
sizes. And I think we can always specify that magic 0x0 value
later (or a new cap/etc) should an actual user for it appear.
I guess to play it safe we could specify 0x0 as a value that
might become valid in the future, so userspace should check
for it and treat it the same as not having the prop at all.
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2023-02-14 11:19 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 4:09 [Intel-gfx] [PATCH 0/2] drm: Add plane SIZE_HINTS property Ville Syrjala
2023-02-08 4:09 ` Ville Syrjala
2023-02-08 4:09 ` [Intel-gfx] [PATCH 1/2] drm: Introduce " Ville Syrjala
2023-02-08 4:09 ` Ville Syrjala
2023-02-08 6:09 ` [Intel-gfx] " kernel test robot
2023-02-08 6:09 ` kernel test robot
2023-02-08 6:09 ` kernel test robot
2023-02-08 6:09 ` kernel test robot
2023-02-08 6:09 ` kernel test robot
2023-02-08 6:09 ` kernel test robot
2023-02-08 12:13 ` Pekka Paalanen
2023-02-08 12:13 ` Pekka Paalanen
2023-02-08 13:03 ` [Intel-gfx] " Ville Syrjälä
2023-02-08 13:03 ` Ville Syrjälä
2023-02-08 21:16 ` [Intel-gfx] " Ville Syrjälä
2023-02-08 21:16 ` Ville Syrjälä
2023-02-09 11:51 ` Pekka Paalanen
2023-02-09 11:51 ` Pekka Paalanen
2023-02-14 9:42 ` Pekka Paalanen
2023-02-14 9:42 ` Pekka Paalanen
2023-02-14 10:27 ` Ville Syrjälä
2023-02-14 10:27 ` Ville Syrjälä
2023-02-14 11:17 ` Pekka Paalanen
2023-02-14 11:17 ` Pekka Paalanen
2023-02-14 11:35 ` Ville Syrjälä
2023-02-14 11:35 ` Ville Syrjälä
2023-02-08 16:51 ` Harry Wentland
2023-02-08 16:51 ` Harry Wentland
2023-02-08 21:10 ` [Intel-gfx] [PATCH v2 " Ville Syrjala
2023-02-08 21:10 ` Ville Syrjala
2023-02-09 11:58 ` [Intel-gfx] " Pekka Paalanen
2023-02-09 11:58 ` Pekka Paalanen
2023-02-09 13:10 ` [Intel-gfx] " Ville Syrjälä
2023-02-09 13:10 ` Ville Syrjälä
2023-02-10 9:44 ` [Intel-gfx] " Pekka Paalanen
2023-02-10 9:44 ` Pekka Paalanen
2023-02-09 14:16 ` [Intel-gfx] " Jonas Ådahl
2023-02-09 14:16 ` Jonas Ådahl
2023-02-14 9:25 ` [Intel-gfx] " Ville Syrjälä
2023-02-14 9:25 ` Ville Syrjälä
2023-02-14 9:54 ` [Intel-gfx] " Jonas Ådahl
2023-02-14 9:54 ` Jonas Ådahl
2023-02-14 10:28 ` [Intel-gfx] " Ville Syrjälä
2023-02-14 10:28 ` Ville Syrjälä
2023-02-14 11:01 ` [Intel-gfx] " Jonas Ådahl
2023-02-14 11:01 ` Jonas Ådahl
2023-02-14 11:19 ` Ville Syrjälä [this message]
2023-02-14 11:19 ` Ville Syrjälä
2023-02-22 18:34 ` [Intel-gfx] " Ville Syrjälä
2023-02-22 18:34 ` Ville Syrjälä
2023-02-14 19:27 ` [Intel-gfx] " Harry Wentland
2023-02-14 19:27 ` Harry Wentland
2023-02-14 19:59 ` [Intel-gfx] " Ville Syrjälä
2023-02-14 19:59 ` Ville Syrjälä
2023-03-13 16:33 ` [Intel-gfx] [PATCH v3 " Ville Syrjala
2023-03-13 16:33 ` Ville Syrjala
2023-03-17 10:34 ` [Intel-gfx] " Jonas Ådahl
2023-03-17 10:34 ` Jonas Ådahl
2023-03-17 11:33 ` [Intel-gfx] " Ville Syrjälä
2023-03-17 11:33 ` Ville Syrjälä
2023-03-17 12:21 ` [Intel-gfx] " Jonas Ådahl
2023-03-17 12:21 ` Jonas Ådahl
2023-03-17 12:29 ` [Intel-gfx] " Jonas Ådahl
2023-03-17 12:29 ` Jonas Ådahl
2023-03-17 13:15 ` [Intel-gfx] " Ville Syrjälä
2023-03-17 13:15 ` Ville Syrjälä
2023-03-17 13:18 ` [Intel-gfx] " Jonas Ådahl
2023-03-17 13:18 ` Jonas Ådahl
2023-03-17 13:13 ` [Intel-gfx] " Ville Syrjälä
2023-03-17 13:13 ` Ville Syrjälä
2023-02-08 4:09 ` [Intel-gfx] [PATCH 2/2] drm/i915: Add SIZE_HINTS property for cursors Ville Syrjala
2023-02-08 4:09 ` Ville Syrjala
2023-02-08 4:50 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm: Add plane SIZE_HINTS property Patchwork
2023-02-08 5:17 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2023-02-08 23:15 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm: Add plane SIZE_HINTS property (rev2) Patchwork
2023-02-09 21:27 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-03-13 17:49 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm: Add plane SIZE_HINTS property (rev3) Patchwork
2023-03-14 21:59 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
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=Y+tuV91XeDoXXp3t@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=contact@emersion.fr \
--cc=daniel@fooishbar.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jadahl@redhat.com \
--cc=pekka.paalanen@collabora.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.