aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2018-01-08 10:11:00 -0500
committerThierry Reding <treding@nvidia.com>2018-01-08 10:24:05 -0500
commit89f6501825b5bae3d4aaa2447636f9d3a4287a75 (patch)
treedcac4a2fc449578a24062404f4199f9c6d609856 /drivers
parent5467a8b8da9890e6216dd786e7f65cce5f23d014 (diff)
drm/tegra: dc: Fix possible_crtcs mask for planes
Cursor and overlay planes use a possible_crtcs mask based on the DC pipe number. However, DRM requires each bit in the mask to correspond to the index of the CRTC, which will be different from the DC pipe number for a configuration where the first display controller is disabled, or where a deferred probe leads to the first display controller being probed after the first. Suggested-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/tegra/dc.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 4507063029e0..7a9c9ff8b4d7 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -572,8 +572,7 @@ static const struct drm_plane_helper_funcs tegra_plane_helper_funcs = {
572 .atomic_update = tegra_plane_atomic_update, 572 .atomic_update = tegra_plane_atomic_update,
573}; 573};
574 574
575static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm, 575static unsigned long tegra_plane_get_possible_crtcs(struct drm_device *drm)
576 struct tegra_dc *dc)
577{ 576{
578 /* 577 /*
579 * Ideally this would use drm_crtc_mask(), but that would require the 578 * Ideally this would use drm_crtc_mask(), but that would require the
@@ -587,7 +586,13 @@ static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm,
587 * of CRTCs that have been registered, and should therefore always be 586 * of CRTCs that have been registered, and should therefore always be
588 * the same as drm_crtc_index() after registration. 587 * the same as drm_crtc_index() after registration.
589 */ 588 */
590 unsigned long possible_crtcs = 1 << drm->mode_config.num_crtc; 589 return 1 << drm->mode_config.num_crtc;
590}
591
592static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm,
593 struct tegra_dc *dc)
594{
595 unsigned long possible_crtcs = tegra_plane_get_possible_crtcs(drm);
591 enum drm_plane_type type = DRM_PLANE_TYPE_PRIMARY; 596 enum drm_plane_type type = DRM_PLANE_TYPE_PRIMARY;
592 struct tegra_plane *plane; 597 struct tegra_plane *plane;
593 unsigned int num_formats; 598 unsigned int num_formats;
@@ -744,6 +749,7 @@ static const struct drm_plane_helper_funcs tegra_cursor_plane_helper_funcs = {
744static struct drm_plane *tegra_dc_cursor_plane_create(struct drm_device *drm, 749static struct drm_plane *tegra_dc_cursor_plane_create(struct drm_device *drm,
745 struct tegra_dc *dc) 750 struct tegra_dc *dc)
746{ 751{
752 unsigned long possible_crtcs = tegra_plane_get_possible_crtcs(drm);
747 struct tegra_plane *plane; 753 struct tegra_plane *plane;
748 unsigned int num_formats; 754 unsigned int num_formats;
749 const u32 *formats; 755 const u32 *formats;
@@ -766,7 +772,7 @@ static struct drm_plane *tegra_dc_cursor_plane_create(struct drm_device *drm,
766 num_formats = ARRAY_SIZE(tegra_cursor_plane_formats); 772 num_formats = ARRAY_SIZE(tegra_cursor_plane_formats);
767 formats = tegra_cursor_plane_formats; 773 formats = tegra_cursor_plane_formats;
768 774
769 err = drm_universal_plane_init(drm, &plane->base, 1 << dc->pipe, 775 err = drm_universal_plane_init(drm, &plane->base, possible_crtcs,
770 &tegra_plane_funcs, formats, 776 &tegra_plane_funcs, formats,
771 num_formats, NULL, 777 num_formats, NULL,
772 DRM_PLANE_TYPE_CURSOR, NULL); 778 DRM_PLANE_TYPE_CURSOR, NULL);
@@ -860,6 +866,7 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm,
860 struct tegra_dc *dc, 866 struct tegra_dc *dc,
861 unsigned int index) 867 unsigned int index)
862{ 868{
869 unsigned long possible_crtcs = tegra_plane_get_possible_crtcs(drm);
863 struct tegra_plane *plane; 870 struct tegra_plane *plane;
864 unsigned int num_formats; 871 unsigned int num_formats;
865 const u32 *formats; 872 const u32 *formats;
@@ -876,7 +883,7 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm,
876 num_formats = dc->soc->num_overlay_formats; 883 num_formats = dc->soc->num_overlay_formats;
877 formats = dc->soc->overlay_formats; 884 formats = dc->soc->overlay_formats;
878 885
879 err = drm_universal_plane_init(drm, &plane->base, 1 << dc->pipe, 886 err = drm_universal_plane_init(drm, &plane->base, possible_crtcs,
880 &tegra_plane_funcs, formats, 887 &tegra_plane_funcs, formats,
881 num_formats, NULL, 888 num_formats, NULL,
882 DRM_PLANE_TYPE_OVERLAY, NULL); 889 DRM_PLANE_TYPE_OVERLAY, NULL);