[PATCH weston 1/3] clients: Drop deadlock circumvention hack now that we don't need it

Derek Foreman derekf at osg.samsung.com
Wed Aug 19 09:15:21 PDT 2015


On 26/01/15 04:19 AM, Jonas Ådahl wrote:
> mesa supports EGLSwapInterval 0 now, so lets remove this hack. As a
> bonus we don't conflict with the XDG shell protocol that doesn't allow
> committing a null-buffer, which was a side effect of this hack.
> 

Unreviewed for far too long. :(

The question I guess is whether toytoolkit needs to maintain this hack
forever because mesa used to have a problem with this.  As far as I can
tell from reading the EGL spec, eglSwapInterval(0) has been defined for
as long as eglSwapInterval() has existed (EGL 1.1)...

You've stated your preference - and I'm convinced.  I don't think
toytoolkit apps should be a reference for avoiding old mesa bugs.  I'm
also not hugely concerned about other broken EGL stacks... (if you're
making a custom IVI with a nasty driver stack, you probably shouldn't be
using toytoolkit at all, and if you are you can re-invent this nastiness.)

Besides, the comments even say we should kill it now.

All that said,
Reviewed-by: Derek Foreman <derekf at osg.samsung.com>

Can we kill this hack? :)

> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> ---
>  clients/window.c | 32 --------------------------------
>  1 file changed, 32 deletions(-)
> 
> diff --git a/clients/window.c b/clients/window.c
> index c5082ba..b45b499 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -3802,36 +3802,6 @@ surface_resize(struct surface *surface)
>  }
>  
>  static void
> -hack_prevent_EGL_sub_surface_deadlock(struct window *window)
> -{
> -	/*
> -	 * This hack should be removed, when EGL respects
> -	 * eglSwapInterval(0).
> -	 *
> -	 * If this window has sub-surfaces, especially a free-running
> -	 * EGL-widget, we need to post the parent surface once with
> -	 * all the old state to guarantee, that the EGL-widget will
> -	 * receive its frame callback soon. Otherwise, a forced call
> -	 * to eglSwapBuffers may end up blocking, waiting for a frame
> -	 * event that will never come, because we will commit the parent
> -	 * surface with all new state only after eglSwapBuffers returns.
> -	 *
> -	 * This assumes, that:
> -	 * 1. When the EGL widget's resize hook is called, it pauses.
> -	 * 2. When the EGL widget's redraw hook is called, it forces a
> -	 *    repaint and a call to eglSwapBuffers(), and maybe resumes.
> -	 * In a single threaded application condition 1 is a no-op.
> -	 *
> -	 * XXX: This should actually be after the surface_resize() calls,
> -	 * but cannot, because then it would commit the incomplete state
> -	 * accumulated from the widget resize hooks.
> -	 */
> -	if (window->subsurface_list.next != &window->main_surface->link ||
> -	    window->subsurface_list.prev != &window->main_surface->link)
> -		wl_surface_commit(window->main_surface->surface);
> -}
> -
> -static void
>  window_do_resize(struct window *window)
>  {
>  	struct surface *surface;
> @@ -3873,8 +3843,6 @@ idle_resize(struct window *window)
>  	    window->pending_allocation.width,
>  	    window->pending_allocation.height);
>  
> -	hack_prevent_EGL_sub_surface_deadlock(window);
> -
>  	window_do_resize(window);
>  }
>  
> 



More information about the wayland-devel mailing list