Patch by Mike A. Harris Currently, when a screensaver kicks in, it calls xf86GetModeLine() which causes the Vidmode extension to write out a debugging log message of what the current modeline is. These messages are generally only useful to an X11 developer who is debugging the extension itself, or to an application developer who is developing an application which uses the vidmode extension to get/set the video mode, however they're not very useful for end users. The current default Xvidmode verbosity causes the X server to write overly detailed video modeline information to the X server log file whenever any application uses the extension to get, set, or delete modelines. This causes a problem for laptop users on battery power with their hard disks set to power saving mode, because the hard disk will power down, then later the screensaver kicks in, which calls xf86GetModeLine(), which causes the log message to get written out, which causes the hard disk to be powered back up. Having these messages off by default solves this problem for laptop users, and seems to make the most sense considering how useful they are in general. By changing the default log level for these messages, developers who need to see these for debugging purposes can increase their X server verbosity level and still see them, so no functionality is lost. This patch lowers the default verbosity of the X server's Xvidmode extension log file messages, in order to stop Xvidmode from writing out non-critical log messages to the X server log whenever an application uses this extension. Fixes reported bug/RFE: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=128305 Reported upstream to X.Org: http://freedesktop.org/bugzilla/show_bug.cgi?id=1552 --- xc/programs/Xserver/Xext/xf86vmode.c.vidmode-change-verbosity 2004-10-06 23:38:43.000000000 -0400 +++ xc/programs/Xserver/Xext/xf86vmode.c 2004-10-06 23:50:43.000000000 -0400 @@ -52,6 +52,8 @@ #include "xf86_ansic.h" #endif +#define DEFAULT_XF86VIDMODE_VERBOSITY 3 + static int VidModeErrorBase; static int VidModeGeneration = 0; static int VidModeClientPrivateIndex; @@ -468,7 +470,7 @@ rep.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL); rep.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS); - if (xf86GetVerbosity() > 1) { + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("GetModeLine - scrn: %d clock: %ld\n", stuff->screen, (unsigned long)rep.dotclock); ErrorF("GetModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n", @@ -676,7 +678,7 @@ stuff->after_vtotal = oldstuff->after_vtotal; stuff->after_flags = oldstuff->after_flags; } - if (xf86GetVerbosity() > 1) { + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("AddModeLine - scrn: %d clock: %ld\n", (int)stuff->screen, (unsigned long)stuff->dotclock); ErrorF("AddModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n", @@ -787,7 +789,7 @@ VidModeAddModeline(stuff->screen, mode); - if (xf86GetVerbosity() > 1) + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) ErrorF("AddModeLine - Succeeded\n"); return client->noClientException; } @@ -824,7 +826,7 @@ stuff->flags = oldstuff->flags; stuff->privsize = oldstuff->privsize; } - if (xf86GetVerbosity() > 1) { + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("DeleteModeLine - scrn: %d clock: %ld\n", (int)stuff->screen, (unsigned long)stuff->dotclock); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", @@ -843,7 +845,7 @@ len = client->req_len - (sizeof(xXF86VidModeDeleteModeLineReq) >> 2); } if (len != stuff->privsize) { - if (xf86GetVerbosity() > 1) { + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("req_len = %ld, sizeof(Req) = %d, privsize = %ld, " "len = %d, length = %d\n", (unsigned long)client->req_len, @@ -859,7 +861,7 @@ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock)) return BadValue; - if (xf86GetVerbosity() > 1) { + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("Checking against clock: %d (%d)\n", VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", @@ -882,7 +884,7 @@ return BadValue; do { - if (xf86GetVerbosity() > 1) { + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("Checking against clock: %d (%d)\n", VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", @@ -900,7 +902,7 @@ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) && MODEMATCH(mode, stuff)) { VidModeDeleteModeline(stuff->screen, mode); - if (xf86GetVerbosity()) + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) ErrorF("DeleteModeLine - Succeeded\n"); return(client->noClientException); } @@ -940,7 +942,7 @@ stuff->flags = oldstuff->flags; stuff->privsize = oldstuff->privsize; } - if (xf86GetVerbosity() > 1) { + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n", (int)stuff->screen, stuff->hdisplay, stuff->hsyncstart, stuff->hsyncend, stuff->htotal); @@ -1028,7 +1030,7 @@ VidModeSetCrtcForMode(stuff->screen, mode); VidModeSwitchMode(stuff->screen, mode); - if (xf86GetVerbosity() > 1) + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) ErrorF("ModModeLine - Succeeded\n"); return(client->noClientException); } @@ -1066,7 +1068,7 @@ stuff->flags = oldstuff->flags; stuff->privsize = oldstuff->privsize; } - if (xf86GetVerbosity() > 1) { + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("ValidateModeLine - scrn: %d clock: %ld\n", (int)stuff->screen, (unsigned long)stuff->dotclock); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", @@ -1146,7 +1148,7 @@ swapl(&rep.status, n); } WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply), (char *)&rep); - if (xf86GetVerbosity() > 1) + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) ErrorF("ValidateModeLine - Succeeded (status = %d)\n", status); return(client->noClientException); } @@ -1200,7 +1202,7 @@ stuff->flags = oldstuff->flags; stuff->privsize = oldstuff->privsize; } - if (xf86GetVerbosity() > 1) { + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("SwitchToMode - scrn: %d clock: %ld\n", (int)stuff->screen, (unsigned long)stuff->dotclock); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", @@ -1235,7 +1237,7 @@ return BadValue; do { - if (xf86GetVerbosity() > 1) { + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("Checking against clock: %d (%d)\n", VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", @@ -1256,7 +1258,7 @@ if (!VidModeSwitchMode(stuff->screen, mode)) return BadValue; - if (xf86GetVerbosity() > 1) + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) ErrorF("SwitchToMode - Succeeded\n"); return(client->noClientException); }