From patchwork Mon Aug 17 20:26:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 9331 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 C6364BD87C for ; Mon, 17 Aug 2020 20:26:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E5BB361A1E; Mon, 17 Aug 2020 22:26:41 +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="v16g3FSG"; 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 EE05060384 for ; Mon, 17 Aug 2020 22:26:38 +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=1HCj0ZCjclBG3r1FTXM7UQGhUTD9RuBq9gGDgl7KOdw=; b=v16g3FSGv4M0ZT2dZ+nAXAYFfwVTFiKZc3wZTwxR3UmMCx3gDnGue9Iv320Tg/LmJ8aI +lO93n9a+Q+gwCegv1oJSagg4d3tUqC3P3fqJlsq0uUqmVyn76vvX2vZuF2z8xBM3/y++P L2kuIGw6Q1qHA0ZPcFFZHKcbeuVRzYlBE= Received: by filterdrecv-p3las1-5785d94c6b-nk2xm with SMTP id filterdrecv-p3las1-5785d94c6b-nk2xm-19-5F3AE7FB-65 2020-08-17 20:26:35.912199406 +0000 UTC m=+359821.842136409 Received: from mail.uajain.com (unknown) by ismtpd0006p1hnd1.sendgrid.net (SG) with ESMTP id jsWVIlvxQ-aj8saOl1QuHQ for ; Mon, 17 Aug 2020 20:26:35.477 +0000 (UTC) From: Umang Jain Date: Mon, 17 Aug 2020 20:26:35 +0000 (UTC) Message-Id: <20200817202629.4277-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPc7nggfkZXnk4gpr6Hf1oWqYUqC6T029TnkHtc7WLt8D/2Xae9on6tEMM/V5udhZsqNZvHI6WNl+DJ26fQCpXzSq91287B7+xQXxOr6QJ7qwfCVlvOJmauEoZtsKWb1gP+Q3SBCXF4aqS72xOCZrUpIJoiFity03EaOu2tlGjIsqYPngSKuvy4eIRjMGHKTzfn+3VG/OXCNnMSyfxWIxV4KA== To: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH v3 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 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 | 15 ++ src/android/camera_device.h | 8 +- src/android/camera_hal_manager.cpp | 179 ++++++++++++++++--- src/android/camera_hal_manager.h | 23 ++- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 7 + 6 files changed, 209 insertions(+), 25 deletions(-)