Skip to content

Commit 4b239cc

Browse files
committed
[WIP] Support VirGL
Follow the installation guide from: https://gitlab.freedesktop.org/virgl/virglrenderer Prerequisite: `sudo apt install libepoxy-dev`
1 parent c7b4d45 commit 4b239cc

File tree

6 files changed

+407
-8
lines changed

6 files changed

+407
-8
lines changed

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ ifneq ($(UNAME_S),Linux)
6262
ENABLE_VIRTIOGPU := 0
6363
endif
6464

65+
# VirGL
66+
ENABLE_VIRGL ?= 1
67+
ifneq (ENABLE_VIRTIOGPU,0)
68+
CFLAGS += $(shell pkg-config virglrenderer --cflags)
69+
LDFLAGS += $(shell pkg-config virglrenderer --libs)
70+
endif
71+
72+
$(call set-feature, VIRGL)
73+
6574
# SDL2
6675
ENABLE_SDL ?= 1
6776
ifeq (, $(shell which sdl2-config))

device.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ void virtio_gpu_write(hart_t *vm,
220220
uint8_t width,
221221
uint32_t value);
222222

223+
void semu_virgl_init(virtio_gpu_state_t *vgpu);
224+
223225
void virtio_gpu_init(virtio_gpu_state_t *vgpu);
224226
void virtio_gpu_add_scanout(virtio_gpu_state_t *vgpu,
225227
uint32_t width,

feature.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
#define SEMU_FEATURE_VIRTIOGPU 1
1818
#endif
1919

20+
/* VirGL */
21+
#ifndef SEMU_FEATURE_VIRGL
22+
#define SEMU_FEATURE_VIRGL 1
23+
#endif
24+
2025
/* virtio-input */
2126
#ifndef SEMU_FEATURE_VIRTIOINPUT
2227
#define SEMU_FEATURE_VIRTIOINPUT 1

main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,8 @@ static int semu_start(int argc, char **argv)
698698
emu.vgpu.ram = emu.ram;
699699
virtio_gpu_init(&(emu.vgpu));
700700
virtio_gpu_add_scanout(&(emu.vgpu), 1024, 768);
701+
702+
semu_virgl_init(&(emu.vgpu));
701703
window_init();
702704
#endif
703705
#if SEMU_HAS(VIRTIOINPUT)

0 commit comments

Comments
 (0)