[PATCH] wayland-server: Add APIs to get some structure's value
강정현
jhyuni.kang at samsung.com
Wed Jun 22 10:45:15 UTC 2016
Dear, Mr. Pekka Paalanen.
Thank you for your reply and opinion.
I have checked Mr. Giulio's patch:
https://patchwork.freedesktop.org/series/4181/
But unfortunately my patch was little different with Mr. Giulio's.
His patch is to watch interfaces binded such clients.
So He added wl_resource_get_interface() function to refer interface from
resource.
But My patch's purpose is that print which interface is supported in this
server and
which requests and events are supported current interface.
But if he has plan to expand "GammaRay"'s function,
my patch can support that.
Because I add this APIs to support debugging.
I explain to my purpose to this patch.
So please give me more opinions.
I want to see all of interfaces and requests/events names supported current
server.
Ex> command in console: $print_supported_layout
[1] wl_compositor
-- Request List --
0) create_surface
1) create_region
-- Event List --
[2] wl_subcompositor
-- Request List --
0) destroy
1) get_subsurface
-- Event List --
Each server has different configuration,
so that they could have different about supported interface.
Because this could show not only wayland's basic protocol
but also extra protocol which is user defined.
And it provide more convenience to client developer.
The client developer can watch all of interface and requests/events easily.
(Yes, I know that to watch xml file is more easier to expert.)
This patch is not related to make new functions, fix bugs.
Just to make easier to debug.
Watch server's global list more easier.
I don't know this is enough explain why I want to added these APIs.
Have you give me more opinions or tips about this.
I'm ready to listen your opinions.
If you feel my purpose is reasonable I'll add more specific doc to each
APIs.
Thanks and regards,
JengHyun Kang.
> -----Original Message-----
> From: wayland-devel [mailto:wayland-devel-bounces at lists.freedesktop.org]
> On Behalf Of Pekka Paalanen
> Sent: Tuesday, June 21, 2016 5:02 PM
> To: JengHyun Kang
> Cc: wayland-devel at lists.freedesktop.org
> Subject: Re: [PATCH] wayland-server: Add APIs to get some structure's
> value
>
> On Tue, 21 Jun 2016 13:45:16 +0900
> JengHyun Kang <jhyuni.kang at samsung.com> wrote:
>
> > This patch's purpose is getting global interface information
> > registerred in the server.
> > If global is created (used wl_global_create()), information are saved
> > in global_list.
> > But almost structures used in wayland is defined statically.
> > So it is hard to get structure's values in server side.
> >
> > Added following APIs.
> > - wl_display_get_global_list()
> > - wl_global_get_interface()
> > - wl_interface_get_name()
> > - wl_interface_get_method_count()
> > - wl_interface_get_methods()
> > - wl_interface_get_event_count()
> > - wl_interface_get_events()
> > - wl_message_get_name()
> > - wl_global_list_get_global()
> >
> > You can get interface information to combine added APIs.
> > (Such as interface's name and events/requests name)
> >
> > 1st, you can get wl_list:global_list to use
wl_display_get_global_list().
> > 2nd, you can get length of wl_list to use wl_list_length() and
> > wl_global to use wl_global_list_get_global().
> > wl_global is saved in list, so you need index to get wl_global.
> > 3rd, you can get wl_interface to use wl_global_get_interface().
> > 4th, in wl_interface structure, there are so many information about
> > interface name and events/requests information.
> > so you can get information to use wl_interface_get_name(),
> > wl_interface_get_method_count(), wl_interface_get_method(),
> > wl_interface_get_event_count(), wl_interface_get_event().
>
> Hi,
>
> your commit message forgot to explain the one most important thing:
>
> Why?
>
> Also, please see https://patchwork.freedesktop.org/series/4181/ which is
> already reviewed and seems to overlap with yours. Giulio has demonstrated
> the use case for all the API he is adding with a single
> screenshot:
> https://i.imgur.com/ihW3d88.jpg
>
> and also roughly explaining how "GammaRay" hooks up to a compositor.
>
> It would be nice if you reviewed Giulio's series, checked how it matches
> your needs, and then explain what you are still missing and why.
> Personally I am in favour of Giulio's series and no-one has yet disagreed
> with it, so I think it has good chances of getting merged once polished.
>
>
> Thanks,
> pq
>
> > ---
> > src/wayland-server.c | 63
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++
> > src/wayland-server.h | 27 ++++++++++++++++++++++
> > 2 files changed, 90 insertions(+)
> >
> > diff --git a/src/wayland-server.c b/src/wayland-server.c index
> > 19aa2e8..ac5c2e5 100644
> > --- a/src/wayland-server.c
> > +++ b/src/wayland-server.c
> > @@ -997,6 +997,63 @@ wl_global_destroy(struct wl_global *global)
> > free(global);
> > }
> >
> > +WL_EXPORT const struct wl_interface * wl_global_get_interface(struct
> > +wl_global *global) {
> > + return global->interface;
> > +}
> > +
> > +WL_EXPORT struct wl_global *
> > +wl_global_list_get_global(struct wl_list *list, int idx) {
> > + int i = 0;
> > + struct wl_global *global;
> > +
> > + wl_list_for_each(global, list, link)
> > + {
> > + if (idx == i) break;
> > + i++;
> > + }
> > +
> > + return global;
> > +}
> > +
> > +WL_EXPORT const char *
> > +wl_interface_get_name(const struct wl_interface *interface) {
> > + return interface->name;
> > +}
> > +
> > +WL_EXPORT int
> > +wl_interface_get_method_count(const struct wl_interface *interface) {
> > + return interface->method_count;
> > +}
> > +
> > +WL_EXPORT const struct wl_message *
> > +wl_interface_get_methods(const struct wl_interface *interface) {
> > + return interface->methods;
> > +}
> > +
> > +WL_EXPORT int
> > +wl_interface_get_event_count(const struct wl_interface *interface) {
> > + return interface->event_count;
> > +}
> > +
> > +WL_EXPORT const struct wl_message *
> > +wl_interface_get_events(const struct wl_interface *interface) {
> > + return interface->events;
> > +}
> > +
> > +WL_EXPORT const char *
> > +wl_message_get_name(const struct wl_message *message) {
> > + return message->name;
> > +}
> > +
> > /** Get the current serial number
> > *
> > * \param display The display object
> > @@ -1035,6 +1092,12 @@ wl_display_get_event_loop(struct wl_display
> *display)
> > return display->loop;
> > }
> >
> > +WL_EXPORT struct wl_list *
> > +wl_display_get_global_list(struct wl_display *display) {
> > + return &display->global_list;
> > +}
> > +
> > WL_EXPORT void
> > wl_display_terminate(struct wl_display *display) { diff --git
> > a/src/wayland-server.h b/src/wayland-server.h index a6e7951..3494641
> > 100644
> > --- a/src/wayland-server.h
> > +++ b/src/wayland-server.h
> > @@ -92,6 +92,33 @@ wl_display_remove_global(struct wl_display
> > *display,
> >
> > #endif
> >
> > +struct wl_list *
> > +wl_display_get_global_list(struct wl_display *display);
> > +
> > +const struct wl_interface *
> > +wl_global_get_interface(struct wl_global *global);
> > +
> > +const char *
> > +wl_interface_get_name(const struct wl_interface *interface);
> > +
> > +int
> > +wl_interface_get_method_count(const struct wl_interface *interface);
> > +
> > +const struct wl_message *
> > +wl_interface_get_methods(const struct wl_interface *interface);
> > +
> > +int
> > +wl_interface_get_event_count(const struct wl_interface *interface);
> > +
> > +const struct wl_message *
> > +wl_interface_get_events(const struct wl_interface *interface);
> > +
> > +const char *
> > +wl_message_get_name(const struct wl_message *message);
> > +
> > +struct wl_global *
> > +wl_global_list_get_global(struct wl_list *list, int idx);
> > +
> > #ifdef __cplusplus
> > }
> > #endif
More information about the wayland-devel
mailing list