[{"id":1222,"web_url":"https://patchwork.libcamera.org/comment/1222/","msgid":"<20190402174053.GR4805@pendragon.ideasonboard.com>","date":"2019-04-02T17:40:53","subject":"Re: [libcamera-devel] [PATCH v7 11/13] libcamera: ipu3: Set stream\n\tconfiguration","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 Tue, Apr 02, 2019 at 07:13:07PM +0200, Jacopo Mondi wrote:\n> Use the cached sensor maximum resolution and the pixel format\n> generated by the ImgU output devices as default stream configuration.\n> \n> While at it, replace the hardcoded numerical value for the number of\n> buffers with a named constexpr.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 34 ++++++++++++----------------\n>  1 file changed, 15 insertions(+), 19 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index f6d08af906da..e4f8f90e2302 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -183,6 +183,8 @@ private:\n>  \t\tStream stream_;\n>  \t};\n>  \n> +\tstatic constexpr unsigned int IPU3_BUFFER_COUNT = 4;\n> +\n>  \tIPU3CameraData *cameraData(const Camera *camera)\n>  \t{\n>  \t\treturn static_cast<IPU3CameraData *>(\n> @@ -215,26 +217,20 @@ std::map<Stream *, StreamConfiguration>\n>  PipelineHandlerIPU3::streamConfiguration(Camera *camera,\n>  \t\t\t\t\t std::set<Stream *> &streams)\n>  {\n> -\tIPU3CameraData *data = cameraData(camera);\n>  \tstd::map<Stream *, StreamConfiguration> configs;\n> -\tV4L2SubdeviceFormat format = {};\n> -\n> -\t/*\n> -\t * FIXME: As of now, return the image format reported by the sensor.\n> -\t * In future good defaults should be provided for each stream.\n> -\t */\n> -\tif (data->cio2_.sensor_->getFormat(0, &format)) {\n> -\t\tLOG(IPU3, Error) << \"Failed to create stream configurations\";\n> -\t\treturn configs;\n> -\t}\n> -\n> -\tStreamConfiguration config = {};\n> -\tconfig.width = format.width;\n> -\tconfig.height = format.height;\n> -\tconfig.pixelFormat = V4L2_PIX_FMT_IPU3_SGRBG10;\n> -\tconfig.bufferCount = 4;\n> -\n> -\tconfigs[&data->stream_] = config;\n> +\tIPU3CameraData *data = cameraData(camera);\n> +\tStreamConfiguration *config = &configs[&data->stream_];\n> +\tSize *maxSize = &data->.cio2_.maxSize_;\n> +\n> +\tconfig->width = maxSize->width;\n> +\tconfig->height = maxSize->height;\n> +\tconfig->pixelFormat = V4L2_PIX_FMT_NV12;\n> +\tconfig->bufferCount = IPU3_BUFFER_COUNT;\n> +\n> +\tLOG(IPU3, Debug)\n> +\t\t<< \"Stream format set to \" << config->width << \"x\"\n> +\t\t<< config->height << \"-0x\" << std::hex << std::setfill('0')\n> +\t\t<< std::setw(8) << config->pixelFormat;\n>  \n>  \treturn configs;\n>  }","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5500F610B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Apr 2019 19:41:04 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DE2F3542;\n\tTue,  2 Apr 2019 19:41:03 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1554226864;\n\tbh=2L0XSfdcBoQHjgHFZF0fwZbOUyxgz4ja3JCaxuFqrEo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=AGHva+yZC0DTeQkWAyWrHXEJBM0WrMT0WYdWAWW2554dVoDQnK06k+diIRGJPdlSW\n\tmz5r/m32RWyuMWRsMDElPnHwcFfvxVeTGX1dig593Pey88npCvDbT3Mg29nfG9T/K+\n\tW0FicwpxbbXxlcuEDO1n5FKzYn1JzjJfugTWw4W0=","Date":"Tue, 2 Apr 2019 20:40:53 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190402174053.GR4805@pendragon.ideasonboard.com>","References":"<20190402171309.6447-1-jacopo@jmondi.org>\n\t<20190402171309.6447-12-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190402171309.6447-12-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v7 11/13] libcamera: ipu3: Set stream\n\tconfiguration","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Tue, 02 Apr 2019 17:41:04 -0000"}},{"id":1230,"web_url":"https://patchwork.libcamera.org/comment/1230/","msgid":"<20190402182706.GE23466@bigcity.dyn.berto.se>","date":"2019-04-02T18:27:06","subject":"Re: [libcamera-devel] [PATCH v7 11/13] libcamera: ipu3: Set stream\n\tconfiguration","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2019-04-02 19:13:07 +0200, Jacopo Mondi wrote:\n> Use the cached sensor maximum resolution and the pixel format\n> generated by the ImgU output devices as default stream configuration.\n> \n> While at it, replace the hardcoded numerical value for the number of\n> buffers with a named constexpr.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 34 ++++++++++++----------------\n>  1 file changed, 15 insertions(+), 19 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index f6d08af906da..e4f8f90e2302 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -183,6 +183,8 @@ private:\n>  \t\tStream stream_;\n>  \t};\n>  \n> +\tstatic constexpr unsigned int IPU3_BUFFER_COUNT = 4;\n> +\n>  \tIPU3CameraData *cameraData(const Camera *camera)\n>  \t{\n>  \t\treturn static_cast<IPU3CameraData *>(\n> @@ -215,26 +217,20 @@ std::map<Stream *, StreamConfiguration>\n>  PipelineHandlerIPU3::streamConfiguration(Camera *camera,\n>  \t\t\t\t\t std::set<Stream *> &streams)\n>  {\n> -\tIPU3CameraData *data = cameraData(camera);\n>  \tstd::map<Stream *, StreamConfiguration> configs;\n> -\tV4L2SubdeviceFormat format = {};\n> -\n> -\t/*\n> -\t * FIXME: As of now, return the image format reported by the sensor.\n> -\t * In future good defaults should be provided for each stream.\n> -\t */\n> -\tif (data->cio2_.sensor_->getFormat(0, &format)) {\n> -\t\tLOG(IPU3, Error) << \"Failed to create stream configurations\";\n> -\t\treturn configs;\n> -\t}\n> -\n> -\tStreamConfiguration config = {};\n> -\tconfig.width = format.width;\n> -\tconfig.height = format.height;\n> -\tconfig.pixelFormat = V4L2_PIX_FMT_IPU3_SGRBG10;\n> -\tconfig.bufferCount = 4;\n> -\n> -\tconfigs[&data->stream_] = config;\n> +\tIPU3CameraData *data = cameraData(camera);\n> +\tStreamConfiguration *config = &configs[&data->stream_];\n> +\tSize *maxSize = &data->.cio2_.maxSize_;\n> +\n> +\tconfig->width = maxSize->width;\n> +\tconfig->height = maxSize->height;\n> +\tconfig->pixelFormat = V4L2_PIX_FMT_NV12;\n> +\tconfig->bufferCount = IPU3_BUFFER_COUNT;\n> +\n> +\tLOG(IPU3, Debug)\n> +\t\t<< \"Stream format set to \" << config->width << \"x\"\n> +\t\t<< config->height << \"-0x\" << std::hex << std::setfill('0')\n> +\t\t<< std::setw(8) << config->pixelFormat;\n>  \n>  \treturn configs;\n>  }\n> -- \n> 2.21.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x243.google.com (mail-lj1-x243.google.com\n\t[IPv6:2a00:1450:4864:20::243])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 913E7610B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Apr 2019 20:27:07 +0200 (CEST)","by mail-lj1-x243.google.com with SMTP id h16so12462102ljg.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 02 Apr 2019 11:27:07 -0700 (PDT)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tr1sm2577458lfm.7.2019.04.02.11.27.06\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 02 Apr 2019 11:27:06 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=BrTEIr0cp7l/HpNFMxkULNc2YhyEZpF1C4H+zVM8cVE=;\n\tb=pZMolvF9A9UHf50Z7lOsCUnPCcMwkmJfKHdSEiVS9wmX9URWLFiUjfYZwDMx+rlKUS\n\tGvCwazq1klLA1Fj+tQbKaP5f1G8Vs3qL4uIpNmU51xBxl2HhcbvISWDVGrXW6FD4DRkw\n\tHbqF3s8TafJ/cFGw2Hm9os+uKjgEAWjGawQLZYuxQFSjIYhhechkoPHOJlfC/eJp1lZI\n\tDDydFbIa2y4Ao1/VeRAJw8tbp0Hl4gwLj46DANgMvh42zr7NvOU4Hd0TW3ZQp2Kl/esX\n\tljfHvg0Tx6lIGVIdrrqCs6esVsTIBVBLy8UXHmFjSwZKzX+AkoXFPvVdHGouaFHd2ajI\n\t3SNQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=BrTEIr0cp7l/HpNFMxkULNc2YhyEZpF1C4H+zVM8cVE=;\n\tb=ZWNEBMbCV2cwxPZjdLCq4MAKzYeHAE17C5Inwsj0kqnB04aRFOTG7buqWauedUSx3q\n\tn4vTIuzwrYzoSpQqNAyvr0lJZ9P1KnhcffaTkvepvfE5/oTJFnhfgHqCAqjulapihFO+\n\tfeYzgHZX1grR9LFqwcMvSZIHkyBC7dtBppsC2Szx8IqafNKVZb1wNf5ZPnGxoBcbP65h\n\tBcl+V+FkJ+34uPXM3qMQW26lSf2AG60p4BdLfXIV6ISaVZE/xZBjiSZ3+64KHD7izGU1\n\tiAPZ4Rb5MEMkGecSCaaWAuDJijj155CUDa033+NPVRaF37noUg09AJCvipkAp+eFpjYZ\n\t7e1Q==","X-Gm-Message-State":"APjAAAWDal8myR3U5lqtQfchpKZc+HKxK67JeRJ0i9cKE3ws5/A7Ikub\n\tQ4mOnSCWxsrC/At/8Xjsu8N5Gw==","X-Google-Smtp-Source":"APXvYqw6LAXefruTheRSdg6how0fEBnLYUynYbP2iatN0JYGP/4U8Ipg7LT2mcAyfKG4JsyiDu78Aw==","X-Received":"by 2002:a2e:87cd:: with SMTP id\n\tv13mr31402617ljj.98.1554229627076; \n\tTue, 02 Apr 2019 11:27:07 -0700 (PDT)","Date":"Tue, 2 Apr 2019 20:27:06 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190402182706.GE23466@bigcity.dyn.berto.se>","References":"<20190402171309.6447-1-jacopo@jmondi.org>\n\t<20190402171309.6447-12-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190402171309.6447-12-jacopo@jmondi.org>","User-Agent":"Mutt/1.11.3 (2019-02-01)","Subject":"Re: [libcamera-devel] [PATCH v7 11/13] libcamera: ipu3: Set stream\n\tconfiguration","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Tue, 02 Apr 2019 18:27:07 -0000"}}]