From 3ba5884954bd7b970a72fe965f632d35400be6c8 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Mon, 7 Oct 2019 23:07:12 +0000 Subject: [PATCH] Feed captured frames to nvnc --- Makefile | 2 +- src/main.c | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e2e71d3..3e350ed 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -DEPENDENCIES := libuv egl glesv2 wayland-client neatvnc +DEPENDENCIES := libuv egl glesv2 wayland-client neatvnc pixman-1 EXEC := wayvnc diff --git a/src/main.c b/src/main.c index 49e9c1f..93cb784 100644 --- a/src/main.c +++ b/src/main.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "wlr-export-dmabuf-unstable-v1.h" #include "render.h" @@ -311,7 +312,21 @@ int wayvnc_start_capture(struct wayvnc* self) void wayvnc_process_frame(struct wayvnc* self, struct dmabuf_frame* frame) { - /* TODO */ + uint32_t format = fourcc_from_gl_format(self->renderer.read_format); + + struct nvnc_fb* fb = nvnc_fb_new(frame->width, frame->height, format); + void* addr = nvnc_fb_get_addr(fb); + + render_dmabuf_frame(&self->renderer, frame); + render_copy_pixels(&self->renderer, addr, 0, frame->height); + + struct pixman_region16 damage; + pixman_region_init_rect(&damage, 0, 0, frame->width, frame->height); + + nvnc_feed_frame(self->nvnc, fb, &damage); + + nvnc_fb_unref(fb); + pixman_region_fini(&damage); if (wayvnc_start_capture(self) < 0) { log_error("Failed to start capture. Exiting...\n");