diff options
author | Thierry Reding <treding@nvidia.com> | 2017-08-30 11:34:10 -0400 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2017-10-20 08:19:54 -0400 |
commit | a4bfa0961c4bccbfd5f23d1283fa3d40e6af1b59 (patch) | |
tree | 33e5e5b322034fa0fa9de9fa0d16fc0e3fa9e520 /drivers/gpu/drm/tegra/dc.c | |
parent | 2d1c18fb0d1c566491dfaba09ed24881b1d82152 (diff) |
drm/tegra: dc: Simplify atomic plane helper functions
Remove the tegra_dc_disable_window() function whose only purpose was to
allow tegra_plane_atomic_update() to also call it. Fix that by shuffling
tegra_plano_atomic_disable() to before tegra_plane_atomic_update().
While at it, also remove the overlay plane helper functions because they
are exactly the same as the primary plane helper functions.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra/dc.c')
-rw-r--r-- | drivers/gpu/drm/tegra/dc.c | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index fd31974e2218..6a43dff70822 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c | |||
@@ -550,14 +550,21 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, | |||
550 | return 0; | 550 | return 0; |
551 | } | 551 | } |
552 | 552 | ||
553 | static void tegra_dc_disable_window(struct tegra_dc *dc, int index) | 553 | static void tegra_plane_atomic_disable(struct drm_plane *plane, |
554 | struct drm_plane_state *old_state) | ||
554 | { | 555 | { |
556 | struct tegra_dc *dc = to_tegra_dc(old_state->crtc); | ||
557 | struct tegra_plane *p = to_tegra_plane(plane); | ||
555 | unsigned long flags; | 558 | unsigned long flags; |
556 | u32 value; | 559 | u32 value; |
557 | 560 | ||
561 | /* rien ne va plus */ | ||
562 | if (!old_state || !old_state->crtc) | ||
563 | return; | ||
564 | |||
558 | spin_lock_irqsave(&dc->lock, flags); | 565 | spin_lock_irqsave(&dc->lock, flags); |
559 | 566 | ||
560 | value = WINDOW_A_SELECT << index; | 567 | value = WINDOW_A_SELECT << p->index; |
561 | tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); | 568 | tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); |
562 | 569 | ||
563 | value = tegra_dc_readl(dc, DC_WIN_WIN_OPTIONS); | 570 | value = tegra_dc_readl(dc, DC_WIN_WIN_OPTIONS); |
@@ -582,7 +589,7 @@ static void tegra_plane_atomic_update(struct drm_plane *plane, | |||
582 | return; | 589 | return; |
583 | 590 | ||
584 | if (!plane->state->visible) | 591 | if (!plane->state->visible) |
585 | return tegra_dc_disable_window(dc, p->index); | 592 | return tegra_plane_atomic_disable(plane, old_state); |
586 | 593 | ||
587 | memset(&window, 0, sizeof(window)); | 594 | memset(&window, 0, sizeof(window)); |
588 | window.src.x = plane->state->src.x1 >> 16; | 595 | window.src.x = plane->state->src.x1 >> 16; |
@@ -618,25 +625,10 @@ static void tegra_plane_atomic_update(struct drm_plane *plane, | |||
618 | tegra_dc_setup_window(dc, p->index, &window); | 625 | tegra_dc_setup_window(dc, p->index, &window); |
619 | } | 626 | } |
620 | 627 | ||
621 | static void tegra_plane_atomic_disable(struct drm_plane *plane, | 628 | static const struct drm_plane_helper_funcs tegra_plane_helper_funcs = { |
622 | struct drm_plane_state *old_state) | ||
623 | { | ||
624 | struct tegra_plane *p = to_tegra_plane(plane); | ||
625 | struct tegra_dc *dc; | ||
626 | |||
627 | /* rien ne va plus */ | ||
628 | if (!old_state || !old_state->crtc) | ||
629 | return; | ||
630 | |||
631 | dc = to_tegra_dc(old_state->crtc); | ||
632 | |||
633 | tegra_dc_disable_window(dc, p->index); | ||
634 | } | ||
635 | |||
636 | static const struct drm_plane_helper_funcs tegra_primary_plane_helper_funcs = { | ||
637 | .atomic_check = tegra_plane_atomic_check, | 629 | .atomic_check = tegra_plane_atomic_check, |
638 | .atomic_update = tegra_plane_atomic_update, | ||
639 | .atomic_disable = tegra_plane_atomic_disable, | 630 | .atomic_disable = tegra_plane_atomic_disable, |
631 | .atomic_update = tegra_plane_atomic_update, | ||
640 | }; | 632 | }; |
641 | 633 | ||
642 | static struct drm_plane *tegra_dc_primary_plane_create(struct drm_device *drm, | 634 | static struct drm_plane *tegra_dc_primary_plane_create(struct drm_device *drm, |
@@ -676,7 +668,7 @@ static struct drm_plane *tegra_dc_primary_plane_create(struct drm_device *drm, | |||
676 | return ERR_PTR(err); | 668 | return ERR_PTR(err); |
677 | } | 669 | } |
678 | 670 | ||
679 | drm_plane_helper_add(&plane->base, &tegra_primary_plane_helper_funcs); | 671 | drm_plane_helper_add(&plane->base, &tegra_plane_helper_funcs); |
680 | 672 | ||
681 | return &plane->base; | 673 | return &plane->base; |
682 | } | 674 | } |
@@ -871,12 +863,6 @@ static const uint32_t tegra_overlay_plane_formats[] = { | |||
871 | DRM_FORMAT_YUV422, | 863 | DRM_FORMAT_YUV422, |
872 | }; | 864 | }; |
873 | 865 | ||
874 | static const struct drm_plane_helper_funcs tegra_overlay_plane_helper_funcs = { | ||
875 | .atomic_check = tegra_plane_atomic_check, | ||
876 | .atomic_update = tegra_plane_atomic_update, | ||
877 | .atomic_disable = tegra_plane_atomic_disable, | ||
878 | }; | ||
879 | |||
880 | static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, | 866 | static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, |
881 | struct tegra_dc *dc, | 867 | struct tegra_dc *dc, |
882 | unsigned int index) | 868 | unsigned int index) |
@@ -904,7 +890,7 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, | |||
904 | return ERR_PTR(err); | 890 | return ERR_PTR(err); |
905 | } | 891 | } |
906 | 892 | ||
907 | drm_plane_helper_add(&plane->base, &tegra_overlay_plane_helper_funcs); | 893 | drm_plane_helper_add(&plane->base, &tegra_plane_helper_funcs); |
908 | 894 | ||
909 | return &plane->base; | 895 | return &plane->base; |
910 | } | 896 | } |