[{"id":2337,"web_url":"https://patchwork.libcamera.org/comment/2337/","msgid":"<20190807212037.GD20497@pendragon.ideasonboard.com>","date":"2019-08-07T21:20:37","subject":"Re: [libcamera-devel] [PATCH v2 3/4] tests: v4l2_videodevice: Set\n\tmedia bus and pixel formats for vimc","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Wed, Aug 07, 2019 at 10:49:14PM +0200, Niklas Söderlund wrote:\n> Most of the video device tests are based on vimc and Linux commit\n> 85ab1aa1fac17bcd (\"media: vimc: deb: fix default sink bayer format\")\n> changes the default media bus format for the debayer subdevices. This\n> leads to a -EPIPE error when trying to use the raw capture video device\n> nodes.\n> \n> Fix this by explicitly setting media bus and pixel formats to known good\n> values which works before and after the upstream change.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  .../v4l2_videodevice_test.cpp                 | 26 +++++++++++++++++++\n>  test/v4l2_videodevice/v4l2_videodevice_test.h |  7 ++++-\n>  2 files changed, 32 insertions(+), 1 deletion(-)\n> \n> diff --git a/test/v4l2_videodevice/v4l2_videodevice_test.cpp b/test/v4l2_videodevice/v4l2_videodevice_test.cpp\n> index b26d06ad45197c8f..a0d269fef7f43895 100644\n> --- a/test/v4l2_videodevice/v4l2_videodevice_test.cpp\n> +++ b/test/v4l2_videodevice/v4l2_videodevice_test.cpp\n> @@ -8,6 +8,8 @@\n>  #include <iostream>\n>  #include <sys/stat.h>\n>  \n> +#include <linux/media-bus-format.h>\n> +\n>  #include \"v4l2_videodevice_test.h\"\n>  \n>  #include \"device_enumerator.h\"\n> @@ -69,6 +71,28 @@ int V4L2VideoDeviceTest::init()\n>  \tif (capture_->getFormat(&format))\n>  \t\treturn TestFail;\n>  \n> +\tif (driver_ == \"vimc\") {\n> +\t\tsensor_ = new CameraSensor(media_->getEntityByName(\"Sensor A\"));\n> +\t\tif (sensor_->init())\n> +\t\t\treturn TestFail;\n> +\n> +\t\tdebayer_ = new V4L2Subdevice(media_->getEntityByName(\"Debayer A\"));\n> +\t\tif (debayer_->open())\n> +\t\t\treturn TestFail;\n\nCould sensor_ and debayer_ be local variables ? Apart from that,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\n> +\t\tformat.fourcc = V4L2_PIX_FMT_SBGGR8;\n> +\n> +\t\tV4L2SubdeviceFormat subformat = {};\n> +\t\tsubformat.mbus_code = MEDIA_BUS_FMT_SBGGR8_1X8;\n> +\t\tsubformat.size = format.size;\n> +\n> +\t\tif (sensor_->setFormat(&subformat))\n> +\t\t\treturn TestFail;\n> +\n> +\t\tif (debayer_->setFormat(0, &subformat))\n> +\t\t\treturn TestFail;\n> +\t}\n> +\n>  \tformat.size.width = 640;\n>  \tformat.size.height = 480;\n>  \tif (capture_->setFormat(&format))\n> @@ -83,5 +107,7 @@ void V4L2VideoDeviceTest::cleanup()\n>  \tcapture_->releaseBuffers();\n>  \tcapture_->close();\n>  \n> +\tdelete debayer_;\n> +\tdelete sensor_;\n>  \tdelete capture_;\n>  };\n> diff --git a/test/v4l2_videodevice/v4l2_videodevice_test.h b/test/v4l2_videodevice/v4l2_videodevice_test.h\n> index 3321b5a4f98fdb1d..34dd231c6d9d108d 100644\n> --- a/test/v4l2_videodevice/v4l2_videodevice_test.h\n> +++ b/test/v4l2_videodevice/v4l2_videodevice_test.h\n> @@ -13,8 +13,10 @@\n>  \n>  #include \"test.h\"\n>  \n> +#include \"camera_sensor.h\"\n>  #include \"device_enumerator.h\"\n>  #include \"media_device.h\"\n> +#include \"v4l2_subdevice.h\"\n>  #include \"v4l2_videodevice.h\"\n>  \n>  using namespace libcamera;\n> @@ -23,7 +25,8 @@ class V4L2VideoDeviceTest : public Test\n>  {\n>  public:\n>  \tV4L2VideoDeviceTest(const char *driver, const char *entity)\n> -\t\t: driver_(driver), entity_(entity), capture_(nullptr)\n> +\t\t: driver_(driver), entity_(entity), sensor_(nullptr),\n> +\t\t  debayer_(nullptr), capture_(nullptr)\n>  \t{\n>  \t}\n>  \n> @@ -35,6 +38,8 @@ protected:\n>  \tstd::string entity_;\n>  \tstd::unique_ptr<DeviceEnumerator> enumerator_;\n>  \tstd::shared_ptr<MediaDevice> media_;\n> +\tCameraSensor *sensor_;\n> +\tV4L2Subdevice *debayer_;\n>  \tV4L2VideoDevice *capture_;\n>  \tBufferPool pool_;\n>  };","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 B29276161A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Aug 2019 23:20:40 +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 2FA9867;\n\tWed,  7 Aug 2019 23:20:40 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1565212840;\n\tbh=vGosG8ei0I//uGFGqj/1al1Mew70JnZwkaGk/PFWjnM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Kg412eA4YKPAknMPZL/ohVTTf0ZbE0h6FpC/GwRgMNty1dWNSVE9kZID5P5mfavRv\n\tGG/lMg3D9mphYIf5oO0BWZmpM2j2o0zE4DhVUyQzNPR5MdKJvzcoMgNenta9ppOaYI\n\th+x2r52aBaIj7zhDCpv5LM01fZgB2fBn0boIU088=","Date":"Thu, 8 Aug 2019 00:20:37 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190807212037.GD20497@pendragon.ideasonboard.com>","References":"<20190807204915.23942-1-niklas.soderlund@ragnatech.se>\n\t<20190807204915.23942-4-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190807204915.23942-4-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 3/4] tests: v4l2_videodevice: Set\n\tmedia bus and pixel formats for vimc","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":"Wed, 07 Aug 2019 21:20:40 -0000"}}]