agl-compositor-init-pipewire: Add a service for streaming PipeWire output 38/30638/6
authorMarius Vlad <marius.vlad@collabora.com>
Fri, 6 Dec 2024 12:58:48 +0000 (14:58 +0200)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Fri, 13 Dec 2024 11:54:09 +0000 (11:54 +0000)
This should be started after compositor starts to automatically stream
the pipewire output to the target.

We add it under agl-compositor-init-pipewire as they belong together.

Bug-AGL: SPEC-5234
Change-Id: I884c73e0d33045284224f439685a19990b1fcebc
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/30638
Tested-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
meta-agl-core/recipes-graphics/wayland/agl-compositor-init-pipewire.bb
meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor-stream-pipewire.service [new file with mode: 0644]

index d84475b..f1d7373 100644 (file)
@@ -4,17 +4,32 @@ SUMMARY = "Startup systemd unit for the AGL Wayland compositor with starting in
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
+inherit systemd
+
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 SRC_URI = "file://agl-compositor-pipewire.conf \
+           file://agl-compositor-stream-pipewire.service \
 "
 
 S = "${WORKDIR}"
 
+AGL_KVM_REMOTE_OUTPUT_IP ?= "172.16.10.3"
+AGL_KVM_REMOTE_OUTPUT_PORT ?= "5005"
+
 do_install() {
+    sed -i -e "s,@REMOTE_OUTPUT_IP@,${AGL_KVM_REMOTE_OUTPUT_IP},g" \
+       ${WORKDIR}/agl-compositor-stream-pipewire.service
+
+    sed -i -e "s,@REMOTE_OUTPUT_PORT@,${AGL_KVM_REMOTE_OUTPUT_PORT},g" \
+       ${WORKDIR}/agl-compositor-stream-pipewire.service
+
+    install -D -p -m0644 ${WORKDIR}/agl-compositor-stream-pipewire.service ${D}${systemd_system_unitdir}/agl-compositor-stream-pipewire.service
+
     install -d ${D}${systemd_system_unitdir}/agl-compositor.service.d
     install -m644 ${WORKDIR}/agl-compositor-pipewire.conf ${D}/${systemd_system_unitdir}/agl-compositor.service.d/02-agl-compositor.conf
 }
+
 FILES:${PN} += "\
     ${systemd_system_unitdir}/agl-compositor.service.d \
     ${systemd_system_unitdir}/agl-compositor.service.d/02-agl-compositor.conf \
@@ -23,3 +38,5 @@ FILES:${PN} += "\
 
 RDEPENDS:${PN} = "agl-compositor-init weston-ini"
 RCONFLICTS:${PN} = "weston-init"
+
+SYSTEMD_SERVICE:${PN} = "agl-compositor-stream-pipewire.service"
diff --git a/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor-stream-pipewire.service b/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor-stream-pipewire.service
new file mode 100644 (file)
index 0000000..949162c
--- /dev/null
@@ -0,0 +1,24 @@
+[Unit]
+Description=Stream PipeWire output created by AGL compositor
+
+Requires=agl-compositor.service
+After=agl-compositor.service
+
+Before=graphical.target
+ConditionPathExists=/usr/bin/agl-stream-pipewire-output
+
+[Service]
+Type=simple
+EnvironmentFile=-/etc/default/agl-stream-pipewire-output
+ExecStart=/usr/bin/agl-stream-pipewire-output @REMOTE_OUTPUT_IP@ @REMOTE_OUTPUT_PORT@
+
+User=agl-driver
+Group=agl-driver
+
+WorkingDirectory=/home/agl-driver
+
+StandardOutput=journal
+StandardError=journal
+
+[Install]
+WantedBy=graphical.target