[PATCH 1/8] dri2: Avoid calculation with undefined msc value

Michel Dänzer michel at daenzer.net
Tue Nov 10 23:15:59 PST 2015


From: Tom St Denis <tom.stdenis at amd.com>

If the get_msc() call fails for any reason we should avoid updating the
vblank counter delta with undefined data.

Signed-off-by: Tom St Denis <tom.stdenis at amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com> (minor fixups)
(ported from amdgpu commit 8823c3d4c6db70cff7699b31088f2d92db8faaf4)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/radeon_dri2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index b29d88b..466d700 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -641,9 +641,9 @@ xf86CrtcPtr radeon_dri2_drawable_crtc(DrawablePtr pDraw, Bool consider_disabled)
 	if (priv->crtc && priv->crtc != crtc) {
 	    CARD64 ust, mscold, mscnew;
 
-	    radeon_dri2_get_crtc_msc(priv->crtc, &ust, &mscold);
-	    radeon_dri2_get_crtc_msc(crtc, &ust, &mscnew);
-	    priv->vblank_delta += mscold - mscnew;
+	    if (radeon_dri2_get_crtc_msc(priv->crtc, &ust, &mscold) &&
+		radeon_dri2_get_crtc_msc(crtc, &ust, &mscnew))
+		priv->vblank_delta += mscold - mscnew;
 	}
 
 	priv->crtc = crtc;
-- 
2.6.2



More information about the xorg-driver-ati mailing list