dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0012-vmware-vga-use-vmsvga_verify_rect-in-vmsvga_update_r.patch

725f84
From: Gerd Hoffmann <kraxel@redhat.com>
725f84
Date: Wed, 29 Oct 2014 12:56:08 +0100
725f84
Subject: [PATCH] vmware-vga: use vmsvga_verify_rect in vmsvga_update_rect
725f84
725f84
Switch vmsvga_update_rect over to use vmsvga_verify_rect.  Slight change
725f84
in behavior:  We don't try to automatically fixup rectangles any more.
725f84
In case we find invalid update requests we'll do a full-screen update
725f84
instead.
725f84
725f84
Cc: qemu-stable@nongnu.org
725f84
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
725f84
Reviewed-by: Don Koch <dkoch@verizon.com>
725f84
---
725f84
 hw/display/vmware_vga.c | 32 ++++----------------------------
725f84
 1 file changed, 4 insertions(+), 28 deletions(-)
725f84
725f84
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
725f84
index f0e487f..718746e 100644
725f84
--- a/hw/display/vmware_vga.c
725f84
+++ b/hw/display/vmware_vga.c
725f84
@@ -356,36 +356,12 @@ static inline void vmsvga_update_rect(struct vmsvga_state_s *s,
725f84
     uint8_t *src;
725f84
     uint8_t *dst;
725f84
 
725f84
-    if (x < 0) {
725f84
-        fprintf(stderr, "%s: update x was < 0 (%d)\n", __func__, x);
725f84
-        w += x;
725f84
+    if (!vmsvga_verify_rect(surface, __func__, x, y, w, h)) {
725f84
+        /* go for a fullscreen update as fallback */
725f84
         x = 0;
725f84
-    }
725f84
-    if (w < 0) {
725f84
-        fprintf(stderr, "%s: update w was < 0 (%d)\n", __func__, w);
725f84
-        w = 0;
725f84
-    }
725f84
-    if (x + w > surface_width(surface)) {
725f84
-        fprintf(stderr, "%s: update width too large x: %d, w: %d\n",
725f84
-                __func__, x, w);
725f84
-        x = MIN(x, surface_width(surface));
725f84
-        w = surface_width(surface) - x;
725f84
-    }
725f84
-
725f84
-    if (y < 0) {
725f84
-        fprintf(stderr, "%s: update y was < 0 (%d)\n",  __func__, y);
725f84
-        h += y;
725f84
         y = 0;
725f84
-    }
725f84
-    if (h < 0) {
725f84
-        fprintf(stderr, "%s: update h was < 0 (%d)\n",  __func__, h);
725f84
-        h = 0;
725f84
-    }
725f84
-    if (y + h > surface_height(surface)) {
725f84
-        fprintf(stderr, "%s: update height too large y: %d, h: %d\n",
725f84
-                __func__, y, h);
725f84
-        y = MIN(y, surface_height(surface));
725f84
-        h = surface_height(surface) - y;
725f84
+        w = surface_width(surface);
725f84
+        h = surface_height(surface);
725f84
     }
725f84
 
725f84
     bypl = surface_stride(surface);