All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org,
	Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Harry Wentland <harry.wentland@amd.com>
Subject: [PATCH 04/10] drm/amdgpu: Handle 64-bit return from drm_crtc_vblank_count()
Date: Fri,  2 Feb 2018 21:12:56 -0800	[thread overview]
Message-ID: <20180203051302.9974-4-dhinakaran.pandiyan@intel.com> (raw)
In-Reply-To: <20180203051302.9974-1-dhinakaran.pandiyan@intel.com>

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>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 2 +-
 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,
 	amdgpu_bo_unreserve(new_abo);
 
 	work->base = base;
-	work->target_vblank = target - drm_crtc_vblank_count(crtc) +
+	work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) +
 		amdgpu_get_vblank_counter_kms(dev, work->crtc_id);
 
 	/* 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,
 
 
 	/* Prepare wait for target vblank early - before the fence-waits */
-	target_vblank = target - drm_crtc_vblank_count(crtc) +
+	target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) +
 			amdgpu_get_vblank_counter_kms(crtc->dev, acrtc->crtc_id);
 
 	/* 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,
 			amdgpu_dm_do_flip(
 				crtc,
 				fb,
-				drm_crtc_vblank_count(crtc) + *wait_for_vblank,
+				(uint32_t)drm_crtc_vblank_count(crtc) + *wait_for_vblank,
 				dm_state->context);
 		}
 
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-02-03  5:12 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-03  5:12 [PATCH 01/10] drm/vblank: Data type fixes for 64-bit vblank sequences Dhinakaran Pandiyan
2018-02-03  5:12 ` [PATCH 02/10] drm/i915/vblank: Make the vblank counter u64 -> u32 typecast explicit Dhinakaran Pandiyan
2018-02-03  5:12 ` [PATCH 03/10] drm/i915: Handle 64-bit return from drm_crtc_vblank_count() Dhinakaran Pandiyan
2018-02-03  5:12 ` Dhinakaran Pandiyan [this message]
2018-02-05 15:20   ` [PATCH 04/10] drm/amdgpu: " Harry Wentland
2018-02-05 18:11   ` Alex Deucher
2018-02-03  5:12 ` [PATCH 05/10] drm/radeon: " Dhinakaran Pandiyan
2018-02-03  5:12 ` [PATCH 06/10] drm/tegra: " Dhinakaran Pandiyan
2018-02-07  1:41   ` Pandiyan, Dhinakaran
2018-02-07  9:41     ` Thierry Reding
2018-02-07 21:32       ` Pandiyan, Dhinakaran
2018-02-13  7:55         ` Rodrigo Vivi
2018-02-14 18:41           ` [Intel-gfx] " Rodrigo Vivi
2018-02-15 12:17     ` Thierry Reding
2018-02-03  5:12 ` [PATCH 07/10] drm/atomic: " Dhinakaran Pandiyan
2018-02-03  5:13 ` [PATCH 08/10] drm/vblank: Do not update vblank count if interrupts are already disabled Dhinakaran Pandiyan
2018-02-03  5:13 ` [PATCH 09/10] drm/vblank: Restoring vblank counts after device PM events Dhinakaran Pandiyan
2018-02-19 22:39   ` Daniel Vetter
2018-02-03  5:13 ` [PATCH 10/10] drm/i915: Estimate and update missed vblanks Dhinakaran Pandiyan
2018-02-03  6:16 ` ✓ Fi.CI.BAT: success for series starting with [01/10] drm/vblank: Data type fixes for 64-bit vblank sequences Patchwork
2018-02-03  8:14 ` [PATCH 01/10] " Keith Packard
2018-02-05 20:32   ` Rodrigo Vivi
2018-02-05 20:37     ` Dave Airlie
2018-02-05 20:49       ` Rodrigo Vivi
2018-02-05 21:11         ` [Intel-gfx] " Pandiyan, Dhinakaran
2018-02-05 23:41         ` Keith Packard
2018-02-15 19:55       ` Rodrigo Vivi
2018-02-16 18:49         ` [Intel-gfx] " Pandiyan, Dhinakaran
2018-02-03  9:58 ` ✗ Fi.CI.IGT: failure for series starting with [01/10] " Patchwork
2018-02-06 18:38 ` ✓ Fi.CI.BAT: success " Patchwork
2018-02-07  7:20 ` ✗ Fi.CI.BAT: warning " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180203051302.9974-4-dhinakaran.pandiyan@intel.com \
    --to=dhinakaran.pandiyan@intel.com \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.