[{"id":12236,"web_url":"https://patchwork.libcamera.org/comment/12236/","msgid":"<20200901004212.GC16155@pendragon.ideasonboard.com>","date":"2020-09-01T00:42:12","subject":"Re: [libcamera-devel] [PATCH v5 6/8] libcamera: raspberrypi: Set\n\tcamera flips correctly from user transform","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi David,\n\nThank you for the patch.\n\nOn Sat, Aug 29, 2020 at 12:54:27PM +0100, David Plowman wrote:\n> The Raspberry Pi pipeline handler allows all transforms except those\n> involving a transpose. The user transform is combined with any\n> inherent rotation of the camera, and the camera's H and V flip bits\n> are set accordingly.\n> \n> Note that the validate() method has to work out what the final Bayer\n> order of any raw streams will be, before configure() actually applies\n> the transform to the sensor.\n> \n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> ---\n>  .../pipeline/raspberrypi/raspberrypi.cpp      | 82 ++++++++++++++++---\n>  1 file changed, 71 insertions(+), 11 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index c554532..333aa94 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -294,7 +294,7 @@ public:\n>  \tvoid frameStarted(uint32_t sequence);\n>  \n>  \tint loadIPA();\n> -\tint configureIPA();\n> +\tint configureIPA(CameraConfiguration *config);\n>  \n>  \tvoid queueFrameAction(unsigned int frame, const IPAOperationData &action);\n>  \n> @@ -400,8 +400,34 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n>  \tif (config_.empty())\n>  \t\treturn Invalid;\n>  \n> -\tif (transform != Transform::Identity) {\n> -\t\ttransform = Transform::Identity;\n> +\t/*\n> +\t * What if the platform has a non-90 degree rotation? We can't even\n> +\t * \"adjust\" the configuration and carry on. Alternatively, raising an\n> +\t * error means the platform can never run. Let's just print a warning\n> +\t * and continue regardless; the rotation is effectively set to zero.\n> +\t */\n> +\tint32_t rotation = data_->sensor_->properties().get(properties::Rotation);\n> +\tbool success;\n> +\tTransform combined = transform * transformFromRotation(rotation, &success);\n> +\tif (!success)\n> +\t\tLOG(RPI, Warning) << \"Invalid rotation of \" << rotation\n> +\t\t\t\t  << \" degrees - ignoring\";\n> +\n> +\t/*\n> +\t * We combine the platform and user transform, but must \"adjust away\"\n> +\t * any combined result that includes a transform, as we can't do those.\n> +\t * In this case, flipping only the transpose bit is helpful to\n> +\t * applications - they either get the transform they requested, or have\n> +\t * to do a simple transpose themselves (they don't have to worry about\n> +\t * the other possible cases).\n> +\t */\n> +\tif (!!(combined & Transform::Transpose)) {\n> +\t\t/*\n> +\t\t * Flipping the transpose bit in \"transform\" flips it in\n> +\t\t * combined result too (as it's the last thing that happens).\n> +\t\t */\n> +\t\ttransform ^= Transform::Transpose;\n> +\t\tcombined ^= Transform::Transpose;\n>  \t\tstatus = Adjusted;\n>  \t}\n\nShouldn't thus logic handle the case where the sensor can't flip ? I\nthink we can keep it simple that considering that either both or neither\nflips are supported.\n\n>  \n> @@ -414,13 +440,42 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n>  \t\t\t * Calculate the best sensor mode we can use based on\n>  \t\t\t * the user request.\n>  \t\t\t */\n> -\t\t\tV4L2VideoDevice::Formats fmts = data_->unicam_[Unicam::Image].dev()->formats();\n> +\t\t\tV4L2VideoDevice *dev = data_->unicam_[Unicam::Image].dev();\n> +\t\t\tV4L2VideoDevice::Formats fmts = dev->formats();\n>  \t\t\tV4L2DeviceFormat sensorFormat = findBestMode(fmts, cfg.size);\n> -\t\t\tint ret = data_->unicam_[Unicam::Image].dev()->tryFormat(&sensorFormat);\n> +\t\t\tint ret = dev->tryFormat(&sensorFormat);\n>  \t\t\tif (ret)\n>  \t\t\t\treturn Invalid;\n>  \n> -\t\t\tPixelFormat sensorPixFormat = sensorFormat.fourcc.toPixelFormat();\n> +\t\t\t/*\n> +\t\t\t * Some sensors change their Bayer order when they are\n> +\t\t\t * h-flipped or v-flipped, according to the transform.\n> +\t\t\t * If the controls own up to \"modifying the layout\" we\n> +\t\t\t * will assume that's what is going on and advertise\n> +\t\t\t * the transformed Bayer order in the stream.\n> +\t\t\t */\n> +\t\t\tV4L2PixelFormat fourcc = sensorFormat.fourcc;\n> +\n> +\t\t\t/*\n> +\t\t\t * The camera may already be transformed, so we must\n> +\t\t\t * only transform the fourcc if the new transform is\n> +\t\t\t * different.\n> +\t\t\t */\n> +\t\t\tControlList ctrls = dev->getControls({ V4L2_CID_HFLIP, V4L2_CID_VFLIP });\n> +\n> +\t\t\tconst struct v4l2_query_ext_ctrl *hflipCtrl = dev->queryControl(V4L2_CID_HFLIP);\n> +\t\t\tif (hflipCtrl &&\n> +\t\t\t    (hflipCtrl->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT) &&\n> +\t\t\t    ctrls.get(V4L2_CID_HFLIP).get<int32_t>() != !!(combined & Transform::HFlip))\n> +\t\t\t\tfourcc = fourcc.transform(Transform::HFlip);\n> +\n> +\t\t\tconst struct v4l2_query_ext_ctrl *vflipCtrl = dev->queryControl(V4L2_CID_VFLIP);\n> +\t\t\tif (vflipCtrl &&\n> +\t\t\t    (vflipCtrl->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT) &&\n> +\t\t\t    ctrls.get(V4L2_CID_VFLIP).get<int32_t>() != !!(combined & Transform::VFlip))\n> +\t\t\t\tfourcc = fourcc.transform(Transform::VFlip);\n\nTo simplify this, would it make sense to reset the h/v flip controls at\ninit time, and then read and store the bayer format ? That would be the\nnative bayer format, and we would only need to care about the\nV4L2_CTRL_FLAG_MODIFY_LAYOUT flags here.\n\nIf we consider it safe to assume that V4L2_CTRL_FLAG_MODIFY_LAYOUT will\nbe set for either both or neither flip controls, the code would be\nsimplified to\n\n\t\t\tV4L2PixelFormat fourcc = data_->sensorFormat_;\n\n\t\t\tconst struct v4l2_query_ext_ctrl *hflipCtrl = dev->queryControl(V4L2_CID_HFLIP);\n\t\t\tconst struct v4l2_query_ext_ctrl *vflipCtrl = dev->queryControl(V4L2_CID_VFLIP);\n\n\t\t\tif (hflipCtrl && vflipCtrl &&\n\t\t\t    (hflipCtrl->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT) &&\n\t\t\t    (vflipCtrl->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT))\n\t\t\t\tfourcc = fourcc.transform(combined);\n\n> +\n> +\t\t\tPixelFormat sensorPixFormat = fourcc.toPixelFormat();\n>  \t\t\tif (cfg.size != sensorFormat.size ||\n>  \t\t\t    cfg.pixelFormat != sensorPixFormat) {\n>  \t\t\t\tcfg.size = sensorFormat.size;\n> @@ -756,7 +811,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>  \tcrop.y = (sensorFormat.size.height - crop.height) >> 1;\n>  \tdata->isp_[Isp::Input].dev()->setSelection(V4L2_SEL_TGT_CROP, &crop);\n>  \n> -\tret = data->configureIPA();\n> +\tret = data->configureIPA(config);\n>  \tif (ret)\n>  \t\tLOG(RPI, Error) << \"Failed to configure the IPA: \" << ret;\n>  \n> @@ -1112,7 +1167,7 @@ int RPiCameraData::loadIPA()\n>  \treturn ipa_->init(settings);\n>  }\n>  \n> -int RPiCameraData::configureIPA()\n> +int RPiCameraData::configureIPA(CameraConfiguration *config)\n>  {\n>  \tstd::map<unsigned int, IPAStream> streamConfig;\n>  \tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n> @@ -1170,11 +1225,16 @@ int RPiCameraData::configureIPA()\n>  \t\t\tsensorMetadata_ = result.data[2];\n>  \t\t}\n>  \n> -\t\t/* Configure the H/V flip controls based on the sensor rotation. */\n> +\t\t/* \n> +\t\t * Configure the H/V flip controls based on the sensor rotation\n> +\t\t * and user transform.\n> +\t\t */\n>  \t\tControlList ctrls(unicam_[Unicam::Image].dev()->controls());\n>  \t\tint32_t rotation = sensor_->properties().get(properties::Rotation);\n> -\t\tctrls.set(V4L2_CID_HFLIP, static_cast<int32_t>(!!rotation));\n> -\t\tctrls.set(V4L2_CID_VFLIP, static_cast<int32_t>(!!rotation));\n> +\t\t/* The rotation angle was already checked in validate(). */\n> +\t\tTransform combined = config->transform * transformFromRotation(rotation);\n> +\t\tctrls.set(V4L2_CID_HFLIP, static_cast<int32_t>(!!(combined & Transform::HFlip)));\n> +\t\tctrls.set(V4L2_CID_VFLIP, static_cast<int32_t>(!!(combined & Transform::VFlip)));\n>  \t\tunicam_[Unicam::Image].dev()->setControls(&ctrls);\n>  \t}\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DB7C5BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  1 Sep 2020 00:42:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 661BC628D4;\n\tTue,  1 Sep 2020 02:42:35 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8C7676037B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  1 Sep 2020 02:42:34 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E1030277;\n\tTue,  1 Sep 2020 02:42:33 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"rxKhqjgU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1598920954;\n\tbh=JBxB+n1W/75spymwdN5QOcEr0rX1srcXvFmTktUu/P8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=rxKhqjgUOZF8DdYbHHwOypLz4vUggt5qaRSKQpmAzoyxWjE15mb+3V1vl/DzOJ8kN\n\thBwpKTk5VwA3ZNbXtnBpIobtm10DsVoj3DhB2KASWVw7CoWXI4A54YgJ9bCt+VnOdY\n\tlz2o3O677yRmOxkZZ0sXpfPek3tKpOtqNmdlKPgs=","Date":"Tue, 1 Sep 2020 03:42:12 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Message-ID":"<20200901004212.GC16155@pendragon.ideasonboard.com>","References":"<20200829115429.30010-1-david.plowman@raspberrypi.com>\n\t<20200829115429.30010-7-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200829115429.30010-7-david.plowman@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v5 6/8] libcamera: raspberrypi: Set\n\tcamera flips correctly from user transform","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":12237,"web_url":"https://patchwork.libcamera.org/comment/12237/","msgid":"<20200901004310.GD16155@pendragon.ideasonboard.com>","date":"2020-09-01T00:43:10","subject":"Re: [libcamera-devel] [PATCH v5 6/8] libcamera: raspberrypi: Set\n\tcamera flips correctly from user transform","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi David,\n\nAnother small comment.\n\nOn Tue, Sep 01, 2020 at 03:42:14AM +0300, Laurent Pinchart wrote:\n> On Sat, Aug 29, 2020 at 12:54:27PM +0100, David Plowman wrote:\n> > The Raspberry Pi pipeline handler allows all transforms except those\n> > involving a transpose. The user transform is combined with any\n> > inherent rotation of the camera, and the camera's H and V flip bits\n> > are set accordingly.\n> > \n> > Note that the validate() method has to work out what the final Bayer\n> > order of any raw streams will be, before configure() actually applies\n> > the transform to the sensor.\n> > \n> > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> > ---\n> >  .../pipeline/raspberrypi/raspberrypi.cpp      | 82 ++++++++++++++++---\n> >  1 file changed, 71 insertions(+), 11 deletions(-)\n> > \n> > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > index c554532..333aa94 100644\n> > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > @@ -294,7 +294,7 @@ public:\n> >  \tvoid frameStarted(uint32_t sequence);\n> >  \n> >  \tint loadIPA();\n> > -\tint configureIPA();\n> > +\tint configureIPA(CameraConfiguration *config);\n> >  \n> >  \tvoid queueFrameAction(unsigned int frame, const IPAOperationData &action);\n> >  \n> > @@ -400,8 +400,34 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n> >  \tif (config_.empty())\n> >  \t\treturn Invalid;\n> >  \n> > -\tif (transform != Transform::Identity) {\n> > -\t\ttransform = Transform::Identity;\n> > +\t/*\n> > +\t * What if the platform has a non-90 degree rotation? We can't even\n> > +\t * \"adjust\" the configuration and carry on. Alternatively, raising an\n> > +\t * error means the platform can never run. Let's just print a warning\n> > +\t * and continue regardless; the rotation is effectively set to zero.\n> > +\t */\n> > +\tint32_t rotation = data_->sensor_->properties().get(properties::Rotation);\n> > +\tbool success;\n> > +\tTransform combined = transform * transformFromRotation(rotation, &success);\n> > +\tif (!success)\n> > +\t\tLOG(RPI, Warning) << \"Invalid rotation of \" << rotation\n> > +\t\t\t\t  << \" degrees - ignoring\";\n> > +\n> > +\t/*\n> > +\t * We combine the platform and user transform, but must \"adjust away\"\n> > +\t * any combined result that includes a transform, as we can't do those.\n> > +\t * In this case, flipping only the transpose bit is helpful to\n> > +\t * applications - they either get the transform they requested, or have\n> > +\t * to do a simple transpose themselves (they don't have to worry about\n> > +\t * the other possible cases).\n> > +\t */\n> > +\tif (!!(combined & Transform::Transpose)) {\n> > +\t\t/*\n> > +\t\t * Flipping the transpose bit in \"transform\" flips it in\n> > +\t\t * combined result too (as it's the last thing that happens).\n> > +\t\t */\n> > +\t\ttransform ^= Transform::Transpose;\n> > +\t\tcombined ^= Transform::Transpose;\n> >  \t\tstatus = Adjusted;\n> >  \t}\n> \n> Shouldn't thus logic handle the case where the sensor can't flip ? I\n> think we can keep it simple that considering that either both or neither\n> flips are supported.\n> \n> >  \n> > @@ -414,13 +440,42 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n> >  \t\t\t * Calculate the best sensor mode we can use based on\n> >  \t\t\t * the user request.\n> >  \t\t\t */\n> > -\t\t\tV4L2VideoDevice::Formats fmts = data_->unicam_[Unicam::Image].dev()->formats();\n> > +\t\t\tV4L2VideoDevice *dev = data_->unicam_[Unicam::Image].dev();\n> > +\t\t\tV4L2VideoDevice::Formats fmts = dev->formats();\n> >  \t\t\tV4L2DeviceFormat sensorFormat = findBestMode(fmts, cfg.size);\n> > -\t\t\tint ret = data_->unicam_[Unicam::Image].dev()->tryFormat(&sensorFormat);\n> > +\t\t\tint ret = dev->tryFormat(&sensorFormat);\n> >  \t\t\tif (ret)\n> >  \t\t\t\treturn Invalid;\n> >  \n> > -\t\t\tPixelFormat sensorPixFormat = sensorFormat.fourcc.toPixelFormat();\n> > +\t\t\t/*\n> > +\t\t\t * Some sensors change their Bayer order when they are\n> > +\t\t\t * h-flipped or v-flipped, according to the transform.\n> > +\t\t\t * If the controls own up to \"modifying the layout\" we\n> > +\t\t\t * will assume that's what is going on and advertise\n> > +\t\t\t * the transformed Bayer order in the stream.\n> > +\t\t\t */\n> > +\t\t\tV4L2PixelFormat fourcc = sensorFormat.fourcc;\n> > +\n> > +\t\t\t/*\n> > +\t\t\t * The camera may already be transformed, so we must\n> > +\t\t\t * only transform the fourcc if the new transform is\n> > +\t\t\t * different.\n> > +\t\t\t */\n> > +\t\t\tControlList ctrls = dev->getControls({ V4L2_CID_HFLIP, V4L2_CID_VFLIP });\n> > +\n> > +\t\t\tconst struct v4l2_query_ext_ctrl *hflipCtrl = dev->queryControl(V4L2_CID_HFLIP);\n> > +\t\t\tif (hflipCtrl &&\n> > +\t\t\t    (hflipCtrl->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT) &&\n> > +\t\t\t    ctrls.get(V4L2_CID_HFLIP).get<int32_t>() != !!(combined & Transform::HFlip))\n> > +\t\t\t\tfourcc = fourcc.transform(Transform::HFlip);\n> > +\n> > +\t\t\tconst struct v4l2_query_ext_ctrl *vflipCtrl = dev->queryControl(V4L2_CID_VFLIP);\n> > +\t\t\tif (vflipCtrl &&\n> > +\t\t\t    (vflipCtrl->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT) &&\n> > +\t\t\t    ctrls.get(V4L2_CID_VFLIP).get<int32_t>() != !!(combined & Transform::VFlip))\n> > +\t\t\t\tfourcc = fourcc.transform(Transform::VFlip);\n> \n> To simplify this, would it make sense to reset the h/v flip controls at\n> init time, and then read and store the bayer format ? That would be the\n> native bayer format, and we would only need to care about the\n> V4L2_CTRL_FLAG_MODIFY_LAYOUT flags here.\n> \n> If we consider it safe to assume that V4L2_CTRL_FLAG_MODIFY_LAYOUT will\n> be set for either both or neither flip controls, the code would be\n> simplified to\n> \n> \t\t\tV4L2PixelFormat fourcc = data_->sensorFormat_;\n> \n> \t\t\tconst struct v4l2_query_ext_ctrl *hflipCtrl = dev->queryControl(V4L2_CID_HFLIP);\n> \t\t\tconst struct v4l2_query_ext_ctrl *vflipCtrl = dev->queryControl(V4L2_CID_VFLIP);\n> \n> \t\t\tif (hflipCtrl && vflipCtrl &&\n> \t\t\t    (hflipCtrl->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT) &&\n> \t\t\t    (vflipCtrl->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT))\n> \t\t\t\tfourcc = fourcc.transform(combined);\n> \n> > +\n> > +\t\t\tPixelFormat sensorPixFormat = fourcc.toPixelFormat();\n> >  \t\t\tif (cfg.size != sensorFormat.size ||\n> >  \t\t\t    cfg.pixelFormat != sensorPixFormat) {\n> >  \t\t\t\tcfg.size = sensorFormat.size;\n> > @@ -756,7 +811,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n> >  \tcrop.y = (sensorFormat.size.height - crop.height) >> 1;\n> >  \tdata->isp_[Isp::Input].dev()->setSelection(V4L2_SEL_TGT_CROP, &crop);\n> >  \n> > -\tret = data->configureIPA();\n> > +\tret = data->configureIPA(config);\n> >  \tif (ret)\n> >  \t\tLOG(RPI, Error) << \"Failed to configure the IPA: \" << ret;\n> >  \n> > @@ -1112,7 +1167,7 @@ int RPiCameraData::loadIPA()\n> >  \treturn ipa_->init(settings);\n> >  }\n> >  \n> > -int RPiCameraData::configureIPA()\n> > +int RPiCameraData::configureIPA(CameraConfiguration *config)\n> >  {\n> >  \tstd::map<unsigned int, IPAStream> streamConfig;\n> >  \tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n> > @@ -1170,11 +1225,16 @@ int RPiCameraData::configureIPA()\n> >  \t\t\tsensorMetadata_ = result.data[2];\n> >  \t\t}\n> >  \n> > -\t\t/* Configure the H/V flip controls based on the sensor rotation. */\n> > +\t\t/* \n\nThere's a trailing white space here.\n\n> > +\t\t * Configure the H/V flip controls based on the sensor rotation\n> > +\t\t * and user transform.\n> > +\t\t */\n> >  \t\tControlList ctrls(unicam_[Unicam::Image].dev()->controls());\n> >  \t\tint32_t rotation = sensor_->properties().get(properties::Rotation);\n> > -\t\tctrls.set(V4L2_CID_HFLIP, static_cast<int32_t>(!!rotation));\n> > -\t\tctrls.set(V4L2_CID_VFLIP, static_cast<int32_t>(!!rotation));\n> > +\t\t/* The rotation angle was already checked in validate(). */\n> > +\t\tTransform combined = config->transform * transformFromRotation(rotation);\n> > +\t\tctrls.set(V4L2_CID_HFLIP, static_cast<int32_t>(!!(combined & Transform::HFlip)));\n> > +\t\tctrls.set(V4L2_CID_VFLIP, static_cast<int32_t>(!!(combined & Transform::VFlip)));\n> >  \t\tunicam_[Unicam::Image].dev()->setControls(&ctrls);\n> >  \t}\n> >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0AED8BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  1 Sep 2020 00:43:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CD3BF628D4;\n\tTue,  1 Sep 2020 02:43:42 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 56BDD6037B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  1 Sep 2020 02:43:41 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CF7A9277;\n\tTue,  1 Sep 2020 02:43:31 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"KMXIsdOD\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1598921012;\n\tbh=/BRilEigzvFhfvREoqRlFj2WKqumWwW7WaXd77yIF1w=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=KMXIsdODQtdHVs4fSXGnWE7qY6PBjyzNW3BnEHglAvxLoMNrn4LGPNtNxHPO7dHzd\n\txukq8/CEz5mgiBt2s2BXxK2igokNiQ9Y7AS66XVOIGexhxu3Xrwg6p7c1Sbg/kvewb\n\tYbdwP0+3DLFcNVYxBPl6ST+WkdVIv5rTuAJKQRII=","Date":"Tue, 1 Sep 2020 03:43:10 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Message-ID":"<20200901004310.GD16155@pendragon.ideasonboard.com>","References":"<20200829115429.30010-1-david.plowman@raspberrypi.com>\n\t<20200829115429.30010-7-david.plowman@raspberrypi.com>\n\t<20200901004212.GC16155@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200901004212.GC16155@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v5 6/8] libcamera: raspberrypi: Set\n\tcamera flips correctly from user transform","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]