From aa92c97dc1717cb8c28cd4a638d53a0adb391ec1 Mon Sep 17 00:00:00 2001
From: Kenta <murakami.kenta002@jp.panasonic.com>
Date: Thu, 3 Oct 2024 09:52:52 +0900
Subject: [PATCH] Unified HMI: Bump remote-virtio-gpu and
 virtio-loopback-driver

Import latest improvements and bug fixes such as:
- Fix incorrect rendering in specific GL formats
- Render mouse cursors remotely

Bug-AGL: SPEC-5252

Change-Id: Iac9de40317930d904221b27942d19ca22925d303
Signed-off-by: Kenta <murakami.kenta002@jp.panasonic.com>
---
 .../remote-virtio-gpu/remote-virtio-gpu.inc        |   2 +-
 .../0001-Remove-some-rvgpu-command-options.patch   | 161 ---------------------
 .../remote-virtio-gpu/remote-virtio-gpu_git.bb     |   4 -
 .../virtio-loopback-driver.inc                     |   2 +-
 .../0001-Remove-card_index-option.patch            |  67 ---------
 .../virtio-loopback-driver_git.bb                  |   6 +-
 6 files changed, 3 insertions(+), 239 deletions(-)
 delete mode 100644 meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu/0001-Remove-some-rvgpu-command-options.patch
 delete mode 100644 meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/0001-Remove-card_index-option.patch

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
index ef5762f4..ddd6dbab 100644
--- 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
@@ -1,5 +1,5 @@
 PV = "0.0+git${SRCPV}"
-SRCREV = "cd79224421fb2e3a0109c8e765264f5f39af9ef3"
+SRCREV = "bce1f77f189dacf3e57d2f4edc37be4ff63b9e4b"
 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
deleted file mode 100644
index 044c8420..00000000
--- a/meta-uhmi/meta-rvgpu/recipes-graphics/remote-virtio-gpu/remote-virtio-gpu/0001-Remove-some-rvgpu-command-options.patch
+++ /dev/null
@@ -1,161 +0,0 @@
-From fb9d1134906356b20ac698fca64a3c7de0dd111c Mon Sep 17 00:00:00 2001
-From: Fumiya Kohzu <kohzu.fumiya@jp.panasonic.com>
-Date: Mon, 20 Nov 2023 19:28:19 +0900
-Subject: [PATCH] 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 72adb07..29dc157 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 0db2d7f..6b84a0a 100644
---- a/src/rvgpu-proxy/gpu/rvgpu-gpu-device.c
-+++ b/src/rvgpu-proxy/gpu/rvgpu-gpu-device.c
-@@ -655,7 +655,6 @@ struct gpu_device *gpu_device_init(int lo_fd, int efd, int capset,
- 	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;
- 
-@@ -1013,8 +1012,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 b9958b8..b78ed1c 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>\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 2757827..b21a168 100644
---- a/src/rvgpu-renderer/rvgpu-renderer.c
-+++ b/src/rvgpu-renderer/rvgpu-renderer.c
-@@ -53,7 +53,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");
-@@ -186,13 +185,13 @@ 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));
- 	memset(&pp, 0, sizeof(pp));
- 
--	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;
-@@ -271,9 +270,6 @@ int main(int argc, char **argv)
- 				     errstr);
- 			}
- 			break;
--		case 'v':
--			vsync = true;
--			break;
- 		case 'h':
- 			usage();
- 			exit(EXIT_SUCCESS);
-@@ -311,7 +307,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.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
index 31416260..86e456c3 100644
--- 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
@@ -5,10 +5,6 @@ LIC_FILES_CHKSUM = "file://LICENSE.md;md5=573c152503e0d9b97c8e0cc09fbb1ad2"
 
 require remote-virtio-gpu.inc
 
-SRC_URI:append = " \
-    file://0001-Remove-some-rvgpu-command-options.patch \
-"
-
 S = "${WORKDIR}/git"
 
 DEPENDS = "virglrenderer virtual/libgbm wayland wayland-native libepoxy libinput virtio-loopback-driver"
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
index fe0757d4..a7c0111b 100644
--- 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
@@ -1,5 +1,5 @@
 PV = "0.0+git${SRCPV}"
-SRCREV = "070ba544722c78e3f6a0f43e4fe08a0214c66a49"
+SRCREV = "cf40e4d295c75567cb7d1d03f9fe291e9593e882"
 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
deleted file mode 100644
index b3305d3d..00000000
--- a/meta-uhmi/meta-rvgpu/recipes-kernel/virtio-loopback-driver/virtio-loopback-driver/0001-Remove-card_index-option.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 123a03d7e2ae90da1b8a00ada136f439ba5672db Mon Sep 17 00:00:00 2001
-From: Fumiya Kohzu <kohzu.fumiya@jp.panasonic.com>
-Date: Mon, 20 Nov 2023 19:37:50 +0900
-Subject: [PATCH] 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]
----
- virtio_lo.h        | 1 -
- virtio_lo_device.c | 1 -
- virtio_lo_device.h | 1 -
- virtio_lo_driver.c | 3 ---
- 4 files changed, 6 deletions(-)
-
-diff --git a/virtio_lo.h b/virtio_lo.h
-index a07fa91..0da681e 100644
---- a/virtio_lo.h
-+++ b/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/virtio_lo_device.c b/virtio_lo_device.c
-index 39e8788..22687b7 100644
---- a/virtio_lo_device.c
-+++ b/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/virtio_lo_device.h b/virtio_lo_device.h
-index 2d872a7..bc40b3e 100644
---- a/virtio_lo_device.h
-+++ b/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/virtio_lo_driver.c b/virtio_lo_driver.c
-index 30d1852..d7f517d 100644
---- a/virtio_lo_driver.c
-+++ b/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.25.1
-
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
index 7a203767..b9682aee 100644
--- 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
@@ -1,14 +1,10 @@
-SUMMARY = "Virtio Loopback Driver for Remote virtual display device"
+SUMMARY = "Remote virtual display device driver"
 
 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 \
-"
-
 S = "${WORKDIR}/git"
 
 inherit module
-- 
2.16.6