[PATCH] wlt_toolkit.c: Fix resize window stuck in need_resize=true

David Herrmann dh.herrmann at googlemail.com
Thu Jan 24 11:37:17 PST 2013


Hi Martin

On Thu, Jan 24, 2013 at 4:48 PM, Martin Minarik
<minarik11 at student.fiit.stuba.sk> wrote:
> The problem is that:
>  wnd->w_frame contains a number
> and
>  wnd->need_frame=true
> Therefore schedule_frame() doesn't schedule the callback.
> But deleting these checks causes flicker. Further redesign
> of the frame sheduling was necessary.
>
> 4. frame_callback()
> 3. do_frame()
> 3. idle_frame()
> 2. schedule_frame()
> 1. wlt_window_set_size()
>
> Please, observe the need_resize variable.
> -------------------------------------------------------------------------------
> BAD (window stuck on resize):
> $3 = {ref = 1, list = {next = 0x659c70, prev = 0x659c70},
>   buffer_attached = true, skip_damage = false, need_resize = true,
>   w_frame = 0x70d9b0, widget_list = {next = 0x686cb0, prev = 0x6b54d0}}
>
> OK (window not stuck on resize):
> $3 = {ref = 1, list = {next = 0x240cc70, prev = 0x240cc70},
>   buffer_attached = true, skip_damage = false, need_resize = false,
>   w_frame = 0x241bb10, widget_list = {next = 0x2439cb0, prev = 0x2468560}}
>
> -----------------------------------------------------------------------------------
>
> This is the basic idea:
>
> -> time ->
> frame callbacks()      *           *           *           *           *           *
> wnd->idle_pending ------   ---------   ---------    --------   ---------------------
> wnd->need_frame   ---      --- ---     ---          ---        ------ ---
> schedule_frame()  *        *   *       *            *          *  *   **
> idle_frame()        *        *   *       *            *          *  *   *
>
> This design follows similiar design in weston/clients/window.c
>
> Kmscon                     Weston
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> wlt_window_do_redraw() ~~~ shm_surface_swap()
> do_frame() ~~~~~~~~~~~~~~~ window_attach_surface()
>
> wnd->idle_pending ~~~~~~~~ window->redraw_scheduled
>
> frame_callback()  ~~~~~~~~ frame_callback()
>
> do_frame()  ~~~~~~~~~~~~~~ idle_redraw()
>
> wlt_window_set_size()
> wlt_window_schedule_redraw()
> schedule_frame()  ~~~~~~~~ window_schedule_redraw()
> ---

Thanks for the detailed description! I knew that there was a race but
haven't had the time to fix it, yet. The analysis seems right and I
have applied your fix. Thanks!

I haven't paid much attention to the WLT toolkit lately as I am busy
with university. But I have planned a rewrite of it for mid February.
I have never updated it to wayland-1.0 correctly and I want to
correctly fix all the nasty details.

Thanks!
David


More information about the wayland-devel mailing list