wl_surface.attach with NULL wl_buffer behaviour

Jasper St. Pierre jstpierre at mecheye.net
Fri Aug 21 10:16:09 PDT 2015


We need to fix that documentation, then, along with fixing Weston.
mutter will give you an error with this event stream, since attaching
a NULL buffer for an xdg_surface is invalid.

This behavior is one of the reasons why I removed this ability from
xdg_surface and instead made it an error -- the semantics were
extremely unclear, and practically the same as destroying and
recreating the xdg_surface. Please do that instead.

However crazy it is, the logic sort of makes sense -- the "frame"
event is guaranteed to be called once a frame when the surface content
is painted and shown on the screen. When there's no surface content,
it isn't painted, so the frame event isn't called.

I'm not sure what you mean about a buffer release event -- you never
attached a buffer to begin with, so I can't imagine how you'll get an
event on it.

On Fri, Aug 21, 2015 at 10:03 AM, Prabhu S <prabhusundar at gmail.com> wrote:
> Hi,
> Based on the wayland protocol specification for wl_surface::attach
>>>If wl_surface.attach is sent with a NULL wl_buffer, the following
>>> wl_surface.commit will remove the surface content.
>
> Wondering if wl_surface_attach called with wl_buffer=NULL, will there be any
> wl_buffer release event or frame callbacks?
>
> Modified the redraw in simple-shm.c as below and not receiving any callback
> or buffer release. It just got stuck.
> The same thing is being done in qtwayland to hide the surface and it is
> getting stuck. Some help to check this case would be helpful.
>
> static int odd = 1;
> if(odd == 1){
>         wl_surface_attach(window->surface, buffer->buffer, 0, 0);
>         wl_surface_damage(window->surface,
>                           20, 20, window->width - 40, window->height - 40);
>         odd = 0;
>     }
>     else{
>             wl_surface_attach(window->surface, 0, 0, 0);
>             wl_surface_damage(window->surface,
>                           0, 0, 0, 0);
>             odd=1;
>     }
>
>
>
> [823379.816]  -> wl_compositor at 4.create_surface(new id wl_surface at 3)
> [823379.949]  -> xdg_shell at 6.get_xdg_surface(new id xdg_surface at 7,
> wl_surface at 3)
> [823380.120]  -> xdg_surface at 7.set_title("simple-shm")
> [823380.244]  -> wl_surface at 3.damage(0, 0, 250, 250)
> [823381.333]  -> wl_shm at 5.create_pool(new id wl_shm_pool at 8, fd 5, 250000)
> [823381.561]  -> wl_shm_pool at 8.create_buffer(new id wl_buffer at 9, 0, 250,
> 250, 1000, 1)
> [823381.870]  -> wl_shm_pool at 8.destroy()
> [823384.880]  -> wl_surface at 3.attach(wl_buffer at 9, 0, 0)
> [823385.095]  -> wl_surface at 3.damage(20, 20, 210, 210)
> [823385.317]  -> wl_surface at 3.frame(new id wl_callback at 10)
> [823385.443]  -> wl_surface at 3.commit()
> [823388.852] wl_display at 1.delete_id(8)
> [823388.979] xdg_surface at 7.configure(0, 0, array, 4)
> [823389.238]  -> xdg_surface at 7.ack_configure(4)
> [823401.773] wl_display at 1.delete_id(10)
> [823401.908] wl_buffer at 9.release()
> [823401.991] wl_callback at 10.done(4056537)
> [823404.239]  -> wl_surface at 3.attach(nil, 0, 0)
> [823404.442]  -> wl_surface at 3.damage(0, 0, 0, 0)
> [823404.663]  -> wl_surface at 3.frame(new id wl_callback at 10)
> [823404.792]  -> wl_surface at 3.commit()
> [823406.292] xdg_surface at 7.configure(0, 0, array, 5)
> [823406.524]  -> xdg_surface at 7.ack_configure(5)
>
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>



-- 
  Jasper


More information about the wayland-devel mailing list