IMX519 Slow Focus Pi 5

Is PDAF enabled on the IMX519 with the Raspberry Pi 5? If so, what are the steps to make it work on the latest version of Raspbian.

On a fresh install of Raspbian OS Lite 64 Bit (6.6.31+rpt-rpi-2712), I did the following:

wget -O install_pivariety_pkgs.sh https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh
chmod +x install_pivariety_pkgs.sh
./install_pivariety_pkgs.sh -p libcamera
./install_pivariety_pkgs.sh -p libcamera_apps

The autofocus is incredibly slow (10+ seconds, and appears to be CDAF). Turning on autofocus debugging shows that the PDAF confidence values are zero.

LIBCAMERA_LOG_LEVELS=RPiAf:0 libcamera-still -n -t 0
[0:12:05.098094394] [11979] INFO Camera camera_manager.cpp:316 libcamera v0.3.1+74-a65f44f4-dirty (2024-09-09T08:55:36BST)
[0:12:05.107975051] [11988] INFO RPI pisp.cpp:695 libpisp version v1.0.7 28196ed6edcf 29-08-2024 (16:33:32)
[0:12:05.248777302] [11988] INFO RPI pisp.cpp:1155 Registered camera /base/axi/pcie@120000/rp1/i2c@88000/imx519@1a to CFE device /dev/media3 and ISP device /dev/media1 using PiSP variant BCM2712_C0
[0:12:05.249235299] [11979] WARN V4L2 v4l2_pixelformat.cpp:344 Unsupported V4L2 pixel format RPBP
Mode selection for 2328:1748:12:P
SRGGB10_CSI2P,1280x720/0 - Score: 5319.24
SRGGB10_CSI2P,1920x1080/0 - Score: 3319.24
SRGGB10_CSI2P,2328x1748/0 - Score: 1000
SRGGB10_CSI2P,3840x2160/0 - Score: 1648.24
SRGGB10_CSI2P,4656x3496/0 - Score: 2019
Stream configuration adjusted
[0:12:05.249557483] [11979] INFO Camera camera.cpp:1191 configuring streams: (0) 2328x1748-YUV420 (1) 2328x1748-RGGB_PISP_COMP1
[0:12:05.249677297] [11988] INFO RPI pisp.cpp:1451 Sensor: /base/axi/pcie@120000/rp1/i2c@88000/imx519@1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected CFE format: 2328x1748-PC1R
[0:12:05.249842260] [11988] DEBUG RPiAf af.cpp:779 setLensPosition: 1
[0:12:05.257678407] [11992] DEBUG RPiAf af.cpp:816 setMode: 2
[0:12:05.257724240] [11992] DEBUG RPiAf af.cpp:739 setSpeed: 0
[0:12:05.257746611] [11992] DEBUG RPiAf af.cpp:732 setRange: 0
[0:12:05.257922758] [11992] DEBUG RPiAf af.cpp:233 switchMode: statsRegion: 0,0,4656,3496
[0:12:05.463206829] [11992] DEBUG RPiAf af.cpp:517 SKIP
[0:12:05.463227718] [11992] DEBUG RPiAf af.cpp:693 1 sst2->2 stp0->0 ft1.00->1.00 fs1.00->1.00 cont=0 phase=0 conf=0
[0:12:05.496766742] [11992] DEBUG RPiAf af.cpp:357 Recompute Contrast weights 8x8
[0:12:05.499591987] [11992] DEBUG RPiAf af.cpp:517 SKIP
[0:12:05.499608413] [11992] DEBUG RPiAf af.cpp:693 1 sst2->2 stp0->0 ft1.00->1.00 fs1.00->1.00 cont=0 phase=0 conf=0
[0:12:05.530215007] [11992] DEBUG RPiAf af.cpp:517 SKIP
[0:12:05.530231618] [11992] DEBUG RPiAf af.cpp:693 1 sst2->2 stp0->0 ft1.00->1.00 fs1.00->1.00 cont=0 phase=0 conf=0
[0:12:05.563507421] [11992] DEBUG RPiAf af.cpp:517 SKIP
[0:12:05.563523310] [11992] DEBUG RPiAf af.cpp:693 1 sst2->2 stp0->0 ft1.00->1.00 fs1.00->1.00 cont=0 phase=0 conf=0
[0:12:05.596824538] [11992] DEBUG RPiAf af.cpp:517 SKIP
[0:12:05.596840446] [11992] DEBUG RPiAf af.cpp:693 1 sst2->2 stp0->0 ft1.00->1.00 fs1.00->1.00 cont=0 phase=0 conf=0
[0:12:05.630143489] [11992] DEBUG RPiAf af.cpp:693 1 sst2->2 stp0->0 ft1.00->1.00 fs1.00->1.00 cont=35 phase=0 conf=0
[0:12:05.663485255] [11992] DEBUG RPiAf af.cpp:693 1 sst2->2 stp0->0 ft1.00->1.00 fs1.00->1.00 cont=35 phase=0 conf=0
[0:12:05.696791187] [11992] DEBUG RPiAf af.cpp:693 1 sst2->2 stp0->0 ft1.00->1.00 fs1.00->1.00 cont=35 phase=0 conf=0
[0:12:05.730154379] [11992] DEBUG RPiAf af.cpp:693 1 sst2->2 stp0->0 ft1.00->1.00 fs1.00->1.00 cont=35 phase=0 conf=0
[0:12:05.763472571] [11992] DEBUG RPiAf af.cpp:693 1 sst2->2 stp0->0 ft1.00->1.00 fs1.00->1.00 cont=98 phase=0 conf=0
[0:12:05.796714577] [11992] DEBUG RPiAf af.cpp:693 1 sst2->3 stp0->4 ft1.00->0.00 fs1.00->0.00 cont=98 phase=0 conf=0
[0:12:05.830048676] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp4->3 ft0.00->0.00 fs0.00->0.00 cont=95 phase=0 conf=0
[0:12:05.863351887] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp3->2 ft0.00->0.00 fs0.00->0.00 cont=87 phase=0 conf=0
[0:12:05.896730930] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp2->1 ft0.00->0.00 fs0.00->0.00 cont=88 phase=0 conf=0
[0:12:05.930068881] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp1->0 ft0.00->0.00 fs0.00->0.00 cont=88 phase=0 conf=0
[0:12:05.963404869] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp0->4 ft0.00->1.00 fs0.00->1.00 cont=89 phase=0 conf=0
[0:12:05.996773245] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp4->3 ft1.00->1.00 fs1.00->1.00 cont=91 phase=0 conf=0
[0:12:06.030121826] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp3->2 ft1.00->1.00 fs1.00->1.00 cont=98 phase=0 conf=0
[0:12:06.063637090] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp2->1 ft1.00->1.00 fs1.00->1.00 cont=98 phase=0 conf=0
[0:12:06.096816764] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp1->0 ft1.00->1.00 fs1.00->1.00 cont=98 phase=0 conf=0
[0:12:06.130143308] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp0->4 ft1.00->2.00 fs1.00->2.00 cont=98 phase=0 conf=0
[0:12:06.163456388] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp4->3 ft2.00->2.00 fs2.00->2.00 cont=101 phase=0 conf=0
[0:12:06.196762858] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp3->2 ft2.00->2.00 fs2.00->2.00 cont=110 phase=0 conf=0
[0:12:06.230071901] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp2->1 ft2.00->2.00 fs2.00->2.00 cont=110 phase=0 conf=0
[0:12:06.263406019] [11992] DEBUG RPiAf af.cpp:693 1 sst3->3 stp1->0 ft2.00->2.00 fs2.00->2.00 cont=110 phase=0 conf=0

Here is a real time video of the autofocus (continuous) in action streamed directly from the camera. As you can see it seems to be using the course step/fine step algorithm which is part of the CDAF fallback.

Hi @Nighthawk
You can stay tuned to the issue opened in the Raspberry Pi GitHub. It has not been solved so far.

Thanks! I will do that.