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