@@ -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: {