]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/tegra: Assign plane type before registration
authorThierry Reding <treding@nvidia.com>
Mon, 21 Apr 2025 16:13:05 +0000 (11:13 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jul 2025 16:27:43 +0000 (18:27 +0200)
commit 9ff4fdf4f44b69237c0afc1d3a8dac916ce66f3e upstream.

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 <webgeek1234@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Cc: stable@vger.kernel.org
Fixes: 473079549f27 ("drm/tegra: dc: Add Tegra186 support")
Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20250421-tegra-drm-primary-v2-1-7f740c4c2121@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/tegra/dc.c
drivers/gpu/drm/tegra/hub.c
drivers/gpu/drm/tegra/hub.h

index 958d12da902d33b8482126ffbef3f483f26d9c8a..8474f022df8f4f0d1d215c1693ec53f9f90acf1c 100644 (file)
@@ -1134,10 +1134,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;
 
@@ -1145,10 +1151,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;
-                               }
                        }
                }
        }
index 5ce771cba1335f4d59466e88294e3bb993963e44..bafc865afe4ba770de12161f1e19625ceda62e61 100644 (file)
@@ -551,9 +551,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;
        /* planes can be assigned to arbitrary CRTCs */
index 3efa1be07ff882e0ff7e522fc74e2738a3fe83c2..aa219450413a5f992861e3c83e8423206fe0a5ca 100644 (file)
@@ -81,7 +81,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);