From patchwork Thu May 6 07:54:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12205 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 5E113BDE7F for ; Thu, 6 May 2021 07:55:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1FEBE6891C; Thu, 6 May 2021 09:55:09 +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="Mc1sgqIF"; dkim-atps=neutral Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B39FC68925 for ; Thu, 6 May 2021 09:55:06 +0200 (CEST) Received: by mail-pl1-x631.google.com with SMTP id b3so2956849plg.11 for ; Thu, 06 May 2021 00:55:06 -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=PG62SFUcUT60t1iuwKKoBqdqCmkKztBSu4RhIwCnTPg=; b=Mc1sgqIF0Jyt2prbymVwrnyydiDKoPEWGB1kgxFkircXVmCRIxdDDnUVKhzJ7kRkE/ 85LOT7RH7ZJSZ0mn18Emgpwvq9U4d9Qufd3pfoFC94uOcdl7b1TEMgmHHMI1pCDU5nw8 TGcMmOHx0FpToEETXegK8XL51+9Ztee3/hPCE= 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=PG62SFUcUT60t1iuwKKoBqdqCmkKztBSu4RhIwCnTPg=; b=Jn7uGtPEqxmH1LNdb8MyYSHcu7hOCkYY27oJHWVPsy5JUGBjqQ53zfmmzpqCqDFEBm dFYePHDqxZtq96BYa3BVfRg28PVXXvjK4qXGWdKr1zDhnOEF8aOwU+aPY7Q/5d4P91PQ SV851JBncfeT0uoJZlMy0VzhTmg8Rd9n37aMINJW9UoSIbeeVoXeEqMPMvuSTI8pjYfX V61PL/lcQZIj0xKlkhJO/RXxAvtr6u4EXfiHgMMpOOZKkP7nSrrCbzyqpw637ZX/HZGu D4IlSeNQca5sCK96LwqkAicPRtSnvxI4++e577U7Zxd7ISdeDkL9Md1WGiG5ANeftkfD HmTQ== X-Gm-Message-State: AOAM532wHW8USCvWA5owu5JTPL7C9tUfDUJCaVVB6/7WR908ujitDQZV vS+lCMAaRT4Tk+j1v96xCcL51yIYS7nCJg== X-Google-Smtp-Source: ABdhPJytg1i3PI/K/WYHBdJtmnd3fRr/VRFSuE2bOgakkqvGEN+lNTU07rAmbKOQ/ePwjQQQP9I14Q== X-Received: by 2002:a17:90a:ad84:: with SMTP id s4mr16499626pjq.162.1620287705058; Thu, 06 May 2021 00:55:05 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:ede4:ae0e:d4a4:c0d3]) by smtp.gmail.com with ESMTPSA id f201sm1355546pfa.133.2021.05.06.00.55.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 May 2021 00:55:04 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Thu, 6 May 2021 16:54:49 +0900 Message-Id: <20210506075449.1761752-7-hiroh@chromium.org> X-Mailer: git-send-email 2.31.1.607.g51e8a6a459-goog In-Reply-To: <20210506075449.1761752-1-hiroh@chromium.org> References: <20210506075449.1761752-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 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,