{"id":11036,"url":"https://patchwork.libcamera.org/api/patches/11036/?format=json","web_url":"https://patchwork.libcamera.org/patch/11036/","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":"<20210128090454.515268-1-jacopo@jmondi.org>","date":"2021-01-28T09:04:54","name":"[libcamera-devel] libcamera: Improve Request life cycle tracking","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"a4e7d8fff066274c6784f4fa6fe719fd0b27c145","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11036/mbox/","series":[{"id":1618,"url":"https://patchwork.libcamera.org/api/series/1618/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1618","date":"2021-01-28T09:04:54","name":"[libcamera-devel] libcamera: Improve Request life cycle tracking","version":1,"mbox":"https://patchwork.libcamera.org/series/1618/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11036/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11036/checks/","tags":{},"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 BE443C33BB\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 28 Jan 2021 09:04:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4583A6837C;\n\tThu, 28 Jan 2021 10:04:43 +0100 (CET)","from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C27896030A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Jan 2021 10:04:41 +0100 (CET)","from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay10.mail.gandi.net (Postfix) with ESMTPSA id 8E410240003\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Jan 2021 09:04:41 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 28 Jan 2021 10:04:54 +0100","Message-Id":"<20210128090454.515268-1-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.30.0","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH] libcamera: Improve Request life cycle\n\ttracking","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The current logging to track the status of a Request when running the\nAndroid camera HAL provide the following information:\n\nWhen a Request is queued to libcamera:\nHAL camera_device.cpp:1776 '\\_SB_.PCI0.I2C2.CAM0': Queueing Request to libcamera with 1 HAL streams\n\nWhen a Request completes:\nRequest request.cpp:268 Request has completed - cookie: 138508601719648\n\nThe queueing of a Request reports the number of streams it contains\nwhile the completion of a Request reports the address of the associated\ncookie.\n\nThis makes very hard to keep track of what Requests have completed, as\nthe logging associated with a queue/complete event does not allow to identify\na Request easily.\n\nAdd two more printouts to make it easier to track a Request life cycle.\n\nThe result looks like the following trace:\n\nRequest request.cpp:92 Created request - cookie: 138508601718368\nHAL camera_device.cpp:1776 '\\_SB_.PCI0.I2C2.CAM0': Queueing Request to libcamera with 1 HAL streams\nHAL camera_device.cpp:1813 '\\_SB_.PCI0.I2C2.CAM0': 0 - (640x480)[0x00000022] -> (640x480)[NV12] (direct)\n...\n...\nRequest request.cpp:268 Request has completed - cookie: 138508601718368\nHAL camera_device.cpp:1866 '\\_SB_.PCI0.I2C2.CAM0': Request completed by libcamera with 1 streams\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 3 +++\n src/libcamera/request.cpp     | 2 ++\n 2 files changed, 5 insertions(+)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex a9634f4e4198..513f000b1854 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1863,6 +1863,9 @@ void CameraDevice::requestComplete(Request *request)\n \t\tstatus = CAMERA3_BUFFER_STATUS_ERROR;\n \t}\n \n+\tLOG(HAL, Debug) << \"Request completed by libcamera with \"\n+\t\t\t<< descriptor->numBuffers_ << \" streams\";\n+\n \t/*\n \t * \\todo The timestamp used for the metadata is currently always taken\n \t * from the first buffer (which may be the first stream) in the Request.\ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex a68684ef9fd3..e561ce1d5d0e 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -88,6 +88,8 @@ Request::Request(Camera *camera, uint64_t cookie)\n \tmetadata_ = new ControlList(controls::controls);\n \n \tLIBCAMERA_TRACEPOINT(request_construct, this);\n+\n+\tLOG(Request, Debug) << \"Created request - cookie: \" << cookie_;\n }\n \n Request::~Request()\n","prefixes":["libcamera-devel"]}