Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: [SOLVED] 3D graphics acceleration on QEMU
Date: Tue, 18 Jul 2017 09:23:10
Message-Id: 1699720.aKevhrB8yE@dell_xps
In Reply to: Re: [gentoo-user] 3D graphics acceleration on QEMU by Mick
1 I had a look at this again this morning and cracked it. More info below.
2
3 On Monday 17 Jul 2017 00:00:53 Mick wrote:
4 > On Sunday 16 Jul 2017 22:49:54 Neil Bothwick wrote:
5 > > On Sun, 16 Jul 2017 16:20:15 +0100, Mick wrote:
6 > > > Another annoying thing was the bottom of the screen was cropped off and
7 > > > to see the main menu and toolbar I have to move the mouse past the
8 > > > bottom edge of the window. The visual aperture is smaller than the
9 > > > desktop screen size. I don't know if this in anyway related to the
10 > > > above warning.
11 > >
12 > > I see that one regularly, the desktop is 1024x768 but the display is
13 > > 1024x720. simply change the display to 1024x720 in Mint's prefs or use a
14 > > different video card emulation, such as vmware, by adding "-vga vmware"
15 > > to your options.
16 >
17 > Thanks Neil, I'll try this out when I boot it up next time. Meanwhile, I'm
18 > not sure if the virtio drivers in the kernel are meant for guest kernels
19 > only, or if I should have them enabled on the host's.
20 >
21 > This is the modules I have enabled on the host which is VT-x capable:
22 >
23 > # grep -e DMAR -e IOMMU -e VIRT /usr/src/linux/.config
24 > CONFIG_VIRT_CPU_ACCOUNTING=y
25 > CONFIG_VIRT_CPU_ACCOUNTING_GEN=y
26 > CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
27 > # CONFIG_GART_IOMMU is not set
28 > # CONFIG_CALGARY_IOMMU is not set
29 > CONFIG_IOMMU_HELPER=y
30 > CONFIG_VIRT_TO_BUS=y
31 > CONFIG_VIRTIO_BLK=m
32 > CONFIG_VIRTIO_NET=m
33 > # CONFIG_VIRTIO_CONSOLE is not set
34 > # CONFIG_HW_RANDOM_VIRTIO is not set
35 > # CONFIG_DRM_VIRTIO_GPU is not set
36 > # CONFIG_FB_VIRTUAL is not set
37 > # CONFIG_SND_VIRTUOSO is not set
38 > # CONFIG_VIRT_DRIVERS is not set
39 > CONFIG_VIRTIO=m
40 > # CONFIG_VIRTIO_PCI is not set
41 > # CONFIG_VIRTIO_BALLOON is not set
42 > # CONFIG_VIRTIO_INPUT is not set
43 > # CONFIG_VIRTIO_MMIO is not set
44 > CONFIG_IOMMU_API=y
45 > CONFIG_IOMMU_SUPPORT=y
46 > # Generic IOMMU Pagetable Support
47 > CONFIG_IOMMU_IOVA=y
48 > # CONFIG_AMD_IOMMU is not set
49 > CONFIG_DMAR_TABLE=y
50 > CONFIG_INTEL_IOMMU=y
51 > CONFIG_INTEL_IOMMU_SVM=y
52 > CONFIG_INTEL_IOMMU_DEFAULT_ON=y
53 > CONFIG_INTEL_IOMMU_FLOPPY_WA=y
54 > # CONFIG_DEBUG_VIRTUAL is not set
55 > # CONFIG_IOMMU_STRESS is not set
56 > CONFIG_VIRTUALIZATION=y
57 >
58 > The CPU has vmx, but not vmd:
59 >
60 > processor : 7
61 > vendor_id : GenuineIntel
62 > cpu family : 6
63 > model : 30
64 > model name : Intel(R) Core(TM) i7 CPU Q 720 @ 1.60GHz
65 > stepping : 5
66 > microcode : 0x7
67 > cpu MHz : 933.000
68 > cache size : 6144 KB
69 > physical id : 0
70 > siblings : 8
71 > core id : 3
72 > cpu cores : 4
73 > apicid : 7
74 > initial apicid : 7
75 > fpu : yes
76 > fpu_exception : yes
77 > cpuid level : 11
78 > wp : yes
79 > flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
80 > pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp
81 > lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc
82 > aperfmperf eagerfpu pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16
83 > xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm tpr_shadow vnmi flexpriority ept
84 > vpid dtherm ida
85 > bugs :
86 > bogomips : 3191.45
87 > clflush size : 64
88 > cache_alignment : 64
89 > address sizes : 36 bits physical, 48 bits virtual
90 > power management:
91
92 The above are as they should be. When building qemu it is important to set
93 USE="virgl". This is how mine was built:
94
95 [ebuild R ] app-emulation/qemu-2.9.0-r2::gentoo USE="aio alsa bluetooth
96 bzip2 caps curl fdt filecaps gtk gtk2 jpeg ncurses nls opengl pin-upstream-
97 blobs png pulseaudio sdl sdl2 seccomp usb vhost-net virgl virtfs vnc xattr -
98 accessibility -debug (-glusterfs) -gnutls -infiniband -iscsi -lzo -nfs -numa -
99 python -rbd -sasl (-selinux) -smartcard -snappy -spice -ssh -static -static-
100 user -systemtap -tci {-test} -usbredir -vde -vte -xen -xfs" LINGUAS="-bg -
101 de_DE -fr_FR -hu -it -tr -zh_CN" PYTHON_TARGETS="python2_7"
102 QEMU_SOFTMMU_TARGETS="x86_64 -aarch64 -alpha -arm -cris -i386 -lm32 -m68k -
103 microblaze -microblazeel -mips -mips64 -mips64el -mipsel -moxie -nios2 -or1k -
104 ppc -ppc64 -ppcemb -s390x -sh4 -sh4eb -sparc -sparc64 -tricore -unicore32 -
105 xtensa -xtensaeb" QEMU_USER_TARGETS="-aarch64 -alpha -arm -armeb -cris -hppa -
106 i386 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -mipsn32
107 -mipsn32el -nios2 -or1k -ppc -ppc64 -ppc64abi32 -ppc64le -s390x -sh4 -sh4eb -
108 sparc -sparc32plus -sparc64 -tilegx -x86_64*" 0 KiB
109
110 Thereafter, the trick in getting hardware acceleration in the guest is to set
111 '-vga virtio' when launching the guest VM with qemu:
112
113 $ qemu-system-x86_64 -m 1024 -enable-kvm -display sdl,gl=on -vga virtio -drive
114 if=virtio,file=Mint_18.2_HDA.qcow2,cache=none
115 gl_version 33 - core profile enabled
116
117 As you can see it returns 'gl_version 33 - core profile enabled' on the
118 terminal. When I login the guest's desktop no longer warns that there will be
119 no hardware acceleration. :-)
120
121 This is what the guest shows:
122
123 $ dmesg | grep -i drm
124 [ 1.413078] [drm] Initialized drm 1.1.0 20060810
125 [ 1.488900] [drm] pci: virtio-vga detected
126 [ 1.488903] fb: switching to virtiodrmfb from VESA VGA
127 [ 1.490827] [drm] virgl 3d acceleration enabled <==virgl being used
128 [ 1.491401] [drm] virtio vbuffers: 272 bufs, 192B each, 51kB total.
129 [ 1.494571] [drm] number of scanouts: 1
130 [ 1.494577] [drm] number of cap sets: 1
131 [ 1.504333] [drm] cap set 0: id 1, max-version 1, max-size 308
132 [ 1.505633] virtio_gpu virtio0: fb0: virtiodrmfb frame buffer device
133 [ 1.505638] [drm] Initialized virtio_gpu 0.0.1 0 on minor 0
134
135
136 $glxinfo
137 name of display: :0
138 display: :0 screen: 0
139 direct rendering: Yes
140 server glx vendor string: SGI
141 server glx version string: 1.4
142 server glx extensions:
143 GLX_ARB_create_context, GLX_ARB_create_context_profile,
144 GLX_ARB_fbconfig_float, GLX_ARB_framebuffer_sRGB, GLX_ARB_multisample,
145 GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile,
146 GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB,
147 GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info,
148 GLX_EXT_visual_rating, GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer,
149 GLX_OML_swap_method, GLX_SGIS_multisample, GLX_SGIX_fbconfig,
150 GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group, GLX_SGI_swap_control
151 client glx vendor string: Mesa Project and SGI
152 client glx version string: 1.4
153 client glx extensions:
154 GLX_ARB_create_context, GLX_ARB_create_context_profile,
155 GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
156 GLX_ARB_framebuffer_sRGB, GLX_ARB_get_proc_address, GLX_ARB_multisample,
157 GLX_EXT_buffer_age, GLX_EXT_create_context_es2_profile,
158 GLX_EXT_create_context_es_profile, GLX_EXT_fbconfig_packed_float,
159 GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context,
160 GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating,
161 GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer,
162 GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer,
163 GLX_MESA_swap_control, GLX_OML_swap_method, GLX_OML_sync_control,
164 GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
165 GLX_SGIX_visual_select_group, GLX_SGI_make_current_read,
166 GLX_SGI_swap_control, GLX_SGI_video_sync
167 GLX version: 1.4
168 GLX extensions:
169 GLX_ARB_create_context, GLX_ARB_create_context_profile,
170 GLX_ARB_fbconfig_float, GLX_ARB_framebuffer_sRGB,
171 GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_buffer_age,
172 GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile,
173 GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB,
174 GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info,
175 GLX_EXT_visual_rating, GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer,
176 GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer,
177 GLX_MESA_swap_control, GLX_OML_swap_method, GLX_OML_sync_control,
178 GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
179 GLX_SGIX_visual_select_group, GLX_SGI_make_current_read,
180 GLX_SGI_swap_control, GLX_SGI_video_sync
181 Extended renderer info (GLX_MESA_query_renderer):
182 Vendor: Red Hat (0x1af4)
183 Device: virgl (0x1010)
184 Version: 12.0.6
185 Accelerated: yes
186 Video memory: 0MB
187 Unified memory: no
188 Preferred profile: core (0x1)
189 Max core profile version: 3.3
190 Max compat profile version: 3.0
191 Max GLES1 profile version: 1.1
192 Max GLES[23] profile version: 3.0
193 OpenGL vendor string: Red Hat
194 OpenGL renderer string: Gallium 0.4 on virgl
195 OpenGL core profile version string: 3.3 (Core Profile) Mesa 12.0.6
196 OpenGL core profile shading language version string: 3.30
197 OpenGL core profile context flags: (none)
198 OpenGL core profile profile mask: core profile
199
200 I hope this helps others.
201 --
202 Regards,
203 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature