From 18b99f9275cdb2473f52706c0d4d33636e8055c5 Mon Sep 17 00:00:00 2001 From: Fumiya Kohzu Date: Thu, 22 Jun 2023 20:17:58 +0900 Subject: Unified HMI: initial commit This is the initial commit for RVGPU of Unified HMI. `Unified HMI` is a common platform that promotes UX innovation in integrated cockpits and enables flexible information display from various applications across multiple displays. `RVGPU` is a client-server based rendering engine that creates 3D commands on a client device, sends them to a server for GPU rendering, and displays the results. - create new layer, meta-uhmi - create sub-layer, meta-rvgpu - add 1 feature to enable basesystem, agl-rvgpu Bug-AGL: SPEC-4744 Change-Id: I9b6f3966e3d5a859787f81c41b584fa686fd1f87 Signed-off-by: Fumiya Kohzu --- meta-uhmi/COPYING.MIT | 17 + meta-uhmi/README.md | 7 + meta-uhmi/meta-rvgpu/README.md | 131 ++++++ meta-uhmi/meta-rvgpu/conf/include/agl-rvgpu.inc | 5 + meta-uhmi/meta-rvgpu/conf/layer.conf | 17 + .../linux/linux-common/enable-virtio.cfg | 6 + .../linux/linux-raspberrypi_%.bbappend | 9 + .../recipes-kernel/linux/linux-renesas_%.bbappend | 1 + .../files/0001-Enable-using-python3.patch | 29 ++ .../0001-Use-wayland-scanner-in-the-path.patch | 37 ++ ...to-virtgpu-3d-transfer-to-host-linux-5-10.patch | 44 ++ ...to-virtgpu-3d-transfer-to-host-linux-5-15.patch | 47 ++ ...BufferData-Update-resource-backing-memory.patch | 91 ++++ ...x-missing-wayland-egl-backend-build-error.patch | 134 ++++++ .../mesa-virtio/mesa-virtio_18.2.0.bb | 66 +++ .../remote-virtio-gpu/remote-virtio-gpu.inc | 6 + .../0001-Remove-some-rvgpu-command-options.patch | 160 +++++++ ...d-agl-shell-desktop-and-xdg-shell-support.patch | 482 +++++++++++++++++++++ .../remote-virtio-gpu/remote-virtio-gpu_git.bb | 27 ++ .../recipes-graphics/wayland/weston_%.bbappend | 1 + .../recipes-graphics/wayland/weston_rvgpuproxy.inc | 7 + .../recipes-kernel/linux/linux-common/uinput.cfg | 2 + .../linux/linux-common/virtio-gpu.cfg | 1 + .../recipes-kernel/linux/linux-rvgpu.inc | 6 + .../recipes-kernel/linux/linux-yocto_%.bbappend | 1 + .../virtio-loopback-driver.inc | 6 + .../0001-Remove-card_index-option.patch | 70 +++ .../virtio-loopback-driver/Kbuild | 3 + .../virtio-loopback-driver/Makefile.driver | 17 + .../virtio-loopback-driver_git.bb | 41 ++ .../images/agl-demo-platform.bbappend | 1 + .../packagegroups/packagegroup-rvgpu.bb | 11 + 32 files changed, 1483 insertions(+) create mode 100644 meta-uhmi/COPYING.MIT create mode 100644 meta-uhmi/README.md create mode 100644 meta-uhmi/meta-rvgpu/README.md create mode 100644 meta-uhmi/meta-rvgpu/conf/include/agl-rvgpu.inc create mode 100644 meta-uhmi/meta-rvgpu/conf/layer.conf create mode 100644 meta-uhmi/meta-rvgpu/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-common/enable-virtio.cfg create mode 100644 meta-uhmi/meta-rvgpu/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend create mode 100644 meta-uhmi/meta-rvgpu/dynamic-layers/rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend create mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-Enable-using-python3.patch create mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-Use-wayland-scanner-in-the-path.patch create mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-add-stride-status-to-virtgpu-3d-transfer-to-host-linux-5-10.patch create mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-add-stride-status-to-virtgpu-3d-transfer-to-host-linux-5-15.patch create mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-glBufferData-Update-resource-backing-memory.patch create mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0002-mesa-virtio-Fix-missing-wayland-egl-backend-build-error.patch create mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/mesa-virtio_18.2.0.bb create mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu.inc create mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu/0001-Remove-some-rvgpu-command-options.patch create mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu/0002-Add-agl-shell-desktop-and-xdg-shell-support.patch create mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu_git.bb create mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/wayland/weston_%.bbappend create mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/wayland/weston_rvgpuproxy.inc create mode 100644 meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-common/uinput.cfg create mode 100644 meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-common/virtio-gpu.cfg create mode 100644 meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-rvgpu.inc create mode 100644 meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-yocto_%.bbappend create mode 100644 meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver.inc create mode 100644 meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/0001-Remove-card_index-option.patch create mode 100644 meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/Kbuild create mode 100644 meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/Makefile.driver create mode 100644 meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver_git.bb create mode 100644 meta-uhmi/meta-rvgpu/recipes-platform/images/agl-demo-platform.bbappend create mode 100644 meta-uhmi/meta-rvgpu/recipes-platform/packagegroups/packagegroup-rvgpu.bb (limited to 'meta-uhmi') diff --git a/meta-uhmi/COPYING.MIT b/meta-uhmi/COPYING.MIT new file mode 100644 index 00000000..fb950dc6 --- /dev/null +++ b/meta-uhmi/COPYING.MIT @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/meta-uhmi/README.md b/meta-uhmi/README.md new file mode 100644 index 00000000..d9a3ee04 --- /dev/null +++ b/meta-uhmi/README.md @@ -0,0 +1,7 @@ +## Unified HMI support layer (meta-uhmi) +"Unified HMI" is a common platform technology for UX innovation in integrated cockpit by flexible information display on multiple displays of various applications. Applications can be rendered to any display via a unified virtual display. + +## Remote Virtio GPU Device support layer(meta-rvgpu) +The RVGPU rendering engine, operating on a client-server model, creates 3D rendering commands on a client device and transmits them to a server device via the network, where the server-side device performs GPU-based rendering and displays the results. For build instructions and testing methods, Refer to the README.md file in the meta-rvgpu directory. +RVGPU is OSS. For more details, visit the following URL: +https://github.com/unified-hmi/remote-virtio-gpu diff --git a/meta-uhmi/meta-rvgpu/README.md b/meta-uhmi/meta-rvgpu/README.md new file mode 100644 index 00000000..64ed4c00 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/README.md @@ -0,0 +1,131 @@ +## Remote Virtio GPU Device support layer(meta-rvgpu) +The RVGPU rendering engine, operating on a client-server model, creates 3D rendering commands on a client device and transmits them to a server device via the network, where the server-side device performs GPU-based rendering and displays the results. The meta-rvgpu currently supports x86, Raspberry Pi 4, and Renesas Boards platforms. +RVGPU is OSS. For more details, visit the following URL: +https://github.com/unified-hmi/remote-virtio-gpu + +## How to build +Follow the [AGL documentation](https://docs.automotivelinux.org/en/master/#01_Getting_Started/02_Building_AGL_Image/01_Build_Process_Overview/) for the build process, and set up the "[Initializing Your Build Environment](https://docs.automotivelinux.org/en/master/#01_Getting_Started/02_Building_AGL_Image/04_Initializing_Your_Build_Environment/)" section as described below to enable the AGL feature 'agl-rvgpu'. For example: +``` +$ cd $AGL_TOP/master +$ source ./meta-agl/scripts/aglsetup.sh -m qemux86-64 -b qemux86-64 agl-demo agl-devel agl-rvgpu +``` +After adding the feature, execute the command: +``` +$ bitbake +``` +Replace the `` with the appropriate values you want. We have confirmed the operation with the **agl-demo-platform**. + +## How to setup and boot +For Environment setup instructions for each platform, refer to the following link in the AGL Documentation. +[Building for x86(Emulation and Hardware)](https://docs.automotivelinux.org/en/master/#01_Getting_Started/02_Building_AGL_Image/07_Building_for_x86_%28Emulation_and_Hardware%29/) +[Building for Raspberry Pi 4](https://docs.automotivelinux.org/en/master/#01_Getting_Started/02_Building_AGL_Image/08_Building_for_Raspberry_Pi_4/) +[Building for Supported Renesas Boards](https://docs.automotivelinux.org/en/master/#01_Getting_Started/02_Building_AGL_Image/09_Building_for_Supported_Renesas_Boards/) + +For Raspberry Pi 4 and Supported Renesas Boards, refer to the above URL for boot methods. +For x86 emulation (qemu), network bridge is required to enable communication with other devices when using RVGPU. Here’s an example procedure for your reference. +``` +$ sudo ip link add type bridge +$ sudo ip addr add dev +$ sudo ip link set dev master +$ sudo ip link set dev up +``` +Replace the placeholders with the appropriate values: +- ``: You can assign any name, for example: `br0` +- ``: Enter an available IP address, for example: `192.168.0.100/24` +- ``: Specify the network interface, for example: `eth0` + +To enable the use of the bridge, create or append /etc/qemu directory and /etc/qemu/bridge.conf file. +``` +allow +``` +Make sure /etc/qemu/ has 755 permissions. +Create the following bash file named **run_qemu_bridge.sh** in any ``. +``` +#!/bin/bash + +KERNEL_PATH=$1 +DRIVE_PATH=$2 +BRIDGE_NAME="" + +printf -v macaddr "52:54:%02x:%02x:%02x:%02x" $(( $RANDOM & 0xff)) $(( $RANDOM & 0xff )) $(( $RANDOM & 0xff)) $(( $RANDOM & 0xff )) + +qemu-system-x86_64 -enable-kvm -m 2048 \ + -kernel ${KERNEL_PATH} \ + -drive file=${DRIVE_PATH},if=virtio,format=raw \ + -cpu kvm64 -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt \ + -vga virtio -show-cursor \ + -device virtio-net-pci,netdev=net0,mac=$macaddr \ + -netdev bridge,br=$BRIDGE_NAME,id=net0 \ + -serial mon:stdio -serial null \ + -soundhw hda \ + -append 'root=/dev/vda rw console=ttyS0,115200n8 fstab=no' +``` +Save the file and run the following to start QEMU. +``` +sudo /run_qemu_bridge.sh /tmp/deploy/images/qemux86-64/bzImage /tmp/deploy/images/qemux86-64/agl-demo-platform-qemux86-64.ext4 +``` +When QEMU boot, assign an IP address. For example: +``` +ifconfig 192.168.0.10 netmask 255.255.255.0 +``` + +## How to run RVGPU remotely +Prepare two images, one as the Sender and the other as the Receiver. +It is necessary for the Sender and Receiver to be within the same network. + +**Receiver side** +``` +$ export XDG_RUNTIME_DIR=/run/user/ +$ rvgpu-renderer -b 1080x1500@0,0 -p & +``` +Replace the placeholders with the appropriate values: +- ``: Specify according to your environment, for example:1001 +- ``: Enter an available port number, for example: 55555 + +**Sender side** +Create the following shell script **run_remote_app.sh** in any `` for a smooth experience. +``` +#!/bin/bash + +mkdir -p /run/user/ +export XDG_RUNTIME_DIR=/run/user/ +export LD_LIBRARY_PATH=/usr/lib/mesa-virtio + +# ------------- +# launch app +# ------------- +$@ +``` +Replace the placeholders with the appropriate values: +- ``: You can assign any UID, for example: 0 + +Save the file and run the following to start weston. + +``` +$ rvgpu-proxy -s 1080x1500@0,0 -n : & +$ /run_remote_app.sh weston --backend drm-backend.so -Swayland-0 --seat=seat_virtual -i 0 & +``` +Replace the placeholders with the appropriate values: +- ``: Port set in the renderer. + +After completing these steps, the Weston screen from the Sender will be transferred and displayed on the Receiver using rvgpu-proxy and rvgpu-renderer. You can verify that everything is functioning properly by launching wayland applications on the Sender side, such as: +``` +$ /run_remote_app.sh weston-simple-egl -f +``` + +You can also verify the touch or keyboard operation support of the RVGPU by using app such as +``` +$ /run_remote_app.sh weston-smoke +$ /run_remote_app.sh weston-editor +``` +**Note**: There are known issues with mouse, such as the cursor becoming invisible and occasional flickering of a green screen. + +**Appendix**: +- You can freely change the display position of the transferred surface in rvgpu-renderer by w option, such as + ``` + rvgpu-renderer -b 1080x1500@0,0 -p -w , + ``` + The coordinates `, = 0,0` represent the top-left corner, and the default position is `0,250`. + +- By building the RVGPU on Ubuntu, it is possible to enable bidirectional remote rendering between the agl-demo-platform and Ubuntu. + For the build procedure on Ubuntu, see the following URL: https://github.com/unified-hmi/remote-virtio-gpu diff --git a/meta-uhmi/meta-rvgpu/conf/include/agl-rvgpu.inc b/meta-uhmi/meta-rvgpu/conf/include/agl-rvgpu.inc new file mode 100644 index 00000000..3fd99823 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/conf/include/agl-rvgpu.inc @@ -0,0 +1,5 @@ +# As of now, we'd unconditionally append agl-rvgpu-proxy +# to all images belong to agl-rvgpu feature. In future +# it will be handled properly via multiconfig etc. + +AGL_FEATURES:append = " agl-rvgpu-proxy" diff --git a/meta-uhmi/meta-rvgpu/conf/layer.conf b/meta-uhmi/meta-rvgpu/conf/layer.conf new file mode 100644 index 00000000..b33aa324 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/conf/layer.conf @@ -0,0 +1,17 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have recipes-* directories, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "meta-rvgpu" +BBFILE_PATTERN_meta-rvgpu = "^${LAYERDIR}/" +BBFILE_PRIORITY_meta-rvgpu = "8" + +BBFILES_DYNAMIC += " \ + rcar-gen3:${LAYERDIR}/dynamic-layers/rcar-gen3/*/*/*.bbappend \ + raspberrypi:${LAYERDIR}/dynamic-layers/raspberrypi/*/*/*.bbappend \ +" + +LAYERSERIES_COMPAT_meta-rvgpu= "kirkstone" diff --git a/meta-uhmi/meta-rvgpu/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-common/enable-virtio.cfg b/meta-uhmi/meta-rvgpu/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-common/enable-virtio.cfg new file mode 100644 index 00000000..82ff9ea1 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-common/enable-virtio.cfg @@ -0,0 +1,6 @@ +CONFIG_VIRTIO=y +CONFIG_VIRTIO_MMIO=y +CONFIG_VIRTIO_BLK=y +CONFIG_VIRTIO_BLK_SCSI=y +CONFIG_VIRTIO_PCI=y +CONFIG_VIRTIO_PCI_LEGACY=y diff --git a/meta-uhmi/meta-rvgpu/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend b/meta-uhmi/meta-rvgpu/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend new file mode 100644 index 00000000..d093e40f --- /dev/null +++ b/meta-uhmi/meta-rvgpu/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend @@ -0,0 +1,9 @@ +require recipes-kernel/linux/linux-rvgpu.inc + +FILESEXTRAPATHS:prepend := "${THISDIR}/linux-common/:" + +SRC_URI:append = " \ + file://enable-virtio.cfg \ +" + +KERNEL_MODULE_AUTOLOAD:append = " virtio-gpu" diff --git a/meta-uhmi/meta-rvgpu/dynamic-layers/rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend b/meta-uhmi/meta-rvgpu/dynamic-layers/rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend new file mode 100644 index 00000000..1b238eea --- /dev/null +++ b/meta-uhmi/meta-rvgpu/dynamic-layers/rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend @@ -0,0 +1 @@ +require recipes-kernel/linux/linux-rvgpu.inc diff --git a/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-Enable-using-python3.patch b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-Enable-using-python3.patch new file mode 100644 index 00000000..30be886a --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-Enable-using-python3.patch @@ -0,0 +1,29 @@ +From b5aedd7844195a3ddae70f02de503636097a8ddb Mon Sep 17 00:00:00 2001 +From: Seimizu Joukan +Date: Fri, 20 Aug 2021 15:56:37 +0900 +Subject: [PATCH] Enable using python3 + +Python2 is not supported anymore since Yocto dunfell, +but mesa-18.2.0 depends on python2. + +Upstream-Status: Inappropriate [embedded specific] +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 42e1582..8c591ce 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -124,7 +124,7 @@ AC_PROG_GREP + AC_PROG_NM + AM_PROG_AS + AX_CHECK_GNU_MAKE +-AC_CHECK_PROGS([PYTHON2], [python2.7 python2 python]) ++AC_CHECK_PROGS([PYTHON2], [python3 python2 python]) + AC_PROG_SED + AC_PROG_MKDIR_P + +-- +2.17.1 + diff --git a/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-Use-wayland-scanner-in-the-path.patch b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-Use-wayland-scanner-in-the-path.patch new file mode 100644 index 00000000..b598cd47 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-Use-wayland-scanner-in-the-path.patch @@ -0,0 +1,37 @@ +From 30da85819c26bb159fd2a6aaa2963f9332bda8d5 Mon Sep 17 00:00:00 2001 +From: Jussi Kukkonen +Date: Mon, 20 May 2019 14:50:19 +0300 +Subject: [PATCH] Simplify wayland-scanner lookup + +Don't use pkg-config to lookup the path of a binary that's in the path. + +Alternatively we'd have to prefix the path returned by pkg-config with +PKG_CONFIG_SYSROOT_DIR. + +Upstream-Status: Pending +Signed-off-by: Jussi Kukkonen +--- + configure.ac | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/configure.ac b/configure.ac +index aa64c99..97070b8 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1823,12 +1823,7 @@ for plat in $platforms; do + fi + WAYLAND_PROTOCOLS_DATADIR=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols` + +- PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland-scanner], +- WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`, +- WAYLAND_SCANNER='') +- if test "x$WAYLAND_SCANNER" = x; then +- AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner], [:]) +- fi ++ AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner], [:]) + + if test "x$WAYLAND_SCANNER" = "x:"; then + AC_MSG_ERROR([wayland-scanner is needed to compile the wayland platform]) +-- +2.7.4 + diff --git a/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-add-stride-status-to-virtgpu-3d-transfer-to-host-linux-5-10.patch b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-add-stride-status-to-virtgpu-3d-transfer-to-host-linux-5-10.patch new file mode 100644 index 00000000..ccf08333 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-add-stride-status-to-virtgpu-3d-transfer-to-host-linux-5-10.patch @@ -0,0 +1,44 @@ +From 1301cdf196f7d27dc23cbd3de1b188369a66dc26 Mon Sep 17 00:00:00 2001 +From: "matsui.tetsuo" +Date: Tue, 10 Dec 2019 10:45:33 +0900 +Subject: [PATCH] Add stride status to virtgpu_3d_transfer_to_host + +The gallium driver in mesa-18.2.0 does not support kernel-5.10 stride +variable definitions. We are currently working on an update to mesa, +but currently need to use mesa-18.2.0, so the stride variable needs +to be defined. + +Upstream-Status: Inappropriate [embedded specific] +--- + src/gallium/winsys/virgl/drm/virgl_drm_winsys.c | 2 +- + src/gallium/winsys/virgl/drm/virtgpu_drm.h | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c +index 7f542e7..06a28c1 100644 +--- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c ++++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c +@@ -266,7 +266,7 @@ virgl_bo_transfer_put(struct virgl_winsys *vws, + tohostcmd.box.d = box->depth; + tohostcmd.offset = buf_offset; + tohostcmd.level = level; +- // tohostcmd.stride = stride; ++ tohostcmd.stride = stride; + // tohostcmd.layer_stride = stride; + return drmIoctl(vdws->fd, DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST, &tohostcmd); + } +diff --git a/src/gallium/winsys/virgl/drm/virtgpu_drm.h b/src/gallium/winsys/virgl/drm/virtgpu_drm.h +index 30bc3af..1b99a6b 100644 +--- a/src/gallium/winsys/virgl/drm/virtgpu_drm.h ++++ b/src/gallium/winsys/virgl/drm/virtgpu_drm.h +@@ -102,6 +102,7 @@ struct drm_virtgpu_3d_transfer_to_host { + struct drm_virtgpu_3d_box box; + uint32_t level; + uint32_t offset; ++ uint32_t stride; + }; + + struct drm_virtgpu_3d_transfer_from_host { +-- +2.7.4 + diff --git a/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-add-stride-status-to-virtgpu-3d-transfer-to-host-linux-5-15.patch b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-add-stride-status-to-virtgpu-3d-transfer-to-host-linux-5-15.patch new file mode 100644 index 00000000..0456841f --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-add-stride-status-to-virtgpu-3d-transfer-to-host-linux-5-15.patch @@ -0,0 +1,47 @@ +From 6e2991baaccfae69721c47e8c533522cfa99c490 Mon Sep 17 00:00:00 2001 +From: murakami +Date: Tue, 28 Mar 2023 14:20:34 +0900 +Subject: [PATCH] Add stride status to virtgpu 3d transfer to host + +The gallium driver in mesa-18.2.0 does not support kernel-5.15 stride +variable definitions. We are currently working on an update to mesa, +but currently need to use mesa-18.2.0, so the stride variable needs +to be defined. + +Upstream-Status: Inappropriate [embedded specific] +--- + src/gallium/winsys/virgl/drm/virgl_drm_winsys.c | 4 ++-- + src/gallium/winsys/virgl/drm/virtgpu_drm.h | 2 ++ + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c +index 3bb637e..0f859c3 100644 +--- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c ++++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c +@@ -266,8 +266,8 @@ virgl_bo_transfer_put(struct virgl_winsys *vws, + tohostcmd.box.d = box->depth; + tohostcmd.offset = buf_offset; + tohostcmd.level = level; +- // tohostcmd.stride = stride; +- // tohostcmd.layer_stride = stride; ++ tohostcmd.stride = 0; ++ tohostcmd.layer_stride = 0; + return drmIoctl(vdws->fd, DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST, &tohostcmd); + } + +diff --git a/src/gallium/winsys/virgl/drm/virtgpu_drm.h b/src/gallium/winsys/virgl/drm/virtgpu_drm.h +index 028e78c..307bbbd 100644 +--- a/src/gallium/winsys/virgl/drm/virtgpu_drm.h ++++ b/src/gallium/winsys/virgl/drm/virtgpu_drm.h +@@ -108,6 +108,8 @@ struct drm_virtgpu_3d_transfer_to_host { + struct drm_virtgpu_3d_box box; + uint32_t level; + uint32_t offset; ++ uint32_t stride; ++ uint32_t layer_stride; + }; + + struct drm_virtgpu_3d_transfer_from_host { +-- +2.17.1 + diff --git a/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-glBufferData-Update-resource-backing-memory.patch b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-glBufferData-Update-resource-backing-memory.patch new file mode 100644 index 00000000..f146c54f --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0001-glBufferData-Update-resource-backing-memory.patch @@ -0,0 +1,91 @@ +From 6e23c8970762309d3f2b88f252333b2492aacd28 Mon Sep 17 00:00:00 2001 +From: Andrii Pauk +Date: Sat, 27 Feb 2021 17:42:00 +0200 +Subject: [PATCH] glBufferData: Update resource backing memory. + +Update buffer backing memory on buffer initialization with data. +This is workaround for UHMI project, where +VIRTIO_GPU_CMD_TRANSFER_FROM_HOST_3D command is not implemented. + +The problem is in the following use-case: +1) glBufferData --- reserves guest memory "backing" for resource, +but doesn't fill it with data. Instead, data is serialized into +virgl internal command and sent using VIRTIO_GPU_CMD_SUBMIT_3D +comand. This command is opaque for rproxy/rvdds and serialized cmd buffer +is just forwarded to virglrenderer, where it is deserialized and +used for initialization of internal "gpu" memory with this data. +2) glMapBuffer --- this calls TRANSFER_FROM_HOST_3D, which asks host/rproxy--> +rvdds/virglrenderer to update backing memory (on source) with buffer data. +And further this backing memory is mapped to guest application. +In case of UHMI, TRANSFER_FROM_HOST_3D is not implemented, thus the memory is +not "initialized". +3) Modify buffer memory, but not whole memory, just some chunks. +4) glUnmapBuffer --- this will trigger VIRTIO_GPU_CMD_TRANSFER_TO_HOST_3D +command, which will send to target whole buffer memory and will overwrite +previous memory. It's ok for modified in step 3 memory, but other is +just garbage (I always saw zero filled memory). + +The above scenario produces artifacts on buffer-scene of glmark, in case of +"update-method=map", which forces glmark to use 1-4 flow. + +As a workaround, fill buffer backing memory with data on step 1. + +Issue: EXDCLXXII-420 + +Upstream-Status: Pending +--- + src/gallium/auxiliary/util/u_inlines.h | 21 +++++++++++++++++++++ + src/mesa/state_tracker/st_cb_bufferobjects.c | 4 +++- + 2 files changed, 24 insertions(+), 1 deletion(-) + +diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h +index dee6f8f..4745f7b 100644 +--- a/src/gallium/auxiliary/util/u_inlines.h ++++ b/src/gallium/auxiliary/util/u_inlines.h +@@ -462,6 +462,27 @@ pipe_buffer_read(struct pipe_context *pipe, + pipe_buffer_unmap(pipe, src_transfer); + } + ++static inline void ++pipe_buffer_update_backing(struct pipe_context *pipe, ++ struct pipe_resource *buf, ++ unsigned offset, ++ unsigned size, ++ void *data) ++{ ++ struct pipe_transfer *src_transfer; ++ ubyte *map; ++ ++ map = (ubyte *) pipe_buffer_map_range(pipe, ++ buf, ++ offset, size, ++ PIPE_TRANSFER_WRITE, ++ &src_transfer); ++ if (!map) ++ return; ++ ++ memcpy(map, data, size); ++ pipe_buffer_unmap(pipe, src_transfer); ++} + + /** + * Map a resource for reading/writing. +diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c +index 5ebe94f..cb33c8c 100644 +--- a/src/mesa/state_tracker/st_cb_bufferobjects.c ++++ b/src/mesa/state_tracker/st_cb_bufferobjects.c +@@ -343,8 +343,10 @@ bufferobj_data(struct gl_context *ctx, + else { + st_obj->buffer = screen->resource_create(screen, &buffer); + +- if (st_obj->buffer && data) ++ if (st_obj->buffer && data) { + pipe_buffer_write(pipe, st_obj->buffer, 0, size, data); ++ pipe_buffer_update_backing(pipe, st_obj->buffer, 0, size, data); ++ } + } + + if (!st_obj->buffer) { +-- +2.7.4 + diff --git a/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0002-mesa-virtio-Fix-missing-wayland-egl-backend-build-error.patch b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0002-mesa-virtio-Fix-missing-wayland-egl-backend-build-error.patch new file mode 100644 index 00000000..af2e8c36 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/files/0002-mesa-virtio-Fix-missing-wayland-egl-backend-build-error.patch @@ -0,0 +1,134 @@ +From d676753e3089c5bccb73750fba0f14d287f8add9 Mon Sep 17 00:00:00 2001 +From: Ihor Korynkevych +Date: Mon, 20 May 2019 15:44:30 +0300 +Subject: [PATCH] mesa-virtio: Fix missing wayland-egl-backend build error. + +From the mesa 18.2.8 release notes: libwayland-egl is now distributed by Wayland +(since 1.15, see announcement), and has been removed from Mesa in this release. + +Add back the wayland-egl-backend header file not to break the build. + +Issue: EXDCLXXII-59 + +Upstream-Status: Pending + +Signed-off-by: Ihor Korynkevych +--- + configure.ac | 4 -- + src/egl/Makefile.am | 3 + + src/egl/wayland/wayland-egl/wayland-egl-backend.h | 67 +++++++++++++++++++++++ + 3 files changed, 70 insertions(+), 4 deletions(-) + create mode 100644 src/egl/wayland/wayland-egl/wayland-egl-backend.h + +diff --git a/configure.ac b/configure.ac +index 97070b8..afc81e6 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -90,7 +90,6 @@ LIBOMXIL_TIZONIA_REQUIRED=0.10.0 + LIBVA_REQUIRED=0.39.0 + VDPAU_REQUIRED=1.1 + WAYLAND_REQUIRED=1.11 +-WAYLAND_EGL_BACKEND_REQUIRED=3 + WAYLAND_PROTOCOLS_REQUIRED=1.8 + XCB_REQUIRED=1.9.3 + XCBDRI2_REQUIRED=1.8 +@@ -1818,9 +1817,6 @@ for plat in $platforms; do + PKG_CHECK_MODULES([WAYLAND_CLIENT], [wayland-client >= $WAYLAND_REQUIRED]) + PKG_CHECK_MODULES([WAYLAND_SERVER], [wayland-server >= $WAYLAND_REQUIRED]) + PKG_CHECK_MODULES([WAYLAND_PROTOCOLS], [wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED]) +- if test "x$enable_egl" = xyes; then +- PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl-backend >= $WAYLAND_EGL_BACKEND_REQUIRED]) +- fi + WAYLAND_PROTOCOLS_DATADIR=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols` + + AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner], [:]) +diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am +index b43805d..0fcc24a 100644 +--- a/src/egl/Makefile.am ++++ b/src/egl/Makefile.am +@@ -123,6 +123,9 @@ AM_CFLAGS += \ + -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \ + -D_EGL_BUILT_IN_DRIVER_DRI2 + ++AM_CFLAGS += \ ++ -I$(top_srcdir)/src/egl/wayland/wayland-egl ++ + nodist_libEGL_common_la_SOURCES = \ + $(dri2_backend_GENERATED_FILES) + +diff --git a/src/egl/wayland/wayland-egl/wayland-egl-backend.h b/src/egl/wayland/wayland-egl/wayland-egl-backend.h +new file mode 100644 +index 0000000..869c86f +--- /dev/null ++++ b/src/egl/wayland/wayland-egl/wayland-egl-backend.h +@@ -0,0 +1,67 @@ ++/* ++ * Copyright © 2011 Benjamin Franzke ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice (including the next ++ * paragraph) shall be included in all copies or substantial portions of the ++ * Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ++ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ++ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ++ * DEALINGS IN THE SOFTWARE. ++ * ++ * Authors: ++ * Benjamin Franzke ++ */ ++ ++#ifndef _WAYLAND_EGL_PRIV_H ++#define _WAYLAND_EGL_PRIV_H ++ ++#include ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/* ++ * NOTE: This version must be kept in sync with the Version field in the ++ * wayland-egl-backend.pc.in file. ++ */ ++#define WL_EGL_WINDOW_VERSION 3 ++ ++struct wl_surface; ++ ++struct wl_egl_window { ++ const intptr_t version; ++ ++ int width; ++ int height; ++ int dx; ++ int dy; ++ ++ int attached_width; ++ int attached_height; ++ ++ void *driver_private; ++ void (*resize_callback)(struct wl_egl_window *, void *); ++ void (*destroy_window_callback)(void *); ++ ++ struct wl_surface *surface; ++}; ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif +-- +2.7.4 + diff --git a/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/mesa-virtio_18.2.0.bb b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/mesa-virtio_18.2.0.bb new file mode 100644 index 00000000..8e4c96b5 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-graphics/mesa-virtio/mesa-virtio_18.2.0.bb @@ -0,0 +1,66 @@ +# This recipe temporarily install mesa-18.2.0 as mesa-virtio to run remote-virtio-gpu. +# The mesa-virtio will be removed after remote-virtio-gpu supports upstream mesa. + +SUMMARY = "Mesa library" +SECTION = "graphics" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://docs/license.html;md5=725f991a1cc322aa7a0cd3a2016621c4" + +DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native" +DEPENDS:append = " libdrm wayland wayland-native wayland-protocols python3-native" + +RDEPENDS:${PN}:append = " libgcc wayland libdrm glibc libstdc++ zlib expat" + +LINUX_MAJOR = "${@(d.getVar('PREFERRED_VERSION_linux-yocto') or "x.y").split('.')[0]}" +LINUX_MINOR = "${@(d.getVar('PREFERRED_VERSION_linux-yocto') or "x.y").split('.')[1].split('%')[0]}" + +SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \ + file://0001-glBufferData-Update-resource-backing-memory.patch \ + file://0001-Use-wayland-scanner-in-the-path.patch \ + file://0002-mesa-virtio-Fix-missing-wayland-egl-backend-build-error.patch \ + file://0001-add-stride-status-to-virtgpu-3d-transfer-to-host-linux-${LINUX_MAJOR}-${LINUX_MINOR}.patch \ + file://0001-Enable-using-python3.patch \ +" + +SRC_URI[md5sum] = "88e1a7f31f259cec69bb76b3cb10c956" +SRC_URI[sha256sum] = "22452bdffff8e11bf4284278155a9f77cb28d6d73a12c507f1490732d0d9ddce" + +S = "${WORKDIR}/mesa-${PV}" + +inherit autotools pkgconfig gettext + +EXTRA_OEMAKE += "WAYLAND_PROTOCOLS_DATADIR=${STAGING_DATADIR}/wayland-protocols" + +EXTRA_OECONF = " \ + --prefix=/usr/lib/mesa-virtio \ + --exec_prefix=/usr/lib/mesa-virtio \ + --libdir=/usr/lib/mesa-virtio \ + --includedir=/usr/include/mesa-virtio \ + --sysconfdir=/etc/mesa-virtio \ + --datadir=/usr/share/mesa-virtio \ +" + +EXTRA_OECONF:append = " \ + --with-dri-drivers=swrast \ + --with-gallium-drivers=swrast,virgl \ + --with-platforms=drm,wayland \ + --disable-glx \ + --disable-dri3 \ +" + +EXCLUDE_FROM_SHLIBS = "1" + +FILES:${PN} = " \ + /usr/lib/mesa-virtio/* \ + /etc/mesa-virtio/drirc \ + /usr/share/mesa-virtio/* \ +" + +FILES:${PN}-dev += " \ + /usr/lib/mesa-virtio/libglapi.so \ + /usr/lib/mesa-virtio/libEGL.so \ + /usr/lib/mesa-virtio/libgbm.so \ + /usr/lib/mesa-virtio/libGLESv2.so \ + /usr/lib/mesa-virtio/libGLESv1_CM.so \ +" diff --git a/meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu.inc b/meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu.inc new file mode 100644 index 00000000..4a8e5357 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu.inc @@ -0,0 +1,6 @@ +PV = "0.0+git${SRCPV}" +SRCREV = "4b1f508003a7bf36256d5cc81986ef733e4cc79b" +BRANCH ?= "main" +SRC_URI = " \ + git://github.com/unified-hmi/remote-virtio-gpu.git;protocol=https;branch=${BRANCH} \ +" diff --git a/meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu/0001-Remove-some-rvgpu-command-options.patch b/meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu/0001-Remove-some-rvgpu-command-options.patch new file mode 100644 index 00000000..4548c53f --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu/0001-Remove-some-rvgpu-command-options.patch @@ -0,0 +1,160 @@ +From 0fc1cf03f76d21cec5b859ff46bee146cd4e52f7 Mon Sep 17 00:00:00 2001 +From: murakami +Date: Fri, 28 Jul 2023 12:09:35 +0900 +Subject: [PATCH 1/2] Remove some rvgpu command options + +Remove vsync and card_index option supports from remote-virtio-gpu, +because the kernel needs to be patched to run those options in +rvgpu-proxy and rvgpu-renderer. + +Upstream-Status: Inappropriate [embedded specific] +--- + include/rvgpu-proxy/gpu/rvgpu-gpu-device.h | 1 - + src/rvgpu-proxy/gpu/rvgpu-gpu-device.c | 3 --- + src/rvgpu-proxy/rvgpu-proxy.c | 27 ++-------------------- + src/rvgpu-renderer/rvgpu-renderer.c | 10 +++----- + 4 files changed, 5 insertions(+), 36 deletions(-) + +diff --git a/include/rvgpu-proxy/gpu/rvgpu-gpu-device.h b/include/rvgpu-proxy/gpu/rvgpu-gpu-device.h +index eb34b6a..76d747a 100644 +--- a/include/rvgpu-proxy/gpu/rvgpu-gpu-device.h ++++ b/include/rvgpu-proxy/gpu/rvgpu-gpu-device.h +@@ -35,7 +35,6 @@ struct gpu_device; + + struct gpu_device_params { + bool split_resources; +- int card_index; + unsigned int num_scanouts; + unsigned int mem_limit; + unsigned long framerate; +diff --git a/src/rvgpu-proxy/gpu/rvgpu-gpu-device.c b/src/rvgpu-proxy/gpu/rvgpu-gpu-device.c +index 947e81a..71f62ca 100644 +--- a/src/rvgpu-proxy/gpu/rvgpu-gpu-device.c ++++ b/src/rvgpu-proxy/gpu/rvgpu-gpu-device.c +@@ -528,7 +528,6 @@ struct gpu_device *gpu_device_init(int lo_fd, int efd, uint32_t cidx, + if (capset != -1) + gpu_capset_init(g, capset); + +- info.card_index = params->card_index; + info.config = (__u8 *)&g->config; + info.config_kick = g->config_fd; + +@@ -939,8 +938,6 @@ static void gpu_device_trigger_vsync(struct gpu_device *g, + return; + + hdr->flags |= VIRTIO_GPU_FLAG_VSYNC; +- /* use padding bytes to pass scanout_id to virtio-gpu driver */ +- hdr->padding = g->scan_id; + add_resp(g, hdr, req); + + if ((!vsync_ts.tv_sec) && (!vsync_ts.tv_nsec)) { +diff --git a/src/rvgpu-proxy/rvgpu-proxy.c b/src/rvgpu-proxy/rvgpu-proxy.c +index 6ff4e19..d082b72 100644 +--- a/src/rvgpu-proxy/rvgpu-proxy.c ++++ b/src/rvgpu-proxy/rvgpu-proxy.c +@@ -47,7 +47,6 @@ static void usage(void) + info("\t-s scanout\tspecify scanout in form WxH@X,Y (default: %ux%u@0,0)\n", + DEFAULT_WIDTH, DEFAULT_HEIGHT); + info("\t-f rate\t\tspecify virtual framerate (default: disabled)\n"); +- info("\t-i index\tspecify index 'n' for device /dev/dri/card\n"); + info("\t-n\t\tserver:port for connecting (max 4 hosts, default: %s:%s)\n", + RVGPU_DEFAULT_HOSTNAME, RVGPU_DEFAULT_PORT); + info("\t-h\t\tshow this message\n"); +@@ -79,7 +78,6 @@ int main(int argc, char **argv) + struct gpu_device_params params = { + .framerate = 0u, + .mem_limit = VMEM_DEFAULT_MB, +- .card_index = -1, + .num_scanouts = 0u, + .dpys = { { .r = { .x = 0, + .y = 0, +@@ -97,38 +95,17 @@ int main(int argc, char **argv) + }; + + pthread_t input_thread; +- char path[64]; + FILE *oomFile; +- int lo_fd, epoll_fd, res, opt, capset = -1; ++ int lo_fd, epoll_fd, opt, capset = -1; + char *ip, *port, *errstr = NULL; + +- while ((opt = getopt(argc, argv, "hi:n:M:c:R:f:s:")) != -1) { ++ while ((opt = getopt(argc, argv, "h:n:M:c:R:f:s:")) != -1) { + switch (opt) { + case 'c': + capset = open(optarg, O_RDONLY); + if (capset == -1) + err(1, "open %s", optarg); + break; +- case 'i': +- params.card_index = +- (int)sanity_strtonum(optarg, CARD_INDEX_MIN, +- CARD_INDEX_MAX - 1, +- &errstr); +- if (errstr != NULL) { +- warnx("Card index should be in [%u..%u]\n", +- CARD_INDEX_MIN, CARD_INDEX_MAX - 1); +- errx(1, "Invalid card index %s:%s", optarg, +- errstr); +- } +- +- snprintf(path, sizeof(path), "/dev/dri/card%d", +- params.card_index); +- res = access(path, F_OK); +- if (res == 0) +- errx(1, "device %s exists", path); +- else if (errno != ENOENT) +- err(1, "error while checking device %s", path); +- break; + case 'M': + params.mem_limit = (unsigned int)sanity_strtonum( + optarg, VMEM_MIN_MB, VMEM_MAX_MB, &errstr); +diff --git a/src/rvgpu-renderer/rvgpu-renderer.c b/src/rvgpu-renderer/rvgpu-renderer.c +index 7166fb9..3e74289 100644 +--- a/src/rvgpu-renderer/rvgpu-renderer.c ++++ b/src/rvgpu-renderer/rvgpu-renderer.c +@@ -52,7 +52,6 @@ static void usage(void) + info("\t-f\t\tRun in fullscreen mode\n"); + info("\t-p port\t\tport for listening (default: %u)\n", + RVGPU_DEFAULT_PORT); +- info("\t-v\t\tRun in vsync mode (eglSwapInterval 1)\n"); + info("\t-h\t\tShow this message\n"); + + info("\nNote:\n"); +@@ -185,12 +184,12 @@ int main(int argc, char **argv) + unsigned int res_id, scanout; + uint16_t port_nr = RVGPU_DEFAULT_PORT; + FILE *input_stream = stdout; +- bool fullscreen = false, vsync = false, translucent = false, ++ bool fullscreen = false, translucent = false, + user_specified_scanouts = false; + + memset(sp, 0, sizeof(sp)); + +- while ((opt = getopt(argc, argv, "afhvi:c:s:S:b:B:p:g:")) != -1) { ++ while ((opt = getopt(argc, argv, "afhi:c:s:S:b:B:p:g:")) != -1) { + switch (opt) { + case 'a': + translucent = true; +@@ -269,9 +268,6 @@ int main(int argc, char **argv) + errstr); + } + break; +- case 'v': +- vsync = true; +- break; + case 'h': + usage(); + exit(EXIT_SUCCESS); +@@ -309,7 +305,7 @@ int main(int argc, char **argv) + } + + while ((res_id = rvgpu_pr_dispatch(pr))) { +- rvgpu_egl_drawall(egl, res_id, vsync); ++ rvgpu_egl_drawall(egl, res_id, false); + } + + if (pp.capset) +-- +2.17.1 + diff --git a/meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu/0002-Add-agl-shell-desktop-and-xdg-shell-support.patch b/meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu/0002-Add-agl-shell-desktop-and-xdg-shell-support.patch new file mode 100644 index 00000000..db5a6922 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu/0002-Add-agl-shell-desktop-and-xdg-shell-support.patch @@ -0,0 +1,482 @@ +From b60e0a361d29723643fe81b47bff8f86d5200258 Mon Sep 17 00:00:00 2001 +From: Kenta +Date: Wed, 6 Sep 2023 18:44:22 +0900 +Subject: [PATCH] Add agl-shell-desktop and xdg-shell supports + +--- + CMakeLists.txt | 25 +++ + include/rvgpu-renderer/renderer/rvgpu-egl.h | 9 +- + src/rvgpu-renderer/CMakeLists.txt | 3 + + src/rvgpu-renderer/backend/rvgpu-gbm.c | 2 + + src/rvgpu-renderer/backend/rvgpu-wayland.c | 192 +++++++++++++++++--- + src/rvgpu-renderer/renderer/rvgpu-egl.c | 3 + + src/rvgpu-renderer/rvgpu-renderer.c | 11 +- + 7 files changed, 220 insertions(+), 25 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f569ca2..85c875a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -20,6 +20,31 @@ cmake_minimum_required(VERSION 3.2) + project(rvgpu C) + set(CMAKE_C_STANDARD 11) + ++find_program(WAYLAND_SCANNER_EXECUTABLE wayland-scanner) ++ ++message("generating agl-shell-desktop client files from: agl-shell-desktop.xml") ++ ++execute_process ( COMMAND mkdir ${CMAKE_BINARY_DIR}/protocol) ++ ++execute_process ( COMMAND ${WAYLAND_SCANNER_EXECUTABLE} private-code ++ ${CMAKE_SYSROOT}/usr/share/agl-compositor/protocols/agl-shell-desktop.xml ++ ${CMAKE_BINARY_DIR}/protocol/agl-shell-desktop-protocol.c) ++ ++execute_process ( COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header ++ ${CMAKE_SYSROOT}/usr/share/agl-compositor/protocols/agl-shell-desktop.xml ++ ${CMAKE_BINARY_DIR}/protocol/agl-shell-desktop-protocol.h) ++ ++message("generating agl-shell-desktop client files from: xdg-shell.xml") ++ ++execute_process ( COMMAND ${WAYLAND_SCANNER_EXECUTABLE} private-code ++ ${CMAKE_SYSROOT}/usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml ++ ${CMAKE_BINARY_DIR}/protocol/xdg-shell-protocol.c) ++ ++execute_process ( COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header ++ ${CMAKE_SYSROOT}/usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml ++ ${CMAKE_BINARY_DIR}/protocol/xdg-shell-protocol.h) ++ ++ + if (CMAKE_SYSROOT AND NOT ENV{PKG_CONFIG_LIBDIR}) + set(ENV{PKG_CONFIG_DIR} "") + set(ENV{PKG_CONFIG_LIBDIR} "${CMAKE_SYSROOT}/usr/lib/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig") +diff --git a/include/rvgpu-renderer/renderer/rvgpu-egl.h b/include/rvgpu-renderer/renderer/rvgpu-egl.h +index ebd2bd2..dcff36a 100644 +--- a/include/rvgpu-renderer/renderer/rvgpu-egl.h ++++ b/include/rvgpu-renderer/renderer/rvgpu-egl.h +@@ -59,6 +59,9 @@ struct rvgpu_scanout_params { + uint32_t id; /**< ID for scanout window (i.e. IVI id)*/ + bool enabled; /**< enable/disable scanout */ + bool boxed; /**< box is set by user */ ++ struct rvgpu_box agl_win; /** Window position & limit on AGL */ ++ bool agl_win_set; ++ + }; + + struct rvgpu_scanout { +@@ -118,6 +121,8 @@ struct rvgpu_egl_state { + bool spawn_support; + + bool use_scissors; ++ ++ bool user_specified_scanouts; + }; + + /** Initialize main context */ +@@ -150,11 +155,11 @@ void rvgpu_egl_destroy_scanout(struct rvgpu_egl_state *e, + + /** Draw Virgl output on the surface */ + void rvgpu_egl_draw(struct rvgpu_egl_state *e, struct rvgpu_scanout *s, +- bool vsync); ++ bool vsync); + + /** Redraw all scanouts with given resource id */ + void rvgpu_egl_drawall(struct rvgpu_egl_state *e, unsigned int res_id, +- bool vsync); ++ bool vsync); + + /* Async event handling */ + /** Call before polling */ +diff --git a/src/rvgpu-renderer/CMakeLists.txt b/src/rvgpu-renderer/CMakeLists.txt +index dc5f5b0..c8a8c34 100644 +--- a/src/rvgpu-renderer/CMakeLists.txt ++++ b/src/rvgpu-renderer/CMakeLists.txt +@@ -17,6 +17,8 @@ + + + add_executable(rvgpu-renderer ++ ${CMAKE_BINARY_DIR}/protocol/agl-shell-desktop-protocol.c ++ ${CMAKE_BINARY_DIR}/protocol/xdg-shell-protocol.c + backend/rvgpu-wayland.c + backend/rvgpu-gbm.c + renderer/rvgpu-egl.c +@@ -28,6 +30,7 @@ add_executable(rvgpu-renderer + target_include_directories(rvgpu-renderer + PRIVATE + ${PROJECT_SOURCE_DIR}/include ++ ${CMAKE_BINARY_DIR}/protocol + ${extlibs_INCLUDE_DIRS} + ) + target_compile_definitions(rvgpu-renderer PRIVATE _GNU_SOURCE) +diff --git a/src/rvgpu-renderer/backend/rvgpu-gbm.c b/src/rvgpu-renderer/backend/rvgpu-gbm.c +index 4194b0d..b2b3ed3 100644 +--- a/src/rvgpu-renderer/backend/rvgpu-gbm.c ++++ b/src/rvgpu-renderer/backend/rvgpu-gbm.c +@@ -259,6 +259,8 @@ static void rvgpu_gbm_create_scanout(struct rvgpu_egl_state *e, + + eglMakeCurrent(e->dpy, s->surface, s->surface, e->context); + glGenFramebuffers(1, &s->fb); ++ ++ rvgpu_egl_draw(e, s, false); + } + + static void rvgpu_gbm_page_flip_handler(int fd, unsigned int sequence, +diff --git a/src/rvgpu-renderer/backend/rvgpu-wayland.c b/src/rvgpu-renderer/backend/rvgpu-wayland.c +index 0aaeaa7..c00ff00 100644 +--- a/src/rvgpu-renderer/backend/rvgpu-wayland.c ++++ b/src/rvgpu-renderer/backend/rvgpu-wayland.c +@@ -39,12 +39,18 @@ + #include + #include + ++#include "agl-shell-desktop-protocol.h" ++#include "xdg-shell-protocol.h" ++ + struct rvgpu_native { + /* Window structures */ + struct wl_surface *surface; + struct wl_shell_surface *shell_surface; + struct wl_egl_window *egl_window; + struct ivi_surface *ivi_surface; ++ struct xdg_surface *xdg_surface; ++ struct xdg_toplevel *xdg_toplevel; ++ bool wait_for_configure; + }; + + struct rvgpu_wl_state { +@@ -58,6 +64,9 @@ struct rvgpu_wl_state { + struct wl_keyboard *keyboard; + struct wl_shell *shell; + struct ivi_application *ivi_app; ++ struct xdg_wm_base *wm_base; ++ struct agl_shell_desktop *agl_shell_desktop; ++ struct wl_output *output; + + /* EGL structures */ + struct rvgpu_egl_state egl; +@@ -78,6 +87,16 @@ static inline struct rvgpu_wl_state *to_wl(struct rvgpu_egl_state *e) + return rvgpu_container_of(e, struct rvgpu_wl_state, egl); + } + ++static void xdg_wm_base_ping(void *data, struct xdg_wm_base *shell, ++ uint32_t serial) ++{ ++ xdg_wm_base_pong(shell, serial); ++} ++ ++static const struct xdg_wm_base_listener xdg_wm_base_listener = { ++ xdg_wm_base_ping, ++}; ++ + static struct wl_seat_listener seat_listener; + + static void registry_add_object(void *data, struct wl_registry *registry, +@@ -98,8 +117,17 @@ static void registry_add_object(void *data, struct wl_registry *registry, + wl_registry_bind(registry, name, &wl_seat_interface, 1); + wl_seat_add_listener(r->seat, &seat_listener, r); + } else if (!strcmp(interface, "ivi_application")) { +- r->ivi_app = wl_registry_bind(registry, name, +- &ivi_application_interface, 1); ++ r->ivi_app = wl_registry_bind(registry, name, &ivi_application_interface, 1); ++ } else if (strcmp(interface, "xdg_wm_base") == 0) { ++ r->wm_base = wl_registry_bind(registry, name, ++ &xdg_wm_base_interface, 1); ++ xdg_wm_base_add_listener(r->wm_base, &xdg_wm_base_listener, r); ++ } else if (strcmp(interface, "agl_shell_desktop") == 0) { ++ r->agl_shell_desktop = wl_registry_bind(registry, name, ++ &agl_shell_desktop_interface, 1); ++ } else if (strcmp(interface, "wl_output") == 0) { ++ r->output = wl_registry_bind(registry, name, ++ &wl_output_interface, 1); + } + } + +@@ -157,6 +185,57 @@ static const struct ivi_surface_listener ivi_surface_listener = { + handle_ivi_surface_configure, + }; + ++static void handle_xdg_toplevel_configure(void *data, ++ struct xdg_toplevel *xdg_toplevel, ++ int32_t width, int32_t height, struct wl_array *states) ++{ ++ (void)xdg_toplevel; ++ struct rvgpu_scanout *s = data; ++ ++ s->window.w = (unsigned int)width; ++ s->window.h = (unsigned int)height; ++ ++ wl_egl_window_resize(s->native->egl_window, width, height, 0, 0); ++} ++ ++static const struct xdg_toplevel_listener xdg_toplevel_listener = { ++ handle_xdg_toplevel_configure, ++}; ++ ++static struct config_param { ++ struct rvgpu_egl_state *egl_state; ++ struct rvgpu_scanout *scanout; ++}; ++ ++static void handle_xdg_surface_configure(void *data, ++ struct xdg_surface *surface, uint32_t serial) ++{ ++ struct config_param *cp = data; ++ struct rvgpu_scanout *s = cp->scanout; ++ struct rvgpu_egl_state *egl = cp->egl_state; ++ ++ if (surface == NULL) ++ return; ++ ++ xdg_surface_ack_configure(surface, serial); ++ if (s->native->wait_for_configure) { ++ if (egl->user_specified_scanouts){ ++ for (unsigned int i = 0; i < VIRTIO_GPU_MAX_SCANOUTS; i++) { ++ if (egl->scanouts[i].params.enabled) { ++ rvgpu_egl_draw(egl, &egl->scanouts[i], false); ++ } ++ } ++ } else { ++ rvgpu_egl_draw(egl, &egl->scanouts[0], false); ++ } ++ s->native->wait_for_configure = false; ++ } ++} ++ ++static const struct xdg_surface_listener xdg_surface_listener = { ++ handle_xdg_surface_configure, ++}; ++ + static void pointer_handle_enter(void *data, struct wl_pointer *pointer, + uint32_t serial, struct wl_surface *surface, + wl_fixed_t sx, wl_fixed_t sy) +@@ -493,6 +572,12 @@ static void rvgpu_wl_destroy_scanout(struct rvgpu_egl_state *e, + if (s->native->ivi_surface) + ivi_surface_destroy(s->native->ivi_surface); + ++ if (s->native->xdg_toplevel) ++ xdg_toplevel_destroy(s->native->xdg_toplevel); ++ ++ if (s->native->xdg_surface) ++ xdg_surface_destroy(s->native->xdg_surface); ++ + wl_surface_destroy(s->native->surface); + free(s->native); + } +@@ -510,6 +595,12 @@ static void rvgpu_wl_free(struct rvgpu_egl_state *e) + if (r->shell) + wl_shell_destroy(r->shell); + ++ if (r->wm_base) ++ xdg_wm_base_destroy(r->wm_base); ++ ++ if (r->agl_shell_desktop) ++ agl_shell_desktop_destroy(r->agl_shell_desktop); ++ + wl_seat_destroy(r->seat); + if (r->pointer) + wl_pointer_destroy(r->pointer); +@@ -564,6 +655,21 @@ static void rvgpu_wl_process_events(struct rvgpu_egl_state *e, const void *ev, + } + } + ++static void create_opaque_region(struct rvgpu_egl_state *e, ++ struct rvgpu_scanout *s) ++{ ++ struct rvgpu_wl_state *r = to_wl(e); ++ struct wl_region *region = ++ wl_compositor_create_region(r->comp); ++ assert(region); ++ wl_region_add(region, 0, 0, (int)s->window.w, ++ (int)s->window.h); ++ wl_surface_set_opaque_region(s->native->surface, ++ region); ++ wl_region_destroy(region); ++} ++ ++ + static void rvgpu_wl_set_scanout(struct rvgpu_egl_state *e, + struct rvgpu_scanout *s) + { +@@ -572,15 +678,9 @@ static void rvgpu_wl_set_scanout(struct rvgpu_egl_state *e, + if (!r->fullscreen) { + s->window = s->virgl.box; + if (s->native) { +- if (!r->translucent) { +- struct wl_region *region = +- wl_compositor_create_region(r->comp); +- wl_region_add(region, 0, 0, (int)s->window.w, +- (int)s->window.h); +- wl_surface_set_opaque_region(s->native->surface, +- region); +- wl_region_destroy(region); +- } ++ if (!r->translucent) ++ create_opaque_region(e, s); ++ + wl_egl_window_resize(s->native->egl_window, + (int)s->window.w, (int)s->window.h, + 0, 0); +@@ -629,6 +729,59 @@ static void rvgpu_wl_create_scanout(struct rvgpu_egl_state *e, + assert(n->ivi_surface); + ivi_surface_add_listener(n->ivi_surface, &ivi_surface_listener, + s); ++ ++ } else if (r->wm_base) { ++ if (r->agl_shell_desktop){ ++ /* Default create window at the center of the AGL homescreen */ ++ unsigned int agl_x = 0; ++ unsigned int agl_y = 215; ++ unsigned int agl_w = 1080; ++ unsigned int agl_h = 1500; ++ if (sp && sp->agl_win_set) { ++ agl_x = sp->agl_win.x; ++ agl_y = sp->agl_win.y; ++ } ++ ++ /* ++ * Because we can not resize the surface automatically, window size ++ * have to be fit to the size of renderer box. ++ */ ++ if (sp && sp->boxed) { ++ agl_w = s->window.w; ++ agl_h = s->window.h; ++ } ++ ++ agl_shell_desktop_set_app_property(r->agl_shell_desktop, ++ "rvgpu-renderer", ++ AGL_SHELL_DESKTOP_APP_ROLE_POPUP, ++ agl_x, agl_y, ++ 0, 0, agl_w, agl_h, ++ r->output); ++ } ++ ++ n->xdg_surface = ++ xdg_wm_base_get_xdg_surface(r->wm_base, n->surface); ++ assert(n->xdg_surface); ++ ++ struct config_param *cp = malloc(sizeof(*cp)); ++ assert(cp); ++ ++ cp->egl_state = e; ++ cp->scanout = s; ++ ++ xdg_surface_add_listener(n->xdg_surface, ++ &xdg_surface_listener, cp); ++ n->xdg_toplevel = xdg_surface_get_toplevel(n->xdg_surface); ++ assert(n->xdg_toplevel); ++ ++ xdg_toplevel_add_listener(n->xdg_toplevel, ++ &xdg_toplevel_listener, s); ++ ++ xdg_toplevel_set_app_id(n->xdg_toplevel, "rvgpu-renderer"); ++ wl_surface_commit(n->surface); ++ n->wait_for_configure = true; ++ create_opaque_region(e, s); ++ + } else if (r->shell) { + char title[32]; + +@@ -654,16 +807,9 @@ static void rvgpu_wl_create_scanout(struct rvgpu_egl_state *e, + NULL); + } else { + wl_shell_surface_set_toplevel(n->shell_surface); +- if (!r->translucent) { +- struct wl_region *region = +- wl_compositor_create_region(r->comp); +- assert(region); +- wl_region_add(region, 0, 0, (int)s->window.w, +- (int)s->window.h); +- wl_surface_set_opaque_region(n->surface, +- region); +- wl_region_destroy(region); +- } ++ if (!r->translucent) ++ create_opaque_region(e, s); ++ + } + } + +@@ -677,6 +823,10 @@ static void rvgpu_wl_create_scanout(struct rvgpu_egl_state *e, + eglMakeCurrent(e->dpy, s->surface, s->surface, e->context); + + glGenFramebuffers(1, &s->fb); ++ ++ if(!r->wm_base){ ++ rvgpu_egl_draw(e, s, false); ++ } + } + + static const struct rvgpu_egl_callbacks wl_callbacks = { +diff --git a/src/rvgpu-renderer/renderer/rvgpu-egl.c b/src/rvgpu-renderer/renderer/rvgpu-egl.c +index a9dd398..6918843 100644 +--- a/src/rvgpu-renderer/renderer/rvgpu-egl.c ++++ b/src/rvgpu-renderer/renderer/rvgpu-egl.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #include + +@@ -146,6 +147,7 @@ void rvgpu_egl_free(struct rvgpu_egl_state *e) + e->cb->free(e); + } + ++ + void rvgpu_egl_draw(struct rvgpu_egl_state *e, struct rvgpu_scanout *s, + bool vsync) + { +@@ -191,6 +193,7 @@ void rvgpu_egl_draw(struct rvgpu_egl_state *e, struct rvgpu_scanout *s, + (int)s->window.w, (int)s->window.h, + GL_COLOR_BUFFER_BIT, GL_NEAREST); + } ++ + if (e->cb->draw) + e->cb->draw(e, s, vsync); + else +diff --git a/src/rvgpu-renderer/rvgpu-renderer.c b/src/rvgpu-renderer/rvgpu-renderer.c +index 3e74289..40b78d4 100644 +--- a/src/rvgpu-renderer/rvgpu-renderer.c ++++ b/src/rvgpu-renderer/rvgpu-renderer.c +@@ -52,6 +52,7 @@ static void usage(void) + info("\t-f\t\tRun in fullscreen mode\n"); + info("\t-p port\t\tport for listening (default: %u)\n", + RVGPU_DEFAULT_PORT); ++ info("\t-w\t\tSet AGL window position\n"); + info("\t-h\t\tShow this message\n"); + + info("\nNote:\n"); +@@ -189,7 +190,7 @@ int main(int argc, char **argv) + + memset(sp, 0, sizeof(sp)); + +- while ((opt = getopt(argc, argv, "afhi:c:s:S:b:B:p:g:")) != -1) { ++ while ((opt = getopt(argc, argv, "afhi:c:s:S:b:w:B:p:g:")) != -1) { + switch (opt) { + case 'a': + translucent = true; +@@ -240,6 +241,13 @@ int main(int argc, char **argv) + } + cp->boxed = true; + break; ++ case 'w': ++ if (sscanf(optarg, "%u,%u", ++ &cp->agl_win.x, &cp->agl_win.y) != 2) { ++ errx(1, "invalid AGL popup application window%s", optarg); ++ } ++ cp->agl_win_set = true; ++ break; + case 'i': + cp->id = (uint32_t)sanity_strtonum( + optarg, 1, UINT32_MAX, &errstr); +@@ -300,7 +308,6 @@ int main(int argc, char **argv) + s->params = sp[i]; + if (sp[i].enabled) { + rvgpu_egl_create_scanout(egl, &egl->scanouts[i]); +- rvgpu_egl_draw(egl, &egl->scanouts[i], false); + } + } + +-- +2.25.1 + diff --git a/meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu_git.bb b/meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu_git.bb new file mode 100644 index 00000000..899f81bb --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu_git.bb @@ -0,0 +1,27 @@ +SUMMARY = "Remote virtual display userland" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=573c152503e0d9b97c8e0cc09fbb1ad2" + +require remote-virtio-gpu.inc + +SRC_URI:append = " \ + file://0001-Remove-some-rvgpu-command-options.patch \ + file://0002-Add-agl-shell-desktop-and-xdg-shell-support.patch \ +" + +S = "${WORKDIR}/git" + +DEPENDS = "virglrenderer virtual/libgbm wayland wayland-native libepoxy libinput linux-libc-headers agl-compositor virtio-loopback-driver" +RDEPENDS:${PN} = " wayland libgles2" + +inherit cmake pkgconfig + +PACKAGECONFIG_CONFARGS += " \ + -DCMAKE_BUILD_TYPE=Release \ +" + +FILES:SOLIBSDEV = "" +FILES:${PN} += " \ + ${libdir}/librvgpu.so* \ +" diff --git a/meta-uhmi/meta-rvgpu/recipes-graphics/wayland/weston_%.bbappend b/meta-uhmi/meta-rvgpu/recipes-graphics/wayland/weston_%.bbappend new file mode 100644 index 00000000..133a34e3 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-graphics/wayland/weston_%.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('AGL_FEATURES', 'agl-rvgpu-proxy', 'weston_rvgpuproxy.inc', '', d)} diff --git a/meta-uhmi/meta-rvgpu/recipes-graphics/wayland/weston_rvgpuproxy.inc b/meta-uhmi/meta-rvgpu/recipes-graphics/wayland/weston_rvgpuproxy.inc new file mode 100644 index 00000000..5b7536df --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-graphics/wayland/weston_rvgpuproxy.inc @@ -0,0 +1,7 @@ +# Remove the RPATH variable, to be able to use LD_LIBRARY_PATH, +# to run render apps using /usr/lib/mesa-virtio +do_install:append() { + chrpath --delete ${D}${libdir}/libweston-10/*.so + chrpath --delete ${D}${libdir}/weston/*.so + chrpath --delete ${D}${libdir}/*.so +} diff --git a/meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-common/uinput.cfg b/meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-common/uinput.cfg new file mode 100644 index 00000000..fd1f78ea --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-common/uinput.cfg @@ -0,0 +1,2 @@ +CONFIG_INPUT_UINPUT=y +CONFIG_INPUT_MISC=y diff --git a/meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-common/virtio-gpu.cfg b/meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-common/virtio-gpu.cfg new file mode 100644 index 00000000..5db61502 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-common/virtio-gpu.cfg @@ -0,0 +1 @@ +CONFIG_DRM_VIRTIO_GPU=y diff --git a/meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-rvgpu.inc b/meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-rvgpu.inc new file mode 100644 index 00000000..b052dfd1 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-rvgpu.inc @@ -0,0 +1,6 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/linux-common/:" + +SRC_URI:append = " \ + file://virtio-gpu.cfg \ + file://uinput.cfg \ +" diff --git a/meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-yocto_%.bbappend b/meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-yocto_%.bbappend new file mode 100644 index 00000000..9dd82e3c --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-kernel/linux/linux-yocto_%.bbappend @@ -0,0 +1 @@ +require linux-rvgpu.inc diff --git a/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver.inc b/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver.inc new file mode 100644 index 00000000..3c21d446 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver.inc @@ -0,0 +1,6 @@ +PV = "0.0+git${SRCPV}" +SRCREV = "db18183e68033fd4a6798e8998a5d9a3c6410cfc" +BRANCH ?= "main" +SRC_URI = " \ + git://github.com/unified-hmi/virtio-loopback-driver.git;protocol=https;branch=${BRANCH} \ +" diff --git a/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/0001-Remove-card_index-option.patch b/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/0001-Remove-card_index-option.patch new file mode 100644 index 00000000..e20df709 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/0001-Remove-card_index-option.patch @@ -0,0 +1,70 @@ +From ba9b19b36f7c7f7df8c4041569f7cef04b2d42da Mon Sep 17 00:00:00 2001 +From: murakami +Date: Fri, 28 Jul 2023 13:05:19 +0900 +Subject: [PATCH] Remove card_index option + +Remove card_index option support from virtio-loopback-driver, +because the kernel needs to be patched to run that option +in rvgpu-proxy. + +Upstream-Status: Inappropriate [embedded specific] +--- + src/virtio_lo.h | 1 - + src/virtio_lo_device.c | 1 - + src/virtio_lo_device.h | 1 - + src/virtio_lo_driver.c | 3 --- + 4 files changed, 6 deletions(-) + +diff --git a/src/virtio_lo.h b/src/virtio_lo.h +index a07fa91..0da681e 100644 +--- a/src/virtio_lo.h ++++ b/src/virtio_lo.h +@@ -25,7 +25,6 @@ struct virtio_lo_devinfo { + __u64 features; /* IN/OUT */ + __u32 config_size; /* IN */ + __s32 config_kick; /* IN */ +- __s32 card_index; /* IN */ + __u32 padding; /* IN */ + __u8 *config; /* IN/OUT */ + struct virtio_lo_qinfo *qinfo; /* IN/OUT */ +diff --git a/src/virtio_lo_device.c b/src/virtio_lo_device.c +index 39e8788..22687b7 100644 +--- a/src/virtio_lo_device.c ++++ b/src/virtio_lo_device.c +@@ -171,7 +171,6 @@ static long vilo_ioctl_adddev(struct virtio_lo_owner *owner, + + dev->device_id = di.device_id; + dev->vendor_id = di.vendor_id; +- dev->card_index = di.card_index; + dev->nqueues = di.nqueues; + dev->features = dev->device_features = di.features; + +diff --git a/src/virtio_lo_device.h b/src/virtio_lo_device.h +index 2d872a7..bc40b3e 100644 +--- a/src/virtio_lo_device.h ++++ b/src/virtio_lo_device.h +@@ -25,7 +25,6 @@ struct virtio_lo_device { + unsigned idx; + u32 device_id; + u32 vendor_id; +- int card_index; + + struct platform_device *pdev; + +diff --git a/src/virtio_lo_driver.c b/src/virtio_lo_driver.c +index 30d1852..d7f517d 100644 +--- a/src/virtio_lo_driver.c ++++ b/src/virtio_lo_driver.c +@@ -284,9 +284,6 @@ static int virtio_lo_probe(struct platform_device *pdev) + vl_driv->device = device; + vl_driv->pdev = pdev; + +-#ifdef CONFIG_VIRTIO_LO_DEVICE_INDEX +- vl_driv->vdev.card_index = device->card_index; +-#endif /* CONFIG_VIRTIO_LO_DEVICE_INDEX */ + vl_driv->vdev.dev.parent = &pdev->dev; + vl_driv->vdev.dev.release = virtio_lo_release_dev_empty; + vl_driv->vdev.config = &virtio_lo_config_ops; +-- +2.17.1 + diff --git a/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/Kbuild b/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/Kbuild new file mode 100644 index 00000000..27e54e58 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/Kbuild @@ -0,0 +1,3 @@ +# KBuild for virtio-lo +obj-m += virtio_lo.o +virtio_lo-y := virtio_lo_device.o virtio_lo_driver.o diff --git a/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/Makefile.driver b/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/Makefile.driver new file mode 100644 index 00000000..662c18ea --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/Makefile.driver @@ -0,0 +1,17 @@ +# +# Makefile for virtio-lo +# +ifeq ($(KDIR),) +$(error "KDIR must be specified.") +endif + +default: + $(MAKE) -C $(KDIR) M=$$PWD/src + +modules_install: + $(MAKE) -C $(KDIR) M=$$PWD/src $@ + +clean: + $(MAKE) -C $(KDIR) M=$$PWD/src $@ + +.PHONY: default modules_install clean diff --git a/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver_git.bb b/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver_git.bb new file mode 100644 index 00000000..687c33dd --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver_git.bb @@ -0,0 +1,41 @@ +SUMMARY = "Virtio Loopback Driver for Remote virtual display device" + +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=688693ebbe31e3eadf819d7d007fa654" + +require virtio-loopback-driver.inc + +SRC_URI:append = " \ + file://0001-Remove-card_index-option.patch \ + file://Makefile.driver \ + file://Kbuild \ +" + +S = "${WORKDIR}/git" +EXTRA_OEMAKE = "KDIR=${STAGING_KERNEL_BUILDDIR}" +MODULES_MODULE_SYMVERS_LOCATION = "src" + +inherit module + +do_compile:prepend() { + cp ${WORKDIR}/Makefile.driver ${S}/Makefile + cp ${WORKDIR}/Kbuild ${S}/src/ +} + +do_install:append() { + install -d ${D}${PKG_CONFIG_SYSTEM_INCLUDE_PATH}/remote-virtio-gpu + install -m 755 ${S}/src/virtio_lo.h ${D}${PKG_CONFIG_SYSTEM_INCLUDE_PATH}/remote-virtio-gpu/virtio_lo.h +} + +FILES:${PN} = " \ + ${libdir}/modules/${KERNEL_VERSION}/extra/virtio_lo* \ + ${sysconfdir}/modules-load.d \ +" + +RPROVIDES:${PN} += " \ + kernel-module-virtiolo \ + kernel-module-virtio-lo${KERNEL_MODULE_PACKAGE_SUFFIX} \ +" + +# Autoload virtio lo driver +KERNEL_MODULE_AUTOLOAD:append = " virtio_lo" diff --git a/meta-uhmi/meta-rvgpu/recipes-platform/images/agl-demo-platform.bbappend b/meta-uhmi/meta-rvgpu/recipes-platform/images/agl-demo-platform.bbappend new file mode 100644 index 00000000..228012d2 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-platform/images/agl-demo-platform.bbappend @@ -0,0 +1 @@ +IMAGE_INSTALL:append = " packagegroup-rvgpu" diff --git a/meta-uhmi/meta-rvgpu/recipes-platform/packagegroups/packagegroup-rvgpu.bb b/meta-uhmi/meta-rvgpu/recipes-platform/packagegroups/packagegroup-rvgpu.bb new file mode 100644 index 00000000..856b2584 --- /dev/null +++ b/meta-uhmi/meta-rvgpu/recipes-platform/packagegroups/packagegroup-rvgpu.bb @@ -0,0 +1,11 @@ +SUMMARY = "Unified HMI Package Groups" +LICENSE = "Apache-2.0" + +inherit packagegroup + +RDEPENDS:${PN} += " \ + remote-virtio-gpu \ + virtio-loopback-driver \ + mesa-virtio \ + weston \ +" -- cgit 1.2.3-korg