From: Leonid Shatz <leonid.sh...@oracle.com> Should not change 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 | 60 ++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 60a672530840..f8c5b64cfd7c 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -607,6 +607,8 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) cmd_start = s->fifo_stop; switch (cmd = vmsvga_fifo_read(s)) { + + /* Implemented commands */ case SVGA_CMD_UPDATE: case SVGA_CMD_UPDATE_VERBOSE: len -= 5; @@ -621,25 +623,6 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) vmsvga_update_rect_delayed(s, x, y, width, height); break; - case SVGA_CMD_RECT_FILL: - len -= 6; - if (len < 0) { - goto rewind; - } - - colour = vmsvga_fifo_read(s); - x = vmsvga_fifo_read(s); - y = vmsvga_fifo_read(s); - width = vmsvga_fifo_read(s); - height = vmsvga_fifo_read(s); -#ifdef HW_FILL_ACCEL - if (vmsvga_fill_rect(s, colour, x, y, width, height) == 0) { - break; - } -#endif - args = 0; - goto badcmd; - case SVGA_CMD_RECT_COPY: len -= 7; if (len < 0) { @@ -704,27 +687,52 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) #endif /* - * Other commands that we at least know the number of arguments - * for so we can avoid FIFO desync if driver uses them illegally. + * Deprecated commands are neither documented in VMware SVGA development kit + * nor in Linux kernel vmware-svga driver source code. + * If they are not encountered in real world scenarious, they should be + * completely removed. */ - case SVGA_CMD_DEFINE_ALPHA_CURSOR: + case SVGA_CMD_RECT_FILL: len -= 6; if (len < 0) { goto rewind; } - vmsvga_fifo_read(s); - vmsvga_fifo_read(s); - vmsvga_fifo_read(s); + + colour = vmsvga_fifo_read(s); x = vmsvga_fifo_read(s); y = vmsvga_fifo_read(s); - args = x * y; + width = vmsvga_fifo_read(s); + height = vmsvga_fifo_read(s); +#ifdef HW_FILL_ACCEL + if (vmsvga_fill_rect(s, colour, x, y, width, height) == 0) { + break; + } +#endif + args = 0; goto badcmd; + + /* + * Unimplemented commands that we gracefully skip their + * arguments so we can avoid FIFO desync + */ case SVGA_CMD_RECT_ROP_FILL: args = 6; goto badcmd; case SVGA_CMD_RECT_ROP_COPY: args = 7; goto badcmd; + case SVGA_CMD_DEFINE_ALPHA_CURSOR: + len -= 6; + if (len < 0) { + goto rewind; + } + vmsvga_fifo_read(s); + vmsvga_fifo_read(s); + vmsvga_fifo_read(s); + x = vmsvga_fifo_read(s); + y = vmsvga_fifo_read(s); + args = x * y; + goto badcmd; case SVGA_CMD_DRAW_GLYPH_CLIPPED: len -= 4; if (len < 0) { -- 1.9.1