[PATCH 1/2] compositor: don't schedule idle_repaint from calls to repaint
Kristian Høgsberg
krh at bitplanet.net
Mon Oct 24 08:57:56 PDT 2011
On Mon, Oct 24, 2011 at 9:30 AM, Ander Conselvan de Oliveira
<ander.conselvan.de.oliveira at intel.com> wrote:
> wlsc_output_repaint may call wlsc_surface_damage indirectly through
> wlsc_output_set_cursor. If this happens in the call made from repaint,
> one ends up with repaint being called from both idle_repaint and
> wlsc_output_finish_frame.
>
> Fix this by setting output->repaint_scheduled to 1 before calling
> wlsc_output_repaint in the function repaint.
Ah, yes, I see. Good catch. I think we want a slightly different fix
though. The damage that is added in wlsc_output_set_cursor() gets
fixed up in the following repaint, so we need to make sure
repaint_needed is cleared to 0 after wlsc_output_repaint(). I would
prefer to only clear repaint_scheduled in the else clause of if
(output->repaint_needed) in wlsc_output_finish_frame(), and just not
set it to 1 in repaint() (see attached patch). That way we only clear
repaint_scheduled, when there really isn't a repaint scheduled. Does
that work for you?
Kristian
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
> ---
> compositor/compositor.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/compositor/compositor.c b/compositor/compositor.c
> index 17b347e..b67aa33 100644
> --- a/compositor/compositor.c
> +++ b/compositor/compositor.c
> @@ -966,9 +966,15 @@ repaint(void *data, int msecs)
> struct wlsc_animation *animation, *next;
> struct wlsc_frame_callback *cb, *cnext;
>
> - wlsc_output_repaint(output);
> + /* Set repaint_schedule to 1 before calling wlsc_output_repaint
> + * since it may call wlsc_output_schedule_repaint indirectly
> + * in which case idle_repaint will be scheduled even though
> + * wlsc_output_finish_frame will call repaint once the frame
> + * completes. */
> output->repaint_needed = 0;
> output->repaint_scheduled = 1;
> +
> + wlsc_output_repaint(output);
> output->present(output);
>
> wl_list_for_each_safe(cb, cnext, &output->frame_callback_list, link) {
> --
> 1.7.4.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: repaint-scheduled.patch
Type: text/x-patch
Size: 729 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20111024/9d6aa3d8/attachment.bin>
More information about the wayland-devel
mailing list