X Error of failed request: BadValue (integer parameter out of range for operation)
Hello.
I've virtualized Android X86 on FreeBSD using bhyve using the following parameters :
/usr/sbin/./bhyve-win -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.img,bootindex=1 \
-s 9,passthru,1/0/0 \
-s 13,virtio-net,tap13 \
-s 29,fbuf,tcp=0.0.0.0:5913,w=1600,h=950,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
and I've enabled the USB debugging inside the vm. After this,I have installed scrcpy in FreeBSD from the packages :
# pkg install scrcpy
version :
[root@marietto /bhyve]==> scrcpy --version :
scrcpy 2.7 <https://github.com/Genymobile/scrcpy>
Dependencies (compiled / linked):
- SDL: 2.30.7 / 2.30.7
- libavcodec: 60.31.102 / 60.31.102
- libavformat: 60.16.100 / 60.16.100
- libavutil: 58.29.100 / 58.29.100
- libusb: - / 1.0.0
[root@marietto /home/marietto]==> adb devices
List of devices attached
192.168.1.6:5555 device
192.168.1.7:5555 device
This is what happens when I try to mirror Android :
[marietto@marietto ~]==> scrcpy --tcpip=192.168.1.7:5555
scrcpy 2.7 <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. 127.8 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
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 151 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 148
Current serial number in output stream: 149
[root@marietto /home/marietto]==> scrcpy --tcpip=192.168.1.7:5555
scrcpy 2.7 <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. 89.4 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
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 151 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 148
Current serial number in output stream: 149
what's missing ? where is the problem ? Please help me to fix it. Thanks.
#584 ?
What if you run glxgears?
[root@marietto /bhyve]==> glxgears
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 151 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 26
Current serial number in output stream: 27
I gave a look at #584,but I didn't understand how to fix the error. Please explain.
I'm trying to understand why scrcpy works using qemu+kvm+virt-manager on Linux,but it does not work on FreeBSD and I've understood what's missing in FreeBSD : openGL and Channel + Server Spice,as you can see below :
Linux :
# scrcpy --tcpip=192.168.122.106:5555
scrcpy 2.7 <https://github.com/Genymobile/scrcpy>
INFO: Connecting to 192.168.122.106:5555...
INFO: Connected to 192.168.122.106:5555
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 661.5 MB/s (71200 bytes in 0.000s)
[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.6 (Compatibility Profile) Mesa 24.0.9-0ubuntu0.1
INFO: Trilinear filtering enabled
WARN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Texture: 1280x800
on Virt-Manager I need to add these :
<video>
<model type="virtio" heads="1" primary="yes">
<acceleration accel3d="yes"/>
</model>
<alias name="video0"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
</video>
<graphics type="spice">
<listen type="none"/>
<image compression="off"/>
<gl enable="yes"/>
</graphics>
or :
<graphics type="spice">
<listen type="none"/>
<image compression="off"/>
<gl enable="yes" rendernode="/dev/dri/renderD128"/>
</graphics>
In addition on Linux scrcpy has been compiled using "libavdevice",but I don't see it on FreeBSD :
# scrcpy --version
scrcpy 2.7 <https://github.com/Genymobile/scrcpy>
Dependencies (compiled / linked):
- SDL: 2.30.0 / 2.30.0
- libavcodec: 60.31.102 / 60.31.102
- libavformat: 60.16.100 / 60.16.100
- libavutil: 58.29.100 / 58.29.100
---> libavdevice: 60.3.100 / 60.3.100
- libusb: - / 1.0.27
on FreeBSD :
# scrcpy --version
scrcpy 2.7 <https://github.com/Genymobile/scrcpy>
Dependencies (compiled / linked):
- SDL: 2.30.7 / 2.30.7
- libavcodec: 60.31.102 / 60.31.102
- libavformat: 60.16.100 / 60.16.100
- libavutil: 58.29.100 / 58.29.100
- libusb: - / 1.0.0
Now the question is how to add these elements on FreeBSD,because scrcpy needs all of those to work correctly...
Once you fixed glxgears (which is a demo app to validate that rendering works), scrcpy will work.
Sorry, I don't know the steps to fix your issue, but focus on making glxgears work, you'll probably find more resources.
Is required an nvidia GPU ?
No.
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 :
kld_list="nvidia-modeset nvidia-drm linux i915kms ext2fs"
and I have commented this line on /boot/loader.conf :
#pptdevs="2/0/0 2/0/1 2/0/2 2/0/3"
and Xorg.conf :
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 :
[root@marietto /etc/X11]==> 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 ?
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 have no idea.
Romain,what's the problem now ? It is frozen..
I would say that the capture/encoder does not produce any frame, so scrcpy waits for new frames.
I don't know why.
You could try a standalone server to confirm that you don't receive any frame: https://github.com/Genymobile/scrcpy/blob/master/doc/develop.md#standalone-server
Like this ?
[root@marietto /mnt/zroot-133/A_FILES/Movies/Films]==> adb push video.mp4 /data/local/tmp/video.mp4
video.mp4: 1 file pushed, 0 skipped. 61.2 MB/s (984878969 bytes in 15.349s)
[root@marietto /mnt/zroot-133/A_FILES/Movies/Films]==> adb forward tcp:1234 localabstract:scrcpy
[root@marietto /mnt/zroot-133/A_FILES/Movies/Films]==> adb shell CLASSPATH=/data/local/tmp/video.mp4 app_process / com.genymobile.scrcpy.Server 2.1 tunnel_forward=true audio=false control=false cleanup=false raw_stream=true max_size=1920
Aborted
CLASSPATH=/data/local/tmp/video.mp4
:boom: You must pass the scrcpy-server binary, not a "video.mp4".
[root@marietto /mnt/zroot-133/A_FILES/Movies/Films]==> find /usr -name scrcpy /usr/local/bin/scrcpy
I don't have any scrcpy-server binary,only scrcpy.
/usr/local/share/scrcpy/scrcpy-server
[root@marietto /usr/local/share/scrcpy]==> adb push scrcpy-server /data/local/tmp/scrcpy-server-manual.jar
scrcpy-server: 1 file pushed, 0 skipped. 79.9 MB/s (71200 bytes in 0.001s)
[root@marietto /usr/local/share/scrcpy]==> adb forward tcp:1234 localabstract:scrcpy
[root@marietto /usr/local/share/scrcpy]==> adb shell CLASSPATH=/data/local/tmp/scrcpy-server-manual.jar app_process / com.genymobile.scrcpy.Server 2.7 tunnel_forward=true audio=false control=false cleanup=false raw_stream=true max_size=1920
[server] INFO: Device: [FreeBSD] Android-x86 BHYVE (Android 7.1.1)
Frozen.
It is expected to be "frozen" until a client connects to it.
For example (as mentioned in the doc):
vlc -Idummy --demux=h264 --network-caching=0 tcp://localhost:1234
Or even just:
nc localhost 1234 | hd
the capture/encoder does not produce any frame
Confirmed.
Do you know why ?
No.
Does screenrecord work?
adb shell screenrecord /sdcard/file.mp4
adb pull /sdcard/file.mp4
Is the file non-empty? Can you play it?
nope. It is empty.
OK, so the screen is not captured with "native" Android tools (without scrcpy). You have to find why.
It happens the same using the Linuxulator :
[root@marietto /compat]==> ./start-ubuntu2310-zsh
access control disabled, clients can connect from any host
compat.linux.emul_path: /compat/ubuntu2310 -> /compat/ubuntu2310
compat.linux.emul_path: /compat/ubuntu2310 -> /compat/ubuntu2310
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]? y
marietto# scrcpy
scrcpy 1.25 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 39.1 MB/s (41650 bytes in 0.001s)
[server] INFO: Device: FreeBSD BHYVE (Android 7.1.1)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 550.54.14
INFO: Trilinear filtering enabled
INFO: Initial texture: 1600x944
^C#
Out of curiosity, what is the result of scrcpy --list-encoders?
In FreeBSD :
[marietto@marietto ~]==> scrcpy --list-encoders
scrcpy 2.7 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO: --> (tcpip) 192.168.1.7:5555 device BHYVE
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 87.5 MB/s (71200 bytes in 0.001s)
[server] INFO: Device: [FreeBSD] Android-x86 BHYVE (Android 7.1.1)
[server] INFO: List of video encoders:
--video-codec=h264 --video-encoder='OMX.google.h264.encoder'
[server] INFO: List of audio encoders:
--audio-codec=aac --audio-encoder='OMX.google.aac.encoder'
--audio-codec=flac --audio-encoder='OMX.google.flac.encoder'
Within the Linuxulator / Ubuntu 23.10 :
marietto# scrcpy --list-encoders
scrcpy 1.25 <https://github.com/Genymobile/scrcpy>
scrcpy: unrecognized option '--list-encoders'
In FreeBSD using the Linuxulator :
marietto# sudo apt install ffmpeg libsdl2-2.0-0 adb wget gcc \
git pkg-config meson ninja-build libsdl2-dev libavcodec-dev \
libavdevice-dev libavformat-dev libavutil-dev \
libswresample-dev libusb-1.0-0 libusb-1.0-0-dev
marietto# cd scrcpy
marietto# ./install_release.sh
[scrcpy] Downloading prebuilt server...
--2024-10-10 12:55:22-- https://github.com/Genymobile/scrcpy/releases/download/v2.7/scrcpy-server-v2.7
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/111583593/2c633ac2-97b4-45a3-b5f3-a6710f7e3c55?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20241010%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241010T105522Z&X-Amz-Expires=300&X-Amz-Signature=8b0f16d8b778d8ae8ae6441d55d7fe3e6e6a9cb1d3c3276e3035a74d28a22cb3&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Dscrcpy-server-v2.7&response-content-type=application%2Foctet-stream [following]
--2024-10-10 12:55:22-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/111583593/2c633ac2-97b4-45a3-b5f3-a6710f7e3c55?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20241010%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241010T105522Z&X-Amz-Expires=300&X-Amz-Signature=8b0f16d8b778d8ae8ae6441d55d7fe3e6e6a9cb1d3c3276e3035a74d28a22cb3&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Dscrcpy-server-v2.7&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, 185.199.109.133, 185.199.108.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 71200 (70K) [application/octet-stream]
Saving to: ‘scrcpy-server’
scrcpy-server 100%[=====================================>] 69,53K --.-KB/s in 0,09s
2024-10-10 12:55:23 (737 KB/s) - ‘scrcpy-server’ saved [71200/71200]
[scrcpy] Verifying prebuilt server...
scrcpy-server: OK
[scrcpy] Building client...
The Meson build system
Version: 1.2.1
Source dir: /home/marietto/Files/scrcpy
Build dir: /home/marietto/Files/scrcpy/build-auto
Build type: native build
Project name: scrcpy
Project version: 2.7
C compiler for the host machine: cc (gcc 13.2.0 "cc (Ubuntu 13.2.0-4ubuntu3) 13.2.0")
C linker for the host machine: cc ld.bfd 2.41
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (1.8.1)
Run-time dependency libavformat found: YES 60.3.100
Run-time dependency libavcodec found: YES 60.3.100
Run-time dependency libavutil found: YES 58.2.100
Run-time dependency libswresample found: YES 4.10.100
Run-time dependency sdl2 found: YES 2.28.3
Run-time dependency libavdevice found: YES 60.1.100
Run-time dependency libusb-1.0 found: YES 1.0.26
Checking for function "strdup" : YES
Checking for function "asprintf" : YES
Checking for function "vasprintf" : YES
Checking for function "nrand48" : YES
Checking for function "jrand48" : YES
Checking for function "reallocarray" : YES
Header "sys/socket.h" has symbol "SOCK_CLOEXEC" : YES
Configuring config.h using configuration
Build targets in project: 2
scrcpy 2.7
User defined options
buildtype : release
strip : True
b_lto : true
prebuilt_server: scrcpy-server
Found ninja-1.11.1 at /usr/bin/ninja
[73/73] Linking target app/scrcpy
[scrcpy] Installing (sudo)...
[0/1] Installing files.
Installing app/scrcpy to /usr/local/bin
Stripping target 'app/scrcpy'.
Installing server/scrcpy-server to /usr/local/share/scrcpy
Installing /home/marietto/Files/scrcpy/app/scrcpy.1 to /usr/local/share/man/man1
Installing /home/marietto/Files/scrcpy/app/data/icon.png to /usr/local/share/icons/hicolor/256x256/apps
Installing /home/marietto/Files/scrcpy/app/data/zsh-completion/_scrcpy to /usr/local/share/zsh/site-functions
Installing /home/marietto/Files/scrcpy/app/data/bash-completion/scrcpy to /usr/local/share/bash-completion/completions
Installing /home/marietto/Files/scrcpy/app/data/scrcpy.desktop to /usr/local/share/applications
Installing /home/marietto/Files/scrcpy/app/data/scrcpy-console.desktop to /usr/local/share/applications
marietto# scrcpy --version
scrcpy 1.25 <https://github.com/Genymobile/scrcpy>
Dependencies (compiled / linked):
- SDL: 2.28.2 / 2.28.3
- libavcodec: 60.3.100 / 60.3.100
- libavformat: 60.3.100 / 60.3.100
- libavutil: 58.2.100 / 58.2.100
- libavdevice: 60.1.100 / 60.1.100
- libusb: - / 1.0.26
marietto# cd build-auto
marietto# cd app
marietto# ./scrcpy --version
scrcpy 2.7 <https://github.com/Genymobile/scrcpy>
Dependencies (compiled / linked):
- SDL: 2.28.3 / 2.28.3
- libavcodec: 60.3.100 / 60.3.100
- libavformat: 60.3.100 / 60.3.100
- libavutil: 58.2.100 / 58.2.100
- libavdevice: 60.1.100 / 60.1.100
- libusb: - / 1.0.26
marietto# ./scrcpy --list-encoders
scrcpy 2.7 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO: --> (tcpip) 192.168.1.7:5555 device BHYVE
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 647.2 MB/s (71200 bytes in 0.000s)
[server] INFO: Device: [FreeBSD] Android-x86 BHYVE (Android 7.1.1)
[server] INFO: List of video encoders:
--video-codec=h264 --video-encoder='OMX.google.h264.encoder'
[server] INFO: List of audio encoders:
--audio-codec=aac --audio-encoder='OMX.google.aac.encoder'
--audio-codec=flac --audio-encoder='OMX.google.flac.encoder'
marietto# ./scrcpy
scrcpy 2.7 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO: --> (tcpip) 192.168.1.7:5555 device BHYVE
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 190.6 MB/s (71200 bytes in 0.000s)
[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
^C
# marietto# nvidia-smi
Thu Oct 10 12:58:03 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.54.14 Driver Version: 550.54.14 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce GTX 1060 3GB Off | 00000000:01:00.0 On | N/A |
| 56% 39C P8 8W / 120W | 246MiB / 3072MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 5036 G /usr/local/libexec/Xorg 101MiB |
| 0 N/A N/A 5202 G firefox 141MiB |
+-----------------------------------------------------------------------------------------+