[PATCH xserver 08/11] kdrive/ephyr: Poll for events in block handler

Laércio de Sousa laerciosousa at sme-mogidascruzes.sp.gov.br
Thu May 19 10:47:32 UTC 2016


Could it be related somehow to my concerns in
https://patchwork.freedesktop.org/patch/86328 ?

2016-05-18 18:51 GMT-03:00 Keith Packard <keithp at keithp.com>:

> With the driver block handler guaranteed to be the last thing called
> before the server blocks, we can now reliably check for events there
> and never block with events read but not processed.
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
>  hw/kdrive/ephyr/ephyr.c     | 14 +++++++++++++-
>  hw/kdrive/ephyr/ephyr.h     |  3 +++
>  hw/kdrive/ephyr/ephyrinit.c |  1 +
>  hw/kdrive/src/kdrive.h      |  2 +-
>  hw/kdrive/src/kinput.c      |  9 ++++-----
>  5 files changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
> index 1a410ca..6066b5d 100644
> --- a/hw/kdrive/ephyr/ephyr.c
> +++ b/hw/kdrive/ephyr/ephyr.c
> @@ -1106,7 +1106,7 @@ ephyrProcessConfigureNotify(xcb_generic_event_t *xev)
>  }
>
>  static void
> -ephyrXcbNotify(int fd, int ready, void *data)
> +ephyrXcbProcessEvents(void)
>  {
>      xcb_connection_t *conn = hostx_get_xcbconn();
>
> @@ -1166,6 +1166,18 @@ ephyrXcbNotify(int fd, int ready, void *data)
>      }
>  }
>
> +static void
> +ephyrXcbNotify(int fd, int ready, void *data)
> +{
> +    ephyrXcbProcessEvents();
> +}
> +
> +void
> +ephyrBlockHandler(ScreenPtr pScreen, void *timeo)
> +{
> +    ephyrXcbProcessEvents();
> +}
> +
>  void
>  ephyrCardFini(KdCardInfo * card)
>  {
> diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h
> index f5015f6..ef5736e 100644
> --- a/hw/kdrive/ephyr/ephyr.h
> +++ b/hw/kdrive/ephyr/ephyr.h
> @@ -138,6 +138,9 @@ void
>  ephyrCloseScreen(ScreenPtr pScreen);
>
>  void
> +ephyrBlockHandler(ScreenPtr pScreen, void *timeo);
> +
> +void
>   ephyrCardFini(KdCardInfo * card);
>
>  void
> diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
> index 149ea98..03d6289 100644
> --- a/hw/kdrive/ephyr/ephyrinit.c
> +++ b/hw/kdrive/ephyr/ephyrinit.c
> @@ -411,4 +411,5 @@ KdCardFuncs ephyrFuncs = {
>      ephyrPutColors,             /* putColors */
>
>      ephyrCloseScreen,           /* closeScreen */
> +    ephyrBlockHandler,          /* blockHandler */
>  };
> diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
> index 3c7f2cd..6ef7337 100644
> --- a/hw/kdrive/src/kdrive.h
> +++ b/hw/kdrive/src/kdrive.h
> @@ -133,6 +133,7 @@ typedef struct _KdCardFuncs {
>      void (*putColors) (ScreenPtr, int, xColorItem *);
>
>      void (*closeScreen) (ScreenPtr);    /* close ScreenRec */
> +    void (*blockHandler) (ScreenPtr, void *timeo);
>  } KdCardFuncs;
>
>  #define KD_MAX_PSEUDO_DEPTH 8
> @@ -296,7 +297,6 @@ typedef struct _KdOsFuncs {
>      Bool (*SpecialKey) (KeySym);
>      void (*Disable) (void);
>      void (*Fini) (void);
> -    void (*pollEvents) (void);
>      void (*Bell) (int, int, int);
>  } KdOsFuncs;
>
> diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
> index c0f1cf7..2234dfc 100644
> --- a/hw/kdrive/src/kinput.c
> +++ b/hw/kdrive/src/kinput.c
> @@ -1965,6 +1965,7 @@ KdBlockHandler(ScreenPtr pScreen, void *timeo)
>  {
>      KdPointerInfo *pi;
>      int myTimeout = 0;
> +    KdScreenPriv(pScreen);
>
>      for (pi = kdPointers; pi; pi = pi->next) {
>          if (pi->timeoutPending) {
> @@ -1977,13 +1978,11 @@ KdBlockHandler(ScreenPtr pScreen, void *timeo)
>                  myTimeout = ms;
>          }
>      }
> -    /* if we need to poll for events, do that */
> -    if (kdOsFuncs->pollEvents) {
> -        (*kdOsFuncs->pollEvents) ();
> -        myTimeout = 20;
> -    }
>      if (myTimeout > 0)
>          AdjustWaitForDelay(timeo, myTimeout);
> +
> +    if (pScreenPriv->card->cfuncs->blockHandler)
> +        (*pScreenPriv->card->cfuncs->blockHandler)(pScreen, timeo);
>  }
>
>  void
> --
> 2.8.0.rc3
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel




-- 
*Laércio de Sousa*
*Orientador de Informática*
*Escola Municipal "Professor Eulálio Gruppi"*
*Rua Ismael da Silva Mello, 559, Mogi Moderno*
*Mogi das Cruzes - SPCEP 08717-390*
Telefone: (11) 4726-8313
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160519/3ba5fe28/attachment.html>


More information about the xorg-devel mailing list