summaryrefslogtreecommitdiff
path: root/src/radeon_dri2.c
diff options
context:
space:
mode:
authorTom St Denis <tom.stdenis@amd.com>2015-11-11 12:54:54 +0900
committerMichel Dänzer <michel@daenzer.net>2015-11-11 15:43:21 +0900
commitdbbcd75b3c80aba77673904d46bca97779fd8a8d (patch)
tree0df7fb625eec5c3301aae7d553e438ce667f72aa /src/radeon_dri2.c
parent7186a8713ba004de4991f21c1a9fc4abc62aeff4 (diff)
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 St Denis <tom.stdenis@amd.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> (minor fixups) (ported from amdgpu commit 8823c3d4c6db70cff7699b31088f2d92db8faaf4) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/radeon_dri2.c')
-rw-r--r--src/radeon_dri2.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index b29d88bc..466d7004 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;