summaryrefslogtreecommitdiffstats
path: root/meta-agl-profile-graphical/recipes-graphics/wayland
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2018-12-07 11:43:59 -0500
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2018-12-20 21:10:07 +0000
commit60873f9da578054e029208ad64da14d2ceeccbbc (patch)
treeb6c22fe968012acd0db8915e70630c0b092d98f5 /meta-agl-profile-graphical/recipes-graphics/wayland
parent38c1a71fc36256a886d7d496d4c9cffd629a8f6b (diff)
weston: add weston-ready
Weston seems to take variable amounts of time to initialize on startup depending on configuration (e.g. gst-record feature being enabled for cluster support). To avoid windowmanager and its dependencies failing, patch LayerManagerControl so that errors can be detected; then use it in a new script, weston-ready, to detect if Weston is functional. A corresponding systemd service unit is also added so that things can use it in their dependencies. Change-Id: I5711e7f9d9a891e1c7a160b5d65711bd6e7fee03 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'meta-agl-profile-graphical/recipes-graphics/wayland')
-rw-r--r--meta-agl-profile-graphical/recipes-graphics/wayland/wayland-ivi-extension/0002-add-LayerManagerControl-error-status.patch21
-rw-r--r--meta-agl-profile-graphical/recipes-graphics/wayland/wayland-ivi-extension_2.0.2.bb3
-rw-r--r--meta-agl-profile-graphical/recipes-graphics/wayland/weston-ready/weston-ready49
-rw-r--r--meta-agl-profile-graphical/recipes-graphics/wayland/weston-ready/weston-ready.service9
-rw-r--r--meta-agl-profile-graphical/recipes-graphics/wayland/weston-ready_1.0.bb21
5 files changed, 102 insertions, 1 deletions
diff --git a/meta-agl-profile-graphical/recipes-graphics/wayland/wayland-ivi-extension/0002-add-LayerManagerControl-error-status.patch b/meta-agl-profile-graphical/recipes-graphics/wayland/wayland-ivi-extension/0002-add-LayerManagerControl-error-status.patch
new file mode 100644
index 000000000..9f1ab47b7
--- /dev/null
+++ b/meta-agl-profile-graphical/recipes-graphics/wayland/wayland-ivi-extension/0002-add-LayerManagerControl-error-status.patch
@@ -0,0 +1,21 @@
+LayerManagerControl: add error exit status
+
+Tweak to add a non-zero exit status on errors. This is useful for
+scripting, and allows writing a simple loop to detect Weston readiness.
+
+Upstream-Status: Pending
+
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+diff --git a/ivi-layermanagement-examples/LayerManagerControl/src/main.cpp b/ivi-layermanagement-examples/LayerManagerControl/src/main.cpp
+index 8ee0546..210e21e 100644
+--- a/ivi-layermanagement-examples/LayerManagerControl/src/main.cpp
++++ b/ivi-layermanagement-examples/LayerManagerControl/src/main.cpp
+@@ -45,6 +45,7 @@ int main(int argc, char* argv[])
+ if (CommandSuccess != interpreter.interpretCommand(userCommand))
+ {
+ cerr << "Interpreter error: " << interpreter.getLastError() << endl;
++ return 1;
+ }
+
+ return 0;
diff --git a/meta-agl-profile-graphical/recipes-graphics/wayland/wayland-ivi-extension_2.0.2.bb b/meta-agl-profile-graphical/recipes-graphics/wayland/wayland-ivi-extension_2.0.2.bb
index 3f0e34f4b..585c9adb6 100644
--- a/meta-agl-profile-graphical/recipes-graphics/wayland/wayland-ivi-extension_2.0.2.bb
+++ b/meta-agl-profile-graphical/recipes-graphics/wayland/wayland-ivi-extension_2.0.2.bb
@@ -10,7 +10,8 @@ SRC_URI = "git://github.com/GENIVI/${BPN}.git;branch=2.0;protocol=http \
file://0001-Added-ivi-id-agent-to-CMake.patch \
file://0002-ivi-id-agent-added-ivi-id-agent.patch \
file://0003-ivi-controller-load-id-agent-module.patch \
- "
+ file://0002-add-LayerManagerControl-error-status.patch \
+"
SRC_URI_append_wandboard = " file://wandboard_fix_build.patch"
S = "${WORKDIR}/git"
diff --git a/meta-agl-profile-graphical/recipes-graphics/wayland/weston-ready/weston-ready b/meta-agl-profile-graphical/recipes-graphics/wayland/weston-ready/weston-ready
new file mode 100644
index 000000000..5a3ff5500
--- /dev/null
+++ b/meta-agl-profile-graphical/recipes-graphics/wayland/weston-ready/weston-ready
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# Copyright (c) 2018, Konsulko Group
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Simple script to check if Weston+IVI shell is ready by calling
+# LayerManagerControl, optionally waiting for a specified timeout.
+#
+
+usage="Usage: weston-ready [-t timeout]"
+timeout=0
+
+if [ $# -eq 2 ]; then
+ if [ $1 = "-t" ]; then
+ timeout=$(($2 * 10))
+ else
+ echo $usage
+ exit 1
+ fi
+fi
+
+time=0
+rc=1
+while true; do
+ if [ $time -gt $timeout ]; then
+ break
+ elif LayerManagerControl get screens >/dev/null 2>&1; then
+ rc=0
+ break
+ fi
+ if [ $timeout -gt 0 ]; then
+ usleep 500000
+ fi
+ time=$(($time + 5))
+done
+exit $rc
diff --git a/meta-agl-profile-graphical/recipes-graphics/wayland/weston-ready/weston-ready.service b/meta-agl-profile-graphical/recipes-graphics/wayland/weston-ready/weston-ready.service
new file mode 100644
index 000000000..f8db5114a
--- /dev/null
+++ b/meta-agl-profile-graphical/recipes-graphics/wayland/weston-ready/weston-ready.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Wait for Weston readiness
+Requires=weston.service
+After=weston.service
+
+[Service]
+Environment="XDG_RUNTIME_DIR=/run/platform/display"
+ExecStart=/usr/bin/weston-ready -t 10
+Type=oneshot
diff --git a/meta-agl-profile-graphical/recipes-graphics/wayland/weston-ready_1.0.bb b/meta-agl-profile-graphical/recipes-graphics/wayland/weston-ready_1.0.bb
new file mode 100644
index 000000000..a3d0bb248
--- /dev/null
+++ b/meta-agl-profile-graphical/recipes-graphics/wayland/weston-ready_1.0.bb
@@ -0,0 +1,21 @@
+SUMMARY = "Weston readiness checker"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+inherit systemd
+
+SRC_URI = "file://weston-ready \
+ file://weston-ready.service \
+"
+
+do_install() {
+ install -D -m 0755 ${WORKDIR}/weston-ready ${D}${bindir}/weston-ready
+
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+ install -D -m 0644 ${WORKDIR}/weston-ready.service ${D}${systemd_system_unitdir}/weston-ready.service
+ fi
+}
+
+SYSTEMD_SERVICE_${PN} = "weston-ready.service"
+
+RDEPENDS_${PN} += "weston bash"
ength of the allocated PB_BYTES_ARRAY structure. */ PB_LTYPE_BYTES = 0x04, /* String with pre-allocated buffer. * data_size is the maximum length. */ PB_LTYPE_STRING = 0x05, /* Submessage * submsg_fields is pointer to field descriptions */ PB_LTYPE_SUBMESSAGE = 0x06, /* Number of declared LTYPES */ PB_LTYPES_COUNT = 7, /****************** * Modifier flags * ******************/ /* Just the basic, write data at data_offset */ PB_HTYPE_REQUIRED = 0x00, /* Write true at size_offset */ PB_HTYPE_OPTIONAL = 0x10, /* Read to pre-allocated array * Maximum number of entries is array_size, * actual number is stored at size_offset */ PB_HTYPE_ARRAY = 0x20, /* Works for all required/optional/repeated fields. * data_offset points to pb_callback_t structure. * LTYPE should be 0 (it is ignored, but sometimes * used to speculatively index an array). */ PB_HTYPE_CALLBACK = 0x30 } pb_packed pb_type_t; #define PB_HTYPE(x) ((x) & 0xF0) #define PB_LTYPE(x) ((x) & 0x0F) /* This structure is used in auto-generated constants * to specify struct fields. * You can change field sizes here if you need structures * larger than 256 bytes or field tags larger than 256. * The compiler should complain if your .proto has such * structures ("initializer too large for type"). */ typedef struct _pb_field_t pb_field_t; struct _pb_field_t { uint8_t tag; pb_type_t type; uint8_t data_offset; /* Offset of field data, relative to previous field. */ int8_t size_offset; /* Offset of array size or has-boolean, relative to data */ uint8_t data_size; /* Data size in bytes for a single item */ uint8_t array_size; /* Maximum number of entries in array */ /* Field definitions for submessage * OR default value for all other non-array, non-callback types * If null, then field will zeroed. */ const void *ptr; } pb_packed; /* This structure is used for 'bytes' arrays. * It has the number of bytes in the beginning, and after that an array. * Note that actual structs used will have a different length of bytes array. */ typedef struct { size_t size; uint8_t bytes[1]; } pb_bytes_array_t; /* This structure is used for giving the callback function. * It is stored in the message structure and filled in by the method that * calls pb_decode. * * The decoding callback will be given a limited-length stream * If the wire type was string, the length is the length of the string. * If the wire type was a varint/fixed32/fixed64, the length is the length * of the actual value. * The function may be called multiple times (especially for repeated types, * but also otherwise if the message happens to contain the field multiple * times.) * * The encoding callback will receive the actual output stream. * It should write all the data in one call, including the field tag and * wire type. It can write multiple fields. * * The callback can be null if you want to skip a field. */ typedef struct _pb_istream_t pb_istream_t; typedef struct _pb_ostream_t pb_ostream_t; typedef struct _pb_callback_t pb_callback_t; struct _pb_callback_t { union { bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void *arg); bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, const void *arg); } funcs; /* Free arg for use by callback */ void *arg; }; /* Wire types. Library user needs these only in encoder callbacks. */ typedef enum { PB_WT_VARINT = 0, PB_WT_64BIT = 1, PB_WT_STRING = 2, PB_WT_32BIT = 5 } pb_wire_type_t; /* These macros are used to declare pb_field_t's in the constant array. */ #define pb_membersize(st, m) (sizeof ((st*)0)->m) #define pb_arraysize(st, m) (pb_membersize(st, m) / pb_membersize(st, m[0])) #define pb_delta(st, m1, m2) ((int)offsetof(st, m1) - (int)offsetof(st, m2)) #define pb_delta_end(st, m1, m2) (offsetof(st, m1) - offsetof(st, m2) - pb_membersize(st, m2)) #define PB_LAST_FIELD {0,0,0,0} #endif