[PATCH 2/2] loader_dri3: Variant 2: Wait for pending swaps to complete before drawable_fini.

Mike Lothian mike at fireburn.co.uk
Fri May 4 16:45:15 UTC 2018


Hi

The first hunk doesn't apply, the other 3 gives this with GCC 8.1


../mesa-9999/src/loader/loader_dri3_helper.c: In function
‘dri3_handle_present_event’:
../mesa-9999/src/loader/loader_dri3_helper.c:376:13: error: implicit
declaration of function ‘printf’
[-Werror=implicit-function-declaration]
             printf("ORPHAN-C: %d x %d, drawable %d: recv %u vs send_sbc %lu\n",
             ^~~~~~
../mesa-9999/src/loader/loader_dri3_helper.c:376:13: warning:
incompatible implicit declaration of built-in function ‘printf’
../mesa-9999/src/loader/loader_dri3_helper.c:376:13: note: include
‘<stdio.h>’ or provide a declaration of ‘printf’
../mesa-9999/src/loader/loader_dri3_helper.c:39:1:
+#include <stdio.h>

../mesa-9999/src/loader/loader_dri3_helper.c:376:13:
             printf("ORPHAN-C: %d x %d, drawable %d: recv %u vs send_sbc %lu\n",
             ^~~~~~
../mesa-9999/src/loader/loader_dri3_helper.c:376:75: warning: format
‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has
type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=]
             printf("ORPHAN-C: %d x %d, drawable %d: recv %u vs send_sbc %lu\n",
                                                                         ~~^
                                                                         %llu
../mesa-9999/src/loader/loader_dri3_helper.c:378:20:
                    draw->send_sbc);
                    ~~~~~~~~~~~~~~
../mesa-9999/src/loader/loader_dri3_helper.c:430:10: warning:
incompatible implicit declaration of built-in function ‘printf’
          printf("ORPHAN-I: %d x %d, drawable %d: recv %u vs send_sbc %lu\n",
          ^~~~~~
../mesa-9999/src/loader/loader_dri3_helper.c:430:10: note: include
‘<stdio.h>’ or provide a declaration of ‘printf’
../mesa-9999/src/loader/loader_dri3_helper.c:430:72: warning: format
‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has
type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=]
          printf("ORPHAN-I: %d x %d, drawable %d: recv %u vs send_sbc %lu\n",
                                                                      ~~^
                                                                      %llu
../mesa-9999/src/loader/loader_dri3_helper.c:432:17:
                 draw->send_sbc);
                 ~~~~~~~~~~~~~~
../mesa-9999/src/loader/loader_dri3_helper.c: In function
‘dri3_update_drawable’:
../mesa-9999/src/loader/loader_dri3_helper.c:1454:7: warning:
incompatible implicit declaration of built-in function ‘printf’
       printf("INIT: wxh = %d x %d, drawable %d eid %d\n",
draw->width, draw->height, draw->drawable, draw->eid);
       ^~~~~~
../mesa-9999/src/loader/loader_dri3_helper.c:1454:7: note: include
‘<stdio.h>’ or provide a declaration of ‘printf’
cc1: some warnings being treated as errors

Cheers

Mike

On 4 May 2018 at 14:45, Mario Kleiner <mario.kleiner.de at gmail.com> wrote:
> See previous patch in series for explanation of the problem.
>
> This method avoids a blocking loader_dri3_swapbuffer_barrier() call
> whenever a GL contexts drawables are changed via glXMakeCurrent et al.
>
> Instead it filters out the "orphaned" PresentNotify events from
> previous incarnations of the loader_dri3_drawable. This should deal
> correctly with PixmapInvalidate, PixmapPresentCompleteNotify and
> MscCompleteNotify events, but i don't know a way to filter out
> WindowConfigureNotify events, or if it even matters to filter them.
>
> This PoC one is only meaningful if the first patch is omitted, and
> shows the spurious "ORPHAN" printouts which would hang KDE plasmashell
> if not filtered out.
>
> Test from a terminal: killall plasmashell; plasmashell
> Wiggly the mouse around, click etc. on the KDE taskbar, K-Menu,
> system tray icons, trigger volume/brightness feedback widgets
> to provoke the occassional ORPHAN event.
>
> Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
> Cc: xorg-devel at lists.x.org
> Cc: daniel at fooishbar.org
> Cc: eero.t.tamminen at intel.com
> Cc: mike at fireburn.co.uk
> ---
>  src/loader/loader_dri3_helper.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
> index 7bd79af..123a996 100644
> --- a/src/loader/loader_dri3_helper.c
> +++ b/src/loader/loader_dri3_helper.c
> @@ -234,6 +234,10 @@ loader_dri3_drawable_fini(struct loader_dri3_drawable *draw)
>  {
>     int i;
>
> +   printf("FINI: wxh = %d x %d, drawable %d eid %d recv_sbc %lu, send_sbc %lu PENDING %lu\n",
> +          draw->width, draw->height, draw->drawable, draw->eid, draw->recv_sbc, draw->send_sbc,
> +          draw->send_sbc - draw->recv_sbc);
> +
>     if (draw->special_event)
>        loader_dri3_swapbuffer_barrier(draw);
>
> @@ -373,6 +377,15 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw,
>         * checking for wrap.
>         */
>        if (ce->kind == XCB_PRESENT_COMPLETE_KIND_PIXMAP) {
> +         /* Filter out orphan events sent for a previous incarnation of draw. */
> +         if (!(draw->send_sbc & 0xffffffff00000000LL) &&
> +             ce->serial > draw->send_sbc) {
> +            printf("ORPHAN-C: %d x %d, drawable %d: recv %u vs send_sbc %lu\n",
> +                   draw->width, draw->height, draw->drawable, ce->serial,
> +                   draw->send_sbc);
> +            break;
> +         }
> +
>           draw->recv_sbc = (draw->send_sbc & 0xffffffff00000000LL) | ce->serial;
>           if (draw->recv_sbc > draw->send_sbc)
>              draw->recv_sbc -= 0x100000000;
> @@ -418,6 +431,15 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw,
>        xcb_present_idle_notify_event_t *ie = (void *) ge;
>        int b;
>
> +      /* Filter out orphan events sent for a previous incarnation of draw. */
> +      if (!(draw->send_sbc & 0xffffffff00000000LL) &&
> +          ie->serial > draw->send_sbc) {
> +         printf("ORPHAN-I: %d x %d, drawable %d: recv %u vs send_sbc %lu\n",
> +                draw->width, draw->height, draw->drawable, ie->serial,
> +                draw->send_sbc);
> +         break;
> +      }
> +
>        for (b = 0; b < ARRAY_SIZE(draw->buffers); b++) {
>           struct loader_dri3_buffer *buf = draw->buffers[b];
>
> @@ -1435,6 +1457,8 @@ dri3_update_drawable(__DRIdrawable *driDrawable,
>           xcb_unregister_for_special_event(draw->conn, draw->special_event);
>           draw->special_event = NULL;
>        }
> +
> +      printf("INIT: wxh = %d x %d, drawable %d eid %d\n", draw->width, draw->height, draw->drawable, draw->eid);
>     }
>     dri3_flush_present_events(draw);
>     mtx_unlock(&draw->mtx);
> --
> 2.7.4
>


More information about the xorg-devel mailing list