meta-agl-core: Revise weston-ini-conf mechanism 60/25860/3
authorScott Murray <scott.murray@konsulko.com>
Mon, 4 Jan 2021 16:25:07 +0000 (11:25 -0500)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Tue, 12 Jan 2021 13:35:51 +0000 (13:35 +0000)
The recent layer reorganization broke the landscape vs portrait scheme
based on bbappend'ing the weston-ini-conf recipe in the previous cluster
and html5 demo layers.  To fix this and to facilitate being able to
easily build the mix of demo platform images, the weston.ini generation
mechanism in the weston-ini-conf has been revised to build multiple
packages.

Instead of relying on SRC_URI to install weston.ini fragments into
WORKDIR and grabbing all of them with a *.cfg glob, an explicit list
built from new WESTON_FRAGMENTS and WESTON_DISPLAYS variables is used.
The fragments listed in WESTON_FRAGMENTS are used to generate both
weston-ini-conf and weston-ini-conf-landscape packages containing
uniquely named files (weston.ini.default and weston.ini.landscape,
respectively), and the OE update-alternatives mechanism is used to have
weston.ini point at the appropriate file on installation.  For now, the
two packages are explicitly marked as incompatible with one another,
but this could be tweaked in the future if switching between them on
target is desired.

Additional notes:
- A RPROVIDES of "weston-ini" has been defined for the weston-ini-conf
  packages and a RDEPENDS on it added to weston-init.  This should
  allow members to drop in a complete alternative solution while still
  having a dependency chain.
- The various meta-agl-bsp bbappends of weston-ini-conf have for the
  most part been updated to yield the same behavior as before, though
  with an eye towards using machine overrides to ease multiconfig usage
  down the road.  This includes the currently unused Raspberry Pi
  touchscreen support, which has been left since it may still see use.
- An exception to the above, however, is that the support for the
  touchscreen on the dra7 EVM has been removed, as upstream dropped the
  support for the screen on the available test hardware and at present
  it only seems feasible to support external HDMI monitors.
- The unused fbdev fragment used to support meta-freescale in the past
  has been removed.
- The virtual and virtual-landscape fragments have been renamed to
  virtual-270 and virtual-0 to better indicate the orientation and match
  the naming used for the other fragments.  It is likely that future
  work will need to split the display enabling and orientation aspects,
  as the current tying together of the two results in configurations
  somewhat overly specific to the actual AGL demo systems.

Bug-AGL: SPEC-3745

Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I2a968781182a346c1d483cca4fd7337679e58118
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/25860
Tested-by: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
ci-image-build: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
ci-image-boot-test: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
13 files changed:
meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-ini-conf/fbdev.cfg [deleted file]
meta-agl-bsp/meta-raspberrypi/recipes-graphics/wayland/weston-ini-conf.bbappend
meta-agl-bsp/meta-rcar-gen3/recipes-graphics/wayland/weston-ini-conf.bbappend
meta-agl-bsp/meta-ti/recipes-graphics/wayland/weston-ini-conf.bbappend [deleted file]
meta-agl-bsp/meta-ti/recipes-graphics/wayland/weston-ini-conf/unnamed.cfg [deleted file]
meta-agl-core/recipes-graphics/wayland/Readme.weston-ini-conf
meta-agl-core/recipes-graphics/wayland/weston-ini-conf.bb
meta-agl-core/recipes-graphics/wayland/weston-ini-conf.bbappend
meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-180.cfg [new file with mode: 0644]
meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-0.cfg [new file with mode: 0644]
meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-270.cfg [new file with mode: 0644]
meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual.cfg [deleted file]
meta-agl-core/recipes-graphics/wayland/weston-init_aglcore.inc

diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-ini-conf/fbdev.cfg b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-ini-conf/fbdev.cfg
deleted file mode 100644 (file)
index b1a1f3c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-[output]
-name=fbdev
-transform=270
index 33dfd6a..086fff7 100644 (file)
@@ -1,3 +1,3 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+FILESEXTRAPATHS_prepend_raspberrypi := "${THISDIR}/${PN}:"
 
-SRC_URI += "file://dsi.cfg"
+SRC_URI_append_raspberrypi = " file://dsi.cfg"
index 44615c3..2fd50c3 100644 (file)
@@ -1,12 +1,15 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+FILESEXTRAPATHS_prepend_rcar-gen3 := "${THISDIR}/${PN}:"
 
-SRC_URI_append_ulcb = " file://kingfisher_output.cfg"
-SRC_URI_append_ebisu = " file://ebisu_output.cfg"
-SRC_URI_append_salvator-x = " file://salvator-x_output.cfg"
+SRC_URI_append_rcar-gen3 = " \
+       file://kingfisher_output.cfg \
+       file://ebisu_output.cfg \
+       file://salvator-x_output.cfg \
+"
 
-do_configure() {
-    echo repaint-window=34 >> ${WORKDIR}/core.cfg
+WESTON_FRAGMENTS_append_ulcb = " kingfisher_output"
+WESTON_FRAGMENTS_append_ebisu = " ebisu_output"
+WESTON_FRAGMENTS_append_salvator-x = " salvator-x_output"
 
-    echo transition-duration=300 >> ${WORKDIR}/ivishell.cfg
-    echo cursor-theme=default >> ${WORKDIR}/ivishell.cfg
+do_configure_append_rcar-gen3() {
+    echo repaint-window=34 >> ${WORKDIR}/core.cfg
 }
diff --git a/meta-agl-bsp/meta-ti/recipes-graphics/wayland/weston-ini-conf.bbappend b/meta-agl-bsp/meta-ti/recipes-graphics/wayland/weston-ini-conf.bbappend
deleted file mode 100644 (file)
index 684031e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-
-# While we could have a panel attached to HDMI, we only use the default
-# panel isntead.
-SRC_URI_remove_dra7xx-evm = "file://hdmi-a-1-270.cfg"
-# Our DPI panel shows up as "UNNAMED-1"
-SRC_URI_append_dra7xx-evm = " file://unnamed.cfg"
diff --git a/meta-agl-bsp/meta-ti/recipes-graphics/wayland/weston-ini-conf/unnamed.cfg b/meta-agl-bsp/meta-ti/recipes-graphics/wayland/weston-ini-conf/unnamed.cfg
deleted file mode 100644 (file)
index 2954493..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-[output]
-name=UNNAMED-1
-transform=270
index bbd5a80..bb66fd2 100644 (file)
@@ -1,10 +1,11 @@
 ##Generate a weston.ini file:
 
-To modify any of the default sections (core, shell, ivi-shell), add a
-do_configure() function to your bbappend:
+To modify any of the default sections (core, shell), add a
+do_configure() function to your bbappend, using machine (e.g. h3ulcb)
+overrides (i.e. use the MACHINE name where "machine" is used below):
 
 '''
-do_configure() {
+do_configure_machine() {
     echo repaint-window=34 >> ${WORKDIR}/core.cfg
 
     echo transition-duration=300 >> ${WORKDIR}/ivishell.cfg
@@ -13,22 +14,30 @@ do_configure() {
 '''
 or:
 '''
-do_configure() {
+do_configure_machine() {
     sed -i -e 's/drm-backend/fbdev-backend/' ${WORKDIR}/core.cfg
 }
 '''
 
-To change the display from the default assumption of an HDMI-1-A connected
-screen that needs to be rotated 270 degrees:
-
-'''
-SRC_URI_remove = "file://hdmi-a-1-270.cfg"
-SRC_URI += "file://hdmi-a-1-90.cfg"
+To add new non-display sections, just list them in SRC_URI and WESTON_FRAGMENTS:
 '''
+FILESEXTRAPATHS_prepend_machine := "${THISDIR}/${PN}:"
+
+SRC_URI_append_machine = " file://foo.cfg"
+WESTON_FRAGMENTS_append_machine = " foo"
 
-To add new sections just list them in SRC_URI:
 '''
-FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
 
-SRC_URI += "file://dsi.cfg"
+To change the display, for example from the default assumption of an
+HDMI-1-A connected screen that needs to be rotated 270 degrees to one
+that is rotated 90 degrees, redefine the WESTON_DISPLAYS variable:
+
+'''
+WESTON_DISPLAYS_machine = "hdmi-a-1-90"
 '''
+
+Note that the weston-ini-conf recipe automatically generates a landscape
+orientation version of weston.ini by replacing 90/270 degree rotation
+fragments for HDMI-A-1 and the virtual output into 180 and 0 degrees,
+respectively.  This landscape configuration can be used in an image by
+pulling in weston-ini-conf-landscape instead of weston-ini-conf.
index 16c0f04..70130f7 100644 (file)
@@ -1,41 +1,86 @@
-SUMMARY = "Startup script and systemd unit file for the Weston Wayland compositor"
+SUMMARY = "Configuration file for the Weston and AGL Wayland compositors"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
 
-SRC_URI = "file://core.cfg \
-           file://shell.cfg \
-           file://hdmi-a-1-270.cfg \
-          "
-
-# cluster and html5-landscape
-# core, shell, hdmi-a-1-180.cfg, virtual-landscape.cfg
-SRC_URI_remove_landscape = " \
-       file://hdmi-a-1-270.cfg \
+SRC_URI = " \
+       file://core.cfg \
+       file://shell.cfg \
        file://hdmi-a-1-90.cfg \
-       file://virtual.cfg \
-"
-SRC_URI_append_landscape = " \
        file://hdmi-a-1-180.cfg \
-       file://virtual-landscape.cfg \
+       file://hdmi-a-1-270.cfg \
+       file://remote-output.cfg \
+       file://virtual-270.cfg \
+       file://virtual-0.cfg \
 "
 
-
 S = "${WORKDIR}"
 
-PACKAGE_ARCH = "${MACHINE_ARCH}"
+inherit update-alternatives
+
+# Default primary display/orientation fragment
+WESTON_DISPLAYS ?= "hdmi-a-1-270"
+
+# Configuration fragments to use in weston.ini.*
+# Note that some may be replaced/removed when building the landscape
+# configuration.
+WESTON_FRAGMENTS = "core shell ${WESTON_DISPLAYS}"
+
+# On-target weston.ini directory
+weston_ini_dir = "${sysconfdir}/xdg/weston"
 
 do_compile() {
-    # Put all of our cfg files together.
-    rm -f ${WORKDIR}/weston.ini
-    for F in ${WORKDIR}/*.cfg; do
-        cat $F >> ${WORKDIR}/weston.ini
-        echo >> ${WORKDIR}/weston.ini
+    # Put all of our cfg files together for a default portrait
+    # orientation configuration
+    rm -f ${WORKDIR}/weston.ini.default
+    for F in ${WESTON_FRAGMENTS}; do
+        cat ${WORKDIR}/${F}.cfg >> ${WORKDIR}/weston.ini.default
+        echo >> ${WORKDIR}/weston.ini.default
     done
-    sed -i -e '$ d' ${WORKDIR}/weston.ini
+    sed -i -e '$ d' ${WORKDIR}/weston.ini.default
+
+    # Do it again, but filter fragments to configure for landscape
+    rm -f ${WORKDIR}/weston.ini.landscape
+    for F in ${WESTON_FRAGMENTS}; do
+        if echo $F | grep '^hdmi-a-1-\(90\|270\)$'; then
+            F="hdmi-a-1-180"
+        elif echo $F | grep '^virtual-270$'; then
+            F="virtual-0"
+        fi
+        cat ${WORKDIR}/${F}.cfg >> ${WORKDIR}/weston.ini.landscape
+        echo >> ${WORKDIR}/weston.ini.landscape
+    done
+    sed -i -e '$ d' ${WORKDIR}/weston.ini.landscape
 }
 
 do_install_append() {
-    WESTON_INI_CONFIG=${sysconfdir}/xdg/weston
-    install -d ${D}${WESTON_INI_CONFIG}
-    install -m 0644 ${WORKDIR}/weston.ini ${D}${WESTON_INI_CONFIG}/weston.ini
+    install -d ${D}${weston_ini_dir}
+    install -m 0644 ${WORKDIR}/weston.ini.default ${D}${weston_ini_dir}/
+    install -m 0644 ${WORKDIR}/weston.ini.landscape ${D}${weston_ini_dir}/
 }
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+# Use the alternative mechanism to handle multiple packages providing
+# weston.ini.  This seems simpler than other possible approaches.
+# Note that for now the generated packages are being marked as
+# incompatible with each other for simplicity, that can be changed if
+# a usecase where switching between alternatives at runtime is desirable
+# appears.
+
+ALTERNATIVE_LINK_NAME[weston.ini] = "${weston_ini_dir}/weston.ini"
+
+RDEPENDS_${PN} = "weston-init"
+RPROVIDES_${PN} = "weston-ini"
+RCONFLICTS_${PN} = "${PN}-landscape"
+ALTERNATIVE_${PN} = "weston.ini"
+ALTERNATIVE_TARGET_${PN} = "${weston_ini_dir}/weston.ini.default"
+
+PACKAGE_BEFORE_PN += "${PN}-landscape"
+
+FILES_${PN}-landscape = "${weston_ini_dir}/weston.ini.landscape"
+
+RDEPENDS_${PN}-landscape = "weston-init"
+RPROVIDES_${PN}-landscape = "weston-ini"
+RCONFLICTS_${PN}-landscape = "${PN}"
+ALTERNATIVE_${PN}-landscape = "weston.ini"
+ALTERNATIVE_TARGET_${PN}-landscape = "${weston_ini_dir}/weston.ini.landscape"
index 1790040..0f51d59 100644 (file)
@@ -2,11 +2,10 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
-SRC_URI += "${@bb.utils.contains("DISTRO_FEATURES", "weston-remoting", "file://remote-output.cfg", "",d)}"
-
+WESTON_DISPLAYS_append = "${@bb.utils.contains("DISTRO_FEATURES", "weston-remoting", " remote-output", "", d)}"
 
 # For virtual machines and intel-corei7-64 we want to support both the HDMI-A-1
 # and Virtual-1 outputs. This allows us to run virtual images on real hardware
 # and vice versa.
-SRC_URI_append_qemuall = " file://virtual.cfg"
-SRC_URI_append_intel-corei7-64 = " file://virtual.cfg"
+WESTON_DISPLAYS_append_qemuall = " virtual-270"
+WESTON_DISPLAYS_append_intel-corei7-64 = " virtual-270"
diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-180.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-180.cfg
new file mode 100644 (file)
index 0000000..7648c77
--- /dev/null
@@ -0,0 +1,4 @@
+# A display is connected to HDMI-A-1
+[output]
+name=HDMI-A-1
+transform=180
diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-0.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-0.cfg
new file mode 100644 (file)
index 0000000..d692536
--- /dev/null
@@ -0,0 +1,3 @@
+[output]
+name=Virtual-1
+mode=1920x1080
diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-270.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-270.cfg
new file mode 100644 (file)
index 0000000..0e5b536
--- /dev/null
@@ -0,0 +1,4 @@
+[output]
+name=Virtual-1
+mode=1920x1080
+transform=270
diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual.cfg
deleted file mode 100644 (file)
index 25a8fae..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-[output]
-name=Virtual-1
-transform=270
-mode=1920x1080
-#mode=1600x1200
-#mode=1680x1050
-#mode=1400x1050
-#mode=1600x900
-#mode=1280x1024
-#mode=1440x900
-#mode=1280x960
-#mode=1360x768
-#mode=1280x800
-#mode=1280x768
-#mode=1280x720
-#mode=800x600
-#mode=848x480
-#mode=640x480
index 51c59ae..fc6ab5d 100644 (file)
@@ -1,6 +1,8 @@
+SYSTEMD_AUTO_ENABLE = "enable"
+
 do_install_append() {
     # Remove upstream weston.ini to avoid conflict with weston-ini-conf package
     rm -f ${D}${sysconfdir}/xdg/weston/weston.ini
 }
 
-SYSTEMD_AUTO_ENABLE = "enable"
+RDEPENDS_${PN} += "weston-ini"