dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Simon Ser <contact@emersion.fr>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	James Qian Wang <james.qian.wang@arm.com>,
	Marius Vlad <marius.vlad@collabora.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v6] drm: two planes with the same zpos have undefined ordering
Date: Thu, 10 Oct 2019 00:43:10 +0200	[thread overview]
Message-ID: <20191009224309.GU16989@phenom.ffwll.local> (raw)
In-Reply-To: <T5nHrvXH0GKOp6ONaFHk-j2cwEb4_4C_sBz9rNw8mmPACuut-DQqC74HMAFKZH3_Q15E8a3YnmKCxap-djKA71VVZv_T-tFxaB0he13O7yA=@emersion.fr>

On Wed, Oct 09, 2019 at 03:10:49PM +0000, Simon Ser 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 unspoken, legacy rule used in the past was to make user-space figure
> out the zpos from object IDs. However some drivers break this rule,
> that's why the ordering is documented as unspecified in case the zpos
> property is missing. User-space should rely on the zpos property only.
> 
> There are some cases in which user-space might read identical zpos
> values for different planes.
> 
> For instance, in case the property is mutable, user-space might set two
> planes' zpos to the same value. This is necessary to support user-space
> using the legacy DRM API where atomic commits are not possible:
> user-space needs to update the planes' zpos one by one.
> 
> Because of this, user-space should handle multiple planes with the same
> zpos.
> 
> While at it, remove the assumption that zpos is only for overlay planes.
> 
> Additionally, update the drm_plane_state.zpos docs to clarify that zpos
> disambiguation via plane object IDs is a recommendation for drivers, not
> something user-space can rely on. In other words, when user-space sets
> the same zpos on two planes, drivers should rely on the plane object ID.
> 
> v2: clarify drm_plane_state.zpos docs (Daniel)
> 
> v3: zpos is for all planes (Marius, Daniel)
> 
> v4: completely reword the drm_plane_state.zpos docs to make it clear the
> recommendation to use plane IDs is for drivers in case user-space uses
> duplicate zpos values (Pekka)
> 
> v5: reword commit message (Pekka, James)
> 
> v6: remove mention of Arm GPUs having planes which can't overlap,
> because this isn't uAPI yet (Daniel)
> 
> Signed-off-by: Simon Ser <contact@emersion.fr>
> Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
> Cc: Marius Vlad <marius.vlad@collabora.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: James Qian Wang <james.qian.wang@arm.com>

Applied, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/drm_blend.c | 8 ++++----
>  include/drm/drm_plane.h     | 9 +++++----
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
> index d02709dd2d4a..121481f6aa71 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 planes, see drm_plane_create_zpos_immutable_property().
>   *
>   * pixel blend mode:
>   *	Pixel blend mode is set up with drm_plane_create_blend_mode_property().
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index cd5903ad33f7..328773690851 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -140,10 +140,11 @@ struct drm_plane_state {
>  	 * @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.
> +	 * User-space may set mutable zpos properties so that multiple active
> +	 * planes on the same CRTC have identical zpos values. This is a
> +	 * user-space bug, but drivers can solve the conflict by comparing the
> +	 * plane object IDs; the plane with a higher ID is 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.
> --
> 2.23.0
> 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2019-10-09 22:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09 15:10 [PATCH v6] drm: two planes with the same zpos have undefined ordering Simon Ser
2019-10-09 22:43 ` Daniel Vetter [this message]

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=20191009224309.GU16989@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=contact@emersion.fr \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=james.qian.wang@arm.com \
    --cc=marius.vlad@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox