diff options
| author | Philippe CORNU <philippe.cornu@st.com> | 2018-04-07 17:35:03 -0400 |
|---|---|---|
| committer | Philippe Cornu <philippe.cornu@st.com> | 2018-04-19 06:15:38 -0400 |
| commit | 25bb1a9de3cc36ea1fd2dc10f4a375571be0ff37 (patch) | |
| tree | 24b749f5989edddad0c5d2bfb385a05996697a42 /drivers/gpu/drm/stm | |
| parent | c8da819478e8149656ff12e40fde2446f9034e81 (diff) | |
drm/stm: ltdc: add user update info in plane print state
This patch adds the user update information in
frames-per-second into the drm debugfs plane state.
Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
Reviewed-by: Vincent Abriou <vincent.abriou@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180407213503.30932-1-philippe.cornu@st.com
Diffstat (limited to 'drivers/gpu/drm/stm')
| -rw-r--r-- | drivers/gpu/drm/stm/ltdc.c | 22 | ||||
| -rw-r--r-- | drivers/gpu/drm/stm/ltdc.h | 8 |
2 files changed, 30 insertions, 0 deletions
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 2b745cfc9000..061d2b6e5157 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c | |||
| @@ -729,6 +729,8 @@ static void ltdc_plane_atomic_update(struct drm_plane *plane, | |||
| 729 | reg_update_bits(ldev->regs, LTDC_L1CR + lofs, | 729 | reg_update_bits(ldev->regs, LTDC_L1CR + lofs, |
| 730 | LXCR_LEN | LXCR_CLUTEN, val); | 730 | LXCR_LEN | LXCR_CLUTEN, val); |
| 731 | 731 | ||
| 732 | ldev->plane_fpsi[plane->index].counter++; | ||
| 733 | |||
| 732 | mutex_lock(&ldev->err_lock); | 734 | mutex_lock(&ldev->err_lock); |
| 733 | if (ldev->error_status & ISR_FUIF) { | 735 | if (ldev->error_status & ISR_FUIF) { |
| 734 | DRM_DEBUG_DRIVER("Fifo underrun\n"); | 736 | DRM_DEBUG_DRIVER("Fifo underrun\n"); |
| @@ -754,6 +756,25 @@ static void ltdc_plane_atomic_disable(struct drm_plane *plane, | |||
| 754 | oldstate->crtc->base.id, plane->base.id); | 756 | oldstate->crtc->base.id, plane->base.id); |
| 755 | } | 757 | } |
| 756 | 758 | ||
| 759 | static void ltdc_plane_atomic_print_state(struct drm_printer *p, | ||
| 760 | const struct drm_plane_state *state) | ||
| 761 | { | ||
| 762 | struct drm_plane *plane = state->plane; | ||
| 763 | struct ltdc_device *ldev = plane_to_ltdc(plane); | ||
| 764 | struct fps_info *fpsi = &ldev->plane_fpsi[plane->index]; | ||
| 765 | int ms_since_last; | ||
| 766 | ktime_t now; | ||
| 767 | |||
| 768 | now = ktime_get(); | ||
| 769 | ms_since_last = ktime_to_ms(ktime_sub(now, fpsi->last_timestamp)); | ||
| 770 | |||
| 771 | drm_printf(p, "\tuser_updates=%dfps\n", | ||
| 772 | DIV_ROUND_CLOSEST(fpsi->counter * 1000, ms_since_last)); | ||
| 773 | |||
| 774 | fpsi->last_timestamp = now; | ||
| 775 | fpsi->counter = 0; | ||
| 776 | } | ||
| 777 | |||
| 757 | static const struct drm_plane_funcs ltdc_plane_funcs = { | 778 | static const struct drm_plane_funcs ltdc_plane_funcs = { |
| 758 | .update_plane = drm_atomic_helper_update_plane, | 779 | .update_plane = drm_atomic_helper_update_plane, |
| 759 | .disable_plane = drm_atomic_helper_disable_plane, | 780 | .disable_plane = drm_atomic_helper_disable_plane, |
| @@ -761,6 +782,7 @@ static const struct drm_plane_funcs ltdc_plane_funcs = { | |||
| 761 | .reset = drm_atomic_helper_plane_reset, | 782 | .reset = drm_atomic_helper_plane_reset, |
| 762 | .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, | 783 | .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, |
| 763 | .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, | 784 | .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, |
| 785 | .atomic_print_state = ltdc_plane_atomic_print_state, | ||
| 764 | }; | 786 | }; |
| 765 | 787 | ||
| 766 | static const struct drm_plane_helper_funcs ltdc_plane_helper_funcs = { | 788 | static const struct drm_plane_helper_funcs ltdc_plane_helper_funcs = { |
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h index 61a80d00bc3b..1e16d6afb0d2 100644 --- a/drivers/gpu/drm/stm/ltdc.h +++ b/drivers/gpu/drm/stm/ltdc.h | |||
| @@ -20,6 +20,13 @@ struct ltdc_caps { | |||
| 20 | bool non_alpha_only_l1; /* non-native no-alpha formats on layer 1 */ | 20 | bool non_alpha_only_l1; /* non-native no-alpha formats on layer 1 */ |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | #define LTDC_MAX_LAYER 4 | ||
| 24 | |||
| 25 | struct fps_info { | ||
| 26 | unsigned int counter; | ||
| 27 | ktime_t last_timestamp; | ||
| 28 | }; | ||
| 29 | |||
| 23 | struct ltdc_device { | 30 | struct ltdc_device { |
| 24 | void __iomem *regs; | 31 | void __iomem *regs; |
| 25 | struct clk *pixel_clk; /* lcd pixel clock */ | 32 | struct clk *pixel_clk; /* lcd pixel clock */ |
| @@ -27,6 +34,7 @@ struct ltdc_device { | |||
| 27 | struct ltdc_caps caps; | 34 | struct ltdc_caps caps; |
| 28 | u32 error_status; | 35 | u32 error_status; |
| 29 | u32 irq_status; | 36 | u32 irq_status; |
| 37 | struct fps_info plane_fpsi[LTDC_MAX_LAYER]; | ||
| 30 | }; | 38 | }; |
| 31 | 39 | ||
| 32 | int ltdc_load(struct drm_device *ddev); | 40 | int ltdc_load(struct drm_device *ddev); |
