[PATCH weston 4/5] compositor: add repaint delay timer

Pekka Paalanen pekka.paalanen at collabora.co.uk
Wed Feb 18 00:19:00 PST 2015


On Thu, 12 Feb 2015 15:30:16 +0200
Pekka Paalanen <ppaalanen at gmail.com> wrote:

> From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> 
> This timer delays the output_repaint towards the end of the refresh
> period, reducing the time from repaint to present.
> 
> The length of the repaint window can be set in weston.ini.
> 
> Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> ---
>  man/weston.ini.man | 10 ++++++++++
>  src/compositor.c   | 49 +++++++++++++++++++++++++++++++++++++++++++++----
>  src/compositor.h   |  2 ++
>  3 files changed, 57 insertions(+), 4 deletions(-)

...

>  WL_EXPORT void
>  weston_output_finish_frame(struct weston_output *output,
>  			   const struct timespec *stamp,
>  			   uint32_t presented_flags)
>  {
>  	struct weston_compositor *compositor = output->compositor;
> -	int r;
>  	uint32_t refresh_nsec;
>  
>  	TL_POINT("core_repaint_finished", TLP_OUTPUT(output),
> @@ -2158,9 +2175,14 @@ weston_output_finish_frame(struct weston_output *output,
>  	if (output->repaint_needed &&
>  	    compositor->state != WESTON_COMPOSITOR_SLEEPING &&
>  	    compositor->state != WESTON_COMPOSITOR_OFFSCREEN) {
> -		r = weston_output_repaint(output);
> -		if (!r)
> -			return;
> +		int msec = refresh_nsec / 1000000;
> +
> +		msec -= compositor->repaint_msec;
> +		if (msec < 1)
> +			output_repaint_delay_handler(output);
> +		else
> +			wl_event_source_timer_update(output->repaint_delay_timer, msec);

Hi,

I need to revise this bit of code to take current time into account,
because the delay is relative, not an absolute timestamp.

And maybe rename repaint_delay_timer to repaint_timer. Or is that too
"omg weston uses a timer!!?!1"? ;-)


Thanks,
pq


More information about the wayland-devel mailing list