[xf86-input-mouse] Support input ABI version 23 and 24

Submitted by Keith Packard on May 30, 2016, 8:42 a.m.

Details

Message ID 1464597740-2681-1-git-send-email-keithp@keithp.com
State Superseded
Headers show
Series "Support input ABI version 23 and 24" ( rev: 1 ) in X.org (DEPRECATED - USE GITLAB)

Not browsing as part of any series.

Commit Message

Keith Packard May 30, 2016, 8:42 a.m.
Version 23 has threaded input, so locking uses input_lock/input_unlock
instead of xf86BlockSIGIO/xf86UnblockSIGIO.

Version 24 removes the FD_SET arguments from block and wakeup handlers

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 src/mouse.c | 45 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 9 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mouse.c b/src/mouse.c
index f9f874b..dae98aa 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -129,6 +129,18 @@  typedef struct _DragLockRec {
 } DragLockRec, *DragLockPtr;
 
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 23
+#define HAVE_THREADED_INPUT	1
+#endif
+
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 24
+#define BLOCK_HANDLER_ARGS     	void *data, void *waitTime
+#define WAKEUP_HANDLER_ARGS	void *data, int i
+#else
+#define BLOCK_HANDLER_ARGS	pointer data, struct timeval **waitTime, pointer LastSelectMask
+#define WAKEUP_HANDLER_ARGS	void *data, int i, pointer LastSelectMask
+#endif
+
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
 static InputInfoPtr MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags);
 #else
@@ -140,9 +152,8 @@  static void MouseCtrl(DeviceIntPtr device, PtrCtrl *ctrl);
 static void MousePostEvent(InputInfoPtr pInfo, int buttons,
                            int dx, int dy, int dz, int dw);
 static void MouseReadInput(InputInfoPtr pInfo);
-static void MouseBlockHandler(pointer data, struct timeval **waitTime,
-                              pointer LastSelectMask);
-static void MouseWakeupHandler(pointer data, int i, pointer LastSelectMask);
+static void MouseBlockHandler(BLOCK_HANDLER_ARGS);
+static void MouseWakeupHandler(WAKEUP_HANDLER_ARGS);
 static void FlushButtons(MouseDevPtr pMse);
 
 static Bool SetupMouse(InputInfoPtr pInfo);
@@ -2025,12 +2036,18 @@  static CARD32
 buttonTimer(InputInfoPtr pInfo)
 {
     MouseDevPtr pMse;
+#if !HAVE_THREADED_INPUT
     int sigstate;
+#endif
     int id;
 
     pMse = pInfo->private;
 
+#if HAVE_THREADED_INPUT
+    input_lock();
+#else
     sigstate = xf86BlockSIGIO ();
+#endif
 
     pMse->emulate3Pending = FALSE;
     if ((id = stateTab[pMse->emulateState][4][0]) != 0) {
@@ -2041,7 +2058,11 @@  buttonTimer(InputInfoPtr pInfo)
             "Got unexpected buttonTimer in state %d\n", pMse->emulateState);
     }
 
+#if HAVE_THREADED_INPUT
+    input_unlock();
+#else
     xf86UnblockSIGIO (sigstate);
+#endif
     return 0;
 }
 
@@ -2098,9 +2119,7 @@  Emulate3ButtonsSoft(InputInfoPtr pInfo)
 #endif
 }
 
-static void MouseBlockHandler(pointer data,
-                              struct timeval **waitTime,
-                              pointer LastSelectMask)
+static void MouseBlockHandler(BLOCK_HANDLER_ARGS)
 {
     InputInfoPtr    pInfo = (InputInfoPtr) data;
     MouseDevPtr     pMse = (MouseDevPtr) pInfo->private;
@@ -2115,9 +2134,7 @@  static void MouseBlockHandler(pointer data,
     }
 }
 
-static void MouseWakeupHandler(pointer data,
-                               int i,
-                               pointer LastSelectMask)
+static void MouseWakeupHandler(WAKEUP_HANDLER_ARGS)
 {
     InputInfoPtr    pInfo = (InputInfoPtr) data;
     MouseDevPtr     pMse = (MouseDevPtr) pInfo->private;
@@ -3276,14 +3293,20 @@  createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
     unsigned char *para;
     mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
     MouseProtocolID *tmplist = NULL;
+#if !HAVE_THREADED_INPUT
     int blocked;
+#endif
 
     AP_DBGC(("Autoprobe: "));
     for (i = 0; i < mPriv->count; i++)
         AP_DBGC(("%2.2x ", (unsigned char) mPriv->data[i]));
     AP_DBGC(("\n"));
 
+#if HAVE_THREADED_INPUT
+    input_lock();
+#else
     blocked = xf86BlockSIGIO ();
+#endif
 
     /* create a private copy first so we can write in the old list */
     if ((tmplist = malloc(sizeof(MouseProtocolID) * NUM_AUTOPROBE_PROTOS))){
@@ -3392,7 +3415,11 @@  createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
         }
     }
 
+#if HAVE_THREADED_INPUT
+    input_unlock();
+#else
     xf86UnblockSIGIO(blocked);
+#endif
 
     mPriv->protoList[k] = PROT_UNKNOWN;
 

Comments

On Mon, May 30, 2016 at 01:42:20AM -0700, Keith Packard wrote:
> Version 23 has threaded input, so locking uses input_lock/input_unlock
> instead of xf86BlockSIGIO/xf86UnblockSIGIO.
> 
> Version 24 removes the FD_SET arguments from block and wakeup handlers

this one isn't merged yet, please send two separate patches so we have a
working mouse driver until the 24 gets merged.

Cheers,
   Peter

> 
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
>  src/mouse.c | 45 ++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 36 insertions(+), 9 deletions(-)
> 
> diff --git a/src/mouse.c b/src/mouse.c
> index f9f874b..dae98aa 100644
> --- a/src/mouse.c
> +++ b/src/mouse.c
> @@ -129,6 +129,18 @@ typedef struct _DragLockRec {
>  } DragLockRec, *DragLockPtr;
>  
>  
> +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 23
> +#define HAVE_THREADED_INPUT	1
> +#endif
> +
> +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 24
> +#define BLOCK_HANDLER_ARGS     	void *data, void *waitTime
> +#define WAKEUP_HANDLER_ARGS	void *data, int i
> +#else
> +#define BLOCK_HANDLER_ARGS	pointer data, struct timeval **waitTime, pointer LastSelectMask
> +#define WAKEUP_HANDLER_ARGS	void *data, int i, pointer LastSelectMask
> +#endif
> +
>  #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
>  static InputInfoPtr MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags);
>  #else
> @@ -140,9 +152,8 @@ static void MouseCtrl(DeviceIntPtr device, PtrCtrl *ctrl);
>  static void MousePostEvent(InputInfoPtr pInfo, int buttons,
>                             int dx, int dy, int dz, int dw);
>  static void MouseReadInput(InputInfoPtr pInfo);
> -static void MouseBlockHandler(pointer data, struct timeval **waitTime,
> -                              pointer LastSelectMask);
> -static void MouseWakeupHandler(pointer data, int i, pointer LastSelectMask);
> +static void MouseBlockHandler(BLOCK_HANDLER_ARGS);
> +static void MouseWakeupHandler(WAKEUP_HANDLER_ARGS);
>  static void FlushButtons(MouseDevPtr pMse);
>  
>  static Bool SetupMouse(InputInfoPtr pInfo);
> @@ -2025,12 +2036,18 @@ static CARD32
>  buttonTimer(InputInfoPtr pInfo)
>  {
>      MouseDevPtr pMse;
> +#if !HAVE_THREADED_INPUT
>      int sigstate;
> +#endif
>      int id;
>  
>      pMse = pInfo->private;
>  
> +#if HAVE_THREADED_INPUT
> +    input_lock();
> +#else
>      sigstate = xf86BlockSIGIO ();
> +#endif
>  
>      pMse->emulate3Pending = FALSE;
>      if ((id = stateTab[pMse->emulateState][4][0]) != 0) {
> @@ -2041,7 +2058,11 @@ buttonTimer(InputInfoPtr pInfo)
>              "Got unexpected buttonTimer in state %d\n", pMse->emulateState);
>      }
>  
> +#if HAVE_THREADED_INPUT
> +    input_unlock();
> +#else
>      xf86UnblockSIGIO (sigstate);
> +#endif
>      return 0;
>  }
>  
> @@ -2098,9 +2119,7 @@ Emulate3ButtonsSoft(InputInfoPtr pInfo)
>  #endif
>  }
>  
> -static void MouseBlockHandler(pointer data,
> -                              struct timeval **waitTime,
> -                              pointer LastSelectMask)
> +static void MouseBlockHandler(BLOCK_HANDLER_ARGS)
>  {
>      InputInfoPtr    pInfo = (InputInfoPtr) data;
>      MouseDevPtr     pMse = (MouseDevPtr) pInfo->private;
> @@ -2115,9 +2134,7 @@ static void MouseBlockHandler(pointer data,
>      }
>  }
>  
> -static void MouseWakeupHandler(pointer data,
> -                               int i,
> -                               pointer LastSelectMask)
> +static void MouseWakeupHandler(WAKEUP_HANDLER_ARGS)
>  {
>      InputInfoPtr    pInfo = (InputInfoPtr) data;
>      MouseDevPtr     pMse = (MouseDevPtr) pInfo->private;
> @@ -3276,14 +3293,20 @@ createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
>      unsigned char *para;
>      mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
>      MouseProtocolID *tmplist = NULL;
> +#if !HAVE_THREADED_INPUT
>      int blocked;
> +#endif
>  
>      AP_DBGC(("Autoprobe: "));
>      for (i = 0; i < mPriv->count; i++)
>          AP_DBGC(("%2.2x ", (unsigned char) mPriv->data[i]));
>      AP_DBGC(("\n"));
>  
> +#if HAVE_THREADED_INPUT
> +    input_lock();
> +#else
>      blocked = xf86BlockSIGIO ();
> +#endif
>  
>      /* create a private copy first so we can write in the old list */
>      if ((tmplist = malloc(sizeof(MouseProtocolID) * NUM_AUTOPROBE_PROTOS))){
> @@ -3392,7 +3415,11 @@ createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
>          }
>      }
>  
> +#if HAVE_THREADED_INPUT
> +    input_unlock();
> +#else
>      xf86UnblockSIGIO(blocked);
> +#endif
>  
>      mPriv->protoList[k] = PROT_UNKNOWN;
>  
> -- 
> 2.8.1
> 
> _______________________________________________
> 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
>
Peter Hutterer <peter.hutterer@who-t.net> writes:

> On Mon, May 30, 2016 at 01:42:20AM -0700, Keith Packard wrote:
>> Version 23 has threaded input, so locking uses input_lock/input_unlock
>> instead of xf86BlockSIGIO/xf86UnblockSIGIO.
>> 
>> Version 24 removes the FD_SET arguments from block and wakeup handlers
>
> this one isn't merged yet, please send two separate patches so we have a
> working mouse driver until the 24 gets merged.

The version 24 stuff shouldn't have any effect until the server bits are merged?
On Mon, May 30, 2016 at 10:08:34PM -0700, Keith Packard wrote:
> Peter Hutterer <peter.hutterer@who-t.net> writes:
> 
> > On Mon, May 30, 2016 at 01:42:20AM -0700, Keith Packard wrote:
> >> Version 23 has threaded input, so locking uses input_lock/input_unlock
> >> instead of xf86BlockSIGIO/xf86UnblockSIGIO.
> >> 
> >> Version 24 removes the FD_SET arguments from block and wakeup handlers
> >
> > this one isn't merged yet, please send two separate patches so we have a
> > working mouse driver until the 24 gets merged.
> 
> The version 24 stuff shouldn't have any effect until the server bits are merged?

yeah, but until the server bits are merged there is still a chance that the
patches change and I'd rather not have to worry about that.

Cheers,
   Peter
Peter Hutterer <peter.hutterer@who-t.net> writes:

> yeah, but until the server bits are merged there is still a chance that the
> patches change and I'd rather not have to worry about that.

Sure, two patches sent to the list.

I'd love to get review on the proposed server API changes for version 24
so that we can get the drivers ready for the new version before we push
that to the server this time. Only 16 short patches to review leading to
the ABI version bump...