Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[gentoo-user] Re: 3D graphics acceleration on QEMU

344 views
Skip to first unread message

Mick

unread,
Jul 16, 2017, 11:30:03 AM7/16/17
to
On Sunday 16 Jul 2017 16:20:15 Mick wrote:
> I launched a Linux Mint liveDVD in QEMU like so:
>
> qemu-system-x86_64 -m 1024 -enable-kvm -drive
> if=virtio,file=Mint_18.2_HDA.qcow2,cache=none -cdrom linuxmint-18.2-
> cinnamon-64bit.iso
>
> and noticed a warning popping up informing me Cinnamon is running without
> video hardware acceleration available and everything will be rendered in
> software.
>
> I've had a similar experience when running Cinnamon on VirtualBox on a quite
> old 32bit desktop, but thought this i7 laptop + QEMU may fair better.
>
> Another annoying thing was the bottom of the screen was cropped off and to
> see the main menu and toolbar I have to move the mouse past the bottom edge
> of the window. The visual aperture is smaller than the desktop screen
> size. I don't know if this in anyway related to the above warning.
>
> Anyway, is there a setting I could enable to have hardware acceleration on
> QEMU, or have I come across a hardware limitation of this laptop? Grateful
> for any pointers.

Hmm ... it seems this is also a rather old laptop:

# dmesg | grep -e DMAR -e IOMMU
#

There is no explicit IOMMU setting in the BIOS.
--
Regards,
Mick
signature.asc

Mick

unread,
Jul 16, 2017, 11:30:03 AM7/16/17
to
I launched a Linux Mint liveDVD in QEMU like so:

qemu-system-x86_64 -m 1024 -enable-kvm -drive
if=virtio,file=Mint_18.2_HDA.qcow2,cache=none -cdrom linuxmint-18.2-
cinnamon-64bit.iso

and noticed a warning popping up informing me Cinnamon is running without
video hardware acceleration available and everything will be rendered in
software.

I've had a similar experience when running Cinnamon on VirtualBox on a quite
old 32bit desktop, but thought this i7 laptop + QEMU may fair better.

Another annoying thing was the bottom of the screen was cropped off and to see
the main menu and toolbar I have to move the mouse past the bottom edge of the
window. The visual aperture is smaller than the desktop screen size. I don't
know if this in anyway related to the above warning.

Anyway, is there a setting I could enable to have hardware acceleration on
QEMU, or have I come across a hardware limitation of this laptop? Grateful
for any pointers.
--
Regards,
Mick
signature.asc

Neil Bothwick

unread,
Jul 16, 2017, 6:00:04 PM7/16/17
to
On Sun, 16 Jul 2017 16:20:15 +0100, Mick wrote:

> Another annoying thing was the bottom of the screen was cropped off and
> to see the main menu and toolbar I have to move the mouse past the
> bottom edge of the window. The visual aperture is smaller than the
> desktop screen size. I don't know if this in anyway related to the
> above warning.

I see that one regularly, the desktop is 1024x768 but the display is
1024x720. simply change the display to 1024x720 in Mint's prefs or use a
different video card emulation, such as vmware, by adding "-vga vmware"
to your options.


--
Neil Bothwick

Don't judge a book by its movie.

Mick

unread,
Jul 16, 2017, 7:10:04 PM7/16/17
to
Thanks Neil, I'll try this out when I boot it up next time. Meanwhile, I'm
not sure if the virtio drivers in the kernel are meant for guest kernels only,
or if I should have them enabled on the host's.

This is the modules I have enabled on the host which is VT-x capable:

# grep -e DMAR -e IOMMU -e VIRT /usr/src/linux/.config
CONFIG_VIRT_CPU_ACCOUNTING=y
CONFIG_VIRT_CPU_ACCOUNTING_GEN=y
CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
# CONFIG_GART_IOMMU is not set
# CONFIG_CALGARY_IOMMU is not set
CONFIG_IOMMU_HELPER=y
CONFIG_VIRT_TO_BUS=y
CONFIG_VIRTIO_BLK=m
CONFIG_VIRTIO_NET=m
# CONFIG_VIRTIO_CONSOLE is not set
# CONFIG_HW_RANDOM_VIRTIO is not set
# CONFIG_DRM_VIRTIO_GPU is not set
# CONFIG_FB_VIRTUAL is not set
# CONFIG_SND_VIRTUOSO is not set
# CONFIG_VIRT_DRIVERS is not set
CONFIG_VIRTIO=m
# CONFIG_VIRTIO_PCI is not set
# CONFIG_VIRTIO_BALLOON is not set
# CONFIG_VIRTIO_INPUT is not set
# CONFIG_VIRTIO_MMIO is not set
CONFIG_IOMMU_API=y
CONFIG_IOMMU_SUPPORT=y
# Generic IOMMU Pagetable Support
CONFIG_IOMMU_IOVA=y
# CONFIG_AMD_IOMMU is not set
CONFIG_DMAR_TABLE=y
CONFIG_INTEL_IOMMU=y
CONFIG_INTEL_IOMMU_SVM=y
CONFIG_INTEL_IOMMU_DEFAULT_ON=y
CONFIG_INTEL_IOMMU_FLOPPY_WA=y
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_IOMMU_STRESS is not set
CONFIG_VIRTUALIZATION=y

The CPU has vmx, but not vmd:

processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 30
model name : Intel(R) Core(TM) i7 CPU Q 720 @ 1.60GHz
stepping : 5
microcode : 0x7
cpu MHz : 933.000
cache size : 6144 KB
physical id : 0
siblings : 8
core id : 3
cpu cores : 4
apicid : 7
initial apicid : 7
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm
constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc
aperfmperf eagerfpu pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr
pdcm sse4_1 sse4_2 popcnt lahf_lm tpr_shadow vnmi flexpriority ept vpid dtherm
ida
bugs :
bogomips : 3191.45
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

--
Regards,
Mick
signature.asc

Mick

unread,
Jul 18, 2017, 5:30:04 AM7/18/17
to
I had a look at this again this morning and cracked it. More info below.
The above are as they should be. When building qemu it is important to set
USE="virgl". This is how mine was built:

[ebuild R ] app-emulation/qemu-2.9.0-r2::gentoo USE="aio alsa bluetooth
bzip2 caps curl fdt filecaps gtk gtk2 jpeg ncurses nls opengl pin-upstream-
blobs png pulseaudio sdl sdl2 seccomp usb vhost-net virgl virtfs vnc xattr -
accessibility -debug (-glusterfs) -gnutls -infiniband -iscsi -lzo -nfs -numa -
python -rbd -sasl (-selinux) -smartcard -snappy -spice -ssh -static -static-
user -systemtap -tci {-test} -usbredir -vde -vte -xen -xfs" LINGUAS="-bg -
de_DE -fr_FR -hu -it -tr -zh_CN" PYTHON_TARGETS="python2_7"
QEMU_SOFTMMU_TARGETS="x86_64 -aarch64 -alpha -arm -cris -i386 -lm32 -m68k -
microblaze -microblazeel -mips -mips64 -mips64el -mipsel -moxie -nios2 -or1k -
ppc -ppc64 -ppcemb -s390x -sh4 -sh4eb -sparc -sparc64 -tricore -unicore32 -
xtensa -xtensaeb" QEMU_USER_TARGETS="-aarch64 -alpha -arm -armeb -cris -hppa -
i386 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -mipsn32
-mipsn32el -nios2 -or1k -ppc -ppc64 -ppc64abi32 -ppc64le -s390x -sh4 -sh4eb -
sparc -sparc32plus -sparc64 -tilegx -x86_64*" 0 KiB

Thereafter, the trick in getting hardware acceleration in the guest is to set
'-vga virtio' when launching the guest VM with qemu:

$ qemu-system-x86_64 -m 1024 -enable-kvm -display sdl,gl=on -vga virtio -drive
if=virtio,file=Mint_18.2_HDA.qcow2,cache=none
gl_version 33 - core profile enabled

As you can see it returns 'gl_version 33 - core profile enabled' on the
terminal. When I login the guest's desktop no longer warns that there will be
no hardware acceleration. :-)

This is what the guest shows:

$ dmesg | grep -i drm
[ 1.413078] [drm] Initialized drm 1.1.0 20060810
[ 1.488900] [drm] pci: virtio-vga detected
[ 1.488903] fb: switching to virtiodrmfb from VESA VGA
[ 1.490827] [drm] virgl 3d acceleration enabled <==virgl being used
[ 1.491401] [drm] virtio vbuffers: 272 bufs, 192B each, 51kB total.
[ 1.494571] [drm] number of scanouts: 1
[ 1.494577] [drm] number of cap sets: 1
[ 1.504333] [drm] cap set 0: id 1, max-version 1, max-size 308
[ 1.505633] virtio_gpu virtio0: fb0: virtiodrmfb frame buffer device
[ 1.505638] [drm] Initialized virtio_gpu 0.0.1 0 on minor 0


$glxinfo
name of display: :0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
GLX_ARB_create_context, GLX_ARB_create_context_profile,
GLX_ARB_fbconfig_float, GLX_ARB_framebuffer_sRGB, GLX_ARB_multisample,
GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile,
GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB,
GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info,
GLX_EXT_visual_rating, GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer,
GLX_OML_swap_method, GLX_SGIS_multisample, GLX_SGIX_fbconfig,
GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group, GLX_SGI_swap_control
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
client glx extensions:
GLX_ARB_create_context, GLX_ARB_create_context_profile,
GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
GLX_ARB_framebuffer_sRGB, GLX_ARB_get_proc_address, GLX_ARB_multisample,
GLX_EXT_buffer_age, GLX_EXT_create_context_es2_profile,
GLX_EXT_create_context_es_profile, GLX_EXT_fbconfig_packed_float,
GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context,
GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating,
GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer,
GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer,
GLX_MESA_swap_control, GLX_OML_swap_method, GLX_OML_sync_control,
GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
GLX_SGIX_visual_select_group, GLX_SGI_make_current_read,
GLX_SGI_swap_control, GLX_SGI_video_sync
GLX version: 1.4
GLX extensions:
GLX_ARB_create_context, GLX_ARB_create_context_profile,
GLX_ARB_fbconfig_float, GLX_ARB_framebuffer_sRGB,
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_buffer_age,
GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile,
GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB,
GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info,
GLX_EXT_visual_rating, GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer,
GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer,
GLX_MESA_swap_control, GLX_OML_swap_method, GLX_OML_sync_control,
GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
GLX_SGIX_visual_select_group, GLX_SGI_make_current_read,
GLX_SGI_swap_control, GLX_SGI_video_sync
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Red Hat (0x1af4)
Device: virgl (0x1010)
Version: 12.0.6
Accelerated: yes
Video memory: 0MB
Unified memory: no
Preferred profile: core (0x1)
Max core profile version: 3.3
Max compat profile version: 3.0
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.0
OpenGL vendor string: Red Hat
OpenGL renderer string: Gallium 0.4 on virgl
OpenGL core profile version string: 3.3 (Core Profile) Mesa 12.0.6
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

I hope this helps others.
--
Regards,
Mick
signature.asc
0 new messages