On Sat, Apr 19, 2025 at 7:30 PM Aaron Kling via B4 Relay
<devnull+webgeek1234.gmail....@kernel.org> wrote:
>
> From: Thierry Reding <tred...@nvidia.com>
>
> Changes to a plane's type after it has been registered aren't propagated
> to userspace automatically. This could possibly be achieved by updating
> the property, but since we can already determine which type this should
> be before the registration, passing in the right type from the start is
> a much better solution.
>
> Suggested-by: Aaron Kling <webgeek1...@gmail.com>
> Signed-off-by: Thierry Reding <tred...@nvidia.com>
> Cc: sta...@vger.kernel.org
> ---
> Signed-off-by: Aaron Kling <webgeek1...@gmail.com>
> ---
>  drivers/gpu/drm/tegra/dc.c  | 12 ++++++++----
>  drivers/gpu/drm/tegra/hub.c |  4 ++--
>  drivers/gpu/drm/tegra/hub.h |  3 ++-
>  3 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
> index 
> 798507a8ae56d6789feb95dccdd23b2e63d9c148..56f12dbcee3e93ff5e4804e5fe9b23f160073ebf
>  100644
> --- a/drivers/gpu/drm/tegra/dc.c
> +++ b/drivers/gpu/drm/tegra/dc.c
> @@ -1321,10 +1321,16 @@ static struct drm_plane 
> *tegra_dc_add_shared_planes(struct drm_device *drm,
>                 if (wgrp->dc == dc->pipe) {
>                         for (j = 0; j < wgrp->num_windows; j++) {
>                                 unsigned int index = wgrp->windows[j];
> +                               enum drm_plane_type type;
> +
> +                               if (primary)
> +                                       type = DRM_PLANE_TYPE_OVERLAY;
> +                               else
> +                                       type = DRM_PLANE_TYPE_PRIMARY;
>
>                                 plane = tegra_shared_plane_create(drm, dc,
>                                                                   wgrp->index,
> -                                                                 index);
> +                                                                 index, 
> type);
>                                 if (IS_ERR(plane))
>                                         return plane;
>
> @@ -1332,10 +1338,8 @@ static struct drm_plane 
> *tegra_dc_add_shared_planes(struct drm_device *drm,
>                                  * Choose the first shared plane owned by this
>                                  * head as the primary plane.
>                                  */
> -                               if (!primary) {
> -                                       plane->type = DRM_PLANE_TYPE_PRIMARY;
> +                               if (!primary)
>                                         primary = plane;
> -                               }
>                         }
>                 }
>         }
> diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c
> index 
> fa6140fc37fb16df4b150e5ae9d8148f8f446cd7..8f779f23dc0904d38b14d3f3a928a07fc9e601ad
>  100644
> --- a/drivers/gpu/drm/tegra/hub.c
> +++ b/drivers/gpu/drm/tegra/hub.c
> @@ -755,9 +755,9 @@ static const struct drm_plane_helper_funcs 
> tegra_shared_plane_helper_funcs = {
>  struct drm_plane *tegra_shared_plane_create(struct drm_device *drm,
>                                             struct tegra_dc *dc,
>                                             unsigned int wgrp,
> -                                           unsigned int index)
> +                                           unsigned int index,
> +                                           enum drm_plane_type type)
>  {
> -       enum drm_plane_type type = DRM_PLANE_TYPE_OVERLAY;
>         struct tegra_drm *tegra = drm->dev_private;
>         struct tegra_display_hub *hub = tegra->hub;
>         struct tegra_shared_plane *plane;
> diff --git a/drivers/gpu/drm/tegra/hub.h b/drivers/gpu/drm/tegra/hub.h
> index 
> 23c4b2115ed1e36e8d2d6ed614a6ead97eb4c441..a66f18c4facc9df96ea8b9f54239b52f06536d12
>  100644
> --- a/drivers/gpu/drm/tegra/hub.h
> +++ b/drivers/gpu/drm/tegra/hub.h
> @@ -80,7 +80,8 @@ void tegra_display_hub_cleanup(struct tegra_display_hub 
> *hub);
>  struct drm_plane *tegra_shared_plane_create(struct drm_device *drm,
>                                             struct tegra_dc *dc,
>                                             unsigned int wgrp,
> -                                           unsigned int index);
> +                                           unsigned int index,
> +                                           enum drm_plane_type type);
>
>  int tegra_display_hub_atomic_check(struct drm_device *drm,
>                                    struct drm_atomic_state *state);
>
> ---
> base-commit: 119009db267415049182774196e3cce9e13b52ef
> change-id: 20250419-tegra-drm-primary-ce47febefdaf
>
> Best regards,
> --
> Aaron Kling <webgeek1...@gmail.com>
>
>

This patch was being discussed on the tegra-drm freedesktop issue
tracker [0], but movement there has stopped. I'm submitting the change
here in hopes of getting it moving again.

The stable cc is intended to get this picked back to 6.12 at least.
But as far as I know, this bug has existed as long as Tegra186 support
in tegra-drm has.

Sincerely,
Aaron Kling

[0] https://gitlab.freedesktop.org/drm/tegra/-/issues/3

Reply via email to