From patchwork Tue May 25 09:46:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12403 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 80A08C3200 for ; Tue, 25 May 2021 09:46:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E8E9268921; Tue, 25 May 2021 11:46:33 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PiyYxFCA"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id ECBB7602AF for ; Tue, 25 May 2021 11:46:32 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B6D88344; Tue, 25 May 2021 11:46:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1621935992; bh=PZT+4S+FzBOA2T7h/UskEXloQvnR3HhuY17sHvqGqtw=; h=From:To:Cc:Subject:Date:From; b=PiyYxFCAeXamlChcLZCY7s3xnTCpu8Jf+HtfmrdsSzgSt2/If92SFcERRMu6aFH89 eF5jFk56PWuAUqfqhfOwxYrt1p47zVGExum5cYYvSKNeGBSaJRWeK1KykxigFRKb4x 4Y4Tv70H9GzebWZ9kT6q9jyH88G28T6mQT8sSNvg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 25 May 2021 12:46:21 +0300 Message-Id: <20210525094621.23029-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.28.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] test: v4l2_videodevice: controls: Test 64-bit controls 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 recent merge (and revert) of commit 34bee5e84ecb ("libcamera: V4L2Device: Remove the controls order assumption in updateControls()") showed that 64-bit controls were missing from unit tests. Fix this by testing the VIVID_CID_INTEGER64 control in the V4L2 video device controls test. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Hirokazu Honda --- test/v4l2_videodevice/controls.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp index 8d42508192d8..0f603b85930d 100644 --- a/test/v4l2_videodevice/controls.cpp +++ b/test/v4l2_videodevice/controls.cpp @@ -16,6 +16,7 @@ /* These come from the vivid driver. */ #define VIVID_CID_CUSTOM_BASE (V4L2_CID_USER_BASE | 0xf000) +#define VIVID_CID_INTEGER64 (VIVID_CID_CUSTOM_BASE + 3) #define VIVID_CID_U8_4D_ARRAY (VIVID_CID_CUSTOM_BASE + 10) /* Helper for VIVID_CID_U8_4D_ARRAY control array size: not from kernel. */ @@ -46,6 +47,7 @@ protected: if (infoMap.find(V4L2_CID_BRIGHTNESS) == infoMap.end() || infoMap.find(V4L2_CID_CONTRAST) == infoMap.end() || infoMap.find(V4L2_CID_SATURATION) == infoMap.end() || + infoMap.find(VIVID_CID_INTEGER64) == infoMap.end() || infoMap.find(VIVID_CID_U8_4D_ARRAY) == infoMap.end()) { cerr << "Missing controls" << endl; return TestFail; @@ -54,12 +56,14 @@ protected: const ControlInfo &brightness = infoMap.find(V4L2_CID_BRIGHTNESS)->second; const ControlInfo &contrast = infoMap.find(V4L2_CID_CONTRAST)->second; const ControlInfo &saturation = infoMap.find(V4L2_CID_SATURATION)->second; + const ControlInfo &int64 = infoMap.find(VIVID_CID_INTEGER64)->second; const ControlInfo &u8 = infoMap.find(VIVID_CID_U8_4D_ARRAY)->second; /* Test getting controls. */ ControlList ctrls = capture_->getControls({ V4L2_CID_BRIGHTNESS, V4L2_CID_CONTRAST, V4L2_CID_SATURATION, + VIVID_CID_INTEGER64, VIVID_CID_U8_4D_ARRAY }); if (ctrls.empty()) { cerr << "Failed to get controls" << endl; @@ -78,6 +82,12 @@ protected: return TestFail; } + /* + * The VIVID_CID_INTEGER64 control can take any value, just test + * that its value can be retrieved and has the right type. + */ + ctrls.get(VIVID_CID_INTEGER64).get(); + uint8_t u8Min = u8.min().get(); uint8_t u8Max = u8.max().get(); @@ -94,6 +104,7 @@ protected: ctrls.set(V4L2_CID_BRIGHTNESS, brightness.min()); ctrls.set(V4L2_CID_CONTRAST, contrast.max()); ctrls.set(V4L2_CID_SATURATION, saturation.min()); + ctrls.set(VIVID_CID_INTEGER64, int64.min()); std::array u8Values; std::fill(u8Values.begin(), u8Values.end(), u8.min().get());