Patch Detail
Show a patch.
GET /api/patches/13580/?format=api
{ "id": 13580, "url": "https://patchwork.libcamera.org/api/patches/13580/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13580/", "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": "<20210831093439.853586-2-hiroh@chromium.org>", "date": "2021-08-31T09:34:37", "name": "[libcamera-devel,v3,1/3] android: camera_stream: Create post processor in configure()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "98e3d47099b25c45309d73bc55922e23b58cfccf", "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/13580/mbox/", "series": [ { "id": 2427, "url": "https://patchwork.libcamera.org/api/series/2427/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2427", "date": "2021-08-31T09:34:36", "name": "android: Request one stream for identica stream requests", "version": 3, "mbox": "https://patchwork.libcamera.org/series/2427/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13580/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13580/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 F2A50BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 31 Aug 2021 09:34:49 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B180F6916A;\n\tTue, 31 Aug 2021 11:34:49 +0200 (CEST)", "from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com\n\t[IPv6:2607:f8b0:4864:20::62c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B24C669169\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 31 Aug 2021 11:34:47 +0200 (CEST)", "by mail-pl1-x62c.google.com with SMTP id n18so854727plp.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 31 Aug 2021 02:34:47 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:3c62:aba4:18ea:5441])\n\tby smtp.gmail.com with ESMTPSA id\n\tw5sm19787885pgp.79.2021.08.31.02.34.44\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 31 Aug 2021 02:34:45 -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=\"NWg7rXbj\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=57tKIuEBA859JTYpRptWPWiS7SHHF7e4yXerawVnHqA=;\n\tb=NWg7rXbjEANHITLJjr8qnE4XyQf6ieq4ROBMh2dv7n1UfUKZbYNpSLs2Lfhj5bjVvI\n\t77bfcPlZCjZoDU8BOm2nxt4/e24tx0PLQhI2s5AH1V0AM4Omk8Jcg8b8zPeEL1udtG/p\n\tsQ2BuvlyhgSMcqVG3shK+h6XIe5GGIqsxuIaQ=", "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:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=57tKIuEBA859JTYpRptWPWiS7SHHF7e4yXerawVnHqA=;\n\tb=dX+tP5OzRojYwbg0Tqal4fx0pMPgyNzdlItK/RlUxu1+NLpTp8hBDrPMNIpTUbpFOh\n\tJPm9m6d2Xi/TO2jxd3rdXPdhNN/Pa5lv2eHfCnz6G5wtEXteOF1NX9PZEvDSRm6oFKPn\n\tpRk+BfAc+v+qXZPfYXSi/OoBdx0wZg6uh/RY7SxU5+EP3BX0NIhmE0LoVjJwWH+L8PLw\n\tE1vHKGmuX09m2zL+krVzkE1p74kDO2bQX+d8c6CAepYFDEx8rbrfCdqFXJh5RDKbQ49L\n\tcErgIxf9kEftyiJqnZ9dfgoPRTlSa1r2dPBI9ZzdUFnMTlNgEM4RYsHEdrQ3rGPm32a/\n\tv5vQ==", "X-Gm-Message-State": "AOAM530tcrslxkssvEcn325LvO/HB2gI1NQDiWrGkEMTv/nYS5KFNntf\n\t6u0wJU5B/OnTB7a1dd+EpkxNblGBUOn6cA==", "X-Google-Smtp-Source": "ABdhPJxhERb7uSugtlfnAb6e/PRq43PJjcw/vZq0RgVgmYCO9SzuP7ZH5UVI1rLiG9IcHTh4erKa/A==", "X-Received": "by 2002:a17:90a:b390:: with SMTP id\n\te16mr4436101pjr.49.1630402486040; \n\tTue, 31 Aug 2021 02:34:46 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 31 Aug 2021 18:34:37 +0900", "Message-Id": "<20210831093439.853586-2-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.33.0.259.gc128427fd7-goog", "In-Reply-To": "<20210831093439.853586-1-hiroh@chromium.org>", "References": "<20210831093439.853586-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 1/3] android: camera_stream: Create\n\tpost processor in configure()", "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": "CameraStream creates PostProcessor and FrameBufferAllocator in\nthe constructor. CameraStream assumes that a used post processor\nis JPEG post processor. Since we need to support various post\nprocessors, we would rather move the creation to configure() so\nas to return an error code if no proper post processor is found.\nThis also moves FrameBufferAllocator and Mutex creation for\nconsistency.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.h | 1 +\n src/android/camera_stream.cpp | 36 ++++++++++++++++++-----------------\n 2 files changed, 20 insertions(+), 17 deletions(-)", "diff": "diff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex a5576927..296c2f18 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -48,6 +48,7 @@ public:\n \n \tunsigned int id() const { return id_; }\n \tcamera3_device_t *camera3Device() { return &camera3Device_; }\n+\tconst CameraCapabilities *capabilities() const { return &capabilities_; }\n \tconst std::shared_ptr<libcamera::Camera> &camera() const { return camera_; }\n \n \tconst std::string &maker() const { return maker_; }\ndiff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\nindex 01909ec7..fb10bf06 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -10,6 +10,7 @@\n #include <sys/mman.h>\n \n #include \"camera_buffer.h\"\n+#include \"camera_capabilities.h\"\n #include \"camera_device.h\"\n #include \"camera_metadata.h\"\n #include \"jpeg/post_processor_jpeg.h\"\n@@ -47,20 +48,6 @@ CameraStream::CameraStream(CameraDevice *const cameraDevice,\n \t: cameraDevice_(cameraDevice), config_(config), type_(type),\n \t camera3Stream_(camera3Stream), index_(index)\n {\n-\tif (type_ == Type::Internal || type_ == Type::Mapped) {\n-\t\t/*\n-\t\t * \\todo There might be multiple post-processors. The logic\n-\t\t * which should be instantiated here, is deferred for the\n-\t\t * future. For now, we only have PostProcessorJpeg and that\n-\t\t * is what we instantiate here.\n-\t\t */\n-\t\tpostProcessor_ = std::make_unique<PostProcessorJpeg>(cameraDevice_);\n-\t}\n-\n-\tif (type == Type::Internal) {\n-\t\tallocator_ = std::make_unique<FrameBufferAllocator>(cameraDevice_->camera());\n-\t\tmutex_ = std::make_unique<std::mutex>();\n-\t}\n }\n \n const StreamConfiguration &CameraStream::configuration() const\n@@ -75,15 +62,30 @@ Stream *CameraStream::stream() const\n \n int CameraStream::configure()\n {\n-\tif (postProcessor_) {\n+\tif (type_ == Type::Internal || type_ == Type::Mapped) {\n+\t\tconst PixelFormat outFormat =\n+\t\t\tcameraDevice_->capabilities()->toPixelFormat(camera3Stream_->format);\n \t\tStreamConfiguration output = configuration();\n-\t\toutput.pixelFormat = formats::MJPEG;\n+\t\toutput.pixelFormat = outFormat;\n+\t\tswitch (outFormat) {\n+\t\tcase formats::MJPEG:\n+\t\t\tpostProcessor_ = std::make_unique<PostProcessorJpeg>(cameraDevice_);\n+\t\t\tbreak;\n+\n+\t\tdefault:\n+\t\t\tLOG(HAL, Error) << \"Unsupported format: \" << outFormat;\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n \t\tint ret = postProcessor_->configure(configuration(), output);\n \t\tif (ret)\n \t\t\treturn ret;\n \t}\n \n-\tif (allocator_) {\n+\tif (type_ == Type::Internal) {\n+\t\tallocator_ = std::make_unique<FrameBufferAllocator>(cameraDevice_->camera());\n+\t\tmutex_ = std::make_unique<std::mutex>();\n+\n \t\tint ret = allocator_->allocate(stream());\n \t\tif (ret < 0)\n \t\t\treturn ret;\n", "prefixes": [ "libcamera-devel", "v3", "1/3" ] }