qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [4857] Eliminate spurous screen updates.


From: Paul Brook
Subject: [Qemu-devel] [4857] Eliminate spurous screen updates.
Date: Mon, 07 Jul 2008 23:01:26 +0000

Revision: 4857
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4857
Author:   pbrook
Date:     2008-07-07 23:01:25 +0000 (Mon, 07 Jul 2008)

Log Message:
-----------
Eliminate spurous screen updates.

Modified Paths:
--------------
    trunk/hw/ssd0303.c
    trunk/hw/ssd0323.c

Modified: trunk/hw/ssd0303.c
===================================================================
--- trunk/hw/ssd0303.c  2008-07-07 20:25:41 UTC (rev 4856)
+++ trunk/hw/ssd0303.c  2008-07-07 23:01:25 UTC (rev 4857)
@@ -203,55 +203,57 @@
     int dest_width;
     uint8_t mask;
 
-    if (s->redraw) {
-        switch (s->ds->depth) {
-        case 0:
-            return;
-        case 15:
-            dest_width = 2;
-            break;
-        case 16:
-            dest_width = 2;
-            break;
-        case 24:
-            dest_width = 3;
-            break;
-        case 32:
-            dest_width = 4;
-            break;
-        default:
-            BADF("Bad color depth\n");
-            return;
+    if (!s->redraw)
+        return;
+
+    switch (s->ds->depth) {
+    case 0:
+        return;
+    case 15:
+        dest_width = 2;
+        break;
+    case 16:
+        dest_width = 2;
+        break;
+    case 24:
+        dest_width = 3;
+        break;
+    case 32:
+        dest_width = 4;
+        break;
+    default:
+        BADF("Bad color depth\n");
+        return;
+    }
+    dest_width *= MAGNIFY;
+    memset(colortab, 0xff, dest_width);
+    memset(colortab + dest_width, 0, dest_width);
+    if (s->flash) {
+        colors[0] = colortab;
+        colors[1] = colortab;
+    } else if (s->inverse) {
+        colors[0] = colortab;
+        colors[1] = colortab + dest_width;
+    } else {
+        colors[0] = colortab + dest_width;
+        colors[1] = colortab;
+    }
+    dest = s->ds->data;
+    for (y = 0; y < 16; y++) {
+        line = (y + s->start_line) & 63;
+        src = s->framebuffer + 132 * (line >> 3) + 36;
+        mask = 1 << (line & 7);
+        for (x = 0; x < 96; x++) {
+            memcpy(dest, colors[(*src & mask) != 0], dest_width);
+            dest += dest_width;
+            src++;
         }
-        dest_width *= MAGNIFY;
-        memset(colortab, 0xff, dest_width);
-        memset(colortab + dest_width, 0, dest_width);
-        if (s->flash) {
-            colors[0] = colortab;
-            colors[1] = colortab;
-        } else if (s->inverse) {
-            colors[0] = colortab;
-            colors[1] = colortab + dest_width;
-        } else {
-            colors[0] = colortab + dest_width;
-            colors[1] = colortab;
+        for (x = 1; x < MAGNIFY; x++) {
+            memcpy(dest, dest - dest_width * 96, dest_width * 96);
+            dest += dest_width * 96;
         }
-        dest = s->ds->data;
-        for (y = 0; y < 16; y++) {
-            line = (y + s->start_line) & 63;
-            src = s->framebuffer + 132 * (line >> 3) + 36;
-            mask = 1 << (line & 7);
-            for (x = 0; x < 96; x++) {
-                memcpy(dest, colors[(*src & mask) != 0], dest_width);
-                dest += dest_width;
-                src++;
-            }
-            for (x = 1; x < MAGNIFY; x++) {
-                memcpy(dest, dest - dest_width * 96, dest_width * 96);
-                dest += dest_width * 96;
-            }
-        }
     }
+    s->redraw = 0;
     dpy_update(s->ds, 0, 0, 96 * MAGNIFY, 16 * MAGNIFY);
 }
 

Modified: trunk/hw/ssd0323.c
===================================================================
--- trunk/hw/ssd0323.c  2008-07-07 20:25:41 UTC (rev 4856)
+++ trunk/hw/ssd0323.c  2008-07-07 23:01:25 UTC (rev 4857)
@@ -184,78 +184,80 @@
     char *p;
     int dest_width;
 
-    if (s->redraw) {
+    if (!s->redraw)
+        return;
+
+    switch (s->ds->depth) {
+    case 0:
+        return;
+    case 15:
+        dest_width = 2;
+        break;
+    case 16:
+        dest_width = 2;
+        break;
+    case 24:
+        dest_width = 3;
+        break;
+    case 32:
+        dest_width = 4;
+        break;
+    default:
+        BADF("Bad color depth\n");
+        return;
+    }
+    p = colortab;
+    for (i = 0; i < 16; i++) {
+        int n;
+        colors[i] = p;
         switch (s->ds->depth) {
-        case 0:
-            return;
         case 15:
-            dest_width = 2;
+            n = i * 2 + (i >> 3);
+            p[0] = n | (n << 5);
+            p[1] = (n << 2) | (n >> 3);
             break;
         case 16:
-            dest_width = 2;
+            n = i * 2 + (i >> 3);
+            p[0] = n | (n << 6) | ((n << 1) & 0x20);
+            p[1] = (n << 3) | (n >> 2);
             break;
         case 24:
-            dest_width = 3;
-            break;
         case 32:
-            dest_width = 4;
+            n = (i << 4) | i;
+            p[0] = p[1] = p[2] = n;
             break;
         default:
             BADF("Bad color depth\n");
             return;
         }
-        p = colortab;
-        for (i = 0; i < 16; i++) {
-            int n;
-            colors[i] = p;
-            switch (s->ds->depth) {
-            case 15:
-                n = i * 2 + (i >> 3);
-                p[0] = n | (n << 5);
-                p[1] = (n << 2) | (n >> 3);
-                break;
-            case 16:
-                n = i * 2 + (i >> 3);
-                p[0] = n | (n << 6) | ((n << 1) & 0x20);
-                p[1] = (n << 3) | (n >> 2);
-                break;
-            case 24:
-            case 32:
-                n = (i << 4) | i;
-                p[0] = p[1] = p[2] = n;
-                break;
-            default:
-                BADF("Bad color depth\n");
-                return;
+        p += dest_width;
+    }
+    /* TODO: Implement row/column remapping.  */
+    dest = s->ds->data;
+    for (y = 0; y < 64; y++) {
+        line = y;
+        src = s->framebuffer + 64 * line;
+        for (x = 0; x < 64; x++) {
+            int val;
+            val = *src >> 4;
+            for (i = 0; i < MAGNIFY; i++) {
+                memcpy(dest, colors[val], dest_width);
+                dest += dest_width;
             }
-            p += dest_width;
-        }
-        /* TODO: Implement row/column remapping.  */
-        dest = s->ds->data;
-        for (y = 0; y < 64; y++) {
-            line = y;
-            src = s->framebuffer + 64 * line;
-            for (x = 0; x < 64; x++) {
-                int val;
-                val = *src >> 4;
-                for (i = 0; i < MAGNIFY; i++) {
-                    memcpy(dest, colors[val], dest_width);
-                    dest += dest_width;
-                }
-                val = *src & 0xf;
-                for (i = 0; i < MAGNIFY; i++) {
-                    memcpy(dest, colors[val], dest_width);
-                    dest += dest_width;
-                }
-                src++;
+            val = *src & 0xf;
+            for (i = 0; i < MAGNIFY; i++) {
+                memcpy(dest, colors[val], dest_width);
+                dest += dest_width;
             }
-            for (i = 1; i < MAGNIFY; i++) {
-                memcpy(dest, dest - dest_width * MAGNIFY * 128,
-                       dest_width * 128 * MAGNIFY);
-                dest += dest_width * 128 * MAGNIFY;
-            }
+            src++;
         }
+        for (i = 1; i < MAGNIFY; i++) {
+            memcpy(dest, dest - dest_width * MAGNIFY * 128,
+                   dest_width * 128 * MAGNIFY);
+            dest += dest_width * 128 * MAGNIFY;
+        }
     }
+    s->redraw = 0;
     dpy_update(s->ds, 0, 0, 128 * MAGNIFY, 64 * MAGNIFY);
 }
 






reply via email to

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