Allow compositor be started using software rendering
[AGL/meta-agl-demo.git] / recipes-graphics / wayland / weston-init_agldemo.inc
1 FILESEXTRAPATHS_prepend := "${THISDIR}/weston-init:"
2
3 inherit agl-graphical
4
5 AGL_DEFAULT_WESTONSTART ??= "/usr/bin/agl-compositor --config ${sysconfdir}/xdg/weston/weston.ini"
6 WESTON_USE_PIXMAN ??= "0"
7
8 WESTONSTART ??= "${AGL_DEFAULT_WESTONSTART} ${WESTONARGS}"
9 WESTONSTART_append = " ${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", " --log=${DISPLAY_XDG_RUNTIME_DIR}/compositor.log", "",d)}"
10 WESTONSTART_append = " ${@bb.utils.contains("DISTRO_FEATURES", "agl-devel", " --debug", "",d)}"
11 WESTONSTART_append = " ${@bb.utils.contains("WESTON_USE_PIXMAN", "1", " --use-pixman", "",d)}"
12
13 # Systemd name of DRM device to have weston/agl-compositor startup depend
14 # upon, if required.  Currently only x86-64 seems to need a dependency to
15 # avoid failures due to racing with i915 driver init on e.g. UpSquared.
16 # It seems safer for now to only apply it there rather than doing a blanket
17 # default everywhere that might then need to be over-ridden for vendor BSPs.
18 WESTON_DRM_DEVICE ?= ""
19
20 WIFILES = " \
21     file://weston.conf.in \
22     file://weston-dep.conf.in \
23     file://tmpfiles.conf.in \
24     file://zz-dri.rules.in \
25     file://zz-input.rules.in \
26     file://zz-tty.rules.in \
27 "
28
29 WIFILES_append_imx = " \
30     file://zz-dri-imx.rules.in \
31 "
32
33 SRC_URI_append = " ${WIFILES}"
34
35 do_install_append() {
36     # Remove upstream weston udev rules just to be safe
37     rm -f ${D}${sysconfdir}/udev/rules.d/71-weston-drm.rules
38
39     # Process ".in" files
40     files=$(echo ${WIFILES} | sed s,file://,,g)
41     for f in ${files}; do
42         g=${f%.in}
43         if [ "${f}" != "${g}" ]; then
44             sed -e "s,@WESTONUSER@,${WESTONUSER},g" \
45                 -e "s,@WESTONGROUP@,${WESTONGROUP},g" \
46                 -e "s,@XDG_RUNTIME_DIR@,${DISPLAY_XDG_RUNTIME_DIR},g" \
47                 -e "s,@WESTONSTART@,${WESTONSTART},g" \
48                 -e "s,@WESTON_DRM_DEVICE@,${WESTON_DRM_DEVICE},g" \
49                     ${WORKDIR}/${f} > ${WORKDIR}/${g}
50         fi
51     done
52
53     # Install weston drop-in
54     install -d ${D}${systemd_system_unitdir}/weston@.service.d
55     install -m644 ${WORKDIR}/weston.conf ${D}/${systemd_system_unitdir}/weston@.service.d/weston-init.conf
56
57     # Install weston DRM device dependency drop-in if required
58     if [ -n "${WESTON_DRM_DEVICE}" ]; then
59         install -m 0644 ${WORKDIR}/weston-dep.conf ${D}/${systemd_system_unitdir}/weston@.service.d/
60     fi
61
62     # Install tmpfiles drop-in
63     install -d ${D}${libdir}/tmpfiles.d
64     install -m644 ${WORKDIR}/tmpfiles.conf ${D}${libdir}/tmpfiles.d/weston-init.conf
65
66     # Install udev rules
67     install -d ${D}${sysconfdir}/udev/rules.d
68     for f in ${files}; do
69         g=${f%.in}
70         h=${g%.rules}
71         if [ "${g}" != "${h}" ]; then
72             install -m644 ${WORKDIR}/${g} ${D}${sysconfdir}/udev/rules.d
73         fi
74     done
75 }
76
77 FILES_${PN} += " \
78     ${libdir}/tmpfiles.d/ \
79     ${systemd_system_unitdir}/weston@.service.d/ \
80 "