os: add a generic -verbose option instead of making each server add its own

Replaces Xwayland's server-specific implementation, but leaves Xorg's
since it sets global variables in the xfree86 ddx layer.  Also leaves
Xephyr's differently-spelled "-verbosity" for backwards compatibility.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2131>
This commit is contained in:
Alan Coopersmith 2026-02-22 17:55:45 -08:00 committed by Marge Bot
parent 12791f5027
commit 2e338890ee
5 changed files with 29 additions and 27 deletions

View file

@ -282,12 +282,14 @@ ddxProcessArgument(int argc, char **argv, int i)
ephyrFuncs.finiAccel = ephyrDrawFini;
return 1;
}
/* Xephyr adopted a different spelling before the common -verbose option
* was added, so it's been left for compatibility */
else if (!strcmp(argv[i], "-verbosity")) {
if (i + 1 < argc && argv[i + 1][0] != '-') {
int verbosity = atoi(argv[i + 1]);
LogSetParameter(XLOG_VERBOSITY, verbosity);
EPHYR_LOG("set verbosiry to %d\n", verbosity);
EPHYR_LOG("set verbosity to %d\n", verbosity);
return 2;
}
else {

View file

@ -154,15 +154,6 @@ buffers to the Wayland server.
This option is not compatible with \fI-glamor\fP option.
.TP 8
.BR \-verbose " [\fIn\fP]"
Sets the verbosity level for information printed on stderr. If the
.I n
value isn't supplied, each occurrence of this option increments the
verbosity level. When the
.I n
value is supplied, the verbosity level is set to that value. The default
verbosity level is 0.
.TP 8
.B \-version
Show the server version and exit.
.TP 8

View file

@ -110,7 +110,6 @@ ddxUseMsg(void)
#ifdef XWL_HAS_GLAMOR
ErrorF("-glamor [gl|es|off] use given API for Glamor acceleration. Incompatible with -shm option\n");
#endif
ErrorF("-verbose [n] verbose startup messages\n");
ErrorF("-version show the server version and exit\n");
ErrorF("-noTouchPointerEmulation disable touch pointer emulation\n");
ErrorF("-force-xrandr-emulation force non-native modes to be exposed when viewporter is not exposed by the compositor\n");
@ -126,7 +125,6 @@ static int init_fd = -1;
static int wm_fd = -1;
static int listen_fds[5] = { -1, -1, -1, -1, -1 };
static int listen_fd_count = 0;
static int verbosity = 0;
static void
xwl_show_version(void)
@ -222,21 +220,6 @@ ddxProcessArgument(int argc, char *argv[], int i)
return 2;
}
#endif
else if (strcmp(argv[i], "-verbose") == 0) {
if (++i < argc && argv[i]) {
char *end;
long val;
val = strtol(argv[i], &end, 0);
if (*end == '\0') {
verbosity = val;
LogSetParameter(XLOG_VERBOSITY, verbosity);
return 2;
}
}
LogSetParameter(XLOG_VERBOSITY, ++verbosity);
return 1;
}
else if (strcmp(argv[i], "-version") == 0) {
xwl_show_version();
exit(0);

View file

@ -309,6 +309,15 @@ sets video-off screen-saver preference.
.B \-v
sets video-on screen-saver preference.
.TP 8
.BR \-verbose " [\fIn\fP]"
Sets the verbosity level for information printed on stderr. If the
.I n
value isn't supplied, each occurrence of this option increments the
verbosity level. When the
.I n
value is supplied, the verbosity level is set to that value. The default
verbosity level is 0.
.TP 8
.B \-wr
sets the default root window to solid white instead of the standard root weave
pattern.

View file

@ -572,6 +572,7 @@ UseMsg(void)
ErrorF("ttyxx server started from init on /dev/ttyxx\n");
ErrorF("v video blanking for screen-saver\n");
ErrorF("-v screen-saver without video blanking\n");
ErrorF("-verbose [n] verbose startup messages\n");
ErrorF("-wr create root window with white background\n");
ErrorF("-maxbigreqsize set maximal bigrequest size \n");
#ifdef PANORAMIX
@ -662,6 +663,7 @@ void
ProcessCommandLine(int argc, char *argv[])
{
int i, skip;
int verbosity = 0;
defaultKeyboardControl.autoRepeat = TRUE;
@ -948,6 +950,21 @@ ProcessCommandLine(int argc, char *argv[])
defaultScreenSaverBlanking = PreferBlanking;
else if (strcmp(argv[i], "-v") == 0)
defaultScreenSaverBlanking = DontPreferBlanking;
else if (strcmp(argv[i], "-verbose") == 0) {
int n = i + 1; /* next argument */
verbosity++;
if (n < argc && argv[n] && argv[n][0] != '-') {
char *end;
long val;
val = strtol(argv[n], &end, 0);
if (*end == '\0') {
verbosity = val;
i = n;
}
}
LogSetParameter(XLOG_VERBOSITY, verbosity);
}
else if (strcmp(argv[i], "-wr") == 0)
whiteRoot = TRUE;
else if (strcmp(argv[i], "-background") == 0) {