Re: [PATCH xserver 1/3] xfree86: Take the input lock for xf86RecolorCursor

2017-02-07 Thread Peter Hutterer
On Thu, Feb 02, 2017 at 10:51:44AM +, Chris Wilson wrote:
> xf86RecolorCursor() may be called directly from XRecolorCursor as well
> as from xf86ScreenSetCursor(). In the latter case, the input lock is
> already held, but not for the former and so we need to add a wrapper
> function that acquires the input lock before performing
> xf86RecolorCursor()
> 
> Fixes: 6a5a4e60373c ("Remove SIGIO support for input [v5]")
> References: https://bugs.freedesktop.org/show_bug.cgi?id=99358
> Signed-off-by: Chris Wilson 

I pushed all three, but I had the ones from the bugreport directly in the
tree rather than these, so they're missing the s-o-b and the
references/fixes. sorry about that :(

Cheers,
   Peter

> ---
>  hw/xfree86/ramdac/xf86HWCurs.c | 24 ++--
>  1 file changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
> index 448132095..55d5861c1 100644
> --- a/hw/xfree86/ramdac/xf86HWCurs.c
> +++ b/hw/xfree86/ramdac/xf86HWCurs.c
> @@ -22,6 +22,9 @@
>  
>  #include "servermd.h"
>  
> +static void
> +xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs);
> +
>  static CARD32
>  xf86ReverseBitOrder(CARD32 v)
>  {
> @@ -204,7 +207,7 @@ xf86ScreenSetCursor(ScreenPtr pScreen, CursorPtr pCurs, 
> int x, int y)
>  if (!xf86DriverLoadCursorImage (infoPtr, bits))
>  return FALSE;
>  
> -xf86RecolorCursor(pScreen, pCurs, 1);
> +xf86RecolorCursor_locked (ScreenPriv, pCurs);
>  
>  (*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y);
>  
> @@ -312,12 +315,9 @@ xf86MoveCursor(ScreenPtr pScreen, int x, int y)
>  input_unlock();
>  }
>  
> -void
> -xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
> +static void
> +xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs)
>  {
> -xf86CursorScreenPtr ScreenPriv =
> -(xf86CursorScreenPtr) dixLookupPrivate(>devPrivates,
> -   xf86CursorScreenKey);
>  xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
>  
>  /* recoloring isn't applicable to ARGB cursors and drivers
> @@ -357,6 +357,18 @@ xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, 
> Bool displayed)
>  }
>  }
>  
> +void
> +xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
> +{
> +xf86CursorScreenPtr ScreenPriv =
> +(xf86CursorScreenPtr) dixLookupPrivate(>devPrivates,
> +   xf86CursorScreenKey);
> +
> +input_lock();
> +xf86RecolorCursor_locked (ScreenPriv, pCurs);
> +input_unlock();
> +}
> +
>  /* These functions assume that MaxWidth is a multiple of 32 */
>  static unsigned char *
>  RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
> -- 
> 2.11.0
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
> 
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 1/3] xfree86: Take the input lock for xf86RecolorCursor

2017-02-02 Thread Chris Wilson
xf86RecolorCursor() may be called directly from XRecolorCursor as well
as from xf86ScreenSetCursor(). In the latter case, the input lock is
already held, but not for the former and so we need to add a wrapper
function that acquires the input lock before performing
xf86RecolorCursor()

Fixes: 6a5a4e60373c ("Remove SIGIO support for input [v5]")
References: https://bugs.freedesktop.org/show_bug.cgi?id=99358
Signed-off-by: Chris Wilson 
---
 hw/xfree86/ramdac/xf86HWCurs.c | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
index 448132095..55d5861c1 100644
--- a/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/hw/xfree86/ramdac/xf86HWCurs.c
@@ -22,6 +22,9 @@
 
 #include "servermd.h"
 
+static void
+xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs);
+
 static CARD32
 xf86ReverseBitOrder(CARD32 v)
 {
@@ -204,7 +207,7 @@ xf86ScreenSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int 
x, int y)
 if (!xf86DriverLoadCursorImage (infoPtr, bits))
 return FALSE;
 
-xf86RecolorCursor(pScreen, pCurs, 1);
+xf86RecolorCursor_locked (ScreenPriv, pCurs);
 
 (*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y);
 
@@ -312,12 +315,9 @@ xf86MoveCursor(ScreenPtr pScreen, int x, int y)
 input_unlock();
 }
 
-void
-xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
+static void
+xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs)
 {
-xf86CursorScreenPtr ScreenPriv =
-(xf86CursorScreenPtr) dixLookupPrivate(>devPrivates,
-   xf86CursorScreenKey);
 xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
 
 /* recoloring isn't applicable to ARGB cursors and drivers
@@ -357,6 +357,18 @@ xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool 
displayed)
 }
 }
 
+void
+xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
+{
+xf86CursorScreenPtr ScreenPriv =
+(xf86CursorScreenPtr) dixLookupPrivate(>devPrivates,
+   xf86CursorScreenKey);
+
+input_lock();
+xf86RecolorCursor_locked (ScreenPriv, pCurs);
+input_unlock();
+}
+
 /* These functions assume that MaxWidth is a multiple of 32 */
 static unsigned char *
 RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
-- 
2.11.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel