[Mesa-dev] [PATCH] dri3: Stricter SBC wraparound handling

Axel Davy davyaxel0 at gmail.com
Wed May 16 09:14:43 UTC 2018


Hi,

Shouldn't this be fixed on the xserver or the ddx side, rather than in 
Mesa ?

Yours,

Axel Davy

On 16/05/2018 11:10, Michel Dänzer wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> Prevents spuriously bumping the upper 32 bits of the SBC, which results
> in hangs with the modesetting driver from xserver 1.20.
>
> Bugzilla: https://bugs.freedesktop.org/106351
> Tested-by: Mike Lothian <mike at fireburn.co.uk>
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
>   src/loader/loader_dri3_helper.c | 14 +++++++++++---
>   1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
> index 6db8303d26d..f0ff2f07bde 100644
> --- a/src/loader/loader_dri3_helper.c
> +++ b/src/loader/loader_dri3_helper.c
> @@ -370,9 +370,17 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw,
>          * checking for wrap.
>          */
>         if (ce->kind == XCB_PRESENT_COMPLETE_KIND_PIXMAP) {
> -         draw->recv_sbc = (draw->send_sbc & 0xffffffff00000000LL) | ce->serial;
> -         if (draw->recv_sbc > draw->send_sbc)
> -            draw->recv_sbc -= 0x100000000;
> +         uint64_t recv_sbc = (draw->send_sbc & 0xffffffff00000000LL) | ce->serial;
> +
> +         /* Only assume wraparound if that results in exactly the previous
> +          * SBC + 1, otherwise ignore received SBC > sent SBC (those are
> +          * probably from a previous loader_dri3_drawable instance) to avoid
> +          * calculating bogus target MSC values in loader_dri3_swap_buffers_msc
> +          */
> +         if (recv_sbc <= draw->send_sbc)
> +            draw->recv_sbc = recv_sbc;
> +         else if (recv_sbc == (draw->recv_sbc + 0x100000001ULL))
> +            draw->recv_sbc = recv_sbc - 0x100000000ULL;
>   
>            /* When moving from flip to copy, we assume that we can allocate in
>             * a more optimal way if we don't need to cater for the display




More information about the mesa-dev mailing list