From patchwork Fri May 28 03:05:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12468 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 39CC9C3205 for ; Fri, 28 May 2021 03:05:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F04D668922; Fri, 28 May 2021 05:05:48 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="IW/ZnFkm"; dkim-atps=neutral Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3DD6F68932 for ; Fri, 28 May 2021 05:05:46 +0200 (CEST) Received: by mail-pj1-x102c.google.com with SMTP id q6so1728711pjj.2 for ; Thu, 27 May 2021 20:05:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1aFBJcr/n+ZV4L7J15RKBnyQR+JbUBqSyuBTQDCRAic=; b=IW/ZnFkmDGF9GQqiZ7koIwpnWs7QSLcu+iJjHpp/ZzPhKWNRue0zY0IEQxD30ZhSM/ r+WpYAmdJEkFAjc8gBIM08Uut1BoDOYMCrFUr0YczeH7V55k7XJdCeTY+GdcpMntil1m Z4D2HFtHbku2TxiWdQIRuCVhWbYguYKuSZ5t0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1aFBJcr/n+ZV4L7J15RKBnyQR+JbUBqSyuBTQDCRAic=; b=nX6HF3Woelkv1YkpGtwKUM08JIrZ34momd9NId4FKkUW7b4ilx96gEgXavp+WGBsLO K4xcm4gqZAD8gRSNY6twD9YxMObus9FwnGA0u7fNjFyfYT7zJO50gfhzr/e2FHK2BUdg lJC7AoVXSXErGKNlo2kGKkercDkW/CXDnumBpMcw4Cvfn/dsO4omXURk/NycvQ4GW05u JGrBS6RZmEDmQ0hYu7XeQZuuCu1qyR+xCrFxueMdO38RoFdM+PLU1WC8CZA8zrueY2ZW KtOPwWGyNtveiB8IdKAMuqn2QaSC/C5mJzM1i67PrVECQe51QNRhW3h9LsB+uAJDf7IR xmcw== X-Gm-Message-State: AOAM530kmSPZwR3Wu6zvDu+FFXAolb3EeDZpjItqraJ94D0PnW4WKQRL aKw18jUnOL4t8vXLZ9Iq4ZjTUsbg/ZozdA== X-Google-Smtp-Source: ABdhPJwguB4wghh93ybEJpooXCDDu53dE8Aif+ivwLEWGbQeNytKhHKLvpHU9P+J6ezknkG8L1/+fw== X-Received: by 2002:a17:90a:6005:: with SMTP id y5mr258674pji.62.1622171144672; Thu, 27 May 2021 20:05:44 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:caec:ab3b:ea16:3d01]) by smtp.gmail.com with ESMTPSA id l20sm2892051pjq.38.2021.05.27.20.05.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 20:05:44 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Fri, 28 May 2021 12:05:31 +0900 Message-Id: <20210528030531.189492-6-hiroh@chromium.org> X-Mailer: git-send-email 2.32.0.rc0.204.g9fa02ecfa5-goog In-Reply-To: <20210528030531.189492-1-hiroh@chromium.org> References: <20210528030531.189492-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 6/6] android: CameraDevice: Report queried test pattern modes 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" Report to the Android camera stack the list of supported test pattern modes constructed by inspecting the values reported by libcamera through the controls::draft::TestPatternMode control. Signed-off-by: Hirokazu Honda Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/android/camera_device.cpp | 46 ++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 7fc4ddb0..d29147bc 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1082,11 +1082,51 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() staticMetadata_->addEntry(ANDROID_SENSOR_ORIENTATION, orientation_); - std::vector testPatterModes = { - ANDROID_SENSOR_TEST_PATTERN_MODE_OFF, + std::vector testPatternModes = { + ANDROID_SENSOR_TEST_PATTERN_MODE_OFF }; + if (const auto &testPatternsInfo = + controlsInfo.find(&controls::draft::TestPatternMode); + testPatternsInfo != controlsInfo.end()) { + const auto &values = testPatternsInfo->second.values(); + ASSERT(!values.empty()); + for (const auto &value : values) { + switch (value.get()) { + case controls::draft::TestPatternModeOff: + /* + * ANDROID_SENSOR_TEST_PATTERN_MODE_OFF is + * already in testPatternModes. + */ + break; + case controls::draft::TestPatternModeSolidColor: + testPatternModes.push_back( + ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR); + break; + case controls::draft::TestPatternModeColorBars: + testPatternModes.push_back( + ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS); + break; + case controls::draft::TestPatternModeColorBarsFadeToGray: + testPatternModes.push_back( + ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY); + break; + case controls::draft::TestPatternModePn9: + testPatternModes.push_back( + ANDROID_SENSOR_TEST_PATTERN_MODE_PN9); + break; + case controls::draft::TestPatternModeCustom1: + testPatternModes.push_back( + ANDROID_SENSOR_TEST_PATTERN_MODE_CUSTOM1); + break; + default: + LOG(HAL, Error) << "Unknown test pattern mode: " + << value.get(); + continue; + } + } + } staticMetadata_->addEntry(ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES, - testPatterModes); + testPatternModes); uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN; staticMetadata_->addEntry(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,