From patchwork Wed Mar 15 10:23:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-Hao Yang X-Patchwork-Id: 18408 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 D295AC329F for ; Wed, 15 Mar 2023 10:23:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5D1F861ED2; Wed, 15 Mar 2023 11:23:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1678875798; bh=JEB6AEVbGLqmtfC7pHhxD1DmxhBO5vycHkx8UtpTrBI=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=UbCtjJujLx2xY0RdZTY1S5Gssji3CrAES+WWaRxQt6DvCDuUdHVgTvdyoKJkaqTSE CPItN60qzPLh896Tr0+7kVP5S4DSDR0pHff6Qj+STnAF6kog5X0k53wQqwAJ/csjQ3 jev2oM/E9PcEIVqYsR6Zwbs6gGkxfuj1s5qrp+k/sC1sLl6ZFVAZwQhyHzhS7Rpfiv wPZifx6xSiqeISpgfyAWz7kFXtQAZSt+wgHKlcRqlYmbYZAWjoGLIvHTmiwpjHwmMJ gIGOPypKGsQzcvwLCo6EW0kH1UsEVTHHoEuH7M51SiWcYdI3L/tM5wmCm/AMM40MhS MysmhCNN24wlA== Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E6F4D62709 for ; Wed, 15 Mar 2023 11:23:14 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YIm0P+im"; dkim-atps=neutral Received: by mail-pl1-x631.google.com with SMTP id iw3so2655177plb.6 for ; Wed, 15 Mar 2023 03:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1678875793; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F4wCzmkWS8rqH2a3GVhAhLoS0CEQmFOtFrF1j9+6M9I=; b=YIm0P+imiQvHQ4hDZcXfgt8SwlzBUp7X9aEFNpnogxVss9nPmBUPmjypOLjFzgCQP6 P9IatL7aPFqBO6UtqVEtInLuC2OmkgKSYeLhX8FhfA/xku6NgYuxfOCOrMrRTqoGu5JK a1UYvAUs5DNjoACKrBMJt0DG8oY1QXpwpSnhA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678875793; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F4wCzmkWS8rqH2a3GVhAhLoS0CEQmFOtFrF1j9+6M9I=; b=GNAefjdEiE1GTlqhxHbBBRW3WyaUITVvA4IhPq/0uE8tHbcQwPUuWtHJSquuMjUVW/ VaSsTsIUEwZN5Myx3Wb6xOWYwrsEKdiRlDXIZq/M3ZxcsWs+xKjLQjFecj0sbe3/807p BhpxZY1hmQv0dcv/VzTCtnl/1XPcN1u33F8GKiQKqp7C2sKaMojj2RqVyk7MH7rrmJLK 64+1k3sjnuMQUomDdlbjadCy5IjbKwW9wMxSxLzoW7Yho4PJWLFr/gAkz5VQMO8lINAQ ncyJ+8yMKgm4+xHoQc/UgSK4n+uKwsxbtgi0yfI2sOzogLILakMkC84BtSKF7etKbYcC m9bQ== X-Gm-Message-State: AO0yUKURRVZfxi2qUAZGy/pn+GWiWDCJJayZIgn4EoC2aXfTBoB9fq15 xfWkE9Ts10cSXr9bjqmTwPHjYFKUSLodiBaGGN4= X-Google-Smtp-Source: AK7set9qWcrgogAUOzbaZwf6FG4x0tOeBOyEsM7Gp8O2VRD8/rexPkQadxIrR1to45Xjy+G5PJ/vrw== X-Received: by 2002:a17:902:fa87:b0:19e:2eb5:712d with SMTP id lc7-20020a170902fa8700b0019e2eb5712dmr1683070plb.25.1678875793217; Wed, 15 Mar 2023 03:23:13 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (112.157.221.35.bc.googleusercontent.com. [35.221.157.112]) by smtp.gmail.com with ESMTPSA id f11-20020a17090274cb00b001a0450da45csm3262786plt.185.2023.03.15.03.23.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 03:23:13 -0700 (PDT) X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Date: Wed, 15 Mar 2023 10:23:00 +0000 Message-Id: <20230315102300.2265491-7-chenghaoyang@google.com> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog In-Reply-To: <20230315102300.2265491-1-chenghaoyang@google.com> References: <20230315102300.2265491-1-chenghaoyang@google.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 6/6] libcamera: pipeline: virtual: Set camera properties & 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: , X-Patchwork-Original-From: Harvey Yang via libcamera-devel From: Cheng-Hao Yang Reply-To: Harvey Yang Cc: Harvey Yang , Harvey Yang Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Initialize the CameraData properties with Location, Model, and PixelArrayActiveAreas, and the control attribute: FrameDurationLimits. Updating `/etc/camera/libcamera/camera_hal.yaml` on a chromebook DUT is required to find the virtual camera with id `Virtual0`. Signed-off-by: Harvey Yang --- src/libcamera/pipeline/virtual/virtual.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp index b91e7000..f858ed1e 100644 --- a/src/libcamera/pipeline/virtual/virtual.cpp +++ b/src/libcamera/pipeline/virtual/virtual.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "libcamera/internal/camera.h" #include "libcamera/internal/pipeline_handler.h" @@ -20,6 +21,10 @@ namespace libcamera { LOG_DEFINE_CATEGORY(VIRTUAL) +static const ControlInfoMap::Map VirtualControls = { + { &controls::draft::PipelineDepth, ControlInfo(2, 3) }, +}; + uint64_t CurrentTimestamp() { struct timespec ts; @@ -270,6 +275,16 @@ bool PipelineHandlerVirtual::match(DeviceEnumerator *enumerator) data->supportedResolutions_[0] = { .size = Size(1920, 1080), .frame_rates = { 30 }, .formats = { "YCbCr_420_888" } }; data->supportedResolutions_[1] = { .size = Size(1280, 720), .frame_rates = { 30, 60 }, .formats = { "YCbCr_420_888" } }; + data->properties_.set(properties::Location, properties::CameraLocationFront); + data->properties_.set(properties::Model, "Virtual Video Device"); + data->properties_.set(properties::PixelArrayActiveAreas, { Rectangle(Size(1920, 1080)) }); + + // TODO: Set FrameDurationLimits based on config. + ControlInfoMap::Map controls = VirtualControls; + int64_t min_frame_duration = 30, max_frame_duration = 60; + controls[&controls::FrameDurationLimits] = ControlInfo(min_frame_duration, max_frame_duration); + data->controlInfo_ = ControlInfoMap(std::move(controls), controls::controls); + /* Create and register the camera. */ std::set streams{ &data->stream_ }; const std::string id = "Virtual0";