diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gpu/drm/sti/sti_plane.c | 16 | ||||
| -rw-r--r-- | drivers/gpu/drm/sti/sti_plane.h | 2 |
2 files changed, 4 insertions, 14 deletions
diff --git a/drivers/gpu/drm/sti/sti_plane.c b/drivers/gpu/drm/sti/sti_plane.c index 85cee9098439..0cf3335ef37c 100644 --- a/drivers/gpu/drm/sti/sti_plane.c +++ b/drivers/gpu/drm/sti/sti_plane.c | |||
| @@ -45,25 +45,15 @@ const char *sti_plane_to_str(struct sti_plane *plane) | |||
| 45 | 45 | ||
| 46 | #define STI_FPS_INTERVAL_MS 3000 | 46 | #define STI_FPS_INTERVAL_MS 3000 |
| 47 | 47 | ||
| 48 | static int sti_plane_timespec_ms_diff(struct timespec lhs, struct timespec rhs) | ||
| 49 | { | ||
| 50 | struct timespec tmp_ts = timespec_sub(lhs, rhs); | ||
| 51 | u64 tmp_ns = (u64)timespec_to_ns(&tmp_ts); | ||
| 52 | |||
| 53 | do_div(tmp_ns, NSEC_PER_MSEC); | ||
| 54 | |||
| 55 | return (u32)tmp_ns; | ||
| 56 | } | ||
| 57 | |||
| 58 | void sti_plane_update_fps(struct sti_plane *plane, | 48 | void sti_plane_update_fps(struct sti_plane *plane, |
| 59 | bool new_frame, | 49 | bool new_frame, |
| 60 | bool new_field) | 50 | bool new_field) |
| 61 | { | 51 | { |
| 62 | struct timespec now; | 52 | ktime_t now; |
| 63 | struct sti_fps_info *fps; | 53 | struct sti_fps_info *fps; |
| 64 | int fpks, fipks, ms_since_last, num_frames, num_fields; | 54 | int fpks, fipks, ms_since_last, num_frames, num_fields; |
| 65 | 55 | ||
| 66 | getrawmonotonic(&now); | 56 | now = ktime_get(); |
| 67 | 57 | ||
| 68 | /* Compute number of frame updates */ | 58 | /* Compute number of frame updates */ |
| 69 | fps = &plane->fps_info; | 59 | fps = &plane->fps_info; |
| @@ -76,7 +66,7 @@ void sti_plane_update_fps(struct sti_plane *plane, | |||
| 76 | return; | 66 | return; |
| 77 | 67 | ||
| 78 | fps->curr_frame_counter++; | 68 | fps->curr_frame_counter++; |
| 79 | ms_since_last = sti_plane_timespec_ms_diff(now, fps->last_timestamp); | 69 | ms_since_last = ktime_to_ms(ktime_sub(now, fps->last_timestamp)); |
| 80 | num_frames = fps->curr_frame_counter - fps->last_frame_counter; | 70 | num_frames = fps->curr_frame_counter - fps->last_frame_counter; |
| 81 | 71 | ||
| 82 | if (num_frames <= 0 || ms_since_last < STI_FPS_INTERVAL_MS) | 72 | if (num_frames <= 0 || ms_since_last < STI_FPS_INTERVAL_MS) |
diff --git a/drivers/gpu/drm/sti/sti_plane.h b/drivers/gpu/drm/sti/sti_plane.h index 39d39f5b7dd9..e0ea1dd3bb88 100644 --- a/drivers/gpu/drm/sti/sti_plane.h +++ b/drivers/gpu/drm/sti/sti_plane.h | |||
| @@ -55,7 +55,7 @@ struct sti_fps_info { | |||
| 55 | unsigned int last_frame_counter; | 55 | unsigned int last_frame_counter; |
| 56 | unsigned int curr_field_counter; | 56 | unsigned int curr_field_counter; |
| 57 | unsigned int last_field_counter; | 57 | unsigned int last_field_counter; |
| 58 | struct timespec last_timestamp; | 58 | ktime_t last_timestamp; |
| 59 | char fps_str[FPS_LENGTH]; | 59 | char fps_str[FPS_LENGTH]; |
| 60 | char fips_str[FPS_LENGTH]; | 60 | char fips_str[FPS_LENGTH]; |
| 61 | }; | 61 | }; |
