diff options
author | Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com> | 2019-05-08 03:53:23 -0400 |
---|---|---|
committer | Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com> | 2019-05-08 03:53:23 -0400 |
commit | ef6737939438bc4c5891a094fc6fcbc4bac0f9a4 (patch) | |
tree | d7a34d840e83eb28098933e90602eaf6bb60c5b0 | |
parent | 24a34b2b3241cb60567934e97d6319b38f2da38f (diff) | |
download | wayland-ivi-extension-ef6737939438bc4c5891a094fc6fcbc4bac0f9a4.tar.gz |
Integrate DLT support with weston-debug protocol
PFB details of the changes made with the commit:
1) Modified CMakeLists to make it work with Weston 6.
2) Weston debug protocol is slightly changed. The list of debug scopes
available to subscribe will be advertised to the client after binding
with weston debug interface. Created a listener for the advertise event.
Call weston_debug_subscribe only if the debug scope is available.
3) A hang was observed while stopping the weston service.
To resolve the issue, modified the termination sequence such that after
destroying the weston debug interface we should wait till all the stream
objects get destroyed.
Signed-off-by: Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>
-rw-r--r-- | ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt | 4 | ||||
-rw-r--r-- | ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c | 56 |
2 files changed, 53 insertions, 7 deletions
diff --git a/ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt b/ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt index 8264d3a..b34633e 100644 --- a/ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt +++ b/ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt @@ -22,14 +22,14 @@ project (simple-weston-client) find_package(PkgConfig) pkg_check_modules(WAYLAND_CLIENT wayland-client REQUIRED) pkg_check_modules(WAYLAND_CURSOR wayland-cursor REQUIRED) -pkg_check_modules(LIBWESTON_PROTOCOLS libweston-2-protocols QUIET) +pkg_check_modules(LIBWESTON_PROTOCOLS libweston-6-protocols QUIET) if(${LIBWESTON_PROTOCOLS_FOUND}) #check for DLT pkg_check_modules(DLT automotive-dlt REQUIRED) #import the pkgdatadir from libweston-protocols pkgconfig file - execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir libweston-2-protocols + execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir libweston-6-protocols OUTPUT_VARIABLE WestonProtocols_PKGDATADIR) string(REGEX REPLACE "[\r\n]" "" WestonProtocols_PKGDATADIR "${WestonProtocols_PKGDATADIR}") SET(LIBWESTON_PROTOCOLS_PKGDATADIR ${WestonProtocols_PKGDATADIR}) diff --git a/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c b/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c index 9588361..4093cf2 100644 --- a/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c +++ b/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c @@ -92,6 +92,7 @@ typedef struct _WaylandContext { struct debug_stream { struct wl_list link; + int should_bind; char *name; struct weston_debug_stream_v1 *obj; }; @@ -142,6 +143,8 @@ stream_alloc(WaylandContextStruct* wlcontext, const char *name) return NULL; } + stream->should_bind = 0; + wl_list_insert(wlcontext->stream_list.prev, &stream->link); return stream; @@ -203,11 +206,13 @@ start_streams(WaylandContextStruct* wlcontext) struct debug_stream *stream; wl_list_for_each(stream, &wlcontext->stream_list, link) { + if (stream->should_bind) { stream->obj = weston_debug_v1_subscribe(wlcontext->debug_iface, stream->name, wlcontext->debug_fd); weston_debug_stream_v1_add_listener(stream->obj, &stream_listener, stream); + } } } @@ -419,6 +424,30 @@ static struct wl_seat_listener seat_Listener = { seat_name }; +#ifdef LIBWESTON_DEBUG_PROTOCOL +static void +stream_find(WaylandContextStruct* wlcontext, const char *name, const char *desc) +{ + struct debug_stream *stream; + wl_list_for_each(stream, &wlcontext->stream_list, link) + if (strcmp(stream->name, name) == 0) { + stream->should_bind = 1; + } +} + +static void +debug_advertise(void *data, struct weston_debug_v1 *debug, const char *name, + const char *desc) +{ + WaylandContextStruct* wlcontext = data; + stream_find(wlcontext, name, desc); +} + +static const struct weston_debug_v1_listener debug_listener = { + debug_advertise +}; +#endif + static void registry_handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version) @@ -456,6 +485,8 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t name, wlcontext->debug_iface = wl_registry_bind(registry, name, &weston_debug_v1_interface, myver); + weston_debug_v1_add_listener(wlcontext->debug_iface, &debug_listener, + wlcontext); } #endif } @@ -515,11 +546,6 @@ void destroy_wayland_context(WaylandContextStruct* wlcontext) if(wlcontext->wl_display) wl_display_disconnect(wlcontext->wl_display); - -#ifdef LIBWESTON_DEBUG_PROTOCOL - if(wlcontext->debug_iface) - weston_debug_v1_destroy(wlcontext->debug_iface); -#endif } int @@ -775,6 +801,7 @@ int main (int argc, const char * argv[]) { WaylandContextStruct* wlcontext; BkGndSettingsStruct* bkgnd_settings; + struct sigaction sigint; int offset = 0; int ret = 0; @@ -839,6 +866,25 @@ int main (int argc, const char * argv[]) Error: #ifdef LIBWESTON_DEBUG_PROTOCOL + weston_debug_v1_destroy(wlcontext->debug_iface); + + while (1) { + struct debug_stream *stream; + int empty = 1; + + wl_list_for_each(stream, &wlcontext->stream_list, link) + if (stream->obj) { + empty = 0; + break; + } + + if (empty) + break; + + if (wl_display_dispatch(wlcontext->wl_display) < 0) + break; + } + destroy_streams(wlcontext); wl_display_roundtrip(wlcontext->wl_display); |