From patchwork Mon Aug 29 10:04:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17224 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 14395C3272 for ; Mon, 29 Aug 2022 10:04:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C2BEC61FC6; Mon, 29 Aug 2022 12:04:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1661767469; bh=8twypGA1ryQShZKLj+yoixVo829FfaTYwkHXGcLJsMI=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=WfuZYSyp8kbZRfwlCRQonwfz/HggeETtAiKWpvOYre55IUW5lWfHjLeu9PgYVxjTJ 97gL80GEhw4GXIZJD9ZyJRw9SkxhlKnsdMu9pTRIYiFYnXaOCcdN+cJQXNoW1eJqOI eQ7jiEFAmrQNUFuc2gn4DPUsWyjQrvs17jH3R2QP89BSmprRSb+NNY2gYa99dfVPKl thjpu1anRYiY0A/Uugk5ghKGpvnePBOz3HpxvJlDIne8MGbaU9puwnYESS1+UNfUxq T22E4QcTGhTXb3mrFOcxXG1RaYdnQhVXo8QuHl90JbAhY/fZkg8uBZVrTniykzT6B2 wBQxco/QBGFxA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 73B4E61FC2 for ; Mon, 29 Aug 2022 12:04:27 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="MrLnFhwA"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E25EC8BD for ; Mon, 29 Aug 2022 12:04:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1661767467; bh=8twypGA1ryQShZKLj+yoixVo829FfaTYwkHXGcLJsMI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MrLnFhwAiYXvejaSZLrA367SIzuQMbiQ3hCUyfx30mKZPhdZ4ix4UxsG+fTmnuApi YpXdXtoGKFmyQuX3Q15A6+ZObVbdp1S4Q64+JqZ2gyjWjZwMx+4XoBaTHQXTRPkUzn /DmPEkAtpRdEb1Fu5QqtS3HhrmUhnR+OjHzCou4c= To: libcamera-devel@lists.libcamera.org Date: Mon, 29 Aug 2022 13:04:13 +0300 Message-Id: <20220829100414.28404-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220829100414.28404-1-laurent.pinchart@ideasonboard.com> References: <20220829100414.28404-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/3] qcam: Pass color space to ViewFinder::setFormat() 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: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" To prepare for color space support in the viewfinder, pass the color space to the setFormat() function. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain --- src/qcam/main_window.cpp | 6 +++++- src/qcam/viewfinder.h | 2 ++ src/qcam/viewfinder_gl.cpp | 5 +++-- src/qcam/viewfinder_gl.h | 1 + src/qcam/viewfinder_qt.cpp | 5 +++-- src/qcam/viewfinder_qt.h | 1 + 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 7433d647e8a0..addf0d96daf4 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -447,9 +447,13 @@ int MainWindow::startCapture() else rawStream_ = nullptr; - /* Configure the viewfinder. */ + /* + * Configure the viewfinder. If no color space is reported, default to + * sYCC. + */ ret = viewfinder_->setFormat(vfConfig.pixelFormat, QSize(vfConfig.size.width, vfConfig.size.height), + vfConfig.colorSpace.value_or(ColorSpace::Sycc), vfConfig.stride); if (ret < 0) { qInfo() << "Failed to set viewfinder format"; diff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h index 260074aed440..a57446e85951 100644 --- a/src/qcam/viewfinder.h +++ b/src/qcam/viewfinder.h @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -24,6 +25,7 @@ public: virtual const QList &nativeFormats() const = 0; virtual int setFormat(const libcamera::PixelFormat &format, const QSize &size, + const libcamera::ColorSpace &colorSpace, unsigned int stride) = 0; virtual void render(libcamera::FrameBuffer *buffer, Image *image) = 0; virtual void stop() = 0; diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp index 3ae8b03accb5..ec295b6de0dd 100644 --- a/src/qcam/viewfinder_gl.cpp +++ b/src/qcam/viewfinder_gl.cpp @@ -71,8 +71,9 @@ const QList &ViewFinderGL::nativeFormats() const return supportedFormats; } -int ViewFinderGL::setFormat(const libcamera::PixelFormat &format, - const QSize &size, unsigned int stride) +int ViewFinderGL::setFormat(const libcamera::PixelFormat &format, const QSize &size, + [[maybe_unused]] const libcamera::ColorSpace &colorSpace, + unsigned int stride) { if (format != format_) { /* diff --git a/src/qcam/viewfinder_gl.h b/src/qcam/viewfinder_gl.h index 0a9275baf9b9..798830a31cd2 100644 --- a/src/qcam/viewfinder_gl.h +++ b/src/qcam/viewfinder_gl.h @@ -39,6 +39,7 @@ public: const QList &nativeFormats() const override; int setFormat(const libcamera::PixelFormat &format, const QSize &size, + const libcamera::ColorSpace &colorSpace, unsigned int stride) override; void render(libcamera::FrameBuffer *buffer, Image *image) override; void stop() override; diff --git a/src/qcam/viewfinder_qt.cpp b/src/qcam/viewfinder_qt.cpp index 7a6a60c96393..c20fd6bc8fc2 100644 --- a/src/qcam/viewfinder_qt.cpp +++ b/src/qcam/viewfinder_qt.cpp @@ -54,8 +54,9 @@ const QList &ViewFinderQt::nativeFormats() const return formats; } -int ViewFinderQt::setFormat(const libcamera::PixelFormat &format, - const QSize &size, unsigned int stride) +int ViewFinderQt::setFormat(const libcamera::PixelFormat &format, const QSize &size, + [[maybe_unused]] const libcamera::ColorSpace &colorSpace, + unsigned int stride) { image_ = QImage(); diff --git a/src/qcam/viewfinder_qt.h b/src/qcam/viewfinder_qt.h index 8c62145211d1..eb3a99882d19 100644 --- a/src/qcam/viewfinder_qt.h +++ b/src/qcam/viewfinder_qt.h @@ -32,6 +32,7 @@ public: const QList &nativeFormats() const override; int setFormat(const libcamera::PixelFormat &format, const QSize &size, + const libcamera::ColorSpace &colorSpace, unsigned int stride) override; void render(libcamera::FrameBuffer *buffer, Image *image) override; void stop() override;