From patchwork Wed Apr 28 07:36:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12130 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 86AEDBDE44 for ; Wed, 28 Apr 2021 07:36:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 37232688BC; Wed, 28 Apr 2021 09:36:39 +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="GXREcBDy"; dkim-atps=neutral Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A6A6688C2 for ; Wed, 28 Apr 2021 09:36:35 +0200 (CEST) Received: by mail-pj1-x102e.google.com with SMTP id m6-20020a17090a8586b02901507e1acf0fso8645328pjn.3 for ; Wed, 28 Apr 2021 00:36:35 -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=dgY0VyAh1UvCaMt1h0/NXnw6PtEa0f4TRDwpJyByJrU=; b=GXREcBDyNXfAwBylv0uHJJJPCzV/zTFUAEfgsfsE2mCdokBqw1WjEbrqBd5XYJACsJ 2953nR4s71o1feIiVcykgsSmlxGVY4SRWkPNmXHzoiQRAdh5LzjpL60Ruo70fTexsbto FYf4Mp36lR7B4rxuL1XS9b5pP6KnMZCXodqP8= 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=dgY0VyAh1UvCaMt1h0/NXnw6PtEa0f4TRDwpJyByJrU=; b=hMoFvhG1pGGuXomtxEKA1fX1vW3tO2x9reO3Iu3YHJPjVt1j30RIUBT8e1WZElqvdv QS9ghlKG8HmAbh6iYABYLMkM30/0TYQs4ARZU1YszfvLW7DE0D55S3yYB+ouZpY3mFpm 0SJ0DZf668Tn6A3+a0vP07TY0xCGvtTK/f5wJjCXhqxKhhreZbH9m7MhidbyYHbdAexG 71zl3Or2k7mT+hC25RbDM8Ujg+hetsznKKT5Jb+aSLj4gUUjkMMl84+uaIfpqqQ8f67l Yhi50A8uZ/0NPG47ctxdRhtysYF0YreUdSYxfV6jmpClq1hsuPEa4EkXhE0SHpbCpfAf mDAg== X-Gm-Message-State: AOAM530zn330bvQWKtoFzbf3QeCkw0BWGBNKSvnj1ZvNYQ8W3Xzx1puw KWWH7RSR3zCuffJDdHnJq9OUhmxXXzSl7w== X-Google-Smtp-Source: ABdhPJw6r/Men/h/it0SG8CIbqCTCMQjFA+zgCnXjBGGMSMxOxqoAukK1MDCL5V53RbvOFCqNMU6Hw== X-Received: by 2002:a17:902:b582:b029:ed:562a:6f52 with SMTP id a2-20020a170902b582b02900ed562a6f52mr8680320pls.73.1619595393633; Wed, 28 Apr 2021 00:36:33 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:489:a5f4:117:7d51]) by smtp.gmail.com with ESMTPSA id m11sm1661265pgs.4.2021.04.28.00.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 00:36:33 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Wed, 28 Apr 2021 16:36:17 +0900 Message-Id: <20210428073617.373422-8-hiroh@chromium.org> X-Mailer: git-send-email 2.31.1.498.g6c1eba8ee3d-goog In-Reply-To: <20210428073617.373422-1-hiroh@chromium.org> References: <20210428073617.373422-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 7/7] 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 test pattern modes obtained by Camera::controls(). Signed-off-by: Hirokazu Honda --- src/android/camera_device.cpp | 46 ++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 3d5b5f24..a96bc09b 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1090,12 +1090,50 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() staticMetadata_->addEntry(ANDROID_SENSOR_ORIENTATION, &orientation_, 1); - std::vector testPatterModes = { - ANDROID_SENSOR_TEST_PATTERN_MODE_OFF, + const auto &testPatternsInfo = + controlsInfo.find(&controls::draft::TestPatternMode); + std::vector testPatternModes = { + ANDROID_SENSOR_TEST_PATTERN_MODE_OFF }; + if (testPatternsInfo != controlsInfo.end()) { + const auto &values = testPatternsInfo->second.values(); + if (!values.empty()) { + testPatternModes.clear(); + for (const auto &value : values) { + int aValue = -1; + switch (value.get()) { + case controls::draft::TestPatternModeOff: + aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_OFF; + break; + case controls::draft::TestPatternModeSolidColor: + aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR; + break; + case controls::draft::TestPatternModeColorBars: + aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS; + break; + case controls::draft::TestPatternModeColorBarsFadeToGray: + aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY; + break; + case controls::draft::TestPatternModePn9: + aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_PN9; + break; + case controls::draft::TestPatternModeCustom1: + aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_CUSTOM1; + break; + default: + LOG(HAL, Error) + << "Unknown test pattern mode: " + << value.get(); + continue; + } + + testPatternModes.push_back(aValue); + } + } + } staticMetadata_->addEntry(ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES, - testPatterModes.data(), - testPatterModes.size()); + testPatternModes.data(), + testPatternModes.size()); uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN; staticMetadata_->addEntry(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,