Show a patch.

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

{
    "id": 8610,
    "url": "https://patchwork.libcamera.org/api/patches/8610/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/8610/",
    "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": "<20200704005227.21782-7-laurent.pinchart@ideasonboard.com>",
    "date": "2020-07-04T00:52:21",
    "name": "[libcamera-devel,v2,06/12] libcamera: pipeline: raspberrypi: Move configureIPA() to RPiCameraData",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "541ce47a437b4bda36c852d3346a4e8e489deb4f",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/8610/mbox/",
    "series": [
        {
            "id": 1081,
            "url": "https://patchwork.libcamera.org/api/series/1081/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1081",
            "date": "2020-07-04T00:52:15",
            "name": "Support passing custom data to IPA configure()",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/1081/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/8610/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/8610/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 316BBBE905\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  4 Jul 2020 00:52:43 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C954060DCB;\n\tSat,  4 Jul 2020 02:52: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 4297B60C59\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  4 Jul 2020 02:52:39 +0200 (CEST)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C3EBE51B;\n\tSat,  4 Jul 2020 02:52:38 +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=\"MtUOqPvs\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593823959;\n\tbh=w7VqzKTs46LNXSj6Ac9DsZLU+UyV7pdmQJrUwv0RSwQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=MtUOqPvsyW7zmq1Gw/Y3iabGKC2R7ksMVW/9la4cvXNOtYdpNixAVjMrHkSbjWELL\n\tFTWu1/2C3WHD/nt6in6M6uY0j6XyKiKB0hLskc6HVN7TR2+8HNsoOfGsX77Dz8+7Hw\n\tXsVXNfcuJ0nwb4BmtdfhnWlPfwB/Hv1zwiayhmFE=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat,  4 Jul 2020 03:52:21 +0300",
        "Message-Id": "<20200704005227.21782-7-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200704005227.21782-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200704005227.21782-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v2 06/12] libcamera: pipeline:\n\traspberrypi: Move configureIPA() to RPiCameraData",
        "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=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The PipelineHandlerRPi::configureIPA() function accesses plenty of\nmember data from the RPiCameraData class and no member from the\nPipelineHandlerRPi class. Move it to RPiCameraData where it logically\nbelongs.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 127 +++++++++---------\n 1 file changed, 63 insertions(+), 64 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex db0b20135318..a05fc68b98fa 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -311,6 +311,8 @@ public:\n \tvoid frameStarted(uint32_t sequence);\n \n \tint loadIPA();\n+\tint configureIPA();\n+\n \tvoid queueFrameAction(unsigned int frame, const IPAOperationData &action);\n \n \t/* bufferComplete signal handlers. */\n@@ -396,8 +398,6 @@ private:\n \t\treturn static_cast<RPiCameraData *>(PipelineHandler::cameraData(camera));\n \t}\n \n-\tint configureIPA(Camera *camera);\n-\n \tint queueAllBuffers(Camera *camera);\n \tint prepareBuffers(Camera *camera);\n \tvoid freeBuffers(Camera *camera);\n@@ -765,7 +765,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \tcrop.y = (sensorFormat.size.height - crop.height) >> 1;\n \tdata->isp_[Isp::Input].dev()->setSelection(V4L2_SEL_TGT_CROP, &crop);\n \n-\tret = configureIPA(camera);\n+\tret = data->configureIPA();\n \tif (ret)\n \t\tLOG(RPI, Error) << \"Failed to configure the IPA: \" << ret;\n \n@@ -980,67 +980,6 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n \treturn true;\n }\n \n-int PipelineHandlerRPi::configureIPA(Camera *camera)\n-{\n-\tstd::map<unsigned int, IPAStream> streamConfig;\n-\tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n-\tRPiCameraData *data = cameraData(camera);\n-\n-\t/* Get the device format to pass to the IPA. */\n-\tV4L2DeviceFormat sensorFormat;\n-\tdata->unicam_[Unicam::Image].dev()->getFormat(&sensorFormat);\n-\t/* Inform IPA of stream configuration and sensor controls. */\n-\tunsigned int i = 0;\n-\tfor (auto const &stream : data->isp_) {\n-\t\tif (stream.isExternal()) {\n-\t\t\tstreamConfig[i] = {\n-\t\t\t\t.pixelFormat = stream.configuration().pixelFormat,\n-\t\t\t\t.size = stream.configuration().size\n-\t\t\t};\n-\t\t}\n-\t}\n-\tentityControls.emplace(0, data->unicam_[Unicam::Image].dev()->controls());\n-\tentityControls.emplace(1, data->isp_[Isp::Input].dev()->controls());\n-\n-\t/* Allocate the lens shading table via vcsm and pass to the IPA. */\n-\tif (!data->lsTable_) {\n-\t\tdata->lsTable_ = data->vcsm_.alloc(\"ls_grid\", MAX_LS_GRID_SIZE);\n-\t\tuintptr_t ptr = reinterpret_cast<uintptr_t>(data->lsTable_);\n-\n-\t\tif (!data->lsTable_)\n-\t\t\treturn -ENOMEM;\n-\n-\t\t/*\n-\t\t * The vcsm allocation will always be in the memory region\n-\t\t * < 32-bits to allow Videocore to access the memory.\n-\t\t *\n-\t\t * \\todo Sending a pointer to the IPA is a workaround for\n-\t\t * vc_sm_cma not yet supporting dmabuf. This will not work with\n-\t\t * IPA module isolation and should be reworked when vc_sma_cma\n-\t\t * will permit.\n-\t\t */\n-\t\tIPAOperationData op;\n-\t\top.operation = RPI_IPA_EVENT_LS_TABLE_ALLOCATION;\n-\t\top.data = { static_cast<uint32_t>(ptr & 0xffffffff),\n-\t\t\t    data->vcsm_.getVCHandle(data->lsTable_) };\n-\t\tdata->ipa_->processEvent(op);\n-\t}\n-\n-\tCameraSensorInfo sensorInfo = {};\n-\tint ret = data->sensor_->sensorInfo(&sensorInfo);\n-\tif (ret) {\n-\t\tLOG(RPI, Error) << \"Failed to retrieve camera sensor info\";\n-\t\treturn ret;\n-\t}\n-\n-\t/* Ready the IPA - it must know about the sensor resolution. */\n-\tIPAOperationData ipaConfig;\n-\tdata->ipa_->configure(sensorInfo, streamConfig, entityControls,\n-\t\t\t      ipaConfig, nullptr);\n-\n-\treturn 0;\n-}\n-\n int PipelineHandlerRPi::queueAllBuffers(Camera *camera)\n {\n \tRPiCameraData *data = cameraData(camera);\n@@ -1178,6 +1117,66 @@ int RPiCameraData::loadIPA()\n \treturn ipa_->start();\n }\n \n+int RPiCameraData::configureIPA()\n+{\n+\tstd::map<unsigned int, IPAStream> streamConfig;\n+\tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n+\n+\t/* Get the device format to pass to the IPA. */\n+\tV4L2DeviceFormat sensorFormat;\n+\tunicam_[Unicam::Image].dev()->getFormat(&sensorFormat);\n+\t/* Inform IPA of stream configuration and sensor controls. */\n+\tunsigned int i = 0;\n+\tfor (auto const &stream : isp_) {\n+\t\tif (stream.isExternal()) {\n+\t\t\tstreamConfig[i] = {\n+\t\t\t\t.pixelFormat = stream.configuration().pixelFormat,\n+\t\t\t\t.size = stream.configuration().size\n+\t\t\t};\n+\t\t}\n+\t}\n+\tentityControls.emplace(0, unicam_[Unicam::Image].dev()->controls());\n+\tentityControls.emplace(1, isp_[Isp::Input].dev()->controls());\n+\n+\t/* Allocate the lens shading table via vcsm and pass to the IPA. */\n+\tif (!lsTable_) {\n+\t\tlsTable_ = vcsm_.alloc(\"ls_grid\", MAX_LS_GRID_SIZE);\n+\t\tuintptr_t ptr = reinterpret_cast<uintptr_t>(lsTable_);\n+\n+\t\tif (!lsTable_)\n+\t\t\treturn -ENOMEM;\n+\n+\t\t/*\n+\t\t * The vcsm allocation will always be in the memory region\n+\t\t * < 32-bits to allow Videocore to access the memory.\n+\t\t *\n+\t\t * \\todo Sending a pointer to the IPA is a workaround for\n+\t\t * vc_sm_cma not yet supporting dmabuf. This will not work with\n+\t\t * IPA module isolation and should be reworked when vc_sma_cma\n+\t\t * will permit.\n+\t\t */\n+\t\tIPAOperationData op;\n+\t\top.operation = RPI_IPA_EVENT_LS_TABLE_ALLOCATION;\n+\t\top.data = { static_cast<uint32_t>(ptr & 0xffffffff),\n+\t\t\t    vcsm_.getVCHandle(lsTable_) };\n+\t\tipa_->processEvent(op);\n+\t}\n+\n+\tCameraSensorInfo sensorInfo = {};\n+\tint ret = sensor_->sensorInfo(&sensorInfo);\n+\tif (ret) {\n+\t\tLOG(RPI, Error) << \"Failed to retrieve camera sensor info\";\n+\t\treturn ret;\n+\t}\n+\n+\t/* Ready the IPA - it must know about the sensor resolution. */\n+\tIPAOperationData ipaConfig;\n+\tipa_->configure(sensorInfo, streamConfig, entityControls, ipaConfig,\n+\t\t\tnullptr);\n+\n+\treturn 0;\n+}\n+\n void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData &action)\n {\n \t/*\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "06/12"
    ]
}