From patchwork Fri Sep 18 07:59:38 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 28312 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id E96BCBE175 for ; Fri, 18 Sep 2026 08:07:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3296B6870B; Fri, 18 Sep 2026 10:07:40 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="QApWE36M"; dkim-atps=neutral Received: from mail-wr2-x0f.google.com (mail-wr2-x0f.google.com [IPv6:2a00:1450:4864:30::f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5A9D16849B for ; Fri, 18 Sep 2026 10:07:38 +0200 (CEST) Received: by mail-wr2-x0f.google.com with SMTP id ffacd0b85a97d-48436686a40so55845f8f.3 for ; Fri, 18 Sep 2026 01:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1789718858; x=1790323658; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=quAgrDAfwUnNNdoEhCNHQlArXv6W6iR5tEjhbFDYxM4=; b=QApWE36MkeBEiQwjurtmwj1qC3ggz8+uCOnB7B0RU4xlSEhg9avUNGJIX9c/0ObdQ5 Wx16DFiC9wpd5OY4jpbK+K6RDW/y9aAv/h8flJTAwXRA6wy3py7WsnwacJLlE6UccuJc As94jX/GZovayasykmGTuenp25e4uCXbf1cFzzCUb2d8LmD6/V9IEGmfKGrjY/3eKV2i /8YzIccfHvvsLWcTz/mCLTVIrwutUxlG/S1NU3GYyJP5exipSWs+cDJTtb0fbcovE3ab hgVoyx/Owfd0AxVdt268MxOwp/dD5KCa1l9eAbcXCkFybV3eaSGsq1fbQVtsAmyXAZld Lnpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789718858; x=1790323658; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=quAgrDAfwUnNNdoEhCNHQlArXv6W6iR5tEjhbFDYxM4=; b=ZsaN/HaF7BFZ2YTy+BM7rIBL5cde5NIGVN6e4aRZM5JHYcsw8Xp5ryC6KCY0KeO/Xm h/blKBLY5DwfKexU/LlhwcFRV+WmvyvftuEO08K0hsCAQCOpQfT0OJKyUkXivJT1NL1Q wDpmMaTvAwu5/aGRfXi6Z4gH+AnoLaLOyc0Z1LJXrM2bBwPy2ZwKabMPfRsvzEPX2Krz jAypO54UMPi3fxflrPbaDWEn1ZkUkbrma07BYspHyxgQQiZVgpHEsij5IJfMGvOD+Fy2 ALPSSy1ql1Br8ua/hNyqvgzKqT7Fo1TVWsGVxbnu0futG2uRaw/kTBo4q/RePxpTnJYR Mi4g== X-Gm-Message-State: AFuF++ktXXaDVLyIvoSYHuIfVB0LF5ZBHYkQnY8UZzOgFPos0+nSRJrv jJGWM91XFrvhhidLzHUIEypOMqvIDyY/Yy1/7lHgrAhYUZxYZdLXXv97eWuz3V8mUalxMLAdNlZ 3H8S0O+s= X-Gm-Gg: AYBFou1ExC0VHK2HhHcUFWEUCpZyCcuYNSnFEULcLDK51rIWlXKQ8eLo9CAItQeAfEg rJmtpTzZB4IpqIk+hlvdrn1jNkzCLseiF2xmO/AXpcZeT6dA2aMlVkTpR2cpcOasiqPNo8Bu67C 0y9BnfqxDQLXJ/0ibFcUP3PejtQwar5AmE5mHSIh3jvIjDuH0yGnxTQs9cSj8CEDPD4nuYwCDB2 aGsR8YhyWFG5Q3Up/7dBK22QxEpw8OsxRHBIedXaf7wr+w/Qsda225gtdYcWcYh5ZdMgnd9y4dK oyPMa7z6KxVE5jHESX/DK91bombvDgEoUGJ9QDJ8cmwLpIwvOhFx11/SJby40vM/2Hl7Rs6DAaL THdb9ujYu0gTmmI8yGfx+Er4jm60VJT2r4LPEWaypVu/YK8J8suijaW29DgFp4oe5akbh255ty6 mRk6/Pd+YUMZe7Nu59vpFGx51GDc7WRMj+SZhAwNC4fMafjWl2YCMkhNCBkRotjmvcAdNcY7ovc NWbEUDwX4g05rgGQUebIjNJOtDcI1lYbs0Fwbxrt8EB6HTovQf64Ja58j169bViS7GdllVzu7Ya Z1YjSzim+BvycTbzoxDsX+EqhmOL1Gq0pbCq6zrgJnR3SexsgcUIsSA5To3iksLnogvJf6+QDCr C9d1F6w11uKvM3ceTRs9zaPGEE+pQm8m6qIY= X-Received: by 2002:a5d:5c03:0:b0:487:1488:d200 with SMTP id ffacd0b85a97d-4871fa41688mr1203052f8f.3.1789718857650; Fri, 18 Sep 2026 01:07:37 -0700 (PDT) Received: from naush-dell.pitowers.org ([2a00:1098:3142:1f:45e3:df8b:2b18:6253]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-487203f077fsm1742230f8f.26.2026.09.18.01.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2026 01:07:37 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck Subject: [RFC PATCH v1 00/20] libcamera: New enumeration API Date: Fri, 18 Sep 2026 08:59:38 +0100 Message-ID: <20260918080734.1228227-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi, As promised way back in the May F2F (better late than never!), this series adds a new two-phase camera enumeration API to the CameraManager. Today, CameraManager::start() creates and initialises every camera in the system, including IPA initialisation, which can be quite a heavyweight operation. Additionally, this stops application from possibly providing camera specific IPA configurations during initialisation. The new API splits this operation in two. CameraManager::enumerate() returns a CameraDescriptor for every camera in the system, carrying the camera id and the properties known without touching the hardware. The application then picks the ones it wants and calls CameraManager::initialize() on each descriptor to get a fully initialised Camera. This API is optional, and applications can still use start() and cameras() exactly as before. On the pipeline handler side, match() is split into survey() and createCamera(). survey() reports descriptors using only the DeviceEnumerator and must not acquire or open anything, while createCamera() does the per-camera work that match() used to do. Pipeline handlers may still keep working through match(), where their cameras are created by start() but are not reported by enumerate(). The patches roughly grouped as follows: Patches 1-4: Helpers needed to identify a camera without opening it. Camera IDs are generated from the media entity (sysfs/firmware node) rather than an opened subdevice, the model name derivation is factored out, and the device enumerator gains a non-acquiring searchAll(). Patches 5-7: The CameraDescriptor class and the survey()/createCamera() pipeline handler API, plus the ability to acquire a specific media device. Patches 8-15: CameraManager changes. Patches 16-19: survey()/createCamera() implementations for the RPi (vc4/pisp) and uvcvideo pipeline handlers, with their match() implementations removed once they are dead code. Patch 20: Documentation updates. I've tested these changes on a branch of rpicam-apps [1] that implements the enumeration API. Also done some basic testing with the uvcvideo pipeline handler in cam. I'm unable to test any other pipeline handler, so their code remains unchanged, using the existing match() API. There's a few fundamental changes to the CameraManager implemenation here so I'm sure there is plenty to discuss :) Regards, Naush [1]: https://github.com/raspberrypi/rpicam-apps/tree/enumeration-api Naushir Patuck (20): libcamera: sysfs: Add devicePath() helpers libcamera: v4l2_subdevice: Refactor the model name derivation libcamera: camera_sensor: Generate sensor IDs from a media entity libcamera: device_enumerator: Add non-acquiring searchAll() libcamera: Add the CameraDescriptor class libcamera: pipeline_handler: Add survey() and createCamera() libcamera: pipeline_handler: Allow acquiring a specific media device libcamera: camera_manager: Defer IPAManager construction to first use libcamera: camera_manager: Track active pipeline handler instances libcamera: camera_manager: Extract the pipeline handler factory list libcamera: camera_manager: Marshal work onto the camera manager thread libcamera: camera_manager: Add CameraManager::enumerate() libcamera: camera_manager: Add CameraManager::initialize() libcamera: camera_manager: Create cameras through enumeration libcamera: pipeline_handler: Make match() optional pipeline: rpi: Add platform helpers for camera enumeration pipeline: rpi: Implement survey() and createCamera() pipeline: uvcvideo: Factor out camera ID generation pipeline: uvcvideo: Implement survey() and createCamera() Documentation: Describe the two-phase camera enumeration API .../guides/application-developer.rst | 41 ++ Documentation/guides/pipeline-handler.rst | 101 +++++ include/libcamera/camera_descriptor.h | 34 ++ include/libcamera/camera_manager.h | 4 + .../libcamera/internal/camera_descriptor.h | 37 ++ include/libcamera/internal/camera_manager.h | 30 +- include/libcamera/internal/camera_sensor.h | 1 + .../libcamera/internal/device_enumerator.h | 1 + include/libcamera/internal/meson.build | 1 + include/libcamera/internal/pipeline_handler.h | 8 +- include/libcamera/internal/sysfs.h | 3 + include/libcamera/internal/v4l2_subdevice.h | 1 + include/libcamera/meson.build | 1 + src/libcamera/camera_descriptor.cpp | 141 +++++++ src/libcamera/camera_manager.cpp | 372 ++++++++++++++++-- src/libcamera/device_enumerator.cpp | 31 ++ src/libcamera/meson.build | 1 + .../pipeline/rpi/common/pipeline_base.cpp | 99 +++++ .../pipeline/rpi/common/pipeline_base.h | 16 + src/libcamera/pipeline/rpi/pisp/pisp.cpp | 121 +++--- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 79 ++-- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 244 +++++++----- src/libcamera/pipeline_handler.cpp | 107 +++++ src/libcamera/sensor/camera_sensor.cpp | 27 ++ src/libcamera/sensor/camera_sensor_legacy.cpp | 6 +- src/libcamera/sensor/camera_sensor_raw.cpp | 3 +- src/libcamera/sysfs.cpp | 61 +++ src/libcamera/v4l2_device.cpp | 13 +- src/libcamera/v4l2_subdevice.cpp | 60 +-- 29 files changed, 1352 insertions(+), 292 deletions(-) create mode 100644 include/libcamera/camera_descriptor.h create mode 100644 include/libcamera/internal/camera_descriptor.h create mode 100644 src/libcamera/camera_descriptor.cpp