From patchwork Thu Jun 10 08:25:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12547 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 284AFBD78E for ; Thu, 10 Jun 2021 08:25:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D203A6892C; Thu, 10 Jun 2021 10:25:51 +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="gr1ag6l/"; dkim-atps=neutral Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BE7916892C for ; Thu, 10 Jun 2021 10:25:49 +0200 (CEST) Received: by mail-pj1-x1036.google.com with SMTP id m13-20020a17090b068db02901656cc93a75so3289585pjz.3 for ; Thu, 10 Jun 2021 01:25:49 -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=PUYx5PJu6hrDJL7A0XDt0lAHR0rHKJv94avBEeNop2k=; b=gr1ag6l/iMO24dO+nim4I1Fe1iCYzONdK2K147XSTjHtDfv0bsTfu2XBVIXxhWTeIC 06I8AS2PWXRXiNwJWZnb47FNIOMraYr2IuX2Amch9ucaNEnuX3rDQSNRfkRmhhfh0n2l gjh80BYtXaWay1cK33wUyF37XKUolQLBch46s= 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=PUYx5PJu6hrDJL7A0XDt0lAHR0rHKJv94avBEeNop2k=; b=B4hHxRmLdeguCx/PUBUItzr31pxWVlxfCn1sY2wzQM82UYVW7JxwzV4fqdEiZ3dtDs yDrbGtA6ecW+HKUxmQX7SpJnDojwlAW9Q9sWTnQvjtLKqqKG4qJLtXHGJtxRK1u51n9P K+u4c7SRH0YzGxqZf3XO/Rvf7pjPT1ij+PijjIy7yVv++l9SJqf6DvTzNIEqKDK5FLxy M3P7BvCZAKz/bKyHdDtTUxIiozH3m4ul7hGz8g6uVNmuR9TA2QEETZG/5aD1DxLTpZb9 iHU54pAKBozuh3wn/UoCXXjlObi4MfiYXz4uBeTxOEr4cxCWsi8MmnHYbP7ODa8f9usd VNrw== X-Gm-Message-State: AOAM532j/ZK3tsYaxee719XfXVP6696QZkchyORo8+iT4T718fYt7Tcu +8Wal4rivrzcuRxlFDtVY0wbK8boXsaH+g== X-Google-Smtp-Source: ABdhPJzDC1GHyuUa+ehxEThet9f+er9MYUuc6c/9JOSdTTjk1Jg10E1GQcS6VBKMa0Ldg++8nO8jQQ== X-Received: by 2002:a17:90a:9481:: with SMTP id s1mr2211734pjo.48.1623313548189; Thu, 10 Jun 2021 01:25:48 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 01:25:47 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Thu, 10 Jun 2021 17:25:36 +0900 Message-Id: <20210610082539.529739-3-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 3/6] libcamera: CameraSensorProperties: Add table of v4l2 index and test pattern 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" The V4L2 specification defines the sensor test pattern modes through a menu control, where a numerical index is associated to a string that describes the test pattern. The index-to-pattern mapping is driver specific and requires a corresponding representation in the library. Add to the static list of CameraSensorProperties a map of indexes to libcamera::controls::TestPatternModes values to be able to map the indexes returned by the driver to the corresponding test pattern mode. Signed-off-by: Hirokazu Honda Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- .../internal/camera_sensor_properties.h | 2 ++ src/libcamera/camera_sensor_properties.cpp | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h index f5e242cb..67c77920 100644 --- a/include/libcamera/internal/camera_sensor_properties.h +++ b/include/libcamera/internal/camera_sensor_properties.h @@ -7,6 +7,7 @@ #ifndef __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__ #define __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__ +#include #include #include @@ -17,6 +18,7 @@ struct CameraSensorProperties { static const CameraSensorProperties *get(const std::string &sensor); Size unitCellSize; + std::map testPatternModes; }; } /* namespace libcamera */ diff --git a/src/libcamera/camera_sensor_properties.cpp b/src/libcamera/camera_sensor_properties.cpp index a2c04009..f660743a 100644 --- a/src/libcamera/camera_sensor_properties.cpp +++ b/src/libcamera/camera_sensor_properties.cpp @@ -9,6 +9,8 @@ #include +#include + #include "libcamera/internal/log.h" /** @@ -34,6 +36,11 @@ LOG_DEFINE_CATEGORY(CameraSensorProperties) * * \var CameraSensorProperties::unitCellSize * \brief The physical size of a pixel, including pixel edges, in nanometers. + * + * \var CameraSensorProperties::testPatternModes + * \brief Map that associates the indexes of the sensor test pattern modes as + * returned by V4L2_CID_TEST_PATTERN with the corresponding TestPattern + * control value */ /** @@ -47,18 +54,44 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen static const std::map sensorProps = { { "imx219", { .unitCellSize = { 1120, 1120 }, + .testPatternModes = { + { 0, controls::draft::TestPatternModeOff }, + { 1, controls::draft::TestPatternModeColorBars }, + { 2, controls::draft::TestPatternModeSolidColor }, + { 3, controls::draft::TestPatternModeColorBarsFadeToGray }, + { 4, controls::draft::TestPatternModePn9 }, + }, } }, { "imx258", { .unitCellSize = { 1120, 1120 }, + /* \todo fill test pattern modes for imx258. */ + .testPatternModes = {}, } }, { "ov5670", { .unitCellSize = { 1120, 1120 }, + .testPatternModes = { + { 0, controls::draft::TestPatternModeOff }, + { 1, controls::draft::TestPatternModeColorBars }, + }, } }, { "ov13858", { .unitCellSize = { 1120, 1120 }, + .testPatternModes = { + { 0, controls::draft::TestPatternModeOff }, + { 1, controls::draft::TestPatternModeColorBars }, + }, } }, { "ov5693", { .unitCellSize = { 1400, 1400 }, + .testPatternModes = { + { 0, controls::draft::TestPatternModeOff }, + { 2, controls::draft::TestPatternModeColorBars }, + /* + * No corresponding test pattern mode for + * 1: "Random data" and 3: "Colour Bars with + * Rolling Bar". + */ + }, } }, };