Unified HMI: initial commit
[AGL/meta-agl-devel.git] / meta-uhmi / meta-rvgpu / recipes-graphics / remote-virtio-gpu / remote-virtio-gpu / 0001-Remove-some-rvgpu-command-options.patch
1 From 0fc1cf03f76d21cec5b859ff46bee146cd4e52f7 Mon Sep 17 00:00:00 2001
2 From: murakami <murakami.kenta002@jp.panasonic.jp>
3 Date: Fri, 28 Jul 2023 12:09:35 +0900
4 Subject: [PATCH 1/2] Remove some rvgpu command options
5
6 Remove vsync and card_index option supports from remote-virtio-gpu,
7 because the kernel needs to be patched to run those options in
8 rvgpu-proxy and rvgpu-renderer.
9
10 Upstream-Status: Inappropriate [embedded specific]
11 ---
12  include/rvgpu-proxy/gpu/rvgpu-gpu-device.h |  1 -
13  src/rvgpu-proxy/gpu/rvgpu-gpu-device.c     |  3 ---
14  src/rvgpu-proxy/rvgpu-proxy.c              | 27 ++--------------------
15  src/rvgpu-renderer/rvgpu-renderer.c        | 10 +++-----
16  4 files changed, 5 insertions(+), 36 deletions(-)
17
18 diff --git a/include/rvgpu-proxy/gpu/rvgpu-gpu-device.h b/include/rvgpu-proxy/gpu/rvgpu-gpu-device.h
19 index eb34b6a..76d747a 100644
20 --- a/include/rvgpu-proxy/gpu/rvgpu-gpu-device.h
21 +++ b/include/rvgpu-proxy/gpu/rvgpu-gpu-device.h
22 @@ -35,7 +35,6 @@ struct gpu_device;
23  
24  struct gpu_device_params {
25         bool split_resources;
26 -       int card_index;
27         unsigned int num_scanouts;
28         unsigned int mem_limit;
29         unsigned long framerate;
30 diff --git a/src/rvgpu-proxy/gpu/rvgpu-gpu-device.c b/src/rvgpu-proxy/gpu/rvgpu-gpu-device.c
31 index 947e81a..71f62ca 100644
32 --- a/src/rvgpu-proxy/gpu/rvgpu-gpu-device.c
33 +++ b/src/rvgpu-proxy/gpu/rvgpu-gpu-device.c
34 @@ -528,7 +528,6 @@ struct gpu_device *gpu_device_init(int lo_fd, int efd, uint32_t cidx,
35         if (capset != -1)
36                 gpu_capset_init(g, capset);
37  
38 -       info.card_index = params->card_index;
39         info.config = (__u8 *)&g->config;
40         info.config_kick = g->config_fd;
41  
42 @@ -939,8 +938,6 @@ static void gpu_device_trigger_vsync(struct gpu_device *g,
43                 return;
44  
45         hdr->flags |= VIRTIO_GPU_FLAG_VSYNC;
46 -       /* use padding bytes to pass scanout_id to virtio-gpu driver */
47 -       hdr->padding = g->scan_id;
48         add_resp(g, hdr, req);
49  
50         if ((!vsync_ts.tv_sec) && (!vsync_ts.tv_nsec)) {
51 diff --git a/src/rvgpu-proxy/rvgpu-proxy.c b/src/rvgpu-proxy/rvgpu-proxy.c
52 index 6ff4e19..d082b72 100644
53 --- a/src/rvgpu-proxy/rvgpu-proxy.c
54 +++ b/src/rvgpu-proxy/rvgpu-proxy.c
55 @@ -47,7 +47,6 @@ static void usage(void)
56         info("\t-s scanout\tspecify scanout in form WxH@X,Y (default: %ux%u@0,0)\n",
57              DEFAULT_WIDTH, DEFAULT_HEIGHT);
58         info("\t-f rate\t\tspecify virtual framerate (default: disabled)\n");
59 -       info("\t-i index\tspecify index 'n' for device /dev/dri/card<n>\n");
60         info("\t-n\t\tserver:port for connecting (max 4 hosts, default: %s:%s)\n",
61              RVGPU_DEFAULT_HOSTNAME, RVGPU_DEFAULT_PORT);
62         info("\t-h\t\tshow this message\n");
63 @@ -79,7 +78,6 @@ int main(int argc, char **argv)
64         struct gpu_device_params params = {
65                 .framerate = 0u,
66                 .mem_limit = VMEM_DEFAULT_MB,
67 -               .card_index = -1,
68                 .num_scanouts = 0u,
69                 .dpys = { { .r = { .x = 0,
70                                    .y = 0,
71 @@ -97,38 +95,17 @@ int main(int argc, char **argv)
72         };
73  
74         pthread_t input_thread;
75 -       char path[64];
76         FILE *oomFile;
77 -       int lo_fd, epoll_fd, res, opt, capset = -1;
78 +       int lo_fd, epoll_fd, opt, capset = -1;
79         char *ip, *port, *errstr = NULL;
80  
81 -       while ((opt = getopt(argc, argv, "hi:n:M:c:R:f:s:")) != -1) {
82 +       while ((opt = getopt(argc, argv, "h:n:M:c:R:f:s:")) != -1) {
83                 switch (opt) {
84                 case 'c':
85                         capset = open(optarg, O_RDONLY);
86                         if (capset == -1)
87                                 err(1, "open %s", optarg);
88                         break;
89 -               case 'i':
90 -                       params.card_index =
91 -                               (int)sanity_strtonum(optarg, CARD_INDEX_MIN,
92 -                                                    CARD_INDEX_MAX - 1,
93 -                                                    &errstr);
94 -                       if (errstr != NULL) {
95 -                               warnx("Card index should be in [%u..%u]\n",
96 -                                     CARD_INDEX_MIN, CARD_INDEX_MAX - 1);
97 -                               errx(1, "Invalid card index %s:%s", optarg,
98 -                                    errstr);
99 -                       }
100 -
101 -                       snprintf(path, sizeof(path), "/dev/dri/card%d",
102 -                                params.card_index);
103 -                       res = access(path, F_OK);
104 -                       if (res == 0)
105 -                               errx(1, "device %s exists", path);
106 -                       else if (errno != ENOENT)
107 -                               err(1, "error while checking device %s", path);
108 -                       break;
109                 case 'M':
110                         params.mem_limit = (unsigned int)sanity_strtonum(
111                                 optarg, VMEM_MIN_MB, VMEM_MAX_MB, &errstr);
112 diff --git a/src/rvgpu-renderer/rvgpu-renderer.c b/src/rvgpu-renderer/rvgpu-renderer.c
113 index 7166fb9..3e74289 100644
114 --- a/src/rvgpu-renderer/rvgpu-renderer.c
115 +++ b/src/rvgpu-renderer/rvgpu-renderer.c
116 @@ -52,7 +52,6 @@ static void usage(void)
117         info("\t-f\t\tRun in fullscreen mode\n");
118         info("\t-p port\t\tport for listening (default: %u)\n",
119              RVGPU_DEFAULT_PORT);
120 -       info("\t-v\t\tRun in vsync mode (eglSwapInterval 1)\n");
121         info("\t-h\t\tShow this message\n");
122  
123         info("\nNote:\n");
124 @@ -185,12 +184,12 @@ int main(int argc, char **argv)
125         unsigned int res_id, scanout;
126         uint16_t port_nr = RVGPU_DEFAULT_PORT;
127         FILE *input_stream = stdout;
128 -       bool fullscreen = false, vsync = false, translucent = false,
129 +       bool fullscreen = false, translucent = false,
130              user_specified_scanouts = false;
131  
132         memset(sp, 0, sizeof(sp));
133  
134 -       while ((opt = getopt(argc, argv, "afhvi:c:s:S:b:B:p:g:")) != -1) {
135 +       while ((opt = getopt(argc, argv, "afhi:c:s:S:b:B:p:g:")) != -1) {
136                 switch (opt) {
137                 case 'a':
138                         translucent = true;
139 @@ -269,9 +268,6 @@ int main(int argc, char **argv)
140                                      errstr);
141                         }
142                         break;
143 -               case 'v':
144 -                       vsync = true;
145 -                       break;
146                 case 'h':
147                         usage();
148                         exit(EXIT_SUCCESS);
149 @@ -309,7 +305,7 @@ int main(int argc, char **argv)
150         }
151  
152         while ((res_id = rvgpu_pr_dispatch(pr))) {
153 -               rvgpu_egl_drawall(egl, res_id, vsync);
154 +               rvgpu_egl_drawall(egl, res_id, false);
155         }
156  
157         if (pp.capset)
158 -- 
159 2.17.1
160