diff --git a/include/screencopy.h b/include/screencopy.h index bcc09d3..205ebbc 100644 --- a/include/screencopy.h +++ b/include/screencopy.h @@ -65,6 +65,7 @@ struct screencopy { enum wl_shm_format wl_shm_format; bool have_linux_dmabuf; + bool enable_linux_dmabuf; uint32_t dmabuf_width, dmabuf_height; uint32_t fourcc; diff --git a/meson_options.txt b/meson_options.txt index d1781a7..ad052a4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,5 @@ -option('screencopy-dmabuf', type: 'feature', value: 'disabled', - description: 'Enable GPU-side screencopy (experimental)') +option('screencopy-dmabuf', type: 'feature', value: 'auto', + description: 'Enable GPU-side screencopy') option('pam', type: 'feature', value: 'auto', description: 'Enable PAM authentication') option('man-pages', type: 'feature', value: 'auto', diff --git a/src/main.c b/src/main.c index 41febf7..273ff9f 100644 --- a/src/main.c +++ b/src/main.c @@ -694,6 +694,7 @@ int wayvnc_usage(FILE* stream, int rc) "Usage: wayvnc [options] [address [port]]\n" "\n" " -C,--config= Select a config file.\n" +" -g,--gpu Enable feature that need GPU.\n" " -o,--output= Select output to capture.\n" " -k,--keyboard=[-] Select keyboard layout with an\n" " optional variant.\n" @@ -814,6 +815,7 @@ int main(int argc, char* argv[]) struct wayvnc self = { 0 }; const char* cfg_file = NULL; + bool enable_gpu_features = false; const char* address = NULL; int port = 0; @@ -827,13 +829,14 @@ int main(int argc, char* argv[]) int max_rate = 30; bool disable_input = false; - static const char* shortopts = "C:o:k:s:rf:hpudVvL:"; + static const char* shortopts = "C:go:k:s:rf:hpudVvL:"; int drm_fd MAYBE_UNUSED = -1; int log_level = NVNC_LOG_WARNING; static const struct option longopts[] = { { "config", required_argument, NULL, 'C' }, + { "gpu", no_argument, NULL, 'g' }, { "output", required_argument, NULL, 'o' }, { "keyboard", required_argument, NULL, 'k' }, { "seat", required_argument, NULL, 's' }, @@ -858,6 +861,9 @@ int main(int argc, char* argv[]) case 'C': cfg_file = optarg; break; + case 'g': + enable_gpu_features = true; + break; case 'o': output_name = optarg; break; @@ -982,6 +988,7 @@ int main(int argc, char* argv[]) self.selected_seat = seat; self.screencopy.wl_output = out->wl_output; self.screencopy.rate_limit = max_rate; + self.screencopy.enable_linux_dmabuf = enable_gpu_features; if (self.keyboard_manager) { self.keyboard_backend.virtual_keyboard = diff --git a/src/screencopy.c b/src/screencopy.c index f53b078..45f51ff 100644 --- a/src/screencopy.c +++ b/src/screencopy.c @@ -83,7 +83,7 @@ static void screencopy_buffer_done(void* data, enum wv_buffer_type type = WV_BUFFER_UNSPEC; #ifdef ENABLE_SCREENCOPY_DMABUF - if (self->have_linux_dmabuf) { + if (self->have_linux_dmabuf && self->enable_linux_dmabuf) { width = self->dmabuf_width; height = self->dmabuf_height; stride = 0;