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;
bool have_linux_dmabuf;
bool enable_linux_dmabuf;
uint32_t dmabuf_width, dmabuf_height;
uint32_t fourcc;

View File

@ -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',

View File

@ -694,6 +694,7 @@ int wayvnc_usage(FILE* stream, int rc)
"Usage: wayvnc [options] [address [port]]\n"
"\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"
" -k,--keyboard=<layout>[-<variant>] 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 =

View File

@ -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;