[PATCH 4/7] present: Send GLX_BufferSwapComplete events from present extension

Adam Jackson ajax at redhat.com
Wed Dec 4 14:13:19 PST 2013


On Wed, 2013-12-04 at 10:10 -0800, Keith Packard wrote:

> +#if PRESENT
> +static void
> +__glXpresentCompleteNotify(WindowPtr window, CARD8 present_mode, CARD32 serial,
> +                           uint64_t ust, uint64_t msc)
> +{
> +    __GLXdrawable *drawable;
> +    int error;
> +    int glx_type;
> +    int rc;
> +
> +    rc = dixLookupResourceByType((pointer *) &drawable, window->drawable.id,
> +                                 __glXDrawableRes, serverClient, DixGetAttrAccess);
> +
> +    if (rc != Success)
> +        return;
> +
> +    switch(present_mode) {
> +    case PresentCompleteModeFlip:
> +        glx_type = GLX_FLIP_COMPLETE_INTEL;
> +        break;
> +    case PresentCompleteModeCopy:
> +        glx_type = GLX_BLIT_COMPLETE_INTEL;
> +        break;
> +    default:
> +        glx_type = 0;
> +        break;
> +    }

Is this default path right?  If this can be called with
PresentCompleteModeSkip then you'll send a GLX event with type of 0,
which INTEL_swap_event doesn't say is legal.

> diff --git a/glx/glxdri2.c b/glx/glxdri2.c
> index fbbd1fd..e43da05 100644
> --- a/glx/glxdri2.c
> +++ b/glx/glxdri2.c
> @@ -177,36 +177,24 @@ __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
>                    CARD64 msc, CARD32 sbc)
>  {
>      __GLXdrawable *drawable = data;
> -    xGLXBufferSwapComplete2 wire =  {
> -        .type = __glXEventBase + GLX_BufferSwapComplete
> -    };
> -
> -    if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
> -        return;
> -
> +    int glx_type;
>      switch (type) {
>      case DRI2_EXCHANGE_COMPLETE:
> -        wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL;
> +        glx_type = GLX_EXCHANGE_COMPLETE_INTEL;
>          break;
>      case DRI2_BLIT_COMPLETE:
> -        wire.event_type = GLX_BLIT_COMPLETE_INTEL;
> +        glx_type = GLX_BLIT_COMPLETE_INTEL;
>          break;
>      case DRI2_FLIP_COMPLETE:
> -        wire.event_type = GLX_FLIP_COMPLETE_INTEL;
> +        glx_type = GLX_FLIP_COMPLETE_INTEL;
>          break;
>      default:
>          /* unknown swap completion type */
> -        wire.event_type = 0;
> +        glx_type = 0;
>          break;
>      }

Same here; this should probably just assert or return.

- ajax



More information about the xorg-devel mailing list