Make enabling of screencopy-dmabuf a runtime option

pull/143/head
Andri Yngvason 2022-07-09 17:34:05 +00:00
parent 4209a4deb2
commit 28963df226
4 changed files with 12 additions and 4 deletions

View File

@ -65,6 +65,7 @@ struct screencopy {
enum wl_shm_format wl_shm_format; enum wl_shm_format wl_shm_format;
bool have_linux_dmabuf; bool have_linux_dmabuf;
bool enable_linux_dmabuf;
uint32_t dmabuf_width, dmabuf_height; uint32_t dmabuf_width, dmabuf_height;
uint32_t fourcc; uint32_t fourcc;

View File

@ -1,5 +1,5 @@
option('screencopy-dmabuf', type: 'feature', value: 'disabled', option('screencopy-dmabuf', type: 'feature', value: 'auto',
description: 'Enable GPU-side screencopy (experimental)') description: 'Enable GPU-side screencopy')
option('pam', type: 'feature', value: 'auto', option('pam', type: 'feature', value: 'auto',
description: 'Enable PAM authentication') description: 'Enable PAM authentication')
option('man-pages', type: 'feature', value: 'auto', option('man-pages', type: 'feature', value: 'auto',

View File

@ -694,6 +694,7 @@ int wayvnc_usage(FILE* stream, int rc)
"Usage: wayvnc [options] [address [port]]\n" "Usage: wayvnc [options] [address [port]]\n"
"\n" "\n"
" -C,--config=<path> Select a config file.\n" " -C,--config=<path> Select a config file.\n"
" -g,--gpu Enable feature that need GPU.\n"
" -o,--output=<name> Select output to capture.\n" " -o,--output=<name> Select output to capture.\n"
" -k,--keyboard=<layout>[-<variant>] Select keyboard layout with an\n" " -k,--keyboard=<layout>[-<variant>] Select keyboard layout with an\n"
" optional variant.\n" " optional variant.\n"
@ -814,6 +815,7 @@ int main(int argc, char* argv[])
struct wayvnc self = { 0 }; struct wayvnc self = { 0 };
const char* cfg_file = NULL; const char* cfg_file = NULL;
bool enable_gpu_features = false;
const char* address = NULL; const char* address = NULL;
int port = 0; int port = 0;
@ -827,13 +829,14 @@ int main(int argc, char* argv[])
int max_rate = 30; int max_rate = 30;
bool disable_input = false; 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 drm_fd MAYBE_UNUSED = -1;
int log_level = NVNC_LOG_WARNING; int log_level = NVNC_LOG_WARNING;
static const struct option longopts[] = { static const struct option longopts[] = {
{ "config", required_argument, NULL, 'C' }, { "config", required_argument, NULL, 'C' },
{ "gpu", no_argument, NULL, 'g' },
{ "output", required_argument, NULL, 'o' }, { "output", required_argument, NULL, 'o' },
{ "keyboard", required_argument, NULL, 'k' }, { "keyboard", required_argument, NULL, 'k' },
{ "seat", required_argument, NULL, 's' }, { "seat", required_argument, NULL, 's' },
@ -858,6 +861,9 @@ int main(int argc, char* argv[])
case 'C': case 'C':
cfg_file = optarg; cfg_file = optarg;
break; break;
case 'g':
enable_gpu_features = true;
break;
case 'o': case 'o':
output_name = optarg; output_name = optarg;
break; break;
@ -982,6 +988,7 @@ int main(int argc, char* argv[])
self.selected_seat = seat; self.selected_seat = seat;
self.screencopy.wl_output = out->wl_output; self.screencopy.wl_output = out->wl_output;
self.screencopy.rate_limit = max_rate; self.screencopy.rate_limit = max_rate;
self.screencopy.enable_linux_dmabuf = enable_gpu_features;
if (self.keyboard_manager) { if (self.keyboard_manager) {
self.keyboard_backend.virtual_keyboard = self.keyboard_backend.virtual_keyboard =

View File

@ -83,7 +83,7 @@ static void screencopy_buffer_done(void* data,
enum wv_buffer_type type = WV_BUFFER_UNSPEC; enum wv_buffer_type type = WV_BUFFER_UNSPEC;
#ifdef ENABLE_SCREENCOPY_DMABUF #ifdef ENABLE_SCREENCOPY_DMABUF
if (self->have_linux_dmabuf) { if (self->have_linux_dmabuf && self->enable_linux_dmabuf) {
width = self->dmabuf_width; width = self->dmabuf_width;
height = self->dmabuf_height; height = self->dmabuf_height;
stride = 0; stride = 0;