kdrive/fbdev: dont set DPMS mode repeatedly to the same value

This commit is contained in:
Keith Packard 2001-07-11 16:42:17 +00:00
parent 99fb2eb76d
commit 090a429573

View File

@ -770,14 +770,23 @@ fbdevDPMS (ScreenPtr pScreen, int mode)
{
KdScreenPriv(pScreen);
FbdevPriv *priv = pScreenPriv->card->driver;
static int oldmode = -1;
if (mode == oldmode)
return TRUE;
#ifdef FBIOPUT_POWERMODE
if (ioctl (priv->fd, FBIOPUT_POWERMODE, &mode) >= 0)
{
oldmode = mode;
return TRUE;
}
#endif
#ifdef FBIOBLANK
if (ioctl (priv->fd, FBIOBLANK, mode ? mode + 1 : 0) >= 0)
{
oldmode = mode;
return TRUE;
}
#endif
return FALSE;
}