Error when using weston wl_surface_attach

Pekka Paalanen ppaalanen at
Fri Sep 11 05:18:15 PDT 2015

On Fri, 11 Sep 2015 17:18:25 +0530
madana gopal <madanagopal123 at> wrote:

> Hi,
> Thanks. Yes, the working if fine. But somehow, i am getting the above error
> and how it can be resolved/settings that can be checked:
> [15:37:21.716] libwayland: unknown object (19), message attach(?oii)
> wl_display at 1: error 1: invalid arguments for wl_surface at 3.attach
> [0904/] wl_display_dispatch failed
> with an error.22
> 1, Could you please tell, what could be the reason of one client passing
> the object id of other. Do we have any shared buffer pool if both clients
> are within same process?.


your process creates two connections. Then it creates a protocol object
on one connection, and attempts to use it with a protocol object from
another connection. This is a bug in your program.

Note, that object ids are not globally unique. The ids begin at 1 for
every new connection. The identity of the object is tied to which
connection it is being used on.

Wayland protocol objects are not shareable among different connections.

> 2, Also, please let me know how the id's for buffers will be allocated
> before attaching it. I can see buffers are allocated in wl_map_insert call
> at the start of connection of client. I hope it will be mapped to the mmap
> and buffers will be mapped there. But before requesting a buffer to be
> attached in wl_surface_create, how the free buffer will be picked.

Protocol object id allocation is an implementation detail you should
not be concerned about.

The id is always related to a particular connection, and has no meaning
in the context of any other connection. Playing tricks with object ids
will not work.

Application code will never deal with object ids, except for debugging.

> 3, Is there is any possibility of the above problem, due to two different
> connections from same process id. Because in marshaling time, i am seeing
> wrong id being mapped. But i couldn't find the place from where it is
> picked. I am using wayland version 1.6.0.I browsed the weston code , but
> couldn't find the place of buffer allocation for marshaling. Please help on
> this.

Every component in your software that wants to use a Wayland protocol
object, must do so with the same connection where that protocol object
was originally created. That is why a single program opening more than
one connection very rarely makes any sense. The process id is totally

Make sure your program creates only one Wayland connection. That should
fix your problem with protocol objects.

In the X11 world it was possible for a program to create a Window in
one X11 connection, pass the XID to another component, and have the
other component open its own X11 connection and just use the XID to push
content to that window. If you wanted, these two components could be
even separate processes. This is impossible in Wayland by design, same
process or not.

If you cannot use the same Wayland connection in all your software
components, then the component that connects to the Wayland display
server must also become a Wayland mini-server itself (or offer any
other IPC for the other components to talk to it). This means that your
sub-component will connect to the main-component, and the
main-component will connect to the Wayland display server.

In other words, how you share buffers between your own software
components is completely up to you, but it will not work by using the
actual Wayland display server as a middle-man.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the wayland-devel mailing list