From patchwork Fri Apr 3 14:12:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3369 Return-Path: Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 48038600FA for ; Fri, 3 Apr 2020 16:12:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=es-iitr-ac-in.20150623.gappssmtp.com header.i=@es-iitr-ac-in.20150623.gappssmtp.com header.b="Se86HKWU"; dkim-atps=neutral Received: by mail-pf1-x443.google.com with SMTP id u65so3540474pfb.4 for ; Fri, 03 Apr 2020 07:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=zWlB8RhDC1zevTS9Wgr9ZNnJhnB7w7RlTNAvpm3S2/8=; b=Se86HKWUlLxdfIjo0pu3jRD5rt0C/ECdNO3cUSEbkY9ObkB/1J6SPvNFpg1Wt3zxxi yR6Oc8lbpfSuK+1YjqeD0bpYpI+mPwGigCMoJuRHh4H94pamRQ+fEhLTjcTIZpyQ258X /tVDu/ApkYEOwTR7irG+e0lr9PVrxSqiZIaie1IEs4g//WGszAr6KSQWM34pmROGrXc7 98PMlbBqpeRMMfuIwEVUelCSNbRHP/bBRgcP+lEcdIXvIT2POmybHQg4pJfMs9mQO6kY F14PeHLFRH/XGEuQUCEZdKnfLlhz+OJlmLJbnDAzceEB+gNmq8+iircfqRnEXtfjVmGq +A+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=zWlB8RhDC1zevTS9Wgr9ZNnJhnB7w7RlTNAvpm3S2/8=; b=cI3gHqnqKn32n7s+ODy6lSFwJ1eJTre8pAKwk8dED1+/mhVGuhGUrhjwmAnDN8mWXH FHR0iTvFWMrrGfBpa/4JgCG9UL4KQ89OaYjAnXYUv1XkISb56tUIhLZt8y5qDt35pwnV fFbOxTc4hDz5tTlLAnrEWCs8AsIgbJpR7RUqO3a8aOKb2uUSczd10XghloqcLkHvP+4w yv5UAnuaC8YQtlcpX/68pcg41kinavvwu7uq3Frr2Q9v9LPmWASaYGCls8UEQw17t9Ke NeMvAfZ1SF53UK1LGaeNQcdFtW5mZ0Zxv5upNnmidPkIJ9T/leYie9U2kAkzRGiHCF3u TrwQ== X-Gm-Message-State: AGi0PuYUnAAA+LYKWKRtG/Xg9sLdkYo4c/kh3NKyBNnlMs/CDkTij3Dd j8ed2T0n8MGG94RmJojeK/q5aguF3DzynA== X-Google-Smtp-Source: APiQypIp6DtyZQHtjHeeVWhTkjaAlXTUTsh7O1yifhXjoO9pf2pXg7N6gEISR2JzwMddc1uuXNtrbw== X-Received: by 2002:aa7:999e:: with SMTP id k30mr8366518pfh.235.1585923135403; Fri, 03 Apr 2020 07:12:15 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.154]) by smtp.gmail.com with ESMTPSA id f15sm5971263pfq.100.2020.04.03.07.12.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Apr 2020 07:12:14 -0700 (PDT) Date: Fri, 3 Apr 2020 19:42:08 +0530 From: Kaaira Gupta To: libcamera-devel@lists.libcamera.org, Kieran Bingham , Helen Koike , Vaishali Thakkar Message-ID: <20200403141208.GA3005@kaaira-HP-Pavilion-Notebook> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Subject: [libcamera-devel] [PATCH] libcamera: pixelformats: replace set of modifiers with a single value 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-List-Received-Date: Fri, 03 Apr 2020 14:12:17 -0000 Pixelformat class takes a set of modifiers as an input, but all the values in the set are same. Hence take just one value as an input. Signed-off-by: Kaaira Gupta Reviewed-by: Kieran Bingham --- include/libcamera/pixelformats.h | 6 +++--- src/libcamera/pipeline/ipu3/ipu3.cpp | 2 +- src/libcamera/pixelformats.cpp | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/libcamera/pixelformats.h b/include/libcamera/pixelformats.h index 9ce6f7f..89966e5 100644 --- a/include/libcamera/pixelformats.h +++ b/include/libcamera/pixelformats.h @@ -19,7 +19,7 @@ class PixelFormat { public: PixelFormat(); - explicit PixelFormat(uint32_t fourcc, const std::set &modifiers = {}); + explicit PixelFormat(uint32_t fourcc, uint64_t modifier = 0); bool operator==(const PixelFormat &other) const; bool operator!=(const PixelFormat &other) const { return !(*this == other); } @@ -29,13 +29,13 @@ public: operator uint32_t() const { return fourcc_; } uint32_t fourcc() const { return fourcc_; } - const std::set &modifiers() const { return modifiers_; } + uint64_t modifier() const { return modifier_; } std::string toString() const; private: uint32_t fourcc_; - std::set modifiers_; + uint64_t modifier_; }; } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 1e114ca..219b90b 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -365,7 +365,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate() const Size size = cfg.size; const IPU3Stream *stream; - if (cfg.pixelFormat.modifiers().count(IPU3_FORMAT_MOD_PACKED)) + if (cfg.pixelFormat.modifier() == IPU3_FORMAT_MOD_PACKED) stream = &data_->rawStream_; else if (cfg.size == sensorFormat_.size) stream = &data_->outStream_; diff --git a/src/libcamera/pixelformats.cpp b/src/libcamera/pixelformats.cpp index 87557d9..a53d435 100644 --- a/src/libcamera/pixelformats.cpp +++ b/src/libcamera/pixelformats.cpp @@ -19,8 +19,8 @@ namespace libcamera { * \brief libcamera image pixel format * * The PixelFormat type describes the format of images in the public libcamera - * API. It stores a FourCC value as a 32-bit unsigned integer and a set of - * modifiers. The FourCC and modifiers values are defined in the Linux kernel + * API. It stores a FourCC value as a 32-bit unsigned integer and a + * modifier. The FourCC and modifier values are defined in the Linux kernel * DRM/KMS API (see linux/drm_fourcc.h). */ @@ -36,12 +36,12 @@ PixelFormat::PixelFormat() } /** - * \brief Construct a PixelFormat from a DRM FourCC and a set of modifiers + * \brief Construct a PixelFormat from a DRM FourCC and a modifier * \param[in] fourcc A DRM FourCC - * \param[in] modifiers A set of DRM FourCC modifiers + * \param[in] modifier A DRM FourCC modifier */ -PixelFormat::PixelFormat(uint32_t fourcc, const std::set &modifiers) - : fourcc_(fourcc), modifiers_(modifiers) +PixelFormat::PixelFormat(uint32_t fourcc, uint64_t modifier) + : fourcc_(fourcc), modifier_(modifier) { } @@ -51,7 +51,7 @@ PixelFormat::PixelFormat(uint32_t fourcc, const std::set &modifiers) */ bool PixelFormat::operator==(const PixelFormat &other) const { - return fourcc_ == other.fourcc() && modifiers_ == other.modifiers_; + return fourcc_ == other.fourcc() && modifier_ == other.modifier_; } /** @@ -70,7 +70,7 @@ bool PixelFormat::operator<(const PixelFormat &other) const return true; if (fourcc_ > other.fourcc_) return false; - return modifiers_ < modifiers_; + return modifier_ < other.modifier_; } /** @@ -97,9 +97,9 @@ bool PixelFormat::operator<(const PixelFormat &other) const */ /** - * \fn PixelFormat::modifiers() const - * \brief Retrieve the pixel format modifiers - * \return Set of DRM modifiers + * \fn PixelFormat::modifier() const + * \brief Retrieve the pixel format modifier + * \return DRM modifier */ /**