[PATCH 8/8] xephyr: Use GLX swap events to reduce repaints.

Keith Packard keithp at keithp.com
Fri Feb 7 14:54:01 PST 2014


Eric Anholt <eric at anholt.net> writes:

> If there's a swap already outstanding, don't bother queueing another
> one until this one has completed.  The assumption here is that our
> screen paints are cheap compared to everything else going on, so we
> don't need to queue them up way ahead of time.  The swap events also
> give us information we can use to avoid full screen repaints when the
> swap is a copy.

Is there some reason not to use the xcb event all of the time? It looks
like that would simplify the logic quite a bit here.

The rest of this patch is
Reviewed-by: Keith Packard <keithp at keithp.com>

>      if (wire_to_event) {
>          XEvent processed_event;
> +        int x_response_type;
> +        Bool result;
>  
>          /* OK they had an event handler.  Plug it back in, and call
>           * through to it.
>           */
>          XESetWireToEvent(dpy, response_type, wire_to_event);
>          xev->sequence = LastKnownRequestProcessed(dpy);
> +        result = wire_to_event(dpy, &processed_event, (xEvent *)xev);
>          wire_to_event(dpy, &processed_event, (xEvent *)xev);
> +        XUnlockDisplay(dpy);
> +
> +        x_response_type = processed_event.type & 0x7f;
> +
> +        if (result) {
> +            if (x_response_type == glx_swap_event) {
> +                GLXBufferSwapComplete *swap =
> +                    (GLXBufferSwapComplete *)&processed_event;
> +                ephyr_glamor_handle_swap_event(swap->drawable,
> +                                               swap->event_type);
> +                return;
> +            }
> +        }
> +    } else {
> +        XUnlockDisplay(dpy);
> +    }
> +
> +    if (response_type == glx_swap_event) {
> +        xcb_glx_buffer_swap_complete_event_t *swap =
> +            (xcb_glx_buffer_swap_complete_event_t *)xev;
> +        ephyr_glamor_handle_swap_event(swap->drawable, swap->event_type);
>      }
> -    XUnlockDisplay(dpy);
>  }

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140207/21991648/attachment.pgp>


More information about the xorg-devel mailing list