Show a patch.

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

{
    "id": 1067,
    "url": "https://patchwork.libcamera.org/api/patches/1067/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1067/",
    "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": "<20190418164638.400-3-jacopo@jmondi.org>",
    "date": "2019-04-18T16:46:34",
    "name": "[libcamera-devel,v6,2/6] libcamera: ipu3: Use roles in stream configuration",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "24701bfd275256b0d7dc984645ed0cd70a6c2f2e",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/1067/mbox/",
    "series": [
        {
            "id": 259,
            "url": "https://patchwork.libcamera.org/api/series/259/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=259",
            "date": "2019-04-18T16:46:32",
            "name": "libcamera: ipu3: Multiple streams support",
            "version": 6,
            "mbox": "https://patchwork.libcamera.org/series/259/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1067/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1067/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4F18E60DC0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Apr 2019 18:45:53 +0200 (CEST)",
            "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id D732D1C0005;\n\tThu, 18 Apr 2019 16:45:52 +0000 (UTC)"
        ],
        "X-Originating-IP": "2.224.242.101",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 18 Apr 2019 18:46:34 +0200",
        "Message-Id": "<20190418164638.400-3-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190418164638.400-1-jacopo@jmondi.org>",
        "References": "<20190418164638.400-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v6 2/6] libcamera: ipu3: Use roles in\n\tstream configuration",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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>",
        "X-List-Received-Date": "Thu, 18 Apr 2019 16:45:53 -0000"
    },
    "content": "Use and inspect the stream roles provided by the application to\nstreamConfiguration() to assign streams to their intended roles and\nreturn a default configuration associated with them.\n\nSupport a limited number of usages, as the viewfinder stream can\noptionally be used for capturing still images, but the main output\nstream cannot be used as viewfinder or for video recording purposes.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 99 +++++++++++++++++++---------\n 1 file changed, 69 insertions(+), 30 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex b9eb872fd5b2..8c2504499f33 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -221,38 +221,77 @@ CameraConfiguration\n PipelineHandlerIPU3::streamConfiguration(Camera *camera,\n \t\t\t\t\t const std::vector<StreamUsage> &usages)\n {\n-\tCameraConfiguration configs;\n \tIPU3CameraData *data = cameraData(camera);\n-\tStreamConfiguration config = {};\n+\tCameraConfiguration cameraConfig;\n+\tstd::set<IPU3Stream *> streams = {\n+\t\t&data->outStream_,\n+\t\t&data->vfStream_,\n+\t};\n \n-\t/*\n-\t * FIXME: Soraka: the maximum resolution reported by both sensors\n-\t * (2592x1944 for ov5670 and 4224x3136 for ov13858) are returned as\n-\t * default configurations but they're not correctly processed by the\n-\t * ImgU. Resolutions up tp 2560x1920 have been validated.\n-\t *\n-\t * \\todo Clarify ImgU alignement requirements.\n-\t */\n-\tconfig.width = 2560;\n-\tconfig.height = 1920;\n-\tconfig.pixelFormat = V4L2_PIX_FMT_NV12;\n-\tconfig.bufferCount = IPU3_BUFFER_COUNT;\n-\n-\tconfigs[&data->outStream_] = config;\n-\tLOG(IPU3, Debug)\n-\t\t<< \"Stream '\" << data->outStream_.name_ << \"' set to \"\n-\t\t<< config.width << \"x\" << config.height << \"-0x\"\n-\t\t<< std::hex << std::setfill('0') << std::setw(8)\n-\t\t<< config.pixelFormat;\n-\n-\tconfigs[&data->vfStream_] = config;\n-\tLOG(IPU3, Debug)\n-\t\t<< \"Stream '\" << data->vfStream_.name_ << \"' set to \"\n-\t\t<< config.width << \"x\" << config.height << \"-0x\"\n-\t\t<< std::hex << std::setfill('0') << std::setw(8)\n-\t\t<< config.pixelFormat;\n-\n-\treturn configs;\n+\tfor (const StreamUsage &usage : usages) {\n+\t\tstd::vector<IPU3Stream *>::iterator found;\n+\t\tStreamUsage::Role role = usage.role();\n+\t\tStreamConfiguration streamConfig = {};\n+\t\tIPU3Stream *stream = nullptr;\n+\n+\t\tif (role == StreamUsage::Role::StillCapture) {\n+\t\t\t/*\n+\t\t\t * We can use the viewfinder stream in case the\n+\t\t\t * 'StillCapture' usage is required multiple times.\n+\t\t\t */\n+\t\t\tif (streams.find(&data->outStream_) != streams.end())\n+\t\t\t\tstream = &data->outStream_;\n+\t\t\telse if (streams.find(&data->vfStream_) != streams.end())\n+\t\t\t\tstream = &data->vfStream_;\n+\t\t\telse\n+\t\t\t\tgoto error;\n+\n+\t\t\t/*\n+\t\t\t * FIXME: Soraka: the maximum resolution reported by\n+\t\t\t * both sensors (2592x1944 for ov5670 and 4224x3136 for\n+\t\t\t * ov13858) are returned as default configurations but\n+\t\t\t * they're not correctly processed by the ImgU.\n+\t\t\t * Resolutions up tp 2560x1920 have been validated.\n+\t\t\t *\n+\t\t\t * \\todo Clarify ImgU alignment requirements.\n+\t\t\t */\n+\t\t\tstreamConfig.width = 2560;\n+\t\t\tstreamConfig.height = 1920;\n+\t\t} else if (role == StreamUsage::Role::Viewfinder ||\n+\t\t\t   role == StreamUsage::Role::VideoRecording) {\n+\t\t\t/*\n+\t\t\t * We can't use the 'output' stream for viewfinder or\n+\t\t\t * video capture usages.\n+\t\t\t */\n+\t\t\tif (streams.find(&data->vfStream_) == streams.end())\n+\t\t\t\tgoto error;\n+\n+\t\t\tstream = &data->vfStream_;\n+\n+\t\t\tstreamConfig.width = usage.size().width;\n+\t\t\tstreamConfig.height = usage.size().height;\n+\t\t}\n+\n+\t\tstreams.erase(stream);\n+\n+\t\tstreamConfig.pixelFormat = V4L2_PIX_FMT_NV12;\n+\t\tstreamConfig.bufferCount = IPU3_BUFFER_COUNT;\n+\n+\t\tcameraConfig[stream] = streamConfig;\n+\n+\t\tLOG(IPU3, Debug)\n+\t\t\t<< \"Stream '\" << stream->name_ << \"' format set to \"\n+\t\t\t<< streamConfig.width << \"x\" << streamConfig.height\n+\t\t\t<< \"-0x\" << std::hex << std::setfill('0')\n+\t\t\t<< std::setw(8) << streamConfig.pixelFormat;\n+\t}\n+\n+\treturn cameraConfig;\n+\n+error:\n+\tLOG(IPU3, Error) << \"Requested stream roles not supported\";\n+\n+\treturn CameraConfiguration{};\n }\n \n int PipelineHandlerIPU3::configureStreams(Camera *camera,\n",
    "prefixes": [
        "libcamera-devel",
        "v6",
        "2/6"
    ]
}