From patchwork Wed May 19 07:59:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12320 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 1AA60C3200 for ; Wed, 19 May 2021 08:00:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CAC6368926; Wed, 19 May 2021 10:00:00 +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="m3L/ZrIf"; dkim-atps=neutral Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 814356891C for ; Wed, 19 May 2021 09:59:57 +0200 (CEST) Received: by mail-pf1-x42e.google.com with SMTP id e19so9344538pfv.3 for ; Wed, 19 May 2021 00:59:57 -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=QZsnwxA2ke1bJ5i7sxS/mzf7jGdB3f5iGqyBHXj/sFc=; b=m3L/ZrIf10uDbuSYPJbsz9qfnKUKx/MNcfJRpgeHymaKVCi1odrvjMBXogdIgO5XCf YPIshZzduFcS/jU56xhbPw6lgu2neWe5KyxXlRNbILaKUCrXWHwS4F3DbvmyAP7qkcDr 67laSNq566sykHjNHXDP4TdkbaQx3uzJGqB6Y= 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=QZsnwxA2ke1bJ5i7sxS/mzf7jGdB3f5iGqyBHXj/sFc=; b=e/xfn+l4VDy5HpMZTSzz0ixTxysqFo0g9HBYWy56tDXjHX7Nds8D07/IgdrfXpfppB neB0PyN9OV6aVFCgVN7blp97DGyqWdtRCiJcilc82DYQzBE/x6+zzovs+W+kHTA5Y194 Pp78des/C0Mz8bMWDDYrBlKIyYtMcF2BwXD17VFD2f52vB7V9Z3CUCVMfrnRP6kbNtx4 5s0NIpfQ4kf1qIOYAmEnsfR9K1hBmHOLsrUKWWtsvLUL4ApmfuL0zbE/7r1lasU1Bdre jaV4dcFiaQqXuobDyq8VoBoSs3usaZPapy4UgGNNhCnzHYV+r6PBKT5GbUtp+XNUN08x mupQ== X-Gm-Message-State: AOAM533duqghcAPknVS2uRHLL9eCpDm+EQIPPupwVvD8BUuHO4BcIHdy HH4V3DT9dqjVwFFJhJzGo6C0ptTYL1tH6w== X-Google-Smtp-Source: ABdhPJyxj5KP4tTuV9CNxtdRjRzWQHdYB6OQQpLeYwHMP2X4zuwVZ/cTBRg3MF2CaJ699y2Mn9jTUg== X-Received: by 2002:a63:e952:: with SMTP id q18mr9579721pgj.430.1621411195873; Wed, 19 May 2021 00:59:55 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:3948:91a2:b8ec:1976]) by smtp.gmail.com with ESMTPSA id 80sm1160847pfw.200.2021.05.19.00.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 May 2021 00:59:55 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Wed, 19 May 2021 16:59:41 +0900 Message-Id: <20210519075941.1337388-6-hiroh@chromium.org> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog In-Reply-To: <20210519075941.1337388-1-hiroh@chromium.org> References: <20210519075941.1337388-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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 --- src/android/camera_device.cpp | 47 ++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index b32e8be5..a07679a3 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1035,11 +1035,52 @@ 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,