From patchwork Fri Jul 12 05:29:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 20653 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 A0BEAC328C for ; Fri, 12 Jul 2024 05:29:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AC16963377; Fri, 12 Jul 2024 07:29:48 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="qrAH9KDx"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7F52963377 for ; Fri, 12 Jul 2024 07:29:39 +0200 (CEST) Received: from localhost.localdomain (unknown [IPv6:2405:201:2015:f873:55f8:639e:8e9f:12ec]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 54146191B; Fri, 12 Jul 2024 07:29:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1720762145; bh=JorrjuSnTDdfn96gkyLW8ukdpSDHC33JP/GOpH6t8rQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qrAH9KDxfPbiRm+bv5EAqxhdQHAzheyQvmMOvz56TmOUeMibTgXVM0Y+7gjP5gJFE HZTJieVpPRVU2Rp8i6Wxkx5L8lh2a6sLBYuLbdUkMErtsiV/UFYOl/PPTOy/sccdDX QbUIOpMaL0Mp/uvQaq3tNME8twmh9Oe8RRcvt+jY= From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Xavier Roumegue , Umang Jain Subject: [RFC PATCH 5/6] libcamera: converter_v4l2_m2m: Add helper to apply controls Date: Fri, 12 Jul 2024 10:59:19 +0530 Message-ID: <20240712052920.33396-6-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240712052920.33396-1-umang.jain@ideasonboard.com> References: <20240712052920.33396-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 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" Add applyControls() helper to apply controls for a stream. Signed-off-by: Umang Jain --- .../internal/converter/converter_v4l2_m2m.h | 5 +++++ src/libcamera/converter/converter_v4l2_m2m.cpp | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h index f61beef8..9d3d62d6 100644 --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h @@ -24,6 +24,7 @@ namespace libcamera { +class ControlList; class FrameBuffer; class MediaDevice; class Size; @@ -61,6 +62,8 @@ public: int setCrop(const Stream *stream, Rectangle *rect); std::pair getCropBounds(const Stream *stream); + int applyControls(const Stream *stream, ControlList &ctrls); + protected: class Mapping { @@ -97,6 +100,8 @@ private: int start(); void stop(); + int applyControls(ControlList &ctrls); + int queueBuffers(FrameBuffer *input, FrameBuffer *output); int setSelection(unsigned int target, Rectangle *rect); diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp index 9752a23e..9ff5102a 100644 --- a/src/libcamera/converter/converter_v4l2_m2m.cpp +++ b/src/libcamera/converter/converter_v4l2_m2m.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -186,6 +187,11 @@ void V4L2M2MConverter::V4L2M2MStream::captureBufferReady(FrameBuffer *buffer) converter_->outputBufferReady.emit(buffer); } +int V4L2M2MConverter::V4L2M2MStream::applyControls(ControlList &ctrls) +{ + return m2m_->capture()->setControls(&ctrls); +}; + /* ----------------------------------------------------------------------------- * V4L2M2MConverter */ @@ -532,6 +538,18 @@ int V4L2M2MConverter::queueBuffers(FrameBuffer *input, return 0; } +/** + * libcamera::Converter::applyControls + */ +int V4L2M2MConverter::applyControls(const Stream *stream, ControlList &ctrls) +{ + auto iter = streams_.find(stream); + if (iter == streams_.end()) + return -EINVAL; + + return iter->second->applyControls(ctrls); +} + /* * \todo: This should be extended to include Feature::Flag to denote * what each converter supports feature-wise.