drm: two planes with the same zpos have undefined ordering

Submitted by Simon Ser on Sept. 10, 2019, 10:09 a.m.

Details

Message ID KJRi1ROX2_eM1WjtEQ1e1-f--VK4hwMQJQt1nPaS6lcmt3v4yIfdttLIu_EOGdkwXwEMAEo66Xa7ksp7iQABWT5GuMu6UgKoiuEm6EU2N1U=@emersion.fr
State New
Headers show
Series "drm: two planes with the same zpos have undefined ordering" ( rev: 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

Simon Ser Sept. 10, 2019, 10:09 a.m.
Currently the property docs don't specify whether it's okay for two planes to
have the same zpos value and what user-space should expect in this case.

The rule mentionned in the past was to disambiguate with object IDs. However
some drivers break this rule (that's why the ordering is documented as
unspecified in case the zpos property is missing). Additionally it doesn't
really make sense for a driver to user identical zpos values if it knows their
relative position: the driver can just pick different values instead.

So two solutions would make sense: either disallow completely identical zpos
values for two different planes, either make the ordering unspecified. To allow
drivers that don't know the relative ordering between two planes to still
expose the zpos property, choose the latter solution.

Signed-off-by: Simon Ser <contact@emersion.fr>
---

Err, I'm sorry about the double-post. I sent this to intel-gfx by mistake.

 drivers/gpu/drm/drm_blend.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--
2.23.0

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index d02709dd2d4a..51bd5454e50a 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -132,10 +132,10 @@ 
  *	planes. Without this property the primary plane is always below the cursor
  *	plane, and ordering between all other planes is undefined. The positive
  *	Z axis points towards the user, i.e. planes with lower Z position values
- *	are underneath planes with higher Z position values. Note that the Z
- *	position value can also be immutable, to inform userspace about the
- *	hard-coded stacking of overlay planes, see
- *	drm_plane_create_zpos_immutable_property().
+ *	are underneath planes with higher Z position values. Two planes with the
+ *	same Z position value have undefined ordering. Note that the Z position
+ *	value can also be immutable, to inform userspace about the hard-coded
+ *	stacking of overlay planes, see drm_plane_create_zpos_immutable_property().
  *
  * pixel blend mode:
  *	Pixel blend mode is set up with drm_plane_create_blend_mode_property().

Comments


On Tuesday, September 10, 2019 1:38 PM, Pekka Paalanen <ppaalanen@gmail.com> wrote:

> On Tue, 10 Sep 2019 10:09:55 +0000
> Simon Ser contact@emersion.fr wrote:
>
> > Currently the property docs don't specify whether it's okay for two planes to
> > have the same zpos value and what user-space should expect in this case.
> > The rule mentionned in the past was to disambiguate with object IDs. However
> > some drivers break this rule (that's why the ordering is documented as
> > unspecified in case the zpos property is missing). Additionally it doesn't
> > really make sense for a driver to user identical zpos values if it knows their
> > relative position: the driver can just pick different values instead.
> > So two solutions would make sense: either disallow completely identical zpos
> > values for two different planes, either make the ordering unspecified. To allow
> > drivers that don't know the relative ordering between two planes to still
> > expose the zpos property, choose the latter solution.
> >
> > Signed-off-by: Simon Ser contact@emersion.fr
> >
> > ---------------------------------------------
> >
> > Err, I'm sorry about the double-post. I sent this to intel-gfx by mistake.
> > drivers/gpu/drm/drm_blend.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> > diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
> > index d02709dd2d4a..51bd5454e50a 100644
> > --- a/drivers/gpu/drm/drm_blend.c
> > +++ b/drivers/gpu/drm/drm_blend.c
> > @@ -132,10 +132,10 @@
> >
> > -   planes. Without this property the primary plane is always below the cursor
> > -   plane, and ordering between all other planes is undefined. The positive
> > -   Z axis points towards the user, i.e. planes with lower Z position values
> >
> > -   -   are underneath planes with higher Z position values. Note that the Z
> > -   -   position value can also be immutable, to inform userspace about the
> > -   -   hard-coded stacking of overlay planes, see
> > -   -   drm_plane_create_zpos_immutable_property().
> >
> > -   -   are underneath planes with higher Z position values. Two planes with the
> > -   -   same Z position value have undefined ordering. Note that the Z position
> > -   -   value can also be immutable, to inform userspace about the hard-coded
> > -   -   stacking of overlay planes, see drm_plane_create_zpos_immutable_property().
> >     -
> >     -   pixel blend mode:
> >     -   Pixel blend mode is set up with drm_plane_create_blend_mode_property().
>
> Hi,
>
> this seems to contradict what the docs say in another place:

Except this comment is about drm_plane_state.zpos, an internal DRM
property. This is not about the zpos property itself.

The comment was introduced in v2 of [1], although the motivation for
the change isn't documented.

[1]: https://patchwork.freedesktop.org/series/13528/#rev2

> zpos
>
> Priority of the given plane on crtc (optional).
>
> Note that multiple active planes on the same crtc can have an
> identical zpos value. The rule to solving the conflict is to
> compare the plane object IDs; the plane with a higher ID must be
> stacked on top of a plane with a lower ID.
>
> See drm_plane_create_zpos_property() and
> drm_plane_create_zpos_immutable_property() for more details.
>
> from https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-kms.html#plane-functions-reference
>
> Thanks,
> pq