Show a patch.

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

{
    "id": 4202,
    "url": "https://patchwork.libcamera.org/api/patches/4202/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4202/",
    "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": "<20200625072844.1146902-1-naush@raspberrypi.com>",
    "date": "2020-06-25T07:28:44",
    "name": "[libcamera-devel,v2] libcamera: pipeline: raspberrypi: Add StreamFormats to StreamConfiguration",
    "commit_ref": "0396380614fb0b77e91d469f5845291910c8f8d5",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ccfd458fc8719c3d55a86fbb4bf80241aa59c80c",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/4202/mbox/",
    "series": [
        {
            "id": 1039,
            "url": "https://patchwork.libcamera.org/api/series/1039/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1039",
            "date": "2020-06-25T07:28:44",
            "name": "[libcamera-devel,v2] libcamera: pipeline: raspberrypi: Add StreamFormats to StreamConfiguration",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/1039/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/4202/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4202/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 E2ACEC0100\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Jun 2020 07:28:54 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 65128609A9;\n\tThu, 25 Jun 2020 09:28:54 +0200 (CEST)",
            "from mail-wm1-x330.google.com (mail-wm1-x330.google.com\n\t[IPv6:2a00:1450:4864:20::330])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0DADF603BE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Jun 2020 09:28:53 +0200 (CEST)",
            "by mail-wm1-x330.google.com with SMTP id f139so4831711wmf.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Jun 2020 00:28:53 -0700 (PDT)",
            "from naushir-VirtualBox.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tb18sm29736184wrn.88.2020.06.25.00.28.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 25 Jun 2020 00:28:51 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"QhtQTuVG\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=/9+07XO5x7i1vQzPIT/M3etTIBR+g5HDmLLXTTzny5g=;\n\tb=QhtQTuVG13amSd3ysYlahcd0GkoVwbD28NakLfTVTUbo5KkuhllCi6H7MK44EXDLKq\n\tWV20iTmslN88qHhyPDRuLip2p1kFEDrc6Xn3do+wU77MXmvizHcnOYvM5hwys0rK8Sk9\n\tNa82ssnV383bvIyvqjc9XFiOpZrYS48yijuHccT5M/bQ0gXtL8+WWT7mQnU71s0dIlif\n\tzGdorKDtIOc4lTjq+5RP2/BmvOipQRxBSWeVpsn8hDljfZ17nsAEh/NP1M1092YhpL3U\n\tQ4SXrrMbPBsjYf7YP+wdJmB5U9b7Bd76e1T26UzUt7ytTOA0X7yhyeW67aY4xj7DkuTp\n\t1UIg==",
        "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=/9+07XO5x7i1vQzPIT/M3etTIBR+g5HDmLLXTTzny5g=;\n\tb=O4KqLxdQd7tFa5Eqdq2rR+Usdg74XkPkdn/KWo4VP3MC27zneD+XL2exB8H7hDlr0x\n\tiojEUi8mEyccnqKUfcBrnGDqjLbmuAXPIMNZ8l1yMxNPeVXVnlyqnGNwjbQ3057GlKHj\n\tH/9uyLylX9ixVMOTSbgqPHsJsZivE5MromoXapwNDK57/6DQ4kTHaJsqC9fw23wpkAup\n\tqGyRDorUikrwTsylrjJrwAzom1aIUokL9LeI472HCr/reF3iZUjoahbCy7NllSaCrK/2\n\tO/RrPOGX6avv8H44q5tkN/zu1v1M50mV5/vI4hv+qOr0yhClEAqwgt0SBK7XhVHuuAQ2\n\taXLw==",
        "X-Gm-Message-State": "AOAM533j4rWpuIsOvJEQHG4I2R8seVWis2O3xYJ0DraRFf6JD5TWblDR\n\tmpSHHF6cOUjxdC64Vf2NvTMhx5oyIyk=",
        "X-Google-Smtp-Source": "ABdhPJwOwlnlfeDtzNLJ99SH94bUtWU1WkEMT+0YaHD8/8wJtqyK4xhlLpsTpYjN/jj0Zcg1Eo/I0A==",
        "X-Received": "by 2002:a1c:2349:: with SMTP id j70mr1841084wmj.22.1593070132418;\n\tThu, 25 Jun 2020 00:28:52 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 25 Jun 2020 08:28:44 +0100",
        "Message-Id": "<20200625072844.1146902-1-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v2] libcamera: pipeline: raspberrypi: Add\n\tStreamFormats to StreamConfiguration",
        "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": "In generateConfiguration(), add the device node specific formats to the\nStreamConfiguration for each StreamRole requested.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 52 +++++++++++++------\n 1 file changed, 36 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 60985b71..dcd737a1 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -518,41 +518,45 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n \tRPiCameraData *data = cameraData(camera);\n \tCameraConfiguration *config = new RPiCameraConfiguration(data);\n \tV4L2DeviceFormat sensorFormat;\n+\tunsigned int bufferCount;\n+\tPixelFormat pixelFormat;\n \tV4L2PixFmtMap fmts;\n+\tSize size;\n \n \tif (roles.empty())\n \t\treturn config;\n \n \tfor (const StreamRole role : roles) {\n-\t\tStreamConfiguration cfg{};\n-\n \t\tswitch (role) {\n \t\tcase StreamRole::StillCaptureRaw:\n-\t\t\tcfg.size = data->sensor_->resolution();\n+\t\t\tsize = data->sensor_->resolution();\n \t\t\tfmts = data->unicam_[Unicam::Image].dev()->formats();\n-\t\t\tsensorFormat = findBestMode(fmts, cfg.size);\n-\t\t\tcfg.pixelFormat = sensorFormat.fourcc.toPixelFormat();\n-\t\t\tASSERT(cfg.pixelFormat.isValid());\n-\t\t\tcfg.bufferCount = 1;\n+\t\t\tsensorFormat = findBestMode(fmts, size);\n+\t\t\tpixelFormat = sensorFormat.fourcc.toPixelFormat();\n+\t\t\tASSERT(pixelFormat.isValid());\n+\t\t\tbufferCount = 1;\n \t\t\tbreak;\n \n \t\tcase StreamRole::StillCapture:\n-\t\t\tcfg.pixelFormat = formats::NV12;\n+\t\t\tfmts = data->isp_[Isp::Output0].dev()->formats();\n+\t\t\tpixelFormat = formats::NV12;\n \t\t\t/* Return the largest sensor resolution. */\n-\t\t\tcfg.size = data->sensor_->resolution();\n-\t\t\tcfg.bufferCount = 1;\n+\t\t\tsize = data->sensor_->resolution();\n+\t\t\tbufferCount = 1;\n \t\t\tbreak;\n \n \t\tcase StreamRole::VideoRecording:\n-\t\t\tcfg.pixelFormat = formats::NV12;\n-\t\t\tcfg.size = { 1920, 1080 };\n-\t\t\tcfg.bufferCount = 4;\n+\t\t\tfmts = data->isp_[Isp::Output0].dev()->formats();\n+\t\t\tpixelFormat = formats::NV12;\n+\t\t\tsize = { 1920, 1080 };\n+\t\t\tbufferCount = 4;\n \t\t\tbreak;\n \n \t\tcase StreamRole::Viewfinder:\n-\t\t\tcfg.pixelFormat = formats::ARGB8888;\n-\t\t\tcfg.size = { 800, 600 };\n-\t\t\tcfg.bufferCount = 4;\n+\t\t\tfmts = data->isp_[Isp::Output0].dev()->formats();\n+\t\t\tpixelFormat = formats::ARGB8888;\n+\t\t\tsize = { 800, 600 };\n+\t\t\tbufferCount = 4;\n \t\t\tbreak;\n \n \t\tdefault:\n@@ -561,6 +565,22 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera,\n \t\t\tbreak;\n \t\t}\n \n+\t\t/* Translate the V4L2PixelFormat to PixelFormat. */\n+\t\tstd::map<PixelFormat, std::vector<SizeRange>> deviceFormats;\n+\t\tstd::transform(fmts.begin(), fmts.end(), std::inserter(deviceFormats, deviceFormats.end()),\n+\t\t\t       [&](const decltype(fmts)::value_type &format) {\n+\t\t\t\t\treturn decltype(deviceFormats)::value_type{\n+\t\t\t\t\t\tformat.first.toPixelFormat(),\n+\t\t\t\t\t\tformat.second\n+\t\t\t\t\t};\n+\t\t\t       });\n+\n+\t\t/* Add the stream format based on the device node used for the use case. */\n+\t\tStreamFormats formats(deviceFormats);\n+\t\tStreamConfiguration cfg(formats);\n+\t\tcfg.size = size;\n+\t\tcfg.pixelFormat = pixelFormat;\n+\t\tcfg.bufferCount = bufferCount;\n \t\tconfig->addConfiguration(cfg);\n \t}\n \n",
    "prefixes": [
        "libcamera-devel",
        "v2"
    ]
}