[PATCH] DDX/fbdevhw: Make error message on failed FBIOBLANK less noisy and scarey

Egbert Eich eich at freedesktop.org
Mon Aug 12 09:22:48 PDT 2013


Warn only once on repeated occurrences of the same errno when the
FBIOBLANK ioctl fails. Change the status of the message from error
to info as this is ioctl is not supported for all fbdev drivers.
Also give a better description to make the user happier.

Signed-off-by: Egbert Eich <eich at freedesktop.org>
---
 hw/xfree86/fbdevhw/fbdevhw.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index cbb4093..487a1dc 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -829,6 +829,7 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
 {
     fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
     unsigned long fbmode;
+    static int last_errno = 0;
 
     if (!pScrn->vtSema)
         return;
@@ -850,9 +851,13 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
         return;
     }
 
-    if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *) fbmode))
-        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                   "FBIOBLANK: %s\n", strerror(errno));
+    if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *) fbmode) &&
+        last_errno != errno) {
+        xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                   "FBIOBLANK: %s (Screen blanking not supported "
+                   "by kernel)\n", strerror(errno));
+    }
+    last_errno = errno;
 }
 
 Bool
@@ -861,15 +866,18 @@ fbdevHWSaveScreen(ScreenPtr pScreen, int mode)
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
     unsigned long unblank;
+    static int last_errno = 0;
 
     if (!pScrn->vtSema)
         return TRUE;
 
     unblank = xf86IsUnblank(mode);
 
-    if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *) (1 - unblank))) {
-        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                   "FBIOBLANK: %s\n", strerror(errno));
+    if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *) (1 - unblank)) &&
+	    last_errno != errno) {
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                       "FBIOBLANK: (Screen blanking not supported by kernel)%s\n", strerror(errno));
+            last_errno = errno;
         return FALSE;
     }
 
-- 
1.8.1.4



More information about the xorg-devel mailing list