[PATCH xserver/dri2 3/3] DRI2SwapBuffers: Return SBC correctly, handle target_msc correctly.

Ian Romanick idr at freedesktop.org
Mon Mar 22 13:59:44 PDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jesse Barnes wrote:
> On Sun, 21 Feb 2010 05:26:01 +0100
> Mario Kleiner <mario.kleiner at tuebingen.mpg.de> wrote:
> 
>> Returns expected SBC after completion of swap to caller, as required
>> by OML_sync_control spec, instead of the last_swap_target value.
>>
>> Passes target_msc, divisor, remainder, correctly for
>> glXSwapBuffersMscOML() call, while retaining old
>> behaviour for simple glXSwapBuffers() call.
>>
>> Signed-off-by: Mario Kleiner <mario.kleiner at tuebingen.mpg.de>
> 
> I think this is what it ought to look like on top of my last patch to
> fix last_swap_target initialization.
> 
> Your other patches looked fine too.

I've applied the other two patches in this series to my GLX-fixes tree.
 Have you guys reached a decision about this last patch?

> diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
> index 55846b1..952e493 100644
> --- a/hw/xfree86/dri2/dri2.c
> +++ b/hw/xfree86/dri2/dri2.c
> @@ -622,11 +622,26 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
>      }
>  
>      /*
> -     * Swap target for this swap is last swap target + swap interval since
> -     * we have to account for the current swap count, interval, and the
> -     * number of pending swaps.
> +     * In the simple glXSwapBuffers case, all params will be 0, and we just
> +     * need to schedule a swap for the last swap target + the swap interval.
>       */
> -    *swap_target = pPriv->last_swap_target + pPriv->swap_interval;
> +    if (target_msc == 0 && divisor == 0 && remainder == 0) {
> +	/*
> +	 * Swap target for this swap is last swap target + swap interval since
> +	 * we have to account for the current swap count, interval, and the
> +	 * number of pending swaps.
> +	 */
> +	*swap_target = pPriv->last_swap_target + pPriv->swap_interval;
> +    } else {
> +	/* glXSwapBuffersMscOML() call with target_msc, divisor, remainder set.
> +	 * Just make sure that target_msc is not earlier than last swap target +
> +	 * swap interval.
> +	 */
> +	if (target_msc < pPriv->last_swap_target + pPriv->swap_interval)
> +	    target_msc = pPriv->last_swap_target + pPriv->swap_interval;
> +
> +	*swap_target = target_msc;
> +    }
>  
>      ret = (*ds->ScheduleSwap)(client, pDraw, pDestBuffer, pSrcBuffer,
>  			      swap_target, divisor, remainder, func, data);
> @@ -639,6 +654,11 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
>      pPriv->swapsPending++;
>      pPriv->last_swap_target = *swap_target;
>  
> +    /* According to spec, return expected swapbuffers count SBC after this swap
> +     * will complete.
> +     */
> +    *swap_target = pPriv->swap_count + pPriv->swapsPending;
> +
>      return Success;
>  }
>  
> _______________________________________________
> xorg-devel mailing list
> xorg-devel at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-devel
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkun2j8ACgkQX1gOwKyEAw88LACfV2Z1BLUNmRQ1s+zF9taTabtP
FFAAoI5sic83fCS5PpeoI7LT4to1DPbF
=aXvA
-----END PGP SIGNATURE-----


More information about the xorg-devel mailing list