From patchwork Tue Dec 28 09:51:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Stratiienko X-Patchwork-Id: 15223 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 88C5DBE080 for ; Tue, 28 Dec 2021 09:52:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BA42B6090D; Tue, 28 Dec 2021 10:52:01 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LVBtHRjV"; dkim-atps=neutral Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 87578604F8 for ; Tue, 28 Dec 2021 10:52:00 +0100 (CET) Received: by mail-lj1-x230.google.com with SMTP id h21so17894482ljh.3 for ; Tue, 28 Dec 2021 01:52:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wXXSfJXgmnIcH2zJ7nLde5+GKaQ+HsqVyVby3nVFrJU=; b=LVBtHRjVvKzYfuyLtNCaEhXQuowEUERSo2FN70+35vEuXmQGSq6bRrgjbkvr1Rs6zl uQu0COgJhfNd7YCypC0dU0VU6NgsbEAuU7jtcupSDImCGs/OIPz44X7I64SriiiB7gnW 2YYbotuA6j39ePIHS2NtfpCgjgGGm+R8QpgXhB+tZcBqjPtSsSFIZnuXQ3AWr7uQxzgt qTBP7aDuISdqfgql0vrasfVkjZcIGlN5SYPPHfrptHnmNygR90pePjEk6QLri9UHLJtf 1c3Qc0TNaSlcQPyK4Vww89B0CO6WEWpX7KVDoSeZ/+S37uliF2k+hXMAAil/cgayTrFN jmzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wXXSfJXgmnIcH2zJ7nLde5+GKaQ+HsqVyVby3nVFrJU=; b=erZy4LxGjWtlcEM+URiH2Kq5Wtp+d3hu8FFlDnPZ7/g+apffyL02yPv5eechdXH4fO H5m/UCa+CFgnc6ztaNouYGcN1VkzAazl0LCGtqPXz2MdXsUdr8cVWD5ch2UhiFGQGYMU wyCJSrLwb6Bb1CfL2khpIScc7vvTtb0FPeAUu02stLa+msmjkN3/h3G+jHWlq61JKe82 U6JjtNX7SVz0puRuB0McdimCPAozAnl+cnOLhLEyMwtLzTRG8IsXoSgREmenZSXZWTaG 41lfw9DZ0N4mSZx0vHtL6MMvyd/GEQN1vF2IxDcHfc4hE5oe8682CVZk73NK0G4YRcrL Gz/g== X-Gm-Message-State: AOAM5318TEXpBr2U18REeOnepFDdvCqki/U4f/UT9YMIubxvRmfdSkd2 IkTktSQ/YuOhT1cnOF19jmaqRnGmQhg= X-Google-Smtp-Source: ABdhPJyPukBrSmChtCDpqDF8zG4V047IzQddz7vr6ep9Hs7IudJKwLyMxHPOI7vKJjGMTafHsKcXGw== X-Received: by 2002:a2e:8045:: with SMTP id p5mr11025567ljg.127.1640685119461; Tue, 28 Dec 2021 01:51:59 -0800 (PST) Received: from hrk1-lhp-A00621.synapse.com ([195.234.75.141]) by smtp.gmail.com with ESMTPSA id e4sm1491069lfr.221.2021.12.28.01.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Dec 2021 01:51:59 -0800 (PST) From: Roman Stratiienko X-Google-Original-From: Roman Stratiienko To: libcamera-devel@lists.libcamera.org Date: Tue, 28 Dec 2021 11:51:53 +0200 Message-Id: <20211228095153.611009-1-roman.o.stratiienko@globallogic.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] android: Make libyaml dependency optional 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: , Cc: Roman Stratiienko Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Mainline Android has no libyaml in-tree. Moreover camera_hal_config.cpp uses std::filesystem class that is not permitted for AOSP VNDK vendor libraries. External configuration file is no longer mandatory and DTS overlays can be used to specify camera location and rotation. Do not require external configuration file for cases where meson.build can't find libyaml. Assume that cameras without location specified by V4L2 properties are always external. Signed-off-by: Roman Stratiienko --- src/android/camera_hal_manager.cpp | 13 +++++++++++++ src/android/camera_hal_manager.h | 2 ++ src/android/meson.build | 10 ++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp index 5f7bfe265c71b..9e575bfa5204a 100644 --- a/src/android/camera_hal_manager.cpp +++ b/src/android/camera_hal_manager.cpp @@ -48,6 +48,7 @@ int CameraHalManager::init() { cameraManager_ = std::make_unique(); +#ifdef HAVE_LIBYAML /* * If the configuration file is not available the HAL only supports * external cameras. If it exists but it's not valid then error out. @@ -56,6 +57,7 @@ int CameraHalManager::init() LOG(HAL, Error) << "HAL configuration file is not valid"; return -EINVAL; } +#endif /* Support camera hotplug. */ cameraManager_->cameraAdded.connect(this, &CameraHalManager::cameraAdded); @@ -133,6 +135,7 @@ void CameraHalManager::cameraAdded(std::shared_ptr cam) } } +#ifdef HAVE_LIBYAML /* * The configuration file must be valid, and contain a corresponding * entry for internal cameras. External cameras can be initialized @@ -145,6 +148,16 @@ void CameraHalManager::cameraAdded(std::shared_ptr cam) } const CameraConfigData *cameraConfigData = halConfig_.cameraConfigData(cam->id()); +#else + /* + * Assume that cameras without properties::Location specified are external. + */ + const CameraConfigData *cameraConfigData = nullptr; + if (!isCameraExternal && cameraLocation(cam.get()) < 0) { + isCameraExternal = true; + id = nextExternalCameraId_; + } +#endif /* * Some cameras whose location is reported by libcamera as external may diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h index a5f8b933a7902..056abbb0d4e54 100644 --- a/src/android/camera_hal_manager.h +++ b/src/android/camera_hal_manager.h @@ -56,7 +56,9 @@ private: CameraDevice *cameraDeviceFromHalId(unsigned int id) LIBCAMERA_TSA_REQUIRES(mutex_); std::unique_ptr cameraManager_; +#ifdef HAVE_LIBYAML CameraHalConfig halConfig_; +#endif const camera_module_callbacks_t *callbacks_; std::vector> cameras_ LIBCAMERA_TSA_GUARDED_BY(mutex_); diff --git a/src/android/meson.build b/src/android/meson.build index 75b4bf2070851..1e471c291a1e4 100644 --- a/src/android/meson.build +++ b/src/android/meson.build @@ -3,7 +3,6 @@ android_deps = [ dependency('libexif', required : get_option('android')), dependency('libjpeg', required : get_option('android')), - dependency('yaml-0.1', required : get_option('android')), libcamera_private, ] @@ -41,7 +40,6 @@ android_hal_sources = files([ 'camera3_hal.cpp', 'camera_capabilities.cpp', 'camera_device.cpp', - 'camera_hal_config.cpp', 'camera_hal_manager.cpp', 'camera_metadata.cpp', 'camera_ops.cpp', @@ -56,6 +54,14 @@ android_hal_sources = files([ android_cpp_args = [] +libyaml_dep = dependency('yaml-0.1', required : false) +if libyaml_dep.found() + config_h.set('HAVE_LIBYAML', 1) + android_hal_sources += files([ + 'camera_hal_config.cpp', + ]) +endif + subdir('cros') subdir('mm')