Commit 8823c3d4 authored by Tom Denis's avatar Tom Denis Committed by Michel Dänzer
Browse files

dri2: Avoid calculation with undefined msc value



If the get_msc() call fails for any reason we should avoid updating the
vblank counter delta with undefined data.
Signed-off-by: Tom Denis's avatarTom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König's avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> (minor fixups)
parent 63948ea0
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment