diff mbox series

[18/29] vmsvga: Add support for SVGA_IRQFLAG_FIFO_PROGRESS

Message ID 1533815202-11967-19-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
If vmsvga supports interrupts (SVGA_CAP_IRQMASK), some guests wait for
FIFO to become not full by sleeping until FIFO_PROGRESS interrupt occurs.
This is the most efficient thing to do when the FIFO fills up.

To support these guests, add support for SVGA_IRQFLAG_FIFO_PROGRESS.

See usage example by guest in VMware SVGA development kit
SVGAFIFOFull().

Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
---
 hw/display/vmware_vga.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index 597051ec5c92..dc5f4681f0d3 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -731,6 +731,7 @@  static void vmsvga_fifo_run(struct vmsvga_state_s *s)
     uint32_t cmd_start;
     bool cmd_ignored;
     bool irq_pending = false;
+    bool fifo_progress = false;
 
     len = vmsvga_fifo_length(s);
     while (len > 0 && --maxloop > 0) {
@@ -930,6 +931,15 @@  static void vmsvga_fifo_run(struct vmsvga_state_s *s)
             s->fifo[SVGA_FIFO_STOP] = cpu_to_le32(s->fifo_stop);
             break;
         }
+
+        if (s->fifo_stop != cmd_start)
+            fifo_progress = true;
+    }
+
+    if ((s->irq_mask & SVGA_IRQFLAG_FIFO_PROGRESS) &&
+        fifo_progress) {
+        s->irq_status |= SVGA_IRQFLAG_FIFO_PROGRESS;
+        irq_pending = true;
     }
 
     s->syncing = 0;