xwayland: allow "-eglstream" option

The command line option "-eglstream" used to enable EGLStream support
for NVidia GPU was made available only when Xwayland was built with
EGLStream support enabled.

Wayland compositors who spawn Xwayland have no easy way to tell whether
or not Xwayland was built with EGLStream support enabled, and adding
"-eglstream" command line option to Xwayland when it wasn't built with
EGLStream support would prevent Xwayland from starting (“Unrecognized
option” error).

Make sure we support the command line option "-eglstream" regardless of
EGLStream support in Xwayland. Obviously, if Xwayland was built without
EGLStream support, this has no effect.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
Olivier Fourdan 2018-06-05 19:37:54 +02:00 committed by Adam Jackson
parent 707d0f912b
commit 06c31e782e

View File

@ -96,9 +96,7 @@ ddxUseMsg(void)
ErrorF("-rootless run rootless, requires wm support\n"); ErrorF("-rootless run rootless, requires wm support\n");
ErrorF("-wm fd create X client for wm on given fd\n"); ErrorF("-wm fd create X client for wm on given fd\n");
ErrorF("-listen fd add give fd as a listen socket\n"); ErrorF("-listen fd add give fd as a listen socket\n");
#ifdef XWL_HAS_EGLSTREAM
ErrorF("-eglstream use eglstream backend for nvidia GPUs\n"); ErrorF("-eglstream use eglstream backend for nvidia GPUs\n");
#endif
} }
int int
@ -117,11 +115,9 @@ ddxProcessArgument(int argc, char *argv[], int i)
else if (strcmp(argv[i], "-shm") == 0) { else if (strcmp(argv[i], "-shm") == 0) {
return 1; return 1;
} }
#ifdef XWL_HAS_EGLSTREAM
else if (strcmp(argv[i], "-eglstream") == 0) { else if (strcmp(argv[i], "-eglstream") == 0) {
return 1; return 1;
} }
#endif
return 0; return 0;
} }
@ -988,11 +984,13 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
else if (strcmp(argv[i], "-shm") == 0) { else if (strcmp(argv[i], "-shm") == 0) {
xwl_screen->glamor = 0; xwl_screen->glamor = 0;
} }
#ifdef XWL_HAS_EGLSTREAM
else if (strcmp(argv[i], "-eglstream") == 0) { else if (strcmp(argv[i], "-eglstream") == 0) {
#ifdef XWL_HAS_EGLSTREAM
use_eglstreams = TRUE; use_eglstreams = TRUE;
} #else
ErrorF("xwayland glamor: this build does not have EGLStream support\n");
#endif #endif
}
} }
#ifdef XWL_HAS_GLAMOR #ifdef XWL_HAS_GLAMOR