[{"id":12313,"web_url":"https://patchwork.libcamera.org/comment/12313/","msgid":"<20200905173829.GD6319@pendragon.ideasonboard.com>","date":"2020-09-05T17:38:29","subject":"Re: [libcamera-devel] [PATCH v2 01/12] android: camera_device:\n\tRefuse unsupported formats","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Wed, Sep 02, 2020 at 05:22:25PM +0200, Jacopo Mondi wrote:\n> The current implementation of CameraDevice::initializeStreamConfigurations()\n> fails if an image format marked as mandatory is not supported by the\n> libcamera::Camera device, but erroneously accepts non-mandatory\n> non-supported formats in the list of accepted ones.\n> \n> Fix this by ignoring non supported image formats which are not marked as\n> mandatory.\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/android/camera_device.cpp | 14 ++++++++++----\n>  1 file changed, 10 insertions(+), 4 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 9605b9e9069e..ad0d7fd15d90 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -392,10 +392,16 @@ int CameraDevice::initializeStreamConfigurations()\n>  \t\t\t\tbreak;\n>  \t\t\t}\n>  \t\t}\n> -\t\tif (camera3Format.mandatory && !mappedFormat.isValid()) {\n> -\t\t\tLOG(HAL, Error) << \"Failed to map Android format \"\n> -\t\t\t\t\t<< camera3Format.name << \" (\"\n> -\t\t\t\t\t<< utils::hex(androidFormat) << \")\";\n> +\n> +\t\tif (!mappedFormat.isValid()) {\n> +\t\t\t/* If the format is not mandatory, skip it. */\n> +\t\t\tif (!camera3Format.mandatory)\n> +\t\t\t\tcontinue;\n> +\n> +\t\t\tLOG(HAL, Error)\n> +\t\t\t\t<< \"Failed to map mandatory Android format \"\n> +\t\t\t\t<< camera3Format.name << \" (\"\n> +\t\t\t\t<< utils::hex(androidFormat) << \"): aborting\";\n>  \t\t\treturn -EINVAL;\n>  \t\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 1C2C3BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  5 Sep 2020 17:38:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9F147629B6;\n\tSat,  5 Sep 2020 19:38:54 +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 4E90462901\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  5 Sep 2020 19:38:53 +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 BBAD9335;\n\tSat,  5 Sep 2020 19:38:52 +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=\"sJOIVBWS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1599327532;\n\tbh=POCoOZota/lEnct/pxfHwYmISiQBSt7iSYB4EITAelE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=sJOIVBWStih3h4EcKJmRGgeIE/At+h9/uFA2xh1bm4TDkauaD1Jta9v7OER9DfH2D\n\tL8ylrlntYDKs1xO4WFNWoSZWX5k3atNA74PJsh4dQ5Zm4O1es0ducVINY2AcdwgD1F\n\tlU34Zzy4cZ8OMj+Jn4zeZunMQf0AMGJWa/z78IeE=","Date":"Sat, 5 Sep 2020 20:38:29 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200905173829.GD6319@pendragon.ideasonboard.com>","References":"<20200902152236.69770-1-jacopo@jmondi.org>\n\t<20200902152236.69770-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200902152236.69770-2-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v2 01/12] android: camera_device:\n\tRefuse unsupported formats","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":"tfiga@google.com, libcamera-devel@lists.libcamera.org, hiroh@google.com","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":12341,"web_url":"https://patchwork.libcamera.org/comment/12341/","msgid":"<CAO5uPHNzwXi7vGHej7i6BoNpqF0fmYMFpACujrGfe2_fZ4NspA@mail.gmail.com>","date":"2020-09-07T07:48:12","subject":"Re: [libcamera-devel] [PATCH v2 01/12] android: camera_device:\n\tRefuse unsupported formats","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"LGTM\n\nOn Sun, Sep 6, 2020 at 2:38 AM Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Wed, Sep 02, 2020 at 05:22:25PM +0200, Jacopo Mondi wrote:\n> > The current implementation of CameraDevice::initializeStreamConfigurations()\n> > fails if an image format marked as mandatory is not supported by the\n> > libcamera::Camera device, but erroneously accepts non-mandatory\n> > non-supported formats in the list of accepted ones.\n> >\n> > Fix this by ignoring non supported image formats which are not marked as\n> > mandatory.\n> >\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n> > ---\n> >  src/android/camera_device.cpp | 14 ++++++++++----\n> >  1 file changed, 10 insertions(+), 4 deletions(-)\n> >\n> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> > index 9605b9e9069e..ad0d7fd15d90 100644\n> > --- a/src/android/camera_device.cpp\n> > +++ b/src/android/camera_device.cpp\n> > @@ -392,10 +392,16 @@ int CameraDevice::initializeStreamConfigurations()\n> >                               break;\n> >                       }\n> >               }\n> > -             if (camera3Format.mandatory && !mappedFormat.isValid()) {\n> > -                     LOG(HAL, Error) << \"Failed to map Android format \"\n> > -                                     << camera3Format.name << \" (\"\n> > -                                     << utils::hex(androidFormat) << \")\";\n> > +\n> > +             if (!mappedFormat.isValid()) {\n> > +                     /* If the format is not mandatory, skip it. */\n> > +                     if (!camera3Format.mandatory)\n> > +                             continue;\n> > +\n> > +                     LOG(HAL, Error)\n> > +                             << \"Failed to map mandatory Android format \"\n> > +                             << camera3Format.name << \" (\"\n> > +                             << utils::hex(androidFormat) << \"): aborting\";\n> >                       return -EINVAL;\n> >               }\n> >\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 9238CBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  7 Sep 2020 07:48:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3678D62B82;\n\tMon,  7 Sep 2020 09:48:25 +0200 (CEST)","from mail-ej1-x641.google.com (mail-ej1-x641.google.com\n\t[IPv6:2a00:1450:4864:20::641])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 555AB629B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  7 Sep 2020 09:48:24 +0200 (CEST)","by mail-ej1-x641.google.com with SMTP id z22so16919759ejl.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 07 Sep 2020 00:48:24 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"A0bC6bIO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=uvu93URaReU3GF6m8um97z7gzf4SKbxbyBOVs5pzsV4=;\n\tb=A0bC6bIOzBxucZpElnukymt97H/FvWp1f5EU3OGc5zlsYjVZOg2GyDgeho9GeF1MKx\n\thrQXGsucGK2aeWYreI63AjaG0S4g97EdffPZprsUh3cnBCUezimLogWzSl+LbdNw+6pc\n\tr1vCiTs+bk2T4yN8ADiVvnCN8ZbykOpQPESBU=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=uvu93URaReU3GF6m8um97z7gzf4SKbxbyBOVs5pzsV4=;\n\tb=knbJoW3sh4NS6dxJ2RIlBwCWTbZgNGJ/uXjxTAXQHJVsi5kpo2nDwdYXHeO30LhsXu\n\tYWSQSz56PHBisXUqPdB45zC6O1o/z8hamXY/e3lmRRHFhWPOexO7/5ud6RLFkQiu+8Ei\n\tYhA3uBOUqbm1u985xO2mDyh8YV8WuLuilqC9bR1Sn2jqJXV3tDk5ueTH6ixc78l1wkpc\n\t5Js+d8gLEINAMSCSCYKrvyKW06Zd/ljB5GLV7tPK+00fq0tpRP8GIMWgTw562sdPZ7ME\n\tBCBAym1zpy5m8eWfFqEOPBj660QbVrM/HLkDMkL5E4dVjMJStbwTw/3MTLd0lLyyaqKj\n\tjDBg==","X-Gm-Message-State":"AOAM530LpKhRIi24CHt/6r4V3Q0kzlTyI52e0fSAsYmNUpXlhgYzcH/K\n\tvVXBNss3GKS0teGS/RHG/jKPkOQk9r04O+BSf+493Q==","X-Google-Smtp-Source":"ABdhPJx6Y0p+KwwnfvCD8RDu0i4JiO+N8LzNB2D/Z8lYXRLWK/IzHVQNQkIDmw6lks6W+25tYnPvWT7xlvMtgPbjGZI=","X-Received":"by 2002:a17:906:12c7:: with SMTP id\n\tl7mr19651964ejb.306.1599464904020; \n\tMon, 07 Sep 2020 00:48:24 -0700 (PDT)","MIME-Version":"1.0","References":"<20200902152236.69770-1-jacopo@jmondi.org>\n\t<20200902152236.69770-2-jacopo@jmondi.org>\n\t<20200905173829.GD6319@pendragon.ideasonboard.com>","In-Reply-To":"<20200905173829.GD6319@pendragon.ideasonboard.com>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Mon, 7 Sep 2020 16:48:12 +0900","Message-ID":"<CAO5uPHNzwXi7vGHej7i6BoNpqF0fmYMFpACujrGfe2_fZ4NspA@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 01/12] android: camera_device:\n\tRefuse unsupported formats","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":"tfiga@google.com, libcamera-devel@lists.libcamera.org,\n\tHirokazu Honda <hiroh@google.com>","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>"}}]