diff options
author | Tom St Denis <tom.stdenis@amd.com> | 2015-09-09 09:34:38 -0400 |
---|---|---|
committer | Michel Dänzer <michel.daenzer@amd.com> | 2015-09-10 11:12:18 +0900 |
commit | 8823c3d4c6db70cff7699b31088f2d92db8faaf4 (patch) | |
tree | d268e5b0ced3da45238eefd6d75cb434ebec283c /src/amdgpu_dri2.c | |
parent | 63948ea091a9b324327ade7ec4fc5d67ca7e6f6f (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>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> (minor fixups)
Diffstat (limited to 'src/amdgpu_dri2.c')
-rw-r--r-- | src/amdgpu_dri2.c | 6 |
1 files changed, 3 insertions, 3 deletions
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; |