bhyve Trying to make more interactive the usage of Android X86 / Phoenix OS virtualized with bhyve...

I'm sure that I can run it as well as you,inside Ubuntu with the linuxulator....but I don't like to run scrcpy from Ubuntu,but from FreeBSD,natively,If I can...
 
Hello.

I've found the way to make work glxinfo and glxgears and it is to boot FreeBSD using the 02:00.0 VGA compatible controller: NVIDIA Corporation TU102 [GeForce RTX 2080 Ti] (rev a1 instead of the 00:02.0 VGA compatible controller: Intel Corporation CoffeeLake-S GT2 [UHD Graphics 630] (rev 02).

How I did this ? Adding these parameters on /etc/rc.conf :

Code:
kld_list="nvidia-modeset nvidia-drm linux i915kms ext2fs"

and I have commented this line on /boot/loader.conf :

Code:
#pptdevs="2/0/0 2/0/1 2/0/2 2/0/3"

and Xorg.conf :

Code:
Section "Device"
Identifier  "Card0"
Driver      "nvidia"
BusID       "PCI:2:0:0"
EndSection

When it is commented,the nvidia geforce 2080 ti can be used on the host os. Instead,when I remove the # it means that it can't be used on FreeBSD,but it is reserved for the virtual machines that I want to create with bhyve.

So,when I use the nvidia GPU,I can run glxinfo and glxgears :

Code:
==> glxinfo

name of display: :0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
server glx extensions:
GLX_ARB_context_flush_control, GLX_ARB_create_context,
GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile,
GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
GLX_ARB_multisample, GLX_EXT_buffer_age,
GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile,
GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context, GLX_EXT_libglvnd,
GLX_EXT_stereo_tree, GLX_EXT_swap_control, GLX_EXT_swap_control_tear,
GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating,
GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer,
GLX_NV_multigpu_context, GLX_NV_robustness_video_memory_purge,
GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGI_swap_control,
GLX_SGI_video_sync
client glx vendor string: NVIDIA Corporation
client glx version string: 1.4
client glx extensions:
GLX_ARB_context_flush_control, GLX_ARB_create_context,
GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile,
GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
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_stereo_tree, GLX_EXT_swap_control,
GLX_EXT_swap_control_tear, GLX_EXT_texture_from_pixmap,
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_NV_copy_buffer,
GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer,
GLX_NV_multigpu_context, GLX_NV_multisample_coverage,
GLX_NV_robustness_video_memory_purge, GLX_NV_swap_group,
GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGI_swap_control,
GLX_SGI_video_sync
GLX version: 1.4

but when I use the "UHD Graphics 630" as primary,I can't. Point is that I need to use the UHD Graphics 630 as primary and I need to reserve the Nvidia GPU for the Windows and Linux virtual machines. So,the problem that I have is not fixed.

Let me understand if the UHD Graphics 630 supports the OpenGL or not. Why If I use it as primary, glxinfo and glxgears don't work ? Is there a fix for this ?
 
good work

so you have 2 graphics cards
and you need to stop the host using the nvidia gpu so you can pass it thorugh to bhyve

im sure i saw something about that recently

ill try and remember where
 
im sure i saw about a blog post or something recently about bhyve
that mentioned blacklist devices on the host so you can pass them through to bhyve

another option

you can run bhyve in a jail


which lets you to unhide various things
just wondering if you could use that to unhide the nvidia gpu

Next, add a devfs ruleset to /etc/devfs.rules:

Code:
[devfsrules_jail_bhyve=100]
add include $devfsrules_hide_all
add include $devfsrules_unhide_login
add path 'urandom' unhide
add path 'random' unhide
add path 'crypto' unhide
add path 'shm' unhide
add path 'zero' unhide
add path 'null' unhide
add path 'mem' unhide
add path 'vmm' unhide
add path 'vmm/*' unhide
add path 'vmm.io' unhide
add path 'vmm.io/*' unhide
add path 'nmdmbhyve*' unhide
add path 'zvol' unhide
add path 'zvol/zroot' unhide
add path 'zvol/zroot/vms' unhide
add path 'zvol/zroot/vms/bhyvevm0' unhide
add path 'zvol/zroot/vms/bhyvevm1' unhide
add path 'tap10*' unhide

this is how i unhide the nvidia gpu on my system for a jail

Code:
[jail=7]
add include $devfsrules_jail
add path 'mixer*' unhide
add path 'dsp*' unhide
add path 'dri*' unhide
add path 'drm*' unhide
add path 'nvidia*' unhide
add path 'speaker*' unhide

the following are for nvidia

Code:
add path 'dri*' unhide
add path 'drm*' unhide
add path 'nvidia*' unhide
 
im sure you have seen this post on the forum


sure i saw something else as well

another post

 
output on my dell xps 15

Code:
pciconf -v -l | grep -B 1 -A 3 NVIDIA

Code:
vgapci0@pci0:1:0:0:     class=0x030200 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1f91 subvendor=0x1028 subdevice=0x0905
    vendor     = 'NVIDIA Corporation'
    device     = 'TU117M [GeForce GTX 1650 Mobile / Max-Q]'
    class      = display
    subclass   = 3D
Now note down those numbers and insert them into /boot/loader.conf as following

pci0:1:0:0 becomes 1/0/0

Code:
# echo pptdevs="1/0/0" >> /boot/loader.conf

Simply add the following to the end of your $VM.conf file, they will now show up in pci slots 9:0 and 9:1 on the VM.

You might want to make sure that you dont make them to a spot thats already occupied, if so just go higher

Code:
passthru0="1/0/0=9:0"

is that the sort of thing your after
or have i got it arse about elbow
 
The question is : why glxgears does not work when the primary (and only) GPU present on the system is the Intel UHD Graphics 630 ?
 
I'm using 3 GPUs now :

1) UHD Graphics 630
2) nVidia GTX 1060
3) nVidia RTX 2080 ti

I've attached again the GTX 1060 previously removed and now glxgears works,but scrcpy not :

 
Maybe I've found why scrcpy works on Ubuntu installed physically,but not in FreeBSD and not in the Linuxulator.

This is what it says when I run it on Ubuntu 24.04 :

Code:
# scrcpy --tcpip=192.168.1.7:5555

scrcpy 2.6.1 <https://github.com/Genymobile/scrcpy>
INFO: Connecting to 192.168.1.7:5555...
INFO: Connected to 192.168.1.7:5555
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 100.8 MB/s (71112 bytes in 0.001s)
[server] INFO: Device: [QEMU] Android-x86 Standard PC (Q35 + ICH9, 2009) (Android 7.1.1)
[server] WARN: Audio disabled: it is not supported before Android 11
INFO: Renderer: opengl
INFO: OpenGL version: 4.3 (Compatibility Profile) Mesa 24.0.9-0ubuntu0.1
INFO: Trilinear filtering enabled
WARN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Texture: 1280x800
WARN: Killing the server...

Instead,this is what it says when I run it in FreeBSD :

Code:
==> scrcpy --tcpip=192.168.1.9:5555
scrcpy 2.7 <https://github.com/Genymobile/scrcpy>
INFO: Connecting to 192.168.1.9:5555...
INFO: Connected to 192.168.1.9:5555
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 89.9 MB/s (71200 bytes in 0.001s)
[server] INFO: Device: [FreeBSD] Android-x86 BHYVE (Android 7.1.1)
[server] WARN: Audio disabled: it is not supported before Android 11
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 550.54.14
INFO: Trilinear filtering enabled
WARN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Texture: 1600x944

And now,let's play a game : what's missing between the FreeBSD messages ? I want to tell you for first :

(Compatibility Profile) Mesa 24.0.9-0ubuntu0.1

So,I have reinstalled the mesa libs :

Code:
# pkg install -f libosmesa mesa-devel mesa-dri mesa-gallium-va mesa-gallium-vdpau mesa-gallium-xa mesa-libs

but it still does not work. Do you see that some other package is missing ? How can I check if the MESA libs are installed correctly ?
 
On FreeBSD :

[marietto@marietto ~]==> glxinfo | grep Mesa
[marietto@marietto ~]==> nothing.

And voila',Mesa libs are broken....even if I have installed all the mesa packages.
 
Et voila',as I have suspected : (on Ubuntu 24.04 real installation).

Code:
# glxinfo | grep Mesa

client glx vendor string: Mesa Project and SGI
Vendor: Mesa (0x10de)
OpenGL vendor string: Mesa
OpenGL core profile version string: 4.3 (Core Profile) Mesa 24.0.9-0ubuntu0.1
OpenGL version string: 4.3 (Compatibility Profile) Mesa 24.0.9-0ubuntu0.1
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 24.0.9-0ubuntu0.1
 
If I want that FreeBSD detects the Mesa libs keeping the Intel gpu as primary gpu :

0) put the intel igpu as first choice on the BIOS
1) remove the package xf86-video-intel
2) remove the package nvidia-driver-*
3) create a xorg.file with this content

Code:
Section "Device"
    Identifier  "Card0"
    Driver      "modesetting"
    BusID       "PCI:0:2:0"
EndSection

Section "Device"
    Identifier  "Card1"
    Driver      "modesetting"
    BusID       "PCI:2:0:0"
EndSection

4) nano /etc/rc.conf :

kld_list="i915kms"

5) nano /boot/loader.conf :

pptdevs="2/0/0 2/0/1 2/0/2 2/0/3"

Keep in consideration :

Code:
# lspci :

00:02.0 VGA compatible controller: Intel Corporation CoffeeLake-S GT2 [UHD Graphics 630] (rev 02)

02:00.0 VGA compatible controller: NVIDIA Corporation TU102 [GeForce RTX 2080 Ti] (rev a1)
02:00.1 Audio device: NVIDIA Corporation TU102 High Definition Audio Controller (rev a1)
02:00.2 USB controller: NVIDIA Corporation TU102 USB 3.1 Host Controller (rev a1)
02:00.3 Serial bus controller: NVIDIA Corporation TU102 USB Type-C UCSI Controller (rev a1)
 
i extracted an iso and into a jail
but it doesnt work

you cant start up the jail and enter it
doesnt have the right file system layout

not sure if waydroid would let you install and andriod browser


i think waydroid uses a container and i have had issue trying to run containers in a jail
tried flatpak, snap, podman and none worked

I've already explored waydroid with the developers...I don't remember exactly which error it gives,but it does not allow to watch Netflix and or NowTV.
 
Now another problem comes out. Premising that the bhyve parameters that I've used to boot Phoenix OS are the following :

Code:
/usr/sbin/./bhyve-lin -S -c sockets=4,cores=2,threads=1 -m 8G -w -H -A \
-s 0,hostbridge \
-s 1,ahci-hd,/mnt/zroot-133/bhyve/img/Android/Android-7-qemu.img,bootindex=1 \
-s 7,passthru,1/0/0 \
-s 8,passthru,6/0/0 \
-s 11,hda,play=/dev/dsp,rec=/dev/dsp \
-s 13,virtio-net,tap13 \
-s 29,fbuf,tcp=0.0.0.0:5913,w=1440,h=900,wait \
-s 30,xhci,tablet \
-s 31,lpc \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CODE.fd,/usr/local/share/uefi-firmware/BHYVE_UEFI_VARS.fd \
vm0:13 < /dev/null & sleep 2 && vncviewer 0:13 &

the problem that I need to fix is due to the parameter that I've used to pass the audio :

Code:
-s 11,hda,play=/dev/dsp,rec=/dev/dsp \

I don't know why,but using it,two more problems come out :

1) the audio inside the vm is crackly (while inside the same VM which runs with qemu / virt-manager on Linux is perfect)
2) the speed of the video playback is increased by 1 factor. So,I should reduce it and it becomes almost good,but anyway,it remains crackly.

There is a latency issue.... no good for watching movies...

Maybe what I'm looking for is a sound server. These programs send sound over the network. Choices include JACK, NAS, Pulseaudio and more.

Pulseaudio is the default audio system on Ubuntu and is widely available on Unix. JACK is widely available on desktop operating systems and prides itself on its low latency. I'd try these two first. See Jack vs Pulseaudio -- how is it faster ? for a short comparison.

Source : https://unix.stackexchange.com/questions/1893/sending-audio-through-network

NapoleonWils0n : maybe I should replace Pulseaudio with Jack on FreeBSD ? do you have a nice tutorial to do this ?
 
Back
Top