Blame SOURCES/0005-animcur-Fix-transitions-between-animated-cursors.patch

637c9d
From a8f8ecdde495fb2a6ecdeca306b55c22b5fd3a6d Mon Sep 17 00:00:00 2001
637c9d
From: Adam Jackson <ajax@redhat.com>
637c9d
Date: Tue, 9 Jan 2018 10:54:05 -0500
637c9d
Subject: [PATCH xserver 5/6] animcur: Fix transitions between animated cursors
637c9d
637c9d
We weren't cancelling the old timer when changing cursors, making things
637c9d
go all crashy. Logically we could always cancel the timer first, but
637c9d
then we'd have to call TimerSet to re-arm ourselves, and GetTimeInMillis
637c9d
is potentially expensive.
637c9d
637c9d
Reported-by: https://devtalk.nvidia.com/default/topic/1028172/linux/titan-v-ubuntu-16-04lts-and-387-34-driver-crashes-badly/post/5230967/#5230967
637c9d
Signed-off-by: Adam Jackson <ajax@redhat.com>
637c9d
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
637c9d
Tested-by: Aaron Plattner <aplattner@nvidia.com>
637c9d
(cherry picked from commit de60245e05c0d2528d4ff42557a044387e53315c)
637c9d
---
637c9d
 render/animcur.c | 25 +++++++++++++++----------
637c9d
 1 file changed, 15 insertions(+), 10 deletions(-)
637c9d
637c9d
diff --git a/render/animcur.c b/render/animcur.c
637c9d
index 9393b4018..e585a8f23 100644
637c9d
--- a/render/animcur.c
637c9d
+++ b/render/animcur.c
637c9d
@@ -152,11 +152,20 @@ AnimCurTimerNotify(OsTimerPtr timer, CARD32 now, void *arg)
637c9d
     return ac->elts[elt].delay;
637c9d
 }
637c9d
637c9d
+static void
637c9d
+AnimCurCancelTimer(DeviceIntPtr pDev)
637c9d
+{
637c9d
+    CursorPtr cur = pDev->spriteInfo->anim.pCursor;
637c9d
+
637c9d
+    if (IsAnimCur(cur))
637c9d
+        TimerCancel(GetAnimCur(cur)->timer);
637c9d
+}
637c9d
+
637c9d
 static Bool
637c9d
 AnimCurDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
637c9d
 {
637c9d
     AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
637c9d
-    Bool ret;
637c9d
+    Bool ret = TRUE;
637c9d
637c9d
     if (IsFloating(pDev))
637c9d
         return FALSE;
637c9d
@@ -166,8 +175,10 @@ AnimCurDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
637c9d
         if (pCursor != pDev->spriteInfo->anim.pCursor) {
637c9d
             AnimCurPtr ac = GetAnimCur(pCursor);
637c9d
637c9d
-            ret = (*pScreen->DisplayCursor)
637c9d
-                (pDev, pScreen, ac->elts[0].pCursor);
637c9d
+            AnimCurCancelTimer(pDev);
637c9d
+            ret = (*pScreen->DisplayCursor) (pDev, pScreen,
637c9d
+                                             ac->elts[0].pCursor);
637c9d
+
637c9d
             if (ret) {
637c9d
                 pDev->spriteInfo->anim.elt = 0;
637c9d
                 pDev->spriteInfo->anim.time =
637c9d
@@ -179,15 +190,9 @@ AnimCurDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
637c9d
                                      AnimCurTimerNotify, pDev);
637c9d
             }
637c9d
         }
637c9d
-        else
637c9d
-            ret = TRUE;
637c9d
     }
637c9d
     else {
637c9d
-        CursorPtr old = pDev->spriteInfo->anim.pCursor;
637c9d
-
637c9d
-        if (old && IsAnimCur(old))
637c9d
-            TimerCancel(GetAnimCur(old)->timer);
637c9d
-
637c9d
+        AnimCurCancelTimer(pDev);
637c9d
         pDev->spriteInfo->anim.pCursor = 0;
637c9d
         pDev->spriteInfo->anim.pScreen = 0;
637c9d
         ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
637c9d
--
637c9d
2.14.3