From patchwork Mon Jun 7 01:13:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12496 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 3AEFAC320B for ; Mon, 7 Jun 2021 01:14:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EE7EC68935; Mon, 7 Jun 2021 03:14:13 +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="CY+1wYeS"; dkim-atps=neutral Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EE62A68932 for ; Mon, 7 Jun 2021 03:14:11 +0200 (CEST) Received: by mail-pg1-x52c.google.com with SMTP id q15so12561975pgg.12 for ; Sun, 06 Jun 2021 18:14:11 -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=g7msIY4ZSNeR107C0dMkHU0ne5zKkI1ZRoSc6ZNH+C8=; b=CY+1wYeSmdq5SoDmd32SBdRgJQ8CO70/4rGDswE1vTjBXXl2XiSagrhvylfpASWUj9 mkT9/YCNfX605zdMgKtXQQWMoS7z6JY4hgX0b+L8iUoWcnRsg/84QkekNYLVxW14jz3r 92JlJes8YoHjeOcY08onbvWK3i/P70ksuEc74= 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=g7msIY4ZSNeR107C0dMkHU0ne5zKkI1ZRoSc6ZNH+C8=; b=Uu+qOBkRuNIhm5/aI1JJECV/O4tEssN0//RY92n203bdPpIyhAjyCUNhTus9tsngK+ YAE9AZBh+lI+m7Y295scR0EJa/3tg2XWj1U6qggWALkI+brQiXGEZ0suJ3oHIwzF4RK2 powus+FG+nOpJsLK8wGUkl8C7Dw4fokt6CDzOzbboHwbgpffuoR+MtqIsunHzwYCUeP+ d7Z/+GfMD5p8D+nDQYm1x8jvWvWkaKwxU49/zuUktKC+4tYVkNrwZB44U1F0AoBz4iW2 Lvnd6cj3HcHnnDQRMsJwWbdSGiEMUOAMadtcw15FKx3jxpZMFp00xUvSawW55j5EAtCN IGeQ== X-Gm-Message-State: AOAM532wdGPsdRQ7zRWD2C19hSWtkDNyjzZdFQx1Xqugf39BsQU/xd77 dWM7vEVHkb6gfanl/25YONRKJO1SCLa3NMBl X-Google-Smtp-Source: ABdhPJwSzwkIXJz1NvAtiORtO3G8lWAfseYM6gEEXK12munH3hEFqFBOmyzmNEKMAZO5U7KFlVKwyA== X-Received: by 2002:a63:dc03:: with SMTP id s3mr8993508pgg.354.1623028450403; Sun, 06 Jun 2021 18:14:10 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:6eb1:2d91:79ee:2043]) by smtp.gmail.com with ESMTPSA id h12sm7303655pgn.54.2021.06.06.18.14.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 18:14:10 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Mon, 7 Jun 2021 10:13:59 +0900 Message-Id: <20210607011402.55331-3-hiroh@chromium.org> X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog In-Reply-To: <20210607011402.55331-1-hiroh@chromium.org> References: <20210607011402.55331-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 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 --- .../internal/camera_sensor_properties.h | 2 ++ src/libcamera/camera_sensor_properties.cpp | 31 +++++++++++++++++++ 2 files changed, 33 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..14270ef9 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,42 @@ 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 }, } }, { "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". + */ + }, } }, };