qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Rate limit vnc_write_pixels_generic


From: Philipp Hahn
Subject: [Qemu-devel] [PATCH] Rate limit vnc_write_pixels_generic
Date: Mon, 7 May 2012 15:58:21 +0200

Only print the error message once per change and also include the actual
unsupported color depth in bytes per pixel in the error message.

Signed-off-by: Philipp Hahn <address@hidden>
---
 ui/vnc.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index deb9ecd..9dcff9b 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -641,6 +641,7 @@ static void vnc_write_pixels_generic(VncState *vs, struct 
PixelFormat *pf,
                                      void *pixels1, int size)
 {
     uint8_t buf[4];
+    static uint8_t last_error_bpp = 4; /* any of the supported formats */
 
     if (pf->bytes_per_pixel == 4) {
         uint32_t *pixels = pixels1;
@@ -667,7 +668,12 @@ static void vnc_write_pixels_generic(VncState *vs, struct 
PixelFormat *pf,
             vnc_write(vs, buf, vs->clientds.pf.bytes_per_pixel);
         }
     } else {
-        fprintf(stderr, "vnc_write_pixels_generic: VncState color depth not 
supported\n");
+        if (last_error_bpp != pf->bytes_per_pixel) {
+            last_error_bpp = pf->bytes_per_pixel;
+            fprintf(stderr,
+                    "vnc_write_pixels_generic: VncState color depth %d not 
supported\n",
+                    pf->bytes_per_pixel);
+        }
     }
 }
 
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]