bug99358.patch 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. From 7198a6d4e74f684cb383b3e0f70dd2bae405e6e7 Mon Sep 17 00:00:00 2001
  2. From: Chris Wilson <chris@chris-wilson.co.uk>
  3. Date: Mon, 16 Jan 2017 22:17:36 +0000
  4. Subject: xfree86: Take the input lock for xf86RecolorCursor
  5. xf86RecolorCursor() may be called directly from XRecolorCursor as well
  6. as from xf86ScreenSetCursor(). In the latter case, the input lock is
  7. already held, but not for the former and so we need to add a wrapper
  8. function that acquires the input lock before performing
  9. xf86RecolorCursor()
  10. References: https://bugs.freedesktop.org/show_bug.cgi?id=99358
  11. diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
  12. index 4481320..55d5861 100644
  13. --- a/hw/xfree86/ramdac/xf86HWCurs.c
  14. +++ b/hw/xfree86/ramdac/xf86HWCurs.c
  15. @@ -22,6 +22,9 @@
  16. #include "servermd.h"
  17. +static void
  18. +xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs);
  19. +
  20. static CARD32
  21. xf86ReverseBitOrder(CARD32 v)
  22. {
  23. @@ -204,7 +207,7 @@ xf86ScreenSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
  24. if (!xf86DriverLoadCursorImage (infoPtr, bits))
  25. return FALSE;
  26. - xf86RecolorCursor(pScreen, pCurs, 1);
  27. + xf86RecolorCursor_locked (ScreenPriv, pCurs);
  28. (*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y);
  29. @@ -312,12 +315,9 @@ xf86MoveCursor(ScreenPtr pScreen, int x, int y)
  30. input_unlock();
  31. }
  32. -void
  33. -xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
  34. +static void
  35. +xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs)
  36. {
  37. - xf86CursorScreenPtr ScreenPriv =
  38. - (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
  39. - xf86CursorScreenKey);
  40. xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
  41. /* recoloring isn't applicable to ARGB cursors and drivers
  42. @@ -357,6 +357,18 @@ xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
  43. }
  44. }
  45. +void
  46. +xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
  47. +{
  48. + xf86CursorScreenPtr ScreenPriv =
  49. + (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
  50. + xf86CursorScreenKey);
  51. +
  52. + input_lock();
  53. + xf86RecolorCursor_locked (ScreenPriv, pCurs);
  54. + input_unlock();
  55. +}
  56. +
  57. /* These functions assume that MaxWidth is a multiple of 32 */
  58. static unsigned char *
  59. RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
  60. --
  61. cgit v0.10.2
  62. From cfddd919cce4178baba07959e5e862d02e166522 Mon Sep 17 00:00:00 2001
  63. From: Chris Wilson <chris@chris-wilson.co.uk>
  64. Date: Mon, 16 Jan 2017 22:36:34 +0000
  65. Subject: xfree86: Take input lock for xf86TransparentCursor
  66. diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
  67. index 55d5861..26dc7e5 100644
  68. --- a/hw/xfree86/ramdac/xf86HWCurs.c
  69. +++ b/hw/xfree86/ramdac/xf86HWCurs.c
  70. @@ -261,6 +261,8 @@ xf86SetTransparentCursor(ScreenPtr pScreen)
  71. xf86CursorScreenKey);
  72. xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
  73. + input_lock();
  74. +
  75. if (!ScreenPriv->transparentData)
  76. ScreenPriv->transparentData =
  77. (*infoPtr->RealizeCursor) (infoPtr, NullCursor);
  78. @@ -273,6 +275,8 @@ xf86SetTransparentCursor(ScreenPtr pScreen)
  79. ScreenPriv->transparentData);
  80. (*infoPtr->ShowCursor) (infoPtr->pScrn);
  81. +
  82. + input_unlock();
  83. }
  84. static void
  85. --
  86. cgit v0.10.2
  87. From 3eb964e25243056dd998f52d3b00171b71c89189 Mon Sep 17 00:00:00 2001
  88. From: Chris Wilson <chris@chris-wilson.co.uk>
  89. Date: Fri, 20 Jan 2017 09:49:19 +0000
  90. Subject: xfree86: Take input_lock() for xf86ScreenCheckHWCursor
  91. diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
  92. index 26dc7e5..7043a9c 100644
  93. --- a/hw/xfree86/ramdac/xf86HWCurs.c
  94. +++ b/hw/xfree86/ramdac/xf86HWCurs.c
  95. @@ -139,9 +139,14 @@ Bool
  96. xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr)
  97. {
  98. ScreenPtr pSlave;
  99. + Bool use_hw_cursor = TRUE;
  100. - if (!xf86ScreenCheckHWCursor(pScreen, cursor, infoPtr))
  101. - return FALSE;
  102. + input_lock();
  103. +
  104. + if (!xf86ScreenCheckHWCursor(pScreen, cursor, infoPtr)) {
  105. + use_hw_cursor = FALSE;
  106. + goto unlock;
  107. + }
  108. /* ask each driver consuming a pixmap if it can support HW cursor */
  109. xorg_list_for_each_entry(pSlave, &pScreen->slave_list, slave_head) {
  110. @@ -151,14 +156,22 @@ xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr
  111. continue;
  112. sPriv = dixLookupPrivate(&pSlave->devPrivates, xf86CursorScreenKey);
  113. - if (!sPriv) /* NULL if Option "SWCursor", possibly other conditions */
  114. - return FALSE;
  115. + if (!sPriv) { /* NULL if Option "SWCursor", possibly other conditions */
  116. + use_hw_cursor = FALSE;
  117. + break;
  118. + }
  119. /* FALSE if HWCursor not supported by slave */
  120. - if (!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr))
  121. - return FALSE;
  122. + if (!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr)) {
  123. + use_hw_cursor = FALSE;
  124. + break;
  125. + }
  126. }
  127. - return TRUE;
  128. +
  129. +unlock:
  130. + input_unlock();
  131. +
  132. + return use_hw_cursor;
  133. }
  134. static Bool
  135. --
  136. cgit v0.10.2