From patchwork Fri Aug 21 14:46:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 9344 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 83E2FBD87C for ; Fri, 21 Aug 2020 14:46:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 99F71626E3; Fri, 21 Aug 2020 16:46:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="eZ8y3hBV"; dkim-atps=neutral Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E331A61ED9 for ; Fri, 21 Aug 2020 16:46:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com; h=from:subject:mime-version:to:cc:content-type: content-transfer-encoding; s=s1; bh=jtCQoAI9wHGaidZkpss5zPczuMngj2kArBdoqj6xgeg=; b=eZ8y3hBVo+/X92Xz/lUT7LWjR3byMTgN+g+7//6wwd459l6BK1HWaw/9KN0gAVGfKv04 CbEbXSB3kyQM2oYwG8X/oOJvvrvgfX0Nt1RUnehrCco6S0UwGAy6uwDGIWlbWkbGb1KxTF 61vpscvhb15q7xpx5CGkhmofTVKqnZJlA= Received: by filterdrecv-p3las1-7c6d97d9cb-cbgjr with SMTP id filterdrecv-p3las1-7c6d97d9cb-cbgjr-18-5F3FDE2E-4C 2020-08-21 14:46:06.501174639 +0000 UTC m=+74570.951664913 Received: from mail.uajain.com (unknown) by ismtpd0005p1hnd1.sendgrid.net (SG) with ESMTP id H4ltTXgFQ3-prAA0jN3S5w for ; Fri, 21 Aug 2020 14:46:06.083 +0000 (UTC) From: Umang Jain Date: Fri, 21 Aug 2020 14:46:06 +0000 (UTC) Message-Id: <20200821144601.67860-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcBLpXFhl3+P87RHKL8hWvbDVyMatKsgYvi9PahGRp7p1y5+jvf1v7hWc7IX3zU5ZCpT45skPnGbl3qjRxZwYKOOi4bu9ss44NZJUY2xjggPueRGvo2IUumfLRO0/Od9A4BrUhcgedMBK+rxmkhG6waJ4dp9v+97z0mmbKXKYyvFxeY201JVzPYPYa4pS9Nr4UvBgiX0grsIzr1jCmDLBMEQ== To: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH v4 0/5] android: Camera hotplug support 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" Changes from v3: - No major functional changes as such. Only comestic and refactoring ones pointed out in the review. Changes from v2: - Separate CameraDevice as shared pointer and a getter func as two new commits from "camera_hal_manager: Support camera hotplug" - Rename few variables and refactor to have more code-sharing. - Drop "camera_hal_manager: Handle hot-unplug of currently open camera" - Still finding out a nice way to deal with this. Current stock implementation on CrOS is to ::exit(1) cros_camera_service if an open camera is unplugged. AOSP doesn't seem to handle this use case, maybe because it doesn't have notion of hot-[un]pluggable cameras? Add a \todo on unplug handler path. Changes from v1: - Treat all UVC cameras as external - based off Laurent's suggestion. -It's difficult to know whether a UVC camera is external or internal. Hence, treat all UVC camereas as external by setting their CameraLocation property as CameraLocationExternal. - Use different IDs for internal and external cameras. -Internal camera IDs are meant to be started with 0 and external/removable ones from 1000. Also, support that if the camera has been seen in the past, reuse it's ID. - Few changes dealing with race conditions, locking and graceful handling of currently streaming camera. Umang Jain (5): libcamera: pipeline: uvcvideo: Treat all UVC cameras as external android: camera_hal_manager: Set camera module callbacks android: camera_device: Make CameraDevice a shared object android: camera_device: Add a getter to get libcamera::Camera pointer android: camera_hal_manager: Support camera hotplug src/android/camera3_hal.cpp | 2 + src/android/camera_device.cpp | 7 + src/android/camera_device.h | 6 +- src/android/camera_hal_manager.cpp | 176 ++++++++++++++++--- src/android/camera_hal_manager.h | 25 ++- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 7 + 6 files changed, 198 insertions(+), 25 deletions(-)