{"id":1742,"url":"https://patchwork.libcamera.org/api/patches/1742/?format=json","web_url":"https://patchwork.libcamera.org/patch/1742/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190807204915.23942-4-niklas.soderlund@ragnatech.se>","date":"2019-08-07T20:49:14","name":"[libcamera-devel,v2,3/4] tests: v4l2_videodevice: Set media bus and pixel formats for vimc","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"e4d36844ad6c009275bf048842a024851e1dcb21","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1742/mbox/","series":[{"id":447,"url":"https://patchwork.libcamera.org/api/series/447/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=447","date":"2019-08-07T20:49:13","name":"libcamera: Fix issues with vimc and Linux v5.2","version":2,"mbox":"https://patchwork.libcamera.org/series/447/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1742/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1742/checks/","tags":{},"headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 32A7661624\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Aug 2019 22:49:23 +0200 (CEST)","from bismarck.berto.se (unknown [145.14.112.32])\n\tby bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid d0d74565-b954-11e9-bdc3-005056917a89;\n\tWed, 07 Aug 2019 22:49:14 +0200 (CEST)"],"X-Halon-ID":"d0d74565-b954-11e9-bdc3-005056917a89","Authorized-sender":"niklas@soderlund.pp.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  7 Aug 2019 22:49:14 +0200","Message-Id":"<20190807204915.23942-4-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.22.0","In-Reply-To":"<20190807204915.23942-1-niklas.soderlund@ragnatech.se>","References":"<20190807204915.23942-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 3/4] tests: v4l2_videodevice: Set media\n\tbus 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 20:49:30 -0000"},"content":"Most of the video device tests are based on vimc and Linux commit\n85ab1aa1fac17bcd (\"media: vimc: deb: fix default sink bayer format\")\nchanges the default media bus format for the debayer subdevices. This\nleads to a -EPIPE error when trying to use the raw capture video device\nnodes.\n\nFix this by explicitly setting media bus and pixel formats to known good\nvalues which works before and after the upstream change.\n\nSigned-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(-)","diff":"diff --git a/test/v4l2_videodevice/v4l2_videodevice_test.cpp b/test/v4l2_videodevice/v4l2_videodevice_test.cpp\nindex 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+\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 };\ndiff --git a/test/v4l2_videodevice/v4l2_videodevice_test.h b/test/v4l2_videodevice/v4l2_videodevice_test.h\nindex 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 };\n","prefixes":["libcamera-devel","v2","3/4"]}