drm/tegra: Add zpos property for cursor planes
PATCH 1/1 drm/tegra: Add zpos property for cursor planes
From: Thierry Reding <[email protected]>
As of commit 4dc55525b095 ("drm: plane: Verify that no or all planes have a zpos property") a warning is emitted if there's a mix of planes with and without a zpos property.
On Tegra, cursor planes are always composited on top of all other planes, which is why they never had a zpos property attached to them. However, since the composition order is fixed, this is trivial to remedy by simply attaching an immutable zpos property to them.
--- drivers/gpu/drm/tegra/dc.c | 10 ++++++++-- drivers/gpu/drm/tegra/hub.c | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/tegra/dc.c +8 -2
@@ -787,7 +787,7 @@ static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm, }drm_plane_helper_add (&plane->base, &tegra_plane_helper_funcs); -drm_plane_create_zpos_property (&plane->base, plane->index,0 ,255 ); +drm_plane_create_zpos_property (&plane->base,1 + plane->index,1 ,255 ); err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0,
@@ -957,6 +957,7 @@ static struct drm_plane *tegra_dc_cursor_plane_create(struct drm_device *drm, }drm_plane_helper_add (&plane->base, &tegra_cursor_plane_helper_funcs); +drm_plane_create_zpos_immutable_property (&plane->base,0 );return &plane->base; }
@@ -1074,7 +1075,12 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, }drm_plane_helper_add (&plane->base, &tegra_plane_helper_funcs); -drm_plane_create_zpos_property (&plane->base, plane->index,0 ,255 ); + +if (!cursor) +drm_plane_create_zpos_property (&plane->base,1 + plane->index, +1 ,255 ); +else +drm_plane_create_zpos_immutable_property (&plane->base,0 ); err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0,
drivers/gpu/drm/tegra/hub.c +1 -1
@@ -590,7 +590,7 @@ struct drm_plane *tegra_shared_plane_create(struct drm_device *drm, }drm_plane_helper_add (p, &tegra_shared_plane_helper_funcs); -drm_plane_create_zpos_property (p,0 ,0 ,255 ); +drm_plane_create_zpos_property (p,1 + index,1 ,255 );return p; }
Signature · 1 line
2.24.1
Quoted 32 lines · Thierry Reding
From: Thierry Reding <[email protected]>
As of commit
4dc55525b095("drm: plane: Verify that no or all planes have a zpos property") a warning is emitted if there's a mix of planes with and without a zpos property.On Tegra, cursor planes are always composited on top of all other planes, which is why they never had a zpos property attached to them. However, since the composition order is fixed, this is trivial to remedy by simply attaching an immutable zpos property to them.
Reported-by Jonathan Hunter <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- drivers/gpu/drm/tegra/dc.c | 10 ++++++++-- drivers/gpu/drm/tegra/hub.c | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-)drivers/gpu/drm/tegra/dc.c +1
-1@@ -787,7 +787,7 @@ static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm, }drm_plane_helper_add (&plane->base, &tegra_plane_helper_funcs); -drm_plane_create_zpos_property (&plane->base, plane->index,0 ,255 ); +drm_plane_create_zpos_property (&plane->base,1 + plane->index,1 ,255 ); err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0,
drivers/gpu/drm/tegra/dc.c static struct drm_plane *tegra_dc_cursor_plane_create(struct drm_device *drm, · line 960
Quoted 4 lines
drivers/gpu/drm/tegra/dc.c +1
-0@@ -957,6 +957,7 @@ static struct drm_plane *tegra_dc_cursor_plane_create(struct drm_device *drm, }drm_plane_helper_add (&plane->base, &tegra_cursor_plane_helper_funcs); +drm_plane_create_zpos_immutable_property (&plane->base,0 );
zpos==0 means the plane is at the bottom of the pile. Doesn't seem to agree what you say in the commit msg.
Quoted 37 lines
drivers/gpu/drm/tegra/dc.c +6
-1return &plane->base; }@@ -1074,7 +1075,12 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, }drm_plane_helper_add (&plane->base, &tegra_plane_helper_funcs); -drm_plane_create_zpos_property (&plane->base, plane->index,0 ,255 ); + +if (!cursor) +drm_plane_create_zpos_property (&plane->base,1 + plane->index, +1 ,255 ); +else +drm_plane_create_zpos_immutable_property (&plane->base,0 ); err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0,drivers/gpu/drm/tegra/hub.c +1
-1@@ -590,7 +590,7 @@ struct drm_plane *tegra_shared_plane_create(struct drm_device *drm, }drm_plane_helper_add (p, &tegra_shared_plane_helper_funcs); -drm_plane_create_zpos_property (p,0 ,0 ,255 ); +drm_plane_create_zpos_property (p,1 + index,1 ,255 );return p; }Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 2 lines
Ville Syrjälä Intel
10.06.2020 14:30, Thierry Reding пишет:
Quoted 6 lines
From: Thierry Reding <[email protected]>
As of commit
4dc55525b095("drm: plane: Verify that no or all planes have a zpos property") a warning is emitted if there's a mix of planes with and without a zpos property.
Quoted 8 lines
On Tegra, cursor planes are always composited on top of all other planes, which is why they never had a zpos property attached to them. However, since the composition order is fixed, this is trivial to remedy by simply attaching an immutable zpos property to them.
Reported-by Jonathan Hunter <[email protected]>Signed-off-by Thierry Reding <[email protected]>---
What problem does it solve?
Hi Dmitry,
Quoted 7 lines · Dmitry Osipenko
10.06.2020 14:30, Thierry Reding пишет:
Quoted 4 lines
From: Thierry Reding <[email protected]> As of commit
4dc55525b095("drm: plane: Verify that no or all planes have a zpos property") a warning is emitted if there's a mix of planes with and without a zpos property.What problem does it solve?
Well, it fixes the WARN_ON, which asserts that either no planes have the zpos property attached, or all planes have the zpos property attached. When only _some_ planes have the property, the property is pretty much useless: zpos exists to guarantee to userspace the relative ordering between planes, defined by the value of the property. If not all planes have the property, then userspace cannot reason about the ordering, since some of the planes have undefined ordering.
Cheers,
Daniel
11.06.2020 11:17, Daniel Stone пишет:
Quoted 11 lines
Hi Dmitry,
Quoted 7 lines · Dmitry Osipenko
10.06.2020 14:30, Thierry Reding пишет:
Quoted 4 lines
From: Thierry Reding <[email protected]> As of commit
4dc55525b095("drm: plane: Verify that no or all planes have a zpos property") a warning is emitted if there's a mix of planes with and without a zpos property.What problem does it solve?
Quoted 8 lines
Well, it fixes the
WARN_ON, which asserts that either no planes have the zpos property attached, or all planes have the zpos property attached. When only _some_ planes have the property, the property is pretty much useless: zpos exists to guarantee to userspace the relative ordering between planes, defined by the value of the property. If not all planes have the property, then userspace cannot reason about the ordering, since some of the planes have undefined ordering.
Hello Daniel,
So it's a kernel warning, thank you for the clarification! I'm running only older Tegras that have a black-n-white cursor plane, but this is not supported by the upstream kernel. No wonder that I haven't seen the warning, this made me curious what this patch is about :)