diff options
author | Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> | 2018-02-03 00:12:56 -0500 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2018-02-15 14:49:35 -0500 |
commit | 23effc1100975a36953255c1db737f18adf8dd0d (patch) | |
tree | ebef9e3337d8638ec487bc5fe337e0c5549cda51 | |
parent | 1b29b7ca7d43be309d399c996910c04a8ba0c195 (diff) |
drm/amdgpu: Handle 64-bit return from drm_crtc_vblank_count()
570e86963a51 ("drm: Widen vblank count to 64-bits [v3]") changed the
return type for drm_crtc_vblank_count() to u64. This could cause
potential problems if the return value is used in arithmetic operations
with a 32-bit reference HW vblank count. Explicitly typecasting this down
to u32 either fixes a potential problem or serves to add clarity in case
the typecasting was implicitly done.
Cc: Keith Packard <keithp@keithp.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com> for both this patch
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180203051302.9974-4-dhinakaran.pandiyan@intel.com
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index 38d47559f098..c2fa5d55f04e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | |||
@@ -207,7 +207,7 @@ int amdgpu_crtc_page_flip_target(struct drm_crtc *crtc, | |||
207 | amdgpu_bo_unreserve(new_abo); | 207 | amdgpu_bo_unreserve(new_abo); |
208 | 208 | ||
209 | work->base = base; | 209 | work->base = base; |
210 | work->target_vblank = target - drm_crtc_vblank_count(crtc) + | 210 | work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) + |
211 | amdgpu_get_vblank_counter_kms(dev, work->crtc_id); | 211 | amdgpu_get_vblank_counter_kms(dev, work->crtc_id); |
212 | 212 | ||
213 | /* we borrow the event spin lock for protecting flip_wrok */ | 213 | /* we borrow the event spin lock for protecting flip_wrok */ |
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 1ce4c98385e3..b7254a29b34a 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | |||
@@ -3836,7 +3836,7 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc, | |||
3836 | 3836 | ||
3837 | 3837 | ||
3838 | /* Prepare wait for target vblank early - before the fence-waits */ | 3838 | /* Prepare wait for target vblank early - before the fence-waits */ |
3839 | target_vblank = target - drm_crtc_vblank_count(crtc) + | 3839 | target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) + |
3840 | amdgpu_get_vblank_counter_kms(crtc->dev, acrtc->crtc_id); | 3840 | amdgpu_get_vblank_counter_kms(crtc->dev, acrtc->crtc_id); |
3841 | 3841 | ||
3842 | /* TODO This might fail and hence better not used, wait | 3842 | /* TODO This might fail and hence better not used, wait |
@@ -3982,7 +3982,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, | |||
3982 | amdgpu_dm_do_flip( | 3982 | amdgpu_dm_do_flip( |
3983 | crtc, | 3983 | crtc, |
3984 | fb, | 3984 | fb, |
3985 | drm_crtc_vblank_count(crtc) + *wait_for_vblank, | 3985 | (uint32_t)drm_crtc_vblank_count(crtc) + *wait_for_vblank, |
3986 | dm_state->context); | 3986 | dm_state->context); |
3987 | } | 3987 | } |
3988 | 3988 | ||