diff mbox series

[28/29] vmsvga: Introduce new function for reporting device capabilities

Message ID 1533815202-11967-29-git-send-email-liran.alon@oracle.com (mailing list archive)
State New, archived
Headers show
Series : vmsvga: Various fixes and enhancements | expand

Commit Message

Liran Alon Aug. 9, 2018, 11:46 a.m. UTC
From: Leonid Shatz <leonid.shatz@oracle.com>

This in only code refactoring without change in semantics.

Signed-off-by: Leonid Shatz <leonid.shatz@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
---
 hw/display/vmware_vga.c | 45 +++++++++++++++++++++++++--------------------
 1 file changed, 25 insertions(+), 20 deletions(-)

Comments

Gerd Hoffmann Aug. 10, 2018, 9:58 a.m. UTC | #1
> +#ifdef HW_RECT_ACCEL
> +    caps |= SVGA_CAP_RECT_COPY;
> +#endif
> +#ifdef HW_FILL_ACCEL
> +    caps |= SVGA_CAP_RECT_FILL;
> +#endif

Same with these #ifdefs.  I think we should either make them runtime
options or just drop them.

cheers,
  Gerd
diff mbox series

Patch

diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index bd7202833081..389248b4badf 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -479,6 +479,30 @@  static void cursor_update_from_fifo(struct vmsvga_state_s *s)
 #endif
 }
 
+/* Report device capabilities */
+static uint32_t vmsvga_device_caps(struct vmsvga_state_s *s)
+{
+    uint32_t caps = SVGA_CAP_NONE;
+#ifdef HW_RECT_ACCEL
+    caps |= SVGA_CAP_RECT_COPY;
+#endif
+#ifdef HW_FILL_ACCEL
+    caps |= SVGA_CAP_RECT_FILL;
+#endif
+#ifdef HW_MOUSE_ACCEL
+    if (dpy_cursor_define_supported(s->vga.con)) {
+        caps |= SVGA_CAP_ALPHA_CURSOR;
+        caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 |
+                SVGA_CAP_CURSOR_BYPASS;
+    }
+#endif
+    caps |= SVGA_CAP_IRQMASK;
+    caps |= SVGA_CAP_EXTENDED_FIFO;
+    caps |= SVGA_CAP_DISPLAY_TOPOLOGY;
+    caps |= SVGA_CAP_PITCHLOCK;
+    return caps;
+}
+
 static inline bool vmsvga_verify_rect(DisplaySurface *surface,
                                       const char *name,
                                       int x, int y, int w, int h)
@@ -1140,7 +1164,6 @@  static void vmsvga_index_write(void *opaque, uint32_t address, uint32_t index)
 
 static uint32_t vmsvga_value_read(void *opaque, uint32_t address)
 {
-    uint32_t caps;
     struct vmsvga_state_s *s = opaque;
     DisplaySurface *surface = qemu_console_surface(s->vga.con);
     PixelFormat pf;
@@ -1228,25 +1251,7 @@  static uint32_t vmsvga_value_read(void *opaque, uint32_t address)
         break;
 
     case SVGA_REG_CAPABILITIES:
-        caps = SVGA_CAP_NONE;
-#ifdef HW_RECT_ACCEL
-        caps |= SVGA_CAP_RECT_COPY;
-#endif
-#ifdef HW_FILL_ACCEL
-        caps |= SVGA_CAP_RECT_FILL;
-#endif
-#ifdef HW_MOUSE_ACCEL
-        if (dpy_cursor_define_supported(s->vga.con)) {
-            caps |= SVGA_CAP_ALPHA_CURSOR;
-            caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 |
-                    SVGA_CAP_CURSOR_BYPASS;
-        }
-#endif
-        caps |= SVGA_CAP_EXTENDED_FIFO;
-        caps |= SVGA_CAP_IRQMASK;
-        caps |= SVGA_CAP_DISPLAY_TOPOLOGY;
-        caps |= SVGA_CAP_PITCHLOCK;
-        ret = caps;
+        ret = vmsvga_device_caps(s);
         break;
 
     case SVGA_REG_MEM_START: {