peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0014-vmware-vga-use-vmsvga_verify_rect-in-vmsvga_fill_rec.patch

725f84
From: Gerd Hoffmann <kraxel@redhat.com>
725f84
Date: Wed, 29 Oct 2014 12:56:10 +0100
725f84
Subject: [PATCH] vmware-vga: use vmsvga_verify_rect in vmsvga_fill_rect
725f84
725f84
Add verification to vmsvga_fill_rect, re-enable HW_FILL_ACCEL.
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 | 17 ++++++++++-------
725f84
 1 file changed, 10 insertions(+), 7 deletions(-)
725f84
725f84
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
725f84
index c2e0a43..d44e3e8 100644
725f84
--- a/hw/display/vmware_vga.c
725f84
+++ b/hw/display/vmware_vga.c
725f84
@@ -30,9 +30,7 @@
725f84
 
725f84
 #undef VERBOSE
725f84
 #define HW_RECT_ACCEL
725f84
-#if 0
725f84
 #define HW_FILL_ACCEL
725f84
-#endif
725f84
 #define HW_MOUSE_ACCEL
725f84
 
725f84
 #include "vga_int.h"
725f84
@@ -444,7 +442,7 @@ static inline int vmsvga_copy_rect(struct vmsvga_state_s *s,
725f84
 #endif
725f84
 
725f84
 #ifdef HW_FILL_ACCEL
725f84
-static inline void vmsvga_fill_rect(struct vmsvga_state_s *s,
725f84
+static inline int vmsvga_fill_rect(struct vmsvga_state_s *s,
725f84
                 uint32_t c, int x, int y, int w, int h)
725f84
 {
725f84
     DisplaySurface *surface = qemu_console_surface(s->vga.con);
725f84
@@ -457,6 +455,10 @@ static inline void vmsvga_fill_rect(struct vmsvga_state_s *s,
725f84
     uint8_t *src;
725f84
     uint8_t col[4];
725f84
 
725f84
+    if (!vmsvga_verify_rect(surface, __func__, x, y, w, h)) {
725f84
+        return -1;
725f84
+    }
725f84
+
725f84
     col[0] = c;
725f84
     col[1] = c >> 8;
725f84
     col[2] = c >> 16;
725f84
@@ -481,6 +483,7 @@ static inline void vmsvga_fill_rect(struct vmsvga_state_s *s,
725f84
     }
725f84
 
725f84
     vmsvga_update_rect_delayed(s, x, y, w, h);
725f84
+    return 0;
725f84
 }
725f84
 #endif
725f84
 
725f84
@@ -613,12 +616,12 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
725f84
             width = vmsvga_fifo_read(s);
725f84
             height = vmsvga_fifo_read(s);
725f84
 #ifdef HW_FILL_ACCEL
725f84
-            vmsvga_fill_rect(s, colour, x, y, width, height);
725f84
-            break;
725f84
-#else
725f84
+            if (vmsvga_fill_rect(s, colour, x, y, width, height) == 0) {
725f84
+                break;
725f84
+            }
725f84
+#endif
725f84
             args = 0;
725f84
             goto badcmd;
725f84
-#endif
725f84
 
725f84
         case SVGA_CMD_RECT_COPY:
725f84
             len -= 7;