From patchwork Thu May 6 07:54:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12202 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 E6CDFBDE7F for ; Thu, 6 May 2021 07:55:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9414D68909; Thu, 6 May 2021 09:55:04 +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="NxtnGyfG"; dkim-atps=neutral Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1656B68918 for ; Thu, 6 May 2021 09:55:02 +0200 (CEST) Received: by mail-pf1-x434.google.com with SMTP id b15so4540834pfl.4 for ; Thu, 06 May 2021 00:55:02 -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=xpgFNDTtg0oyYyVSA6cWMojJgJgBPhdh7V3DPsi5GIo=; b=NxtnGyfGIOgIKSdR8ZmFOK89xpSRUM7RwlepHtQI5IkA+EpvZT4QEHPx70dfZv2PUC EKi8RiSAb3trFhSE0uV3gOvNjRig+d8WPg4K93FQt6xvSKQa5tfGMDYKkANdfre5Iex/ nKE6lfCrn6jxTkoSNO5pPIpFwo5lBLWKsdPO0= 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=xpgFNDTtg0oyYyVSA6cWMojJgJgBPhdh7V3DPsi5GIo=; b=sHgIS5Ev+u4Bvy1ebbxOOOGIW2D2w1cZNkeoxk73dD51fxcQYWV7VJxK8rvUjvUnrO 6QGLHMBiHG3Eh+rHMue7TLAEWvkkyuM8o4ERqsoDzqCLPvFPg82eEGiplW05c878FBxN T5zgAvsamTE8xVww6eS3VJKZauSQ+UKqOU0i+jrzZ5OtlZ9/i0Ifhf7qVBp/qGRwcz2I XtNVR56yJI81AEAJmpeIHz9OC4uaoKUq7+cu8BLHPAi0aXDvfxyqZG6aObsqBCdn907I V4/pxHSLsuTIvv05VQYENFpnPHBe7uEqgQEirassgB1WHgpUu+9O9k4Mlk/xvBh5/HpB 4Wvg== X-Gm-Message-State: AOAM531geyC8NeKfMf0jmEBi7IHlkTiNAOrcg+m/9tubFOHh/una4oOH euBZ45t5wNM/t3+f5Sja/cYvlRSFfurVIA== X-Google-Smtp-Source: ABdhPJyu/GvUJdO/bo1NfPHM9Wmcuxo8xUZvXY6qbHxNKDslFXB4KyzSALLY1zr1uZw4aAbyO9j6MQ== X-Received: by 2002:a05:6a00:1588:b029:272:f5b1:c96c with SMTP id u8-20020a056a001588b0290272f5b1c96cmr3212239pfk.47.1620287700320; Thu, 06 May 2021 00:55:00 -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.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 May 2021 00:54:59 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Thu, 6 May 2021 16:54:46 +0900 Message-Id: <20210506075449.1761752-4-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 3/6] libcamera: CameraSensorProperties: Adds 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" In V4L2 API, a driver returns an index (also with a name) to represent a test pattern, but it is a driver specific what test pattern is represented by the index. Therefore, this adds a mapping table from the index and a test pattern into a static configuration of a sensor. Signed-off-by: Hirokazu Honda --- .../internal/camera_sensor_properties.h | 2 ++ src/libcamera/camera_sensor_properties.cpp | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h index f5e242cb..f52890b4 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 testPatternModeMap; }; } /* namespace libcamera */ diff --git a/src/libcamera/camera_sensor_properties.cpp b/src/libcamera/camera_sensor_properties.cpp index 6ded31dc..89eaf9f8 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" /** @@ -44,15 +46,33 @@ LOG_DEFINE_CATEGORY(CameraSensorProperties) */ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sensor) { + static const std::map sensorProps = { { "imx219", { .unitCellSize = { 1120, 1120 }, + .testPatternModeMap = { + { 0, controls::draft::TestPatternModeOff }, + { 1, controls::draft::TestPatternModeColorBars }, + { 2, controls::draft::TestPatternModeSolidColor }, + { 3, controls::draft::TestPatternModeColorBarsFadeToGray }, + { 4, controls::draft::TestPatternModePn9 }, + }, } }, { "ov5670", { .unitCellSize = { 1120, 1120 }, + .testPatternModeMap = { + { 0, controls::draft::TestPatternModeOff }, + { 1, controls::draft::TestPatternModeColorBars }, + }, + } }, { "ov13858", { .unitCellSize = { 1120, 1120 }, + .testPatternModeMap = { + { 0, controls::draft::TestPatternModeOff }, + { 1, controls::draft::TestPatternModeColorBars }, + { 2, controls::draft::TestPatternModeColorBarsFadeToGray }, + }, } }, };