From 8823c3d4c6db70cff7699b31088f2d92db8faaf4 Mon Sep 17 00:00:00 2001 From: Tom St Denis Date: Wed, 9 Sep 2015 09:34:38 -0400 Subject: dri2: Avoid calculation with undefined msc value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Christian König Acked-by: Alex Deucher Signed-off-by: Michel Dänzer (minor fixups) --- src/amdgpu_dri2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/amdgpu_dri2.c') diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c index cdef3f2..0d9323b 100644 --- a/src/amdgpu_dri2.c +++ b/src/amdgpu_dri2.c @@ -507,9 +507,9 @@ xf86CrtcPtr amdgpu_dri2_drawable_crtc(DrawablePtr pDraw, Bool consider_disabled) if (priv->crtc && priv->crtc != crtc) { CARD64 ust, mscold, mscnew; - amdgpu_dri2_get_crtc_msc(priv->crtc, &ust, &mscold); - amdgpu_dri2_get_crtc_msc(crtc, &ust, &mscnew); - priv->vblank_delta += mscold - mscnew; + if (amdgpu_dri2_get_crtc_msc(priv->crtc, &ust, &mscold) && + amdgpu_dri2_get_crtc_msc(crtc, &ust, &mscnew)) + priv->vblank_delta += mscold - mscnew; } priv->crtc = crtc; -- cgit v1.2.3