From patchwork Tue Nov 5 10:49:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-Hao Yang X-Patchwork-Id: 21813 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 CF6A3BDB1C for ; Tue, 5 Nov 2024 10:54:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8CA41653F8; Tue, 5 Nov 2024 11:54:56 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="U3jieQ0G"; dkim-atps=neutral Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B58DF653F2 for ; Tue, 5 Nov 2024 11:54:52 +0100 (CET) Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-5ebc0e13d25so1841597eaf.1 for ; Tue, 05 Nov 2024 02:54:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730804091; x=1731408891; darn=lists.libcamera.org; 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=GPNOOB5CqS8CnviVkvudD57XLF0SY3nf9n1KG6svXtA=; b=U3jieQ0GJI25dSv/RLT+lOeRhWAQWrw/lSUlqydsdFkeiBSdOVrTgXzKnolcQDypNr KYSeR2Y+SuoI+xQ9zwAZhUnPmOlUYxOKYsAiBGOk+66grmWrwJkrNfQlf4sC0La6WLua pp53ohBu5KMVuDv4uUvjUJozzDoO+1bcQYdv0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730804091; x=1731408891; 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=GPNOOB5CqS8CnviVkvudD57XLF0SY3nf9n1KG6svXtA=; b=Zz0zUxUAXgfEZwhykbV9GrsWoJMGaPs8r81DgLSPp9RWxcoKpQSxZXiqOtQNBe3z/V yQa9NCiXPEkcXcFKrEhwoM9N5TPh0+ggP9RcwmP3xHY6+vohYcJ55DcCHXTW2TY3Z5VO OvPBwqDs+iPAzAMdrCXUU8XNyfGpI0yPaiU8SjWY6vVCxllXypjiSPZWLJo+baQqKtqh CCw+MRetJKUgnPftUdutvuM8xaE1wdZKa2wKi6a9PVI+sNrozpfch7WocpOU1aSPeOSt Y33aVo3FyW9yHi+qqoBXPnejfIeCw1WWAdnLP5S6tBuMYLj+TF8w5GpVjEdImqcskMLP NU7w== X-Gm-Message-State: AOJu0YyDIvqnuqvTKgnEqHwZ0CdtIebDD3h45vujp7rsfUwGJgD98yvl xORN11MpDfBYz1tt8mkKlHJSVH9ZxeKpaExj1BF3byM6H99bSaRp7WO8S2DjUzBtUATyGUgrgoM = X-Google-Smtp-Source: AGHT+IEEGpVnwBY1rKux5F510y/sG6ZwM8zVF9ztUDaYH8X3GGPegK/fJxkrRVZwD71SZH2yGVuv5g== X-Received: by 2002:a05:6820:220e:b0:5e5:d0c8:8030 with SMTP id 006d021491bc7-5ec6db6ce9amr9264321eaf.3.1730804091160; Tue, 05 Nov 2024 02:54:51 -0800 (PST) Received: from chenghaoyang-low.c.googlers.com.com (27.247.221.35.bc.googleusercontent.com. [35.221.247.27]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ee45a002d4sm8817612a12.70.2024.11.05.02.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2024 02:54:50 -0800 (PST) From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Han-Lin Chen , Harvey Yang Subject: [PATCH 1/1] libcamera: Add v4l2_subdev_format in V4L2SubdeviceFormat Date: Tue, 5 Nov 2024 10:49:21 +0000 Message-ID: <20241105105445.1468954-2-chenghaoyang@chromium.org> X-Mailer: git-send-email 2.47.0.199.ga7371fff76-goog In-Reply-To: <20241105105445.1468954-1-chenghaoyang@chromium.org> References: <20241105105445.1468954-1-chenghaoyang@chromium.org> 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" From: Han-Lin Chen Add v4l2_subdev_format in V4L2SubdeviceFormat and set the value when setFormat() and getFormat(). Signed-off-by: Han-Lin Chen Co-developed-by: Harvey Yang Signed-off-by: Harvey Yang --- include/libcamera/internal/v4l2_subdevice.h | 2 ++ src/libcamera/pipeline/simple/simple.cpp | 2 +- src/libcamera/sensor/camera_sensor.cpp | 1 + src/libcamera/v4l2_subdevice.cpp | 10 ++++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h index 194382f84..d81296ee6 100644 --- a/include/libcamera/internal/v4l2_subdevice.h +++ b/include/libcamera/internal/v4l2_subdevice.h @@ -66,6 +66,8 @@ struct V4L2SubdeviceFormat { std::optional colorSpace; const std::string toString() const; + + struct v4l2_subdev_format subdevFmt; }; std::ostream &operator<<(std::ostream &out, const V4L2SubdeviceFormat &f); diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 3ddce71d3..6ec055596 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1063,7 +1063,7 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate() LOG(SimplePipeline, Debug) << "Picked " - << V4L2SubdeviceFormat{ pipeConfig_->code, pipeConfig_->sensorSize, {} } + << V4L2SubdeviceFormat{ pipeConfig_->code, pipeConfig_->sensorSize, {}, {} } << " -> " << pipeConfig_->captureSize << "-" << pipeConfig_->captureFormat << " for max stream size " << maxStreamSize; diff --git a/src/libcamera/sensor/camera_sensor.cpp b/src/libcamera/sensor/camera_sensor.cpp index 1b224f198..ac96b4843 100644 --- a/src/libcamera/sensor/camera_sensor.cpp +++ b/src/libcamera/sensor/camera_sensor.cpp @@ -744,6 +744,7 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector &mbu .code = bestCode, .size = *bestSize, .colorSpace = ColorSpace::Raw, + .subdevFmt = {}, }; return format; diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index 9f2ec4798..677714890 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -808,6 +808,14 @@ const MediaBusFormatInfo &MediaBusFormatInfo::info(uint32_t code) * resulting color space is acceptable. */ +/** + * \var V4L2SubdeviceFormat::subdevFmt + * \brief The whole v4l2_subdev_format after calling setFormat()/getFormat() + * + * It's used in some pipeline handlers that need extra information apart from + * the existing fields. + */ + /** * \brief Assemble and return a string describing the format * \return A string describing the V4L2SubdeviceFormat @@ -1266,6 +1274,7 @@ int V4L2Subdevice::getFormat(const Stream &stream, V4L2SubdeviceFormat *format, format->size.height = subdevFmt.format.height; format->code = subdevFmt.format.code; format->colorSpace = toColorSpace(subdevFmt.format); + format->subdevFmt = subdevFmt; return 0; } @@ -1324,6 +1333,7 @@ int V4L2Subdevice::setFormat(const Stream &stream, V4L2SubdeviceFormat *format, format->size.height = subdevFmt.format.height; format->code = subdevFmt.format.code; format->colorSpace = toColorSpace(subdevFmt.format); + format->subdevFmt = subdevFmt; return 0; }