|
13 | 13 | #include "mini-gdbstub/include/gdbstub.h" |
14 | 14 | #include "riscv.h" |
15 | 15 | #include "riscv_private.h" |
| 16 | +#include "virgl.h" |
16 | 17 | #include "window.h" |
17 | 18 |
|
18 | 19 | #define PRIV(x) ((emu_state_t *) x->priv) |
19 | 20 |
|
| 21 | +extern const struct window_backend g_window; |
| 22 | + |
20 | 23 | /* Define fetch separately since it is simpler (fixed width, already checked |
21 | 24 | * alignment, only main RAM is executable). |
22 | 25 | */ |
@@ -760,19 +763,23 @@ static int semu_init(emu_state_t *emu, int argc, char **argv) |
760 | 763 | fprintf(stderr, "No virtio-snd functioned\n"); |
761 | 764 | emu->vsnd.ram = emu->ram; |
762 | 765 | #endif |
763 | | -#if SEMU_HAS(VIRTIOGPU) |
764 | | - emu->vgpu.ram = emu->ram; |
765 | | - virtio_gpu_init(&(emu->vgpu)); |
766 | | - virtio_gpu_add_scanout(&(emu->vgpu), 1024, 768); |
767 | | - window_init(); |
768 | | -#endif |
769 | 766 | #if SEMU_HAS(VIRTIOINPUT) |
770 | 767 | emu->vkeyboard.ram = emu->ram; |
771 | 768 | virtio_input_init(&(emu->vkeyboard)); |
772 | 769 |
|
773 | 770 | emu->vmouse.ram = emu->ram; |
774 | 771 | virtio_input_init(&(emu->vmouse)); |
775 | 772 | #endif |
| 773 | +#if SEMU_HAS(VIRTIOGPU) |
| 774 | + emu->vgpu.ram = emu->ram; |
| 775 | + virtio_gpu_init(&(emu->vgpu)); |
| 776 | + virtio_gpu_add_scanout(&(emu->vgpu), 1024, 768); |
| 777 | + |
| 778 | + g_window.window_init(); |
| 779 | +#endif |
| 780 | +#if SEMU_HAS(VIRGL) |
| 781 | + semu_virgl_init(&(emu->vgpu)); |
| 782 | +#endif |
776 | 783 |
|
777 | 784 | emu->peripheral_update_ctr = 0; |
778 | 785 | emu->debug = debug; |
@@ -823,6 +830,10 @@ static int semu_step(emu_state_t *emu) |
823 | 830 | if (emu->vmouse.InterruptStatus) |
824 | 831 | emu_update_vinput_mouse_interrupts(vm); |
825 | 832 | #endif |
| 833 | + |
| 834 | +#if SEMU_HAS(VIRGL) |
| 835 | + semu_virgl_fence_poll(); |
| 836 | +#endif |
826 | 837 | } |
827 | 838 |
|
828 | 839 | emu_update_timer_interrupt(vm->hart[i]); |
|
0 commit comments