{"id":12522,"url":"https://patchwork.libcamera.org/api/covers/12522/?format=json","web_url":"https://patchwork.libcamera.org/cover/12522/","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":"<20210608151633.73465-1-jacopo@jmondi.org>","date":"2021-06-08T15:16:25","name":"[libcamera-devel,v5,0/8] Implement flush() camera operation","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/cover/12522/mbox/","series":[{"id":2112,"url":"https://patchwork.libcamera.org/api/series/2112/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2112","date":"2021-06-08T15:16:25","name":"Implement flush() camera operation","version":5,"mbox":"https://patchwork.libcamera.org/series/2112/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/12522/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 E09ACC3206\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Jun 2021 15:15:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 571116892E;\n\tTue,  8 Jun 2021 17:15:48 +0200 (CEST)","from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AFF37602A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Jun 2021 17:15:47 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 16F886001B;\n\tTue,  8 Jun 2021 15:15:46 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  8 Jun 2021 17:16:25 +0200","Message-Id":"<20210608151633.73465-1-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.31.1","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 0/8] Implement flush() camera operation","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Implement the flush() camera operation in Android CameraDevice class.\n\nTo get to a successfull implementation of flush() a bit of preparatory work is\nrequired as currently Requests that fails to queue to the pipeline handler are\nnot returned to the application. Add Request::cancel() and call it in the\nPipelineHandler base class when calling queueRequestDevice() fails to allow\napplication to keep track of the queued requests.\n\nOn top of that, prepare the CameraDevice to support flush with a few clean-up\npatches, then implement the operation.\n\nTested with CTS in LIMITED mode\n\n- No subplan\n\n\t=============== Summary ===============\n\tTotal Run time: 22m 22s\n\t1/1 modules completed\n\tTotal Tests       : 253\n\tPASSED            : 233\n\tFAILED            : 20\n\t============== End of Results ==============\n\n\tandroid.hardware.camera2.cts.ImageReaderTest#testAllOutputYUVResolutions\n\tandroid.hardware.camera2.cts.ImageReaderTest#testRawPrivate\n\tandroid.hardware.camera2.cts.ImageReaderTest#testRepeatingRawPrivate\n\tandroid.hardware.camera2.cts.RobustnessTest#testMandatoryOutputCombinations\n\tandroid.hardware.camera2.cts.StillCaptureTest#testStillPreviewCombination\n\tandroid.hardware.camera2.cts.SurfaceViewPreviewTest#testDeferredSurfaces\n\tandroid.hardware.cts.CameraGLTest#testSetPreviewTextureBothCallbacks\n\tandroid.hardware.cts.CameraGLTest#testSetPreviewTexturePreviewCallback\n\tandroid.hardware.cts.CameraTest#testFocusDistances\n\tandroid.hardware.cts.CameraTest#testImmediateZoom\n\tandroid.hardware.cts.CameraTest#testPreviewCallback\n\tandroid.hardware.cts.CameraTest#testPreviewCallbackWithBuffer\n\tandroid.hardware.cts.CameraTest#testPreviewCallbackWithPicture\n\tandroid.hardware.cts.CameraTest#testPreviewFormats\n\tandroid.hardware.cts.CameraTest#testPreviewFpsRange\n\tandroid.hardware.cts.CameraTest#testPreviewPictureSizesCombination\n\tandroid.hardware.cts.CameraTest#testSetOneShotPreviewCallback\n\tandroid.hardware.cts.CameraTest#testSetPreviewDisplay\n\tandroid.hardware.cts.CameraTest#testVideoSnapshot\n\tandroid.hardware.multiprocess.camera.cts.CameraEvictionTest#testMediaRecorderCameraActivityEviction\n\n- libcamera subplan\n\n\t=============== Summary ===============\n\tTotal Run time: 17m 26s\n\t1/1 modules completed\n\tTotal Tests       : 231\n\tPASSED            : 230\n\tFAILED            : 1\n\t============== End of Results ==============\n\n\tandroid.hardware.camera2.cts.RecordingTest#testVideoSnapshot\n\nTested with cros_camera_test:\n\n   # cros_camera_test --gtest_filter=\"Camera3FrameTest/Camera3FlushRequestsTest*\"\n   [==========] 12 tests from 1 test suite ran. (1380 ms total)\n   [  PASSED  ] 12 tests.\n\nThanks\n  j\n\nv4->v5:\n - [1/8] Rebasing on metadata auto-resize caused a segfault when the camera\n         metadata pack has to be relocated: fix this by assigning the\n         capture result metadata pack after the JPEG encoding\n - [8/8] Drop the first check in process capture request: the camera start and\n         flushing state check is only performed before queueing the request\n\nv3->v4:\n - [1/8] Set stream to nullptr when the error code does not require it\n - [1/8] Drop a useless error message\n - [2/8] Take in style suggestion from Laurent\n - [4/8] Use enum class CameraDevice::State\n - [8/8] Reimplement flush assuming it only races with processCaptureRequest\n\nv2->v3:\n - Request::cancel():\n   - Add tracepoint in request.tp\n   - Emitt Camera::bufferCompleted signal for each cancelled buffer\n   - Do not complete the Request\n\n - PipelineHandler\n   - Do not emit Camera::bufferCompleted as Request::cancel() does so\n   - Do not complete the request immediately but call\n     PipelineHandler::completeRequest()\n\n - Flush\n   - Use CameraMutex_ in place of FlushMutex_ to wait on the flushed_ condition\n     as suggested by Hiro. This guarantees that any access to the camera state\n     is protected by the same mutex and code is simplified.\n   - Assert that stop() does not get called while flushing as suggested by Hiro.\n\nv1->v2:\n - The majority of patches in the series have not been changed if not for\n   collecting tags. However 8/8 which implement the actual flush() has been\n   changed to address Hiro's comment about protecting close() and\n   configureStreams() from being concurrently run with flush().\n\n   - 8/8:\n     - Introduce a new flushed_ condition variable to be used by close() and\n       configureStreams() to be unlocked when flushing has terminated.\n\n\nJacopo Mondi (8):\n  android: Rework request completion notification\n  libcamera: request: Add Request::cancel()\n  libcamera: pipeline_handler: Cancel Request on queueing failure\n  android: camera_device: Replace running_ with CameraState\n  android: Replace scoped_lock<> with libcamera::MutexLocker\n  android: Guard access to the camera state\n  android: Rename CameraDevice::mutex_\n  android: Implement flush() camera operation\n\n .../libcamera/internal/tracepoints/request.tp |   8 +\n include/libcamera/request.h                   |   1 +\n src/android/camera_device.cpp                 | 217 ++++++++++++------\n src/android/camera_device.h                   |  18 +-\n src/android/camera_ops.cpp                    |   8 +-\n src/libcamera/pipeline_handler.cpp            |   8 +-\n src/libcamera/request.cpp                     |  23 ++\n 7 files changed, 205 insertions(+), 78 deletions(-)\n\n--\n2.31.1"}