[PATCH v2] window: do proper Cairo device flushing

Kristian Høgsberg krh at bitplanet.net
Mon Dec 19 07:56:35 PST 2011


On Mon, Dec 19, 2011 at 6:57 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> The Cairo documentation tells us to always call cairo_device_flush()
> before using other rendering APIs on the cairo surface, especially where
> the Cairo device shares state with us (that is, EGL and GL state in this
> case).
>
> Add a call to cairo_device_flush() into display_acquire_window_surface(),
> which the toytoolkit offers for switching to native (GL) rendering.
>
> Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
> ---
> This patch is the same as the first one, but without the "drawback"
> chapter in the message. The drawbacks are fixed in current Cairo
> master HEAD, so there are no drawbacks.
>
> Well, gears will probably break for those who have not yet updated
> to the current Cairo master HEAD.
>
> The Cairo HEAD indeed seems to work enough that we can default to it
> again. The only problem I have seen so far is the unlock dialog's
> button: it's now square and stuff.

It is, isn't it?  Odd.  Applied, thanks.

Kristian

> clients/window.c |    6 +-----
>  1 files changed, 1 insertions(+), 5 deletions(-)
>
> diff --git a/clients/window.c b/clients/window.c
> index 2124899..053d991 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -1007,11 +1007,6 @@ window_draw_decorations(struct window *window)
>        cairo_show_text(cr, window->title);
>
>        cairo_destroy(cr);
> -
> -       /* FIXME: this breakes gears, fix cairo? */
> -#if 0
> -       cairo_device_flush (window->display->device);
> -#endif
>  }
>
>  void
> @@ -2675,6 +2670,7 @@ display_acquire_window_surface(struct display *display,
>        data = cairo_surface_get_user_data(window->cairo_surface,
>                                           &surface_data_key);
>
> +       cairo_device_flush(device);
>        cairo_device_acquire(device);
>        if (!eglMakeCurrent(display->dpy, data->surf, data->surf, ctx))
>                fprintf(stderr, "failed to make surface current\n");
> --
> 1.7.3.4
>


More information about the wayland-devel mailing list