This is the message printed by CvCaptureCAM_V4L::requestBuffers when the ioctl fails with EINVAL.

For uvideo the backend to this is uvideo_reqbufs() in /sys/dev/USB/uvideo.c - this has several cases which return EINVAL. Did you get any kernel messages (dmesg, /var/log/messages) while it was reporting these "no support for memory mapping" errors?

If not, you can differentiate between some of these EINVAL by building a kernel with "#define UVIDEO_DEBUG" added to uvideo.c (before the #ifdef UVIDEO_DEBUG), which might give some clues about what your Python code is doing that didn't work with openbsd's v4l2 implementation.

But...if my quick calculations are right, reading and processing at that resolution in colour is about 6MByte per frame, so 5 channels at say 8fps would be in the region of ~240MByte/s (~2Gbit/s). Even if you can get the code working with openbsd, I really think you are going to struggle to read that from USB and run image processing on the data on a Pi 4 running openbsd (also openbsd's USB layer is not known for being particularly reliable). I think this task is better suited to running under Linux.

--
 Sent from a phone, apologies for poor formatting.

On 11 July 2023 22:12:37 Jeff Ross <jr...@openvistas.net> wrote:

Hi all,

Trying to run an OpenCV python script on a Raspberry Pi 4 with 7.3 and
4G of ram with a single 2K webcam.

I'm getting this when I try to set the camera to shoot at 2K resolution
(1920px x 1080px):

capture is open...
[ WARN:0@2.098] global cap_v4l.cpp:868 requestBuffers
VIDEOIO(V4L2:/dev/video0): no support for memory mapping
[ WARN:0@2.115] global cap_v4l.cpp:868 requestBuffers
VIDEOIO(V4L2:/dev/video0): no support for memory mapping
[ WARN:0@2.115] global cap_v4l.cpp:868 requestBuffers
VIDEOIO(V4L2:/dev/video0): no support for memory mapping
[ WARN:0@2.115] global cap_v4l.cpp:868 requestBuffers
VIDEOIO(V4L2:/dev/video0): no support for memory mapping
[ WARN:0@2.115] global cap_v4l.cpp:868 requestBuffers
VIDEOIO(V4L2:/dev/video0): no support for memory mapping
[ WARN:0@2.115] global cap_v4l.cpp:847 requestBuffers
VIDEOIO(V4L2:/dev/video0): Insufficient buffer memory
[ WARN:0@2.131] global cap_v4l.cpp:868 requestBuffers
VIDEOIO(V4L2:/dev/video0): no support for memory mapping
[ WARN:0@2.131] global cap_v4l.cpp:868 requestBuffers
VIDEOIO(V4L2:/dev/video0): no support for memory mapping
[ WARN:0@2.131] global cap_v4l.cpp:868 requestBuffers
VIDEOIO(V4L2:/dev/video0): no support for memory mapping
[ WARN:0@2.131] global cap_v4l.cpp:868 requestBuffers
VIDEOIO(V4L2:/dev/video0): no support for memory mapping
[ WARN:0@2.131] global cap_v4l.cpp:847 requestBuffers
VIDEOIO(V4L2:/dev/video0): Insufficient buffer memory
[ WARN:0@2.154] global cap_v4l.cpp:868 requestBuffers
VIDEOIO(V4L2:/dev/video0): no support for memory mapping
[ WARN:0@2.154] global cap_v4l.cpp:868 requestBuffers
VIDEOIO(V4L2:/dev/video0): no support for memory mapping
[ WARN:0@2.154] global cap_v4l.cpp:868 requestBuffers
VIDEOIO(V4L2:/dev/video0): no support for memory mapping
[ WARN:0@2.154] global cap_v4l.cpp:868 requestBuffers
VIDEOIO(V4L2:/dev/video0): no support for memory mapping
[ WARN:0@2.154] global cap_v4l.cpp:847 requestBuffers
VIDEOIO(V4L2:/dev/video0): Insufficient buffer memory
FPS: 30.00003000003, Height: 480.0, Width: 640.0, Exp: auto, Gain: auto,
AutoExp: -1.0, Frames: 3

Requested 1920 x 1080 and got 640 x 480.

I had a similar issue before with an amd64 stick:

https://marc.info/?l=openbsd-ports&m=162862043308236&w=2

This is OpenCV installed from packages:

jross@allsky:/home/jross $ pkg_info opencv
Information for inst:opencv-4.7.0

It would seem then that this problem isn't going away any time soon but
if someone has a workaround I'd love to hear it.

I had hoped to use the RPi4 to drive 5 of these 2K webcams to make an
allsky camera.

I have an amd64 with 16G of ram that I'll try next just in case there's
a big difference between amd64 and arm64.

Jeff

dmesg:

jross@allsky:/home/jross $ dmesg
OpenBSD 7.3 (GENERIC.MP) #2080: Sat Mar 25 14:20:25 MDT 2023
dera...@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/GENERIC.MP
real mem  = 4124950528 (3933MB)
avail mem = 3963645952 (3780MB)
random: good seed from bootblocks
mainbus0 at root: Raspberry Pi 4 Model B Rev 1.5
cpu0 at mainbus0 mpidr 0: ARM Cortex-A72 r0p3
cpu0: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache
cpu0: 1024KB 64b/line 16-way L2 cache
cpu0: CRC32,ASID16
cpu1 at mainbus0 mpidr 1: ARM Cortex-A72 r0p3
cpu1: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache
cpu1: 1024KB 64b/line 16-way L2 cache
cpu1: CRC32,ASID16
cpu2 at mainbus0 mpidr 2: ARM Cortex-A72 r0p3
cpu2: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache
cpu2: 1024KB 64b/line 16-way L2 cache
cpu2: CRC32,ASID16
cpu3 at mainbus0 mpidr 3: ARM Cortex-A72 r0p3
cpu3: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache
cpu3: 1024KB 64b/line 16-way L2 cache
cpu3: CRC32,ASID16
efi0 at mainbus0: UEFI 2.8
efi0: Das U-Boot rev 0x20211000
smbios0 at efi0: SMBIOS 3.0
smbios0: vendor U-Boot version "2021.10" date 10/01/2021
smbios0: Unknown Unknown Product
apm0 at mainbus0
"system" at mainbus0 not configured
"axi" at mainbus0 not configured
simplebus0 at mainbus0: "soc"
bcmclock0 at simplebus0
bcmmbox0 at simplebus0
bcmgpio0 at simplebus0
bcmaux0 at simplebus0
ampintc0 at simplebus0 nirq 256, ncpu 4 ipi: 0, 1, 2: "interrupt-controller"
bcmtmon0 at simplebus0
bcmdmac0 at simplebus0: DMA0 DMA2 DMA4 DMA5 DMA6 DMA7 DMA8 DMA9 DMA10
"timer" at simplebus0 not configured
pluart0 at simplebus0: rev 2, 16 byte fifo
pluart0: console
"local_intc" at simplebus0 not configured
bcmdog0 at simplebus0
bcmirng0 at simplebus0
"firmware" at simplebus0 not configured
"power" at simplebus0 not configured
"mailbox" at simplebus0 not configured
sdhc0 at simplebus0
sdhc0: SDHC 3.0, 250 MHz base clock
sdmmc0 at sdhc0: 4-bit, sd high-speed, mmc high-speed
"gpiomem" at simplebus0 not configured
"fb" at simplebus0 not configured
"vcsm" at simplebus0 not configured
"clocks" at mainbus0 not configured
"phy" at mainbus0 not configured
"clk-27M" at mainbus0 not configured
"clk-108M" at mainbus0 not configured
simplebus1 at mainbus0: "emmc2bus"
sdhc1 at simplebus1
sdhc1: SDHC 3.0, 100 MHz base clock
sdmmc1 at sdhc1: 8-bit, sd high-speed, mmc high-speed, ddr52, dma
"arm-pmu" at mainbus0 not configured
agtimer0 at mainbus0: 54000 kHz
simplebus2 at mainbus0: "scb"
bcmpcie0 at simplebus2
pci0 at bcmpcie0
ppb0 at pci0 dev 0 function 0 "Broadcom BCM2711" rev 0x20
pci1 at ppb0 bus 1
xhci0 at pci1 dev 0 function 0 "VIA VL805 xHCI" rev 0x01: intx, xHCI 1.0
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "VIA xHCI root hub" rev
3.00/1.00 addr 1
bse0 at simplebus2: address e4:5f:01:d6:d9:1d
brgphy0 at bse0 phy 1: BCM54210E 10/100/1000baseT PHY, rev. 2
"dma" at simplebus2 not configured
"hevc-decoder" at simplebus2 not configured
"rpivid-local-intc" at simplebus2 not configured
"h264-decoder" at simplebus2 not configured
"vp9-decoder" at simplebus2 not configured
gpioleds0 at mainbus0: "led0", "led1"
"sd_io_1v8_reg" at mainbus0 not configured
"sd_vcc_reg" at mainbus0 not configured
"fixedregulator_3v3" at mainbus0 not configured
"fixedregulator_5v0" at mainbus0 not configured
simplebus3 at mainbus0: "v3dbus"
"bootloader" at mainbus0 not configured
scsibus0 at sdmmc1: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: <SD/MMC, SR128, 0080> removable
sd0: 121942MB, 512 bytes/sector, 249737216 sectors
uhub1 at uhub0 port 1 configuration 1 interface 0 "VIA Labs USB2.0 Hub"
rev 2.10/4.21 addr 2
bwfm0 at sdmmc0 function 1
manufacturer 0x02d0, product 0xa9a6 at sdmmc0 function 2 not configured
manufacturer 0x02d0, product 0xa9a6 at sdmmc0 function 3 not configured
uhub2 at uhub1 port 2 configuration 1 interface 0 "Generic USB2.1 Hub"
rev 2.10/0.01 addr 3
uhub3 at uhub2 port 1 configuration 1 interface 0 "Generic USB2.1 Hub"
rev 2.10/0.02 addr 4
athn0 at uhub1 port 3 configuration 1 interface 0 "ATHEROS USB WLAN" rev
2.00/2.02 addr 5
uhub4 at uhub0 port 3 configuration 1 interface 0 "Generic USB3.2 Hub"
rev 3.20/0.01 addr 6
uhub5 at uhub4 port 1 configuration 1 interface 0 "Generic USB3.2 Hub"
rev 3.20/0.02 addr 7
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on sd0a (079a8ca5cd807d63.a) swap on sd0b dump on sd0b
WARNING: CHECK AND RESET THE DATE!
gpio0 at bcmgpio0: 58 pins
bwfm0: address e4:5f:01:d6:d9:1e
athn0: AR9287 rev 2 (2T2R), ROM rev 4, address b0:48:7a:92:44:b3
uvideo0 at uhub2 port 4 configuration 1 interface 0 "Sonix Technology
Co., Ltd. USB 2.0 Camera" rev 2.00/1.00 addr 8
video0 at uvideo0

Reply via email to