[RFC weston] Add a release_type argument to weston_buffer_reference

Bill Spitzak spitzak at gmail.com
Wed Dec 4 20:24:34 PST 2013


Jason Ekstrand wrote:

> Third, input is handled after the repaint but before the frame callbacks 
> are sent.  Therefore, if the client is receiving any input, the input 
> events will automatically flush out any pending buffer release events 
> there may be.

That is useful to know, as it reduces how often the problem I am trying 
to fix happens, since in most cases repaint() releases the old buffers.

However there is no guarantee that repaint will release the old buffers. 
  It sounds like the Raspberry Pi does this. Also isn't this true of 
overlay and fullscreen surfaces on some devices?

> The second case is if compositor is releasing buffers at 
> strange times or if there is some significant advantage in the client 
> geting woken up the moment it has a free buffer.  This is what Tomeu 
> wants to do with the Raspberry Pi (Buffers get released at strange times 
> and doing so allows them to save a buffer).

I believe this is exactly the same problem I am trying to solve. But the 
difference is that I only want to get "woken up the moment it has a free 
buffer" after an event has triggered a redraw. It sounds like Tomeu 
wants to be woken whether or not an event has happened.

I could turn it on/off rapidly at the start of my redraw():

   redraw() {
     if (!buffer_is_available) {
       wayland_turn_on_instant_release();
       block_until_buffer_release();
       wayland_turn_off_instant_release();
     }
     draw_into_the_free_buffer();
     wayland_attach(the_free_buffer);
   }

Because of the round-trip delay in sending the request, this seems like 
a bad solution. I think what I will do is turn on raspberry pi mode the 
first time redraw() is called and there is no buffer available, then 
leave it on. Thus if repaint always releases buffers it won't get turned 
on. Here is a possible solution for continuous adjusting the setting:

   static bool mode_is_on = false;
   redraw() {
     if (!buffer_is_available) {
       if (!mode_is_on) {
         wayland_turn_on_instant_release();
         mode_is_on = true;
       }
       block_until_buffer_release();
     } else {
       if (mode_is_on) {
         wayland_turn_off_instant_release();
         mode_is_on = false;
       }
     }
     ...

What I was trying to propose is a way for the compositor to internally 
turn this mode on/off so no extra communication is needed.


More information about the wayland-devel mailing list