Show a patch.

GET /api/patches/9957/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 9957,
    "url": "https://patchwork.libcamera.org/api/patches/9957/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/9957/",
    "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": "<20201005104649.10812-11-laurent.pinchart@ideasonboard.com>",
    "date": "2020-10-05T10:46:44",
    "name": "[libcamera-devel,10/15] android: camera_stream: Allocate FrameBuffers",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": false,
    "hash": "4f855a2ec3a576f6f7c5715e69c7bc20e7863b40",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": {
        "id": 14,
        "url": "https://patchwork.libcamera.org/api/users/14/?format=api",
        "username": "pinchartl",
        "first_name": "Laurent",
        "last_name": "Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/9957/mbox/",
    "series": [
        {
            "id": 1349,
            "url": "https://patchwork.libcamera.org/api/series/1349/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1349",
            "date": "2020-10-05T10:46:34",
            "name": "CameraStream refactoring",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1349/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/9957/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/9957/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 0225BC3B5D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Oct 2020 10:47:43 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C1D4F63C13;\n\tMon,  5 Oct 2020 12:47:42 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 939F563C46\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Oct 2020 12:47:37 +0200 (CEST)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 148933B;\n\tMon,  5 Oct 2020 12:47:37 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"QYATGk3v\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1601894857;\n\tbh=d1I5ZDd1nX8LDOlGDOtqicY+AgyoAH2vn8nTc0v75wE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=QYATGk3v6ETo5ARRyXwwbL+/1+3xkb5il3WorZsVxvzs4S6HIKMNVPj4/XtCch9ow\n\tTvUanfA0pmUfVsHGpBI9j5az7qcYTvIY4inYkQMekMahk0MoGdhCMnnJ39b0Wv+hZB\n\tToJXPTz8eKXjyGKsEi8Vu3NrNr5zVyN+0cGu/nbA=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon,  5 Oct 2020 13:46:44 +0300",
        "Message-Id": "<20201005104649.10812-11-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20201005104649.10812-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20201005104649.10812-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 10/15] android: camera_stream: Allocate\n\tFrameBuffers",
        "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": "From: Jacopo Mondi <jacopo@jmondi.org>\n\nAllocate FrameBuffers using the allocator_ class member in the\nCameraStream class at CameraStream::configure() time.\n\nAs FrameBuffer allocation can only happen after the Camera has been\ncorrectly configured, move the CameraStream configuration loop\nafter the Camera::configure() call in CameraDevice.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 22 +++++++++++-----------\n src/android/camera_stream.cpp | 17 +++++++++++++++--\n src/android/camera_stream.h   |  2 ++\n 3 files changed, 28 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex adaec54dbfdb..537883b63f15 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1282,6 +1282,17 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\treturn -EINVAL;\n \t}\n \n+\t/*\n+\t * Once the CameraConfiguration has been adjusted/validated\n+\t * it can be applied to the camera.\n+\t */\n+\tint ret = camera_->configure(config_.get());\n+\tif (ret) {\n+\t\tLOG(HAL, Error) << \"Failed to configure camera '\"\n+\t\t\t\t<< camera_->id() << \"'\";\n+\t\treturn ret;\n+\t}\n+\n \t/*\n \t * Configure the HAL CameraStream instances using the associated\n \t * StreamConfiguration and set the number of required buffers in\n@@ -1300,17 +1311,6 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\tstream->max_buffers = cfg.bufferCount;\n \t}\n \n-\t/*\n-\t * Once the CameraConfiguration has been adjusted/validated\n-\t * it can be applied to the camera.\n-\t */\n-\tint ret = camera_->configure(config_.get());\n-\tif (ret) {\n-\t\tLOG(HAL, Error) << \"Failed to configure camera '\"\n-\t\t\t\t<< camera_->id() << \"'\";\n-\t\treturn ret;\n-\t}\n-\n \treturn 0;\n }\n \ndiff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\nindex 9f3e7026b1a4..76e7d240f4e7 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -58,8 +58,21 @@ const Size &CameraStream::size() const\n \n int CameraStream::configure(const libcamera::StreamConfiguration &cfg)\n {\n-\tif (encoder_)\n-\t\treturn encoder_->configure(cfg);\n+\tif (encoder_) {\n+\t\tint ret = encoder_->configure(cfg);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n+\tif (allocator_) {\n+\t\tint ret = allocator_->allocate(stream());\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\n+\t\t/* Save a pointer to the reserved frame buffers */\n+\t\tfor (const auto &frameBuffer : allocator_->buffers(stream()))\n+\t\t\tbuffers_.push_back(frameBuffer.get());\n+\t}\n \n \treturn 0;\n }\ndiff --git a/src/android/camera_stream.h b/src/android/camera_stream.h\nindex eaf4357ed096..e399e17b2a2f 100644\n--- a/src/android/camera_stream.h\n+++ b/src/android/camera_stream.h\n@@ -8,6 +8,7 @@\n #define __ANDROID_CAMERA_STREAM_H__\n \n #include <memory>\n+#include <vector>\n \n #include <hardware/camera3.h>\n \n@@ -140,6 +141,7 @@ private:\n \tlibcamera::CameraConfiguration *config_;\n \tEncoder *encoder_;\n \tlibcamera::FrameBufferAllocator *allocator_;\n+\tstd::vector<libcamera::FrameBuffer *> buffers_;\n };\n \n #endif /* __ANDROID_CAMERA_STREAM__ */\n",
    "prefixes": [
        "libcamera-devel",
        "10/15"
    ]
}