[PATCH] update protocol specification to match wire protocol

Paul Sbarra sbarra.paul at gmail.com
Thu Sep 4 20:05:00 PDT 2014


I agree it's a hack, but it's also one that invalidates the protocol
specification.  If the wire protocol requires four arguments then the
specification needs to reflect that.  Currently if another tool or protocol
implementation (like the gowl example previously mentioned) attempts to
generate code from the specification they end up code that is not
compatible with libwayland applications.  In my opinion that's a pretty bad
outcome for a hack, documented or not.

Attached is a patch that resolves the problem (at least it limits the scope
of the hack to the wayland code generator) while maintaining the existing
api.  Thank you in advance for reviewing and considering this patch.

Paul


On Wed, Sep 3, 2014 at 11:04 PM, Jasper St. Pierre <jstpierre at mecheye.net>
wrote:

> The fact that we have an undocumented hack like that in our scanner
> clearly isn't great. We need to document it.
> On Sep 3, 2014 8:55 PM, "Boyan Ding" <stu_dby at 126.com> wrote:
>
>> Hi,
>>
>> It is actually not a fault in wayland, instead it is designed to be so.
>> new_id's without interface specified in the protocol (such as the one in
>> wl_registry::bind) must come with 3 arguments (s: interface name, u:
>> version, n: the actual new_id). That's why 'n' turns into 'sun'. If a
>> language binding generates the wrong code, please contact the author of
>> the language binding and let him correct it. If you are changing how
>> wayland-scanner (the official C code generator) works, the whole world
>> will break before you.
>>
>> Refer to "How protocol objects are created" section in [1] to see the
>> details.
>>
>> Regards,
>> Boyan Ding
>>
>> [1]
>>
>> http://ppaalanen.blogspot.fi/2014/07/wayland-protocol-design-object-lifespan.html
>>
>> On Wed, 2014-09-03 at 22:32 -0500, Paul Sbarra wrote:
>> > I tried to start some discussion on this topic previously, but it
>> > apparently didn't make it through the moderator, so I'm trying again
>> > having now joined the list.
>> >
>> >
>> > I've recently taken an interest in the gowl implementation of the
>> > wayland protocol and noticed that the specification doesn't match the
>> > interface that gets generated by the wayland scanner.
>> >
>> >
>> > If I attempt to code-gen gowl using the wayland.xml file the
>> > wl_registry bind interface is missing a couple arguments that weston
>> > expects, resulting in the following runtime error:
>> > libwayland: message too short, object (2), message bind(usun)
>> >
>> >
>> > However, the spec indicates a bind request signature of "un".
>> >
>> >
>> > I tracked this down into some curious logic in the scanner and have
>> > been working on a patch to try and allow the corrected signature to be
>> > specified in the protocol.  Unfortunately this has become more
>> > interesting then I'd anticipated.
>> >
>> >
>> > Attached is my naive attempt at resolving this issue.  I'm horrified
>> > by the string->interface lookup and the wl_registry_bind api change
>> > but I'm not sure what else one can do.  Any feedback or additional
>> > help would be appreciated.
>> >
>> >
>> > Note that this patch applies to the 1.5.91 tagged commit and compiles
>> > cleanly (for wayland).  Weston didn't like having the lookup function
>> > defined in multiple files, so maybe there would be a better place to
>> > put such functionality.
>> >
>> > Thanks,
>> > Paul
>> >
>> > _______________________________________________
>> > wayland-devel mailing list
>> > wayland-devel at lists.freedesktop.org
>> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>>
>>
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20140904/e157a437/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-update-specification-to-match-the-wire-protocol.patch
Type: text/x-patch
Size: 4339 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20140904/e157a437/attachment-0001.bin>


More information about the wayland-devel mailing list