|
11 | 11 | #include "device.h" |
12 | 12 | #include "riscv.h" |
13 | 13 | #include "riscv_private.h" |
| 14 | +#include "virgl.h" |
14 | 15 | #include "window.h" |
15 | 16 |
|
16 | 17 | #define PRIV(x) ((emu_state_t *) x->priv) |
17 | 18 |
|
| 19 | +extern const struct window_backend g_window; |
| 20 | + |
18 | 21 | /* Define fetch separately since it is simpler (fixed width, already checked |
19 | 22 | * alignment, only main RAM is executable). |
20 | 23 | */ |
@@ -722,19 +725,23 @@ static int semu_start(int argc, char **argv) |
722 | 725 | emu.mtimer.mtimecmp = calloc(vm.n_hart, sizeof(uint64_t)); |
723 | 726 | emu.mswi.msip = calloc(vm.n_hart, sizeof(uint32_t)); |
724 | 727 | emu.sswi.ssip = calloc(vm.n_hart, sizeof(uint32_t)); |
725 | | -#if SEMU_HAS(VIRTIOGPU) |
726 | | - emu.vgpu.ram = emu.ram; |
727 | | - virtio_gpu_init(&(emu.vgpu)); |
728 | | - virtio_gpu_add_scanout(&(emu.vgpu), 1024, 768); |
729 | | - window_init(); |
730 | | -#endif |
731 | 728 | #if SEMU_HAS(VIRTIOINPUT) |
732 | 729 | emu.vkeyboard.ram = emu.ram; |
733 | 730 | virtio_input_init(&(emu.vkeyboard)); |
734 | 731 |
|
735 | 732 | emu.vmouse.ram = emu.ram; |
736 | 733 | virtio_input_init(&(emu.vmouse)); |
737 | 734 | #endif |
| 735 | +#if SEMU_HAS(VIRTIOGPU) |
| 736 | + emu.vgpu.ram = emu.ram; |
| 737 | + virtio_gpu_init(&(emu.vgpu)); |
| 738 | + virtio_gpu_add_scanout(&(emu.vgpu), 1024, 768); |
| 739 | + |
| 740 | + g_window.window_init(); |
| 741 | +#endif |
| 742 | +#if SEMU_HAS(VIRGL) |
| 743 | + semu_virgl_init(&(emu.vgpu)); |
| 744 | +#endif |
738 | 745 |
|
739 | 746 | /* Emulate */ |
740 | 747 | uint32_t peripheral_update_ctr = 0; |
@@ -773,6 +780,10 @@ static int semu_start(int argc, char **argv) |
773 | 780 | if (emu.vmouse.InterruptStatus) |
774 | 781 | emu_update_vinput_mouse_interrupts(&vm); |
775 | 782 | #endif |
| 783 | + |
| 784 | +#if SEMU_HAS(VIRGL) |
| 785 | + semu_virgl_fence_poll(); |
| 786 | +#endif |
776 | 787 | } |
777 | 788 |
|
778 | 789 | emu_update_timer_interrupt(vm.hart[i]); |
|
0 commit comments