From patchwork Thu Jun 10 08:25:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12550 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 8DE80BD78E for ; Thu, 10 Jun 2021 08:25:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4FA636893C; Thu, 10 Jun 2021 10:25:56 +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="YqSm8Tfj"; dkim-atps=neutral Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 782036892B for ; Thu, 10 Jun 2021 10:25:55 +0200 (CEST) Received: by mail-pj1-x1029.google.com with SMTP id pi6-20020a17090b1e46b029015cec51d7cdso3344676pjb.5 for ; Thu, 10 Jun 2021 01:25:55 -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=hqu8pksEUVvipvwGZ2F8p2REk5PKW/IuLTrKzsk2/go=; b=YqSm8Tfj31Q0ZUfDA/Cho8VWPsxwTZOtjFYj9mFpHZLSCjtciO9BYH+HNdLCzNKUJg l8QfUVefjGnTrcEYse9OFtUipTF3Ydj7EwrGzkgMUam/qsh4LvUkdWh9gfjCwjWXl23E dRgepoSlGwbxCX8HgH0ZXP/8OVUlkop8Yp1GU= 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=hqu8pksEUVvipvwGZ2F8p2REk5PKW/IuLTrKzsk2/go=; b=o+GWM1247SGif4Hk3Qvm4he3Lu1BPDTON4j4oZohiumuD3nZcdG6ejf9DwXFoJ6lAa 8Wo/DDt5nGTvWRu3d7s70K1ZR/9nIIQtVKFOI7dvQyf9uWT0vmi+54+8n9ZoZe1kAu31 rEeyLm4mRiTwWIswcaaeGoyNAVAD+DG6SKhuieBvpQ87k7c1w+TeFfYZJYFTcVJwZMaU g05muSaxRU3nvpVyCxC5Q8PEbcGwVVKjT7mgaOHiIu4PC5jnft7QUqOQR/zQCDp2c3Mx jd+espVKJ14BwayHOWZcM2pTu3us/7VzMRfLly+soabiguNJ55SXbVLWs1w0nBnmGwSj o8gA== X-Gm-Message-State: AOAM530Huv+BePpgrWN0VqUYY3VIpQHCqqIDznFrVj8Rf6PFqJlI1MyU CisZ4OyIyzBm7jF9ur/1e4ZDZARuH1FgSw== X-Google-Smtp-Source: ABdhPJyLJkXyTLorQLVPedHxehln6bwneeZ+Og6hz/GvWtlyGpg/DOQbQC1TtcJ7S2dZL32pwcTu1Q== X-Received: by 2002:a17:90a:6a8d:: with SMTP id u13mr2184443pjj.55.1623313553870; Thu, 10 Jun 2021 01:25:53 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:98e0:b356:1c8a:25d4]) by smtp.gmail.com with ESMTPSA id x3sm2087011pgx.8.2021.06.10.01.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 01:25:53 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Thu, 10 Jun 2021 17:25:39 +0900 Message-Id: <20210610082539.529739-6-hiroh@chromium.org> X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog In-Reply-To: <20210610082539.529739-1-hiroh@chromium.org> References: <20210610082539.529739-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v8 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 | 51 ++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index fe332ec3..5e961003 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1083,11 +1083,56 @@ 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 }; + const auto &testPatternsInfo = + controlsInfo.find(&controls::draft::TestPatternMode); + if (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: + /* We don't support this yet. */ + 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,