qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 21/29] vmsvga: Use AND mask bpp parameter in SVGA_CM


From: Liran Alon
Subject: [Qemu-devel] [PATCH 21/29] vmsvga: Use AND mask bpp parameter in SVGA_CMD_DEFINE_CURSOR
Date: Thu, 9 Aug 2018 14:46:34 +0300

From: Leonid Shatz <address@hidden>

Prefer variable names of cursor structure from VMware SVGA DevKit.
In addition, make sure to use the AND mask bpp parameter in
SVGA_CMD_DEFINE_CURSOR.

Signed-off-by: Leonid Shatz <address@hidden>
Reviewed-by: Darren Kenny <address@hidden>
Signed-off-by: Liran Alon <address@hidden>
---
 hw/display/vmware_vga.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index d79b3400452b..ef2c8bdbf5be 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -616,9 +616,10 @@ struct vmsvga_cursor_definition_s {
     uint32_t width;
     uint32_t height;
     int id;
-    uint32_t bpp;
     int hot_x;
     int hot_y;
+    uint32_t and_mask_bpp; // Value must be 1 or equal to BITS_PER_PIXEL
+    uint32_t xor_mask_bpp; // Value must be 1 or equal to BITS_PER_PIXEL
     uint32_t and_mask[1024];
     uint32_t xor_mask[4096];
 };
@@ -636,7 +637,7 @@ static inline void vmsvga_cursor_define(struct 
vmsvga_state_s *s,
     qc = cursor_alloc(c->width, c->height);
     qc->hot_x = c->hot_x;
     qc->hot_y = c->hot_y;
-    switch (c->bpp) {
+    switch (c->xor_mask_bpp) {
     case 1:
         cursor_set_mono(qc, 0xffffff, 0x000000, (void *)c->xor_mask,
                         1, (void *)c->and_mask);
@@ -659,7 +660,7 @@ static inline void vmsvga_cursor_define(struct 
vmsvga_state_s *s,
         break;
     default:
         fprintf(stderr, "%s: unhandled bpp %d, using fallback cursor\n",
-                __func__, c->bpp);
+                __func__, c->xor_mask_bpp);
         cursor_put(qc);
         qc = cursor_builtin_left_ptr();
     }
@@ -794,15 +795,18 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
             cursor.hot_y = vmsvga_fifo_read(s);
             cursor.width = x = vmsvga_fifo_read(s);
             cursor.height = y = vmsvga_fifo_read(s);
-            vmsvga_fifo_read(s);
-            cursor.bpp = vmsvga_fifo_read(s);
+            cursor.and_mask_bpp = vmsvga_fifo_read(s);
+            cursor.xor_mask_bpp = vmsvga_fifo_read(s);
 
-            args = SVGA_BITMAP_SIZE(x, y) + SVGA_PIXMAP_SIZE(x, y, cursor.bpp);
+            args = SVGA_PIXMAP_SIZE(x, y, cursor.and_mask_bpp) +
+                SVGA_PIXMAP_SIZE(x, y, cursor.xor_mask_bpp);
             if (cursor.width > 256
                 || cursor.height > 256
-                || cursor.bpp > 32
-                || SVGA_BITMAP_SIZE(x, y) > ARRAY_SIZE(cursor.and_mask)
-                || SVGA_PIXMAP_SIZE(x, y, cursor.bpp)
+                || cursor.and_mask_bpp > 32
+                || cursor.xor_mask_bpp > 32
+                || SVGA_PIXMAP_SIZE(x, y, cursor.and_mask_bpp)
+                    > ARRAY_SIZE(cursor.and_mask)
+                || SVGA_PIXMAP_SIZE(x, y, cursor.xor_mask_bpp)
                     > ARRAY_SIZE(cursor.xor_mask)) {
                     goto badcmd;
             }
@@ -812,10 +816,10 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
                 goto rewind;
             }
 
-            for (args = 0; args < SVGA_BITMAP_SIZE(x, y); args++) {
+            for (args = 0; args < SVGA_PIXMAP_SIZE(x, y, cursor.and_mask_bpp); 
args++) {
                 cursor.and_mask[args] = vmsvga_fifo_read_raw(s);
             }
-            for (args = 0; args < SVGA_PIXMAP_SIZE(x, y, cursor.bpp); args++) {
+            for (args = 0; args < SVGA_PIXMAP_SIZE(x, y, cursor.xor_mask_bpp); 
args++) {
                 cursor.xor_mask[args] = vmsvga_fifo_read_raw(s);
             }
 #ifdef HW_MOUSE_ACCEL
-- 
1.9.1




reply via email to

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