... | ... | ||
---|---|---|---|
33 | -object memory-backend-memfd,id=mem1,size=8G -m 8G | 33 | -object memory-backend-memfd,id=mem1,size=8G -m 8G |
34 | 34 | ||
35 | # Note about known performance problem in Qemu: | 35 | # Note about known performance problem in Qemu: |
36 | 36 | ||
37 | DRM contexts are mapping host blobs extensively and these mapping | 37 | DRM contexts are mapping host blobs extensively and these mapping |
38 | operations work slowly in Qemu. Exact reason is unknown. Mappings work | 38 | operations work slowly in Qemu. We will need to optimize hostmem |
39 | fast on Crosvm For DRM contexts this problem is more visible than for | 39 | unmapping that currently happens in a deffered RCU work, blocking |
40 | Venus/Virgl. | 40 | GPU for a substantial time [2]. |
41 | |||
42 | [2] https://lore.kernel.org/qemu-devel/f58d250d-3831-4ff1-a018-f62f9aeb2527@collabora.com/T/#m17ac72336d28a64c793d4e4e0c87fc7dff9aa847 | ||
41 | 43 | ||
42 | Changelog: | 44 | Changelog: |
45 | |||
46 | v11:- Added column for libvirglrenderer host requrements versions and | ||
47 | corrected Asahi kernel link. Suggested by Akihiko Odaki. | ||
48 | |||
49 | v10:- Added links to Asahi and i915 virglrenderer MRs, link to Asahi host | ||
50 | kernel. Suggested by Akihiko Odaki. | ||
51 | |||
52 | - Renamed gfxstream guest requrements table's colum to match the host | ||
53 | requirements table. Suggested by Akihiko Odaki. | ||
54 | |||
55 | v9: - Updated doc patch by addresing review comments from Akihiko Odaki. | ||
56 | Made kernel requirements section specific to guest kernel and | ||
57 | removed reference to host requirements. Removed examples of | ||
58 | external projects' build flags. | ||
59 | |||
60 | - Added guest kernel minimum versions to the guest requirements table. | ||
43 | 61 | ||
44 | v8: - Addressed review comments from Akihiko Odaki on the doc patch. | 62 | v8: - Addressed review comments from Akihiko Odaki on the doc patch. |
45 | 63 | ||
46 | - Added r-bs from Akihiko Odaki on the doc patches. | 64 | - Added r-bs from Akihiko Odaki on the doc patches. |
47 | 65 | ||
... | ... | ||
163 | docs/system: virtio-gpu: Update Venus link | 181 | docs/system: virtio-gpu: Update Venus link |
164 | 182 | ||
165 | Pierre-Eric Pelloux-Prayer (1): | 183 | Pierre-Eric Pelloux-Prayer (1): |
166 | ui/sdl2: Implement dpy dmabuf functions | 184 | ui/sdl2: Implement dpy dmabuf functions |
167 | 185 | ||
168 | docs/system/devices/virtio-gpu.rst | 122 ++++++++++++++++++++- | 186 | docs/system/devices/virtio-gpu.rst | 117 +++++++++++++++++++- |
169 | hw/display/virtio-gpu-gl.c | 5 + | 187 | hw/display/virtio-gpu-gl.c | 5 + |
170 | hw/display/virtio-gpu-virgl.c | 164 ++++++++++++++++++++++++++++- | 188 | hw/display/virtio-gpu-virgl.c | 164 ++++++++++++++++++++++++++++- |
171 | hw/display/virtio-gpu.c | 15 +++ | 189 | hw/display/virtio-gpu.c | 15 +++ |
172 | include/hw/virtio/virtio-gpu.h | 16 +++ | 190 | include/hw/virtio/virtio-gpu.h | 16 +++ |
173 | include/ui/sdl2.h | 7 ++ | 191 | include/ui/sdl2.h | 7 ++ |
174 | meson.build | 6 +- | 192 | meson.build | 6 +- |
175 | ui/gtk-egl.c | 1 - | 193 | ui/gtk-egl.c | 1 - |
176 | ui/gtk-gl-area.c | 1 - | 194 | ui/gtk-gl-area.c | 1 - |
177 | ui/sdl2-gl.c | 68 +++++++++++- | 195 | ui/sdl2-gl.c | 68 +++++++++++- |
178 | ui/sdl2.c | 42 ++++++++ | 196 | ui/sdl2.c | 42 ++++++++ |
179 | 11 files changed, 435 insertions(+), 12 deletions(-) | 197 | 11 files changed, 429 insertions(+), 13 deletions(-) |
180 | 198 | ||
181 | -- | 199 | -- |
182 | 2.47.1 | 200 | 2.48.1 |
183 | 201 | ||
184 | 202 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
28 | + | 28 | + |
29 | return (QEMUGLContext)ctx; | 29 | return (QEMUGLContext)ctx; |
30 | } | 30 | } |
31 | 31 | ||
32 | -- | 32 | -- |
33 | 2.47.1 | 33 | 2.48.1 |
34 | 34 | ||
35 | 35 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
225 | + sdl2_gl_console_init(&sdl2_console[i]); | 225 | + sdl2_gl_console_init(&sdl2_console[i]); |
226 | } | 226 | } |
227 | register_displaychangelistener(&sdl2_console[i].dcl); | 227 | register_displaychangelistener(&sdl2_console[i].dcl); |
228 | 228 | ||
229 | -- | 229 | -- |
230 | 2.47.1 | 230 | 2.48.1 |
231 | 231 | ||
232 | 232 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
39 | + } | 39 | + } |
40 | } | 40 | } |
41 | 41 | ||
42 | static void virgl_write_fence(void *opaque, uint32_t fence) | 42 | static void virgl_write_fence(void *opaque, uint32_t fence) |
43 | -- | 43 | -- |
44 | 2.47.1 | 44 | 2.48.1 |
45 | 45 | ||
46 | 46 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
258 | GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g); | 258 | GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g); |
259 | +void virtio_gpu_virgl_reset_async_fences(VirtIOGPU *g); | 259 | +void virtio_gpu_virgl_reset_async_fences(VirtIOGPU *g); |
260 | 260 | ||
261 | #endif | 261 | #endif |
262 | -- | 262 | -- |
263 | 2.47.1 | 263 | 2.48.1 |
264 | 264 | ||
265 | 265 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
137 | + (_cfg.flags & (1 << VIRTIO_GPU_FLAG_DRM_ENABLED)) | 137 | + (_cfg.flags & (1 << VIRTIO_GPU_FLAG_DRM_ENABLED)) |
138 | 138 | ||
139 | struct virtio_gpu_base_conf { | 139 | struct virtio_gpu_base_conf { |
140 | uint32_t max_outputs; | 140 | uint32_t max_outputs; |
141 | -- | 141 | -- |
142 | 2.47.1 | 142 | 2.48.1 |
143 | 143 | ||
144 | 144 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
25 | - sdl2_set_scanout_mode(scon, false); | 25 | - sdl2_set_scanout_mode(scon, false); |
26 | 26 | ||
27 | SDL_GetWindowSize(scon->real_window, &ww, &wh); | 27 | SDL_GetWindowSize(scon->real_window, &ww, &wh); |
28 | surface_gl_setup_viewport(scon->gls, scon->surface, ww, wh); | 28 | surface_gl_setup_viewport(scon->gls, scon->surface, ww, wh); |
29 | -- | 29 | -- |
30 | 2.47.1 | 30 | 2.48.1 |
31 | 31 | ||
32 | 32 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
38 | - gtk_gl_area_set_scanout_mode(vc, false); | 38 | - gtk_gl_area_set_scanout_mode(vc, false); |
39 | gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area)); | 39 | gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area)); |
40 | } | 40 | } |
41 | } | 41 | } |
42 | -- | 42 | -- |
43 | 2.47.1 | 43 | 2.48.1 |
44 | 44 | ||
45 | 45 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
28 | +.. _virgl: https://docs.mesa3d.org/drivers/virgl.html | 28 | +.. _virgl: https://docs.mesa3d.org/drivers/virgl.html |
29 | .. _Gallium3D: https://www.freedesktop.org/wiki/Software/gallium/ | 29 | .. _Gallium3D: https://www.freedesktop.org/wiki/Software/gallium/ |
30 | .. _virglrenderer: https://gitlab.freedesktop.org/virgl/virglrenderer/ | 30 | .. _virglrenderer: https://gitlab.freedesktop.org/virgl/virglrenderer/ |
31 | 31 | ||
32 | -- | 32 | -- |
33 | 2.47.1 | 33 | 2.48.1 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
21 | +.. _venus: https://docs.mesa3d.org/drivers/venus.html | 21 | +.. _venus: https://docs.mesa3d.org/drivers/venus.html |
22 | 22 | ||
23 | DRM native context is supported since release of `virglrenderer`_ v1.0.0 | 23 | DRM native context is supported since release of `virglrenderer`_ v1.0.0 |
24 | using `drm`_ protocol. ``DRM`` virtio-gpu capability set ("capset") requires | 24 | using `drm`_ protocol. ``DRM`` virtio-gpu capability set ("capset") requires |
25 | -- | 25 | -- |
26 | 2.47.1 | 26 | 2.48.1 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
8 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | 8 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> |
9 | Cc: Sergio Lopez Pascual <slp@redhat.com> | 9 | Cc: Sergio Lopez Pascual <slp@redhat.com> |
10 | Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> | 10 | Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> |
11 | [dmitry.osipenko@collabora.com: Extended and corrected doc] | 11 | [dmitry.osipenko@collabora.com: Extended and corrected doc] |
12 | --- | 12 | --- |
13 | docs/system/devices/virtio-gpu.rst | 106 ++++++++++++++++++++++++++++- | 13 | docs/system/devices/virtio-gpu.rst | 101 ++++++++++++++++++++++++++++- |
14 | 1 file changed, 104 insertions(+), 2 deletions(-) | 14 | 1 file changed, 98 insertions(+), 3 deletions(-) |
15 | 15 | ||
16 | diff --git a/docs/system/devices/virtio-gpu.rst b/docs/system/devices/virtio-gpu.rst | 16 | diff --git a/docs/system/devices/virtio-gpu.rst b/docs/system/devices/virtio-gpu.rst |
17 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/docs/system/devices/virtio-gpu.rst | 18 | --- a/docs/system/devices/virtio-gpu.rst |
19 | +++ b/docs/system/devices/virtio-gpu.rst | 19 | +++ b/docs/system/devices/virtio-gpu.rst |
... | ... | ||
23 | This document explains the setup and usage of the virtio-gpu device. | 23 | This document explains the setup and usage of the virtio-gpu device. |
24 | -The virtio-gpu device paravirtualizes the GPU and display controller. | 24 | -The virtio-gpu device paravirtualizes the GPU and display controller. |
25 | +The virtio-gpu device provides a GPU and display controller | 25 | +The virtio-gpu device provides a GPU and display controller |
26 | +paravirtualized using VirtIO. It supports a number of different modes | 26 | +paravirtualized using VirtIO. It supports a number of different modes |
27 | +from simple 2D displays to fully accelerated 3D graphics. | 27 | +from simple 2D displays to fully accelerated 3D graphics. |
28 | + | 28 | |
29 | +virtio-gpu requirements | 29 | -Linux kernel support |
30 | +----------------------- | ||
31 | |||
32 | Linux kernel support | ||
33 | --------------------- | 30 | --------------------- |
34 | +^^^^^^^^^^^^^^^^^^^^ | 31 | +Linux guest kernel support |
32 | +-------------------------- | ||
35 | 33 | ||
36 | virtio-gpu requires a guest Linux kernel built with the | 34 | virtio-gpu requires a guest Linux kernel built with the |
37 | ``CONFIG_DRM_VIRTIO_GPU`` option. | 35 | ``CONFIG_DRM_VIRTIO_GPU`` option. |
38 | 36 | ||
39 | +Host Linux kernel requirements vary depending on a used virtio-gpu | ||
40 | +capabilities. See further sections for a detailed descriptions. | ||
41 | + | ||
42 | +3D acceleration | 37 | +3D acceleration |
43 | +^^^^^^^^^^^^^^^ | 38 | +--------------- |
44 | + | 39 | + |
45 | +3D acceleration of a virtualized GPU is still an evolving field. | 40 | +3D acceleration of a virtualized GPU is still an evolving field. |
46 | +Depending on the 3D mode you are running you may need to override | 41 | +Depending on the 3D mode you are running you may need to override |
47 | +distribution supplied libraries with more recent versions or enable | 42 | +distribution supplied libraries with more recent versions or enable |
48 | +build options. There are a number of requirements the host must meet | 43 | +build options. There are a number of requirements the host must meet |
... | ... | ||
57 | @@ -XXX,XX +XXX,XX @@ intermediate representation is communicated to the host and the | 52 | @@ -XXX,XX +XXX,XX @@ intermediate representation is communicated to the host and the |
58 | `virglrenderer`_ library on the host translates the intermediate | 53 | `virglrenderer`_ library on the host translates the intermediate |
59 | representation back to OpenGL API calls. | 54 | representation back to OpenGL API calls. |
60 | 55 | ||
61 | +By default OpenGL version on guest is limited to 4.3. In order to enable | 56 | +By default OpenGL version on guest is limited to 4.3. In order to enable |
62 | +OpenGL 4.6 support, virtio-gpu host blobs feature (``hostmem`` and ``blob`` | 57 | +OpenGL 4.6 support, virtio-gpu host blobs feature (``hostmem`` and ``blob`` |
63 | +fields) should be enabled. The ``hostmem`` field specifies the size of | 58 | +fields) should be enabled. The ``hostmem`` field specifies the size of |
64 | +virtio-gpu host memory window. This is typically between 256M and 8G. | 59 | +virtio-gpu host memory window. This is typically between 256M and 8G. |
65 | + | 60 | + |
66 | .. parsed-literal:: | 61 | .. parsed-literal:: |
67 | -device virtio-gpu-gl | 62 | -device virtio-gpu-gl |
... | ... | ||
75 | 70 | ||
76 | +.. list-table:: Linux Host Requirements | 71 | +.. list-table:: Linux Host Requirements |
77 | + :header-rows: 1 | 72 | + :header-rows: 1 |
78 | + | 73 | + |
79 | + * - Capability | 74 | + * - Capability |
80 | + - Kernel | 75 | + - Kernel Version |
81 | + - virglrenderer build flags | 76 | + - Libvirglrenderer Version |
82 | + * - OpenGL pass-through | 77 | + * - OpenGL pass-through |
83 | + - Any Linux version compatible with QEMU if not using host blobs feature, | 78 | + - Any Linux version compatible with QEMU if not using host blobs feature, |
84 | + Linux 6.13+ otherwise | 79 | + Linux 6.13+ otherwise |
85 | + - N/A | 80 | + - 0.8.2+ |
86 | + * - Vulkan pass-through | 81 | + * - Vulkan pass-through |
87 | + - Linux 6.13+ | 82 | + - Linux 6.13+ |
88 | + - -Dvenus=true -Drender-server=true | 83 | + - 1.0.0+ |
89 | + * - AMDGPU DRM native context | 84 | + * - AMDGPU DRM native context |
90 | + - Linux 6.13+ | 85 | + - Linux 6.13+ |
91 | + - -Ddrm-renderers=amdgpu-experimental | 86 | + - 1.1.0+ |
92 | + * - Freedreno DRM native context | 87 | + * - Freedreno DRM native context |
93 | + - Linux 6.4+ | 88 | + - Linux 6.4+ |
94 | + - -Ddrm-renderers=msm | 89 | + - 1.0.0+ |
95 | + * - Intel i915 DRM native context | 90 | + * - Intel i915 DRM native context |
96 | + - Linux 6.13+ | 91 | + - Linux 6.13+ |
97 | + - -Ddrm-renderers=i915-experimental `mr1384`_ | 92 | + - `mr1384`_ |
98 | + * - Asahi DRM native context | 93 | + * - Asahi DRM native context |
99 | + - Downstream version of Asahi Linux kernel | 94 | + - `Downstream version`_ of Asahi Linux kernel |
100 | + - -Ddrm-renderers=asahi-experimental `mr1274`_ | 95 | + - `mr1274`_ |
101 | + | 96 | + |
102 | +.. _mr1384: https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1384 | 97 | +.. _mr1384: https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1384 |
103 | +.. _mr1274: https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1274 | 98 | +.. _mr1274: https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1274 |
99 | +.. _Downstream version: https://github.com/AsahiLinux/linux | ||
104 | + | 100 | + |
105 | +.. list-table:: Linux Guest Requirements | 101 | +.. list-table:: Linux Guest Requirements |
106 | + :header-rows: 1 | 102 | + :header-rows: 1 |
107 | + | 103 | + |
108 | + * - Capability | 104 | + * - Capability |
105 | + - Kernel Version | ||
109 | + - Mesa Version | 106 | + - Mesa Version |
110 | + - Mesa build flags | ||
111 | + * - OpenGL pass-through | 107 | + * - OpenGL pass-through |
108 | + - Any Linux version supporting virtio-gpu | ||
112 | + - 16.0.0+ | 109 | + - 16.0.0+ |
113 | + - -Dgallium-drivers=virgl | ||
114 | + * - Vulkan pass-through | 110 | + * - Vulkan pass-through |
111 | + - Linux 5.16+ | ||
115 | + - 24.2.0+ | 112 | + - 24.2.0+ |
116 | + - -Dvulkan-drivers=virtio | ||
117 | + * - AMDGPU DRM native context | 113 | + * - AMDGPU DRM native context |
114 | + - Linux 6.14+ | ||
118 | + - 25.0.0+ | 115 | + - 25.0.0+ |
119 | + - -Dgallium-drivers=radeonsi -Dvulkan-drivers=amd -Damdgpu-virtio=true | ||
120 | + * - Freedreno DRM native context | 116 | + * - Freedreno DRM native context |
117 | + - Linux 6.14+ | ||
121 | + - 23.1.0+ | 118 | + - 23.1.0+ |
122 | + - -Dgallium-drivers=freedreno -Dvulkan-drivers=freedreno | ||
123 | + * - Intel i915 DRM native context | 119 | + * - Intel i915 DRM native context |
120 | + - Linux 6.14+ | ||
124 | + - `mr29870`_ | 121 | + - `mr29870`_ |
125 | + - -Dgallium-drivers=iris -Dvulkan-drivers=intel -Dintel-virtio-experimental=true | ||
126 | + * - Asahi DRM native context | 122 | + * - Asahi DRM native context |
123 | + - Linux 6.14+ | ||
127 | + - 24.2.0+ | 124 | + - 24.2.0+ |
128 | + - -Dgallium-drivers=asahi -Dvulkan-drivers=asahi | ||
129 | + | 125 | + |
130 | +.. _mr29870: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29870 | 126 | +.. _mr29870: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29870 |
131 | + | 127 | + |
132 | virtio-gpu rutabaga | 128 | virtio-gpu rutabaga |
133 | ------------------- | 129 | ------------------- |
... | ... | ||
139 | + | 135 | + |
140 | +.. list-table:: Linux Host Requirements | 136 | +.. list-table:: Linux Host Requirements |
141 | + :header-rows: 1 | 137 | + :header-rows: 1 |
142 | + | 138 | + |
143 | + * - Capability | 139 | + * - Capability |
144 | + - Kernel | 140 | + - Kernel Version |
145 | + - Rutabaga build flags | ||
146 | + * - Vulkan+Wayland pass-through | 141 | + * - Vulkan+Wayland pass-through |
147 | + - Linux 6.13+ | 142 | + - Linux 6.13+ |
148 | + - Follow `gfxstream-enabled rutabaga`_ build instructions | ||
149 | + | 143 | + |
150 | +.. list-table:: Linux Guest Requirements | 144 | +.. list-table:: Linux Guest Requirements |
151 | + :header-rows: 1 | 145 | + :header-rows: 1 |
152 | + | 146 | + |
153 | + * - Capability | 147 | + * - Capability |
148 | + - Kernel Version | ||
154 | + - Mesa Version | 149 | + - Mesa Version |
155 | + - Mesa build flags | 150 | + * - Vulkan+Wayland pass-through |
156 | + * - Vulkan pass-through | 151 | + - Linux 5.16+ |
157 | + - 24.3.0+ | 152 | + - 24.3.0+ |
158 | + - -Dvulkan-drivers=gfxstream | ||
159 | -- | 153 | -- |
160 | 2.47.1 | 154 | 2.48.1 |
161 | 155 | ||
162 | 156 | diff view generated by jsdifflib |