Patch Detail
Show a patch.
GET /api/patches/12108/?format=api
{ "id": 12108, "url": "https://patchwork.libcamera.org/api/patches/12108/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12108/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210426034502.2270770-1-hiroh@chromium.org>", "date": "2021-04-26T03:45:02", "name": "[libcamera-devel] android: CameraDevice: factorize generating a capture result", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "cc0497b2bd6398f3bba0162c0ff7f4802b35d8b0", "submitter": { "id": 63, "url": "https://patchwork.libcamera.org/api/people/63/?format=api", "name": "Hirokazu Honda", "email": "hiroh@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/12108/mbox/", "series": [ { "id": 1975, "url": "https://patchwork.libcamera.org/api/series/1975/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1975", "date": "2021-04-26T03:45:02", "name": "[libcamera-devel] android: CameraDevice: factorize generating a capture result", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1975/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12108/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12108/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 1CF80BDC92\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 26 Apr 2021 03:45:11 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6F7EB6889F;\n\tMon, 26 Apr 2021 05:45:10 +0200 (CEST)", "from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com\n\t[IPv6:2607:f8b0:4864:20::1033])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4BB0F68883\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Apr 2021 05:45:09 +0200 (CEST)", "by mail-pj1-x1033.google.com with SMTP id s14so21337828pjl.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 25 Apr 2021 20:45:09 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:56d0:a14c:fac3:5bc3])\n\tby smtp.gmail.com with ESMTPSA id\n\ty18sm9671479pfp.121.2021.04.25.20.45.06\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 25 Apr 2021 20:45:07 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"BArLKbw8\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=5NAMTi6DGK+JAjbXjVACPKoYoNIfdbfagRJcw748ezQ=;\n\tb=BArLKbw8cdT5/0pPaMiyWyTVXpgLVyRcC6J20QlRNRL0jCFrvjI7Iv9YDfa2GCSzCW\n\tpuGyQMruJl/CXC7oCCkUtVWfza5HfvCBrBgUoRU4vbAvFnqVsG4rj5AxBBni3PJzUn4m\n\t0cTppH2lvyks6EYsZWvVoCQ5sHvx1/twl67So=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=5NAMTi6DGK+JAjbXjVACPKoYoNIfdbfagRJcw748ezQ=;\n\tb=asgnuoTWIBfreFe1Ufb0YK5iUxBlPW6F7ybdz5DtChEuN/QKb3TaHCHPYOlY4XzvLS\n\tGT1KnSdRqJIU5EqwIVnxsVMWTH5FBMKawUZRdktnkJyjSoFMckKYYNyS4PXF53Ucg2iU\n\tGyy8wlXRsH0M3MTbeShv6zvSb7xB8+Sk4f/2VWl1P5xmYPWOCnRvT27lnfKNqz7+OXDw\n\tccwEQ7D6VSpEtzYBkCI5pShEA7hrZNposYV3/W+KFqdDSwrHo+wIa2ZI3hQ12c3GMSkd\n\ta40SFasZakAS5EpdR3PQj/eb1u4Wajzx6qT44G3gP55XuDnCdCUPcvy/DbsPhdevMmv2\n\taIzg==", "X-Gm-Message-State": "AOAM5319cbPwfid4RDfTjIoXLmr+FmUZlxMjdBcWDxDyHtRlfjKRhvQt\n\toqmoDT8VIUpWHCm23eoMHdC+fTtDU1lVQw==", "X-Google-Smtp-Source": "ABdhPJxebpMnsqy99Wd0M42xsRfBy+FRhe9kEtvoGFkODyB7YP6GXFgYZYiNYgGcRKg05oz9Gb4Zvg==", "X-Received": "by 2002:a17:90a:66cb:: with SMTP id\n\tz11mr19304066pjl.15.1619408707753; \n\tSun, 25 Apr 2021 20:45:07 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 26 Apr 2021 12:45:02 +0900", "Message-Id": "<20210426034502.2270770-1-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.31.1.498.g6c1eba8ee3d-goog", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH] android: CameraDevice: factorize\n\tgenerating a capture result", "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": "This factorizes a code of generating camera3_capture_result. It\nwill be useful to report capture result in other places than\nCameraDevice::reqeustComplete().\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n\n---\nI was going to implement\nreportShutter() - createCaptureResult() + notifyShutter(), and\nreportError() - createCaptureResult() + notifyError().\n\nBut reportError() can be called after reportShutter(). It is a\nbit less efficient to create capture result twice in the case.\nSo I only factorize a code of generating a capture result.\n\n---\n src/android/camera_device.cpp | 29 ++++++++++++++++++++---------\n src/android/camera_device.h | 3 +++\n 2 files changed, 23 insertions(+), 9 deletions(-)\n\n--\n2.31.1.498.g6c1eba8ee3d-goog", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex a71aee2f..ced8efcc 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -2094,15 +2094,8 @@ void CameraDevice::requestComplete(Request *request)\n \t}\n\n \t/* Prepare to call back the Android camera stack. */\n-\tcamera3_capture_result_t captureResult = {};\n-\tcaptureResult.frame_number = descriptor.frameNumber_;\n-\tcaptureResult.num_output_buffers = descriptor.buffers_.size();\n-\tfor (camera3_stream_buffer_t &buffer : descriptor.buffers_) {\n-\t\tbuffer.acquire_fence = -1;\n-\t\tbuffer.release_fence = -1;\n-\t\tbuffer.status = status;\n-\t}\n-\tcaptureResult.output_buffers = descriptor.buffers_.data();\n+\tcamera3_capture_result_t captureResult =\n+\t\tcreateCaptureResult(descriptor, status);\n\n \tif (status == CAMERA3_BUFFER_STATUS_OK) {\n \t\tnotifyShutter(descriptor.frameNumber_, timestamp);\n@@ -2130,6 +2123,24 @@ std::string CameraDevice::logPrefix() const\n \treturn \"'\" + camera_->id() + \"'\";\n }\n\n+\n+camera3_capture_result_t CameraDevice::createCaptureResult(\n+\tCamera3RequestDescriptor &descriptor,\n+\tcamera3_buffer_status status) const\n+{\n+\tcamera3_capture_result_t captureResult = {};\n+\tcaptureResult.frame_number = descriptor.frameNumber_;\n+\tcaptureResult.num_output_buffers = descriptor.buffers_.size();\n+\tfor (camera3_stream_buffer_t &buffer : descriptor.buffers_) {\n+\t\tbuffer.acquire_fence = -1;\n+\t\tbuffer.release_fence = -1;\n+\t\tbuffer.status = status;\n+\t}\n+\tcaptureResult.output_buffers = descriptor.buffers_.data();\n+\n+\treturn captureResult;\n+}\n+\n void CameraDevice::notifyShutter(uint32_t frameNumber, uint64_t timestamp)\n {\n \tcamera3_notify_msg_t notify = {};\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex c63e8e21..a1abcead 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -100,6 +100,9 @@ private:\n\n \tstd::tuple<uint32_t, uint32_t> calculateStaticMetadataSize();\n \tlibcamera::FrameBuffer *createFrameBuffer(const buffer_handle_t camera3buffer);\n+\tcamera3_capture_result_t createCaptureResult(\n+\t\tCamera3RequestDescriptor &descriptor,\n+\t\tcamera3_buffer_status status) const;\n \tvoid notifyShutter(uint32_t frameNumber, uint64_t timestamp);\n \tvoid notifyError(uint32_t frameNumber, camera3_stream_t *stream);\n \tstd::unique_ptr<CameraMetadata> requestTemplatePreview();\n", "prefixes": [ "libcamera-devel" ] }