From: Leonid Shatz <leonid.sh...@oracle.com> This in only code refactoring without change in semantics.
Signed-off-by: Leonid Shatz <leonid.sh...@oracle.com> Reviewed-by: Darren Kenny <darren.ke...@oracle.com> Signed-off-by: Liran Alon <liran.a...@oracle.com> --- hw/display/vmware_vga.c | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) 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: { -- 1.9.1