{"id":12946,"url":"https://patchwork.libcamera.org/api/covers/12946/?format=json","web_url":"https://patchwork.libcamera.org/cover/12946/","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":"<20210714183857.2046425-1-nfraprado@collabora.com>","date":"2021-07-14T18:38:47","name":"[libcamera-devel,v6,00/10] lc-compliance: Add test to queue more requests than hardware depth","submitter":{"id":84,"url":"https://patchwork.libcamera.org/api/people/84/?format=json","name":"Nícolas F. R. A. Prado","email":"nfraprado@collabora.com"},"mbox":"https://patchwork.libcamera.org/cover/12946/mbox/","series":[{"id":2232,"url":"https://patchwork.libcamera.org/api/series/2232/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2232","date":"2021-07-14T18:38:47","name":"lc-compliance: Add test to queue more requests than hardware depth","version":6,"mbox":"https://patchwork.libcamera.org/series/2232/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/12946/comments/","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 8A50DC3225\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 14 Jul 2021 18:39:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F210B68506;\n\tWed, 14 Jul 2021 20:39:11 +0200 (CEST)","from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DFA8768503\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 14 Jul 2021 20:39:10 +0200 (CEST)","from localhost.localdomain (unknown\n\t[IPv6:2804:14c:1a9:2434:6553:ad0c:9d2a:24db])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits))\n\t(No client certificate requested) (Authenticated sender: nfraprado)\n\tby bhuna.collabora.co.uk (Postfix) with ESMTPSA id 69B291F43215;\n\tWed, 14 Jul 2021 19:39:09 +0100 (BST)"],"From":"=?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 14 Jul 2021 15:38:47 -0300","Message-Id":"<20210714183857.2046425-1-nfraprado@collabora.com>","X-Mailer":"git-send-email 2.32.0","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v6 00/10] lc-compliance: Add test to queue\n\tmore requests than hardware depth","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":"kernel@collabora.com, =?utf-8?q?Andr=C3=A9_Almeida?=\n\t<andrealmeid@collabora.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The purpose of this series is to add a new test to lc-compliance that tests\nqueuing a lot of requests at once in order to ensure that pipeline handlers are\nable to handle more requests than they have resources for (like internal buffers\nand v4l2 buffer slots) [1].\n\n[1] https://bugs.libcamera.org/show_bug.cgi?id=24\n\nIn order to achieve this, the FrameBufferAllocator had to be adapted to allow an\narbitrary amount of buffers to be allocated. But there's also the issue of\nreporting the minimum amount of requests required by the pipeline handler, which\nwas solved by creating a new MinNumRequests property.\n\nSo patch 1 adds the new MinNumRequests property to report the minimum amount of\nrequests needed by the pipeline handler.\n\nPatch 2 adds a count argument to allocate() so that the amount of buffers to\nallocate needs to be specified, as it is no longer assumed through bufferCount.\n\nPatches 3-6 does some refactoring in lc-compliance in order to reduce code\nduplication.\n\nPatch 7 adds the test to lc-compliance.\n\nPatch 8 adds checks to ensure that requests which failed to be enqueued are\nreported as test failure.\n\nPatch 9 replaces all usage of bufferCount for allocateBuffers() and\nimportBuffers() in pipeline handlers to constants, as bufferCount wasn't a good\nfit and to allow its removal. This is intended as a temporary measure, and\npipeline handlers will probably want to improve the logic of those values.\n\nPatch 10 removes bufferCount from the StreamConfiguration as it is no longer\nneeded.\n\nI've run this new lc-compliance test on the rkisp1, raspberrypi, uvcvideo and\nvimc pipelines.\n* raspberrypi already handles it well.\n* uvcvideo runs successfully after applying the patch in [2]\n* rkisp1 runs successfully after applying the patch in [3]\n* vimc fails, but should be easily fixed with a patch similar to the one for\n  uvcvideo.\n\n[2] https://lists.libcamera.org/pipermail/libcamera-devel/2021-July/022029.html\n[3] https://lists.libcamera.org/pipermail/libcamera-devel/2021-July/022135.html\n\nThe amount of buffers to allocate in the lc-compliance test (patch 7) was\nhardcoded to 8 since more than that would cause errors when allocating.\n\nChanges in v6:\n- Thanks to Naushir:\n  - Removed unneeded comment on MinNumRequests property of RPi\n- Fixed style issues\n- Changed static_cast to unsigned int when comparing buffer count in\n  lc-compliance\n- Changed parameter order of queueRequests()\n- Added comment on runCaptureSession()\n- Added pipeline prefix to INTERNAL_BUFFER_COUNT and BUFFER_SLOT_COUNT constants\n- Removed unused variable in the IPU3 pipeline\n\nv5: https://lists.libcamera.org/pipermail/libcamera-devel/2021-July/022098.html\n\nChanges in v5:\n- Rebased on master (now that lc-compliance was refactored to use Googletest)\n- Added patches 3, 5, 6 and 8\n- Fixed qcam to use at least two buffers\n\nv4: https://lists.libcamera.org/pipermail/libcamera-devel/2021-May/020150.html\n\nChanges in v4:\n- Thanks to Laurent:\n  - Renamed QueueDepth property to MinNumRequests and better documented it\n  - Changed patch 6 to also remove bufferCount from android\n- Thanks to Niklas:\n  - Added patch 3 to factor common code in lc-compliance\n- Added patch 5 to remove pipeline dependency on bufferCount\n\nv3: https://lists.libcamera.org/pipermail/libcamera-devel/2021-April/019613.html\n\nChanges in v3:\n- Added patches 1 and 4 to add the QueueDepth property and remove bufferCount\n- Made the count argument required in patch 2\n- Added previously missing changes to the gstreamer and v4l2 compatibility\n  layers\n\nv2: https://lists.libcamera.org/pipermail/libcamera-devel/2021-April/019398.html\n\nChanges in v2:\n- Renamed and reworded commits and series\n- Dropped patches 2 and 3, which were hacks to test, and added patch 1 to add\n  count to FrameBufferAllocator\n- Thanks to Niklas:\n  - Created new standalone test instead of looping over the other tests\n\nv1: https://lists.libcamera.org/pipermail/libcamera-devel/2021-April/019139.html\n\nNícolas F. R. A. Prado (10):\n  libcamera: property: Add MinNumRequests property\n  libcamera: framebuffer_allocator: Make allocate() require count\n  lc-compliance: Move buffer allocation to separate function\n  lc-compliance: Factor common capture code into SimpleCapture\n  lc-compliance: Move camera setup to CameraHolder class\n  lc-compliance: Move role to string conversion to its own function\n  lc-compliance: Add test to queue more requests than hardware depth\n  lc-compliance: Check that requests complete successfully\n  libcamera: pipeline: Don't rely on bufferCount\n  libcamera: stream: Remove bufferCount\n\n include/libcamera/camera.h                    |   2 +-\n include/libcamera/framebuffer_allocator.h     |   2 +-\n include/libcamera/internal/pipeline_handler.h |   2 +-\n include/libcamera/stream.h                    |   2 -\n src/android/camera_stream.cpp                 |   7 +-\n src/cam/capture.cpp                           |   9 +-\n src/gstreamer/gstlibcameraallocator.cpp       |   4 +-\n src/lc-compliance/capture_test.cpp            | 111 ++++++++++---\n src/lc-compliance/simple_capture.cpp          | 150 +++++++++++++-----\n src/lc-compliance/simple_capture.h            |  27 +++-\n src/libcamera/camera.cpp                      |   4 +-\n src/libcamera/framebuffer_allocator.cpp       |   5 +-\n src/libcamera/pipeline/ipu3/cio2.cpp          |   1 -\n src/libcamera/pipeline/ipu3/imgu.cpp          |  12 +-\n src/libcamera/pipeline/ipu3/imgu.h            |   5 +-\n src/libcamera/pipeline/ipu3/ipu3.cpp          |  27 ++--\n .../pipeline/raspberrypi/raspberrypi.cpp      |  27 ++--\n src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  15 +-\n src/libcamera/pipeline/rkisp1/rkisp1_path.cpp |   4 +-\n src/libcamera/pipeline/rkisp1/rkisp1_path.h   |   3 +\n src/libcamera/pipeline/simple/converter.cpp   |   7 +-\n src/libcamera/pipeline/simple/converter.h     |   6 +-\n src/libcamera/pipeline/simple/simple.cpp      |  17 +-\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |  17 +-\n src/libcamera/pipeline/vimc/vimc.cpp          |  17 +-\n src/libcamera/pipeline_handler.cpp            |   1 +\n src/libcamera/property_ids.yaml               |   8 +\n src/libcamera/stream.cpp                      |   9 +-\n src/qcam/main_window.cpp                      |  11 +-\n src/v4l2/v4l2_camera.cpp                      |  16 +-\n src/v4l2/v4l2_camera.h                        |   5 +-\n src/v4l2/v4l2_camera_proxy.cpp                |   8 +-\n test/camera/buffer_import.cpp                 |  10 +-\n test/camera/capture.cpp                       |   4 +-\n test/camera/statemachine.cpp                  |   4 +-\n test/libtest/buffer_source.cpp                |   4 +-\n test/libtest/buffer_source.h                  |   2 +-\n test/mapped-buffer.cpp                        |   4 +-\n test/v4l2_videodevice/buffer_cache.cpp        |   4 +-\n 39 files changed, 367 insertions(+), 206 deletions(-)"}