{"id":17842,"url":"https://patchwork.libcamera.org/api/1.1/patches/17842/?format=json","web_url":"https://patchwork.libcamera.org/patch/17842/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20221122154235.4319-1-naush@raspberrypi.com>","date":"2022-11-22T15:42:35","name":"[libcamera-devel,v1] pipeline: raspberrypi: Remove enum BuffferMask from the mojom interface","commit_ref":"a857a150e13d71abdc0b321984f08bd0a173a3b2","pull_url":null,"state":"accepted","archived":false,"hash":"03d3fe0c01f14b45fe813b684ece928b55286c99","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17842/mbox/","series":[{"id":3630,"url":"https://patchwork.libcamera.org/api/1.1/series/3630/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3630","date":"2022-11-22T15:42:35","name":"[libcamera-devel,v1] pipeline: raspberrypi: Remove enum BuffferMask from the mojom interface","version":1,"mbox":"https://patchwork.libcamera.org/series/3630/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17842/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17842/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 82DD4BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Nov 2022 15:42:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D353163314;\n\tTue, 22 Nov 2022 16:42:38 +0100 (CET)","from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com\n\t[IPv6:2a00:1450:4864:20::32b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 823FC603CE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Nov 2022 16:42:37 +0100 (CET)","by mail-wm1-x32b.google.com with SMTP id\n\ta11-20020a05600c2d4b00b003cf6f5fd9f1so11590540wmg.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Nov 2022 07:42:37 -0800 (PST)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tx9-20020a5d6509000000b0023c8026841csm14359349wru.23.2022.11.22.07.42.36\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 22 Nov 2022 07:42:36 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669131758;\n\tbh=VnUo6kCCRKEqYN+ZlEwVYVpfFfj6zlK6VXBZiizwvFU=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=hB2wXHIInCsdU5qzIFh5ZCOnBzimaITHyiWKN2+ImewvSx0BIPxHiufIWOqpYUaNH\n\tiBMJgOh3JErjGLTLw1FKiUrmvObIWKutOFNO++ZOstonWpDvtmuW3Uxiowf5XKkfUK\n\tc/IRTCEAEkI7zgUmQktm4vizLurTVDhdn3eOK2+E3dl41EL+HZZgIbLbReyQ9cY/07\n\tItnhDGYUvmAjSV2ojcrtbIW25ebVpTfMS2tF79Q37AfowfZmHZ1s06N/h+o/QjKutu\n\t6Wht8HnqeT6Bm1jPWLCUB75PnKakMWdKwqr7NSdbjgNDdu69BSKwG8FTsExj1z6tsX\n\tVs2RdBNFG4rKg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=yyKJhSfXr3vsy3OPJjCtXMhON7f6tNpE+h1u8tDWUx4=;\n\tb=o1NVh39uUknh7Ho3otY0Ma7smEEQZF6qR2uQV1Xa0XJRy4nWPg1cPv8l3PnobgdGxI\n\t/IfC5ZwWYnWM4j5+E4nPSRSsbzJ0dlgqhsgeAw6nUgu0r4bXA0ay+9mMBpOkUF5wF42F\n\tU6sPgbzvsYGZA9vrbSymTdaCYJapMDC/k+gC3VDjdeKgkT9aPRhfCnQRnY1rfQEl2wzC\n\tyyC/XCAppfbjP5/sSZCprJIjhueP4UPSrfB/kQGxhFZLtq9zpqAVGYbBMzXT2i0ZBEXU\n\t4ixsX55MjdDVXrvhWDhqLRYZhL4h/9DbR0YuPPSE5cy/myWNO0ydaqf1KwKN4LuWK4R/\n\tso8A=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"o1NVh39u\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=yyKJhSfXr3vsy3OPJjCtXMhON7f6tNpE+h1u8tDWUx4=;\n\tb=ojF1B8Q8cxviNndkWH6XmmR9PKQMB3QAQhbCEkHTXIq0fXOfAph8l+e3b6TS9/9I7w\n\tk8jz/SWHeA3FdaG4ZnbZ/MuPsMa4afx0r0TzXWlGuyrJDEh0rhnEs/dwD54vHZQNT6P9\n\tb3O8GRtW2dzNiVuxlGe72DGfNEmCWFgvEwTvTKpMIKQbM6XO2H3pri2Rq4tCKE2cJC2M\n\tVVYuB7bwDL2QRIk6aSdY7LPDdnxNkPzWkYLjkbsqMp8QUbMFRp1OGZy4a4g1dxBkunJb\n\tWOfaGv8OJ0hib0Nyja1i0aM82nIHhXZU3+MfdeKxW+TMQlUQNm5cXBJfWBTVNzvsBnM6\n\tgb7A==","X-Gm-Message-State":"ANoB5pkYfYsvEvWiSD8cUFjzXU/HQ9Y+TQv/E/WVo0XsXxi/zdnAwCK9\n\tdScHTlTgdUWCw3IwtoJV/aq5m6wRDCbl9Q==","X-Google-Smtp-Source":"AA0mqf7+GnzN3OfftLKU1qxTbg1qdsTy1v4dqu+hjIRnQa5hJFcw7MpnJwXXsAhqQTEprVmMbOeGZA==","X-Received":"by 2002:a05:600c:35c7:b0:3cf:7dc1:f432 with SMTP id\n\tr7-20020a05600c35c700b003cf7dc1f432mr19779217wmq.148.1669131756773; \n\tTue, 22 Nov 2022 07:42:36 -0800 (PST)","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 22 Nov 2022 15:42:35 +0000","Message-Id":"<20221122154235.4319-1-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v1] pipeline: raspberrypi: Remove enum\n\tBuffferMask from the mojom interface","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>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The BufferMask enum provides a way of identifying which stream a frame buffer\nbelongs to. This enum is defined in the raspberrypi.mojom interface file.\nHowever, the IPA does not need these enum definitions to mmap buffers that it\nuses.\n\nMove this enum out of the raspberrypi.mojom interface file and put it into\nthe RPi namespace visible only to the pipeline handler. This removes the\nneed to include the auto-generated IPA interface header in the RPi::Stream\ndefinition.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n include/libcamera/ipa/raspberrypi.mojom       |  8 --------\n src/ipa/raspberrypi/raspberrypi.cpp           |  6 +++---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 20 +++++++++----------\n .../pipeline/raspberrypi/rpi_stream.cpp       |  6 ++----\n .../pipeline/raspberrypi/rpi_stream.h         | 13 +++++++++---\n 5 files changed, 25 insertions(+), 28 deletions(-)","diff":"diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\nindex 40f78d9e3b3f..d53644fe296c 100644\n--- a/include/libcamera/ipa/raspberrypi.mojom\n+++ b/include/libcamera/ipa/raspberrypi.mojom\n@@ -8,14 +8,6 @@ module ipa.RPi;\n \n import \"include/libcamera/ipa/core.mojom\";\n \n-enum BufferMask {\n-\tMaskID\t\t\t= 0x00ffff,\n-\tMaskStats\t\t= 0x010000,\n-\tMaskEmbeddedData\t= 0x020000,\n-\tMaskBayerData\t\t= 0x040000,\n-\tMaskExternalBuffer\t= 0x100000,\n-};\n-\n /* Size of the LS grid allocation. */\n const uint32 MaxLsGridSize = 0x8000;\n \ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex beb076dc4909..4e10c57d7f87 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -515,7 +515,7 @@ void IPARPi::signalStatReady(uint32_t bufferId)\n \n \treportMetadata();\n \n-\tstatsMetadataComplete.emit(bufferId & MaskID, libcameraMetadata_);\n+\tstatsMetadataComplete.emit(bufferId, libcameraMetadata_);\n }\n \n void IPARPi::signalQueueRequest(const ControlList &controls)\n@@ -534,7 +534,7 @@ void IPARPi::signalIspPrepare(const ISPConfig &data)\n \tframeCount_++;\n \n \t/* Ready to push the input buffer into the ISP. */\n-\trunIsp.emit(data.bayerBufferId & MaskID);\n+\trunIsp.emit(data.bayerBufferId);\n }\n \n void IPARPi::reportMetadata()\n@@ -1001,7 +1001,7 @@ void IPARPi::queueRequest(const ControlList &controls)\n \n void IPARPi::returnEmbeddedBuffer(unsigned int bufferId)\n {\n-\tembeddedComplete.emit(bufferId & MaskID);\n+\tembeddedComplete.emit(bufferId);\n }\n \n void IPARPi::prepareISP(const ISPConfig &data)\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 087c71b65700..0e0b71945640 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1484,10 +1484,10 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)\n \t * Pass the stats and embedded data buffers to the IPA. No other\n \t * buffers need to be passed.\n \t */\n-\tmapBuffers(camera, data->isp_[Isp::Stats].getBuffers(), ipa::RPi::MaskStats);\n+\tmapBuffers(camera, data->isp_[Isp::Stats].getBuffers(), RPi::MaskStats);\n \tif (data->sensorMetadata_)\n \t\tmapBuffers(camera, data->unicam_[Unicam::Embedded].getBuffers(),\n-\t\t\t   ipa::RPi::MaskEmbeddedData);\n+\t\t\t   RPi::MaskEmbeddedData);\n \n \treturn 0;\n }\n@@ -1727,7 +1727,7 @@ void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &\n \tif (!isRunning())\n \t\treturn;\n \n-\tFrameBuffer *buffer = isp_[Isp::Stats].getBuffers().at(bufferId);\n+\tFrameBuffer *buffer = isp_[Isp::Stats].getBuffers().at(bufferId & RPi::MaskID);\n \n \thandleStreamBuffer(buffer, &isp_[Isp::Stats]);\n \n@@ -1763,9 +1763,9 @@ void RPiCameraData::runIsp(uint32_t bufferId)\n \tif (!isRunning())\n \t\treturn;\n \n-\tFrameBuffer *buffer = unicam_[Unicam::Image].getBuffers().at(bufferId);\n+\tFrameBuffer *buffer = unicam_[Unicam::Image].getBuffers().at(bufferId & RPi::MaskID);\n \n-\tLOG(RPI, Debug) << \"Input re-queue to ISP, buffer id \" << bufferId\n+\tLOG(RPI, Debug) << \"Input re-queue to ISP, buffer id \" << (bufferId & RPi::MaskID)\n \t\t\t<< \", timestamp: \" << buffer->metadata().timestamp;\n \n \tisp_[Isp::Input].queueBuffer(buffer);\n@@ -1778,7 +1778,7 @@ void RPiCameraData::embeddedComplete(uint32_t bufferId)\n \tif (!isRunning())\n \t\treturn;\n \n-\tFrameBuffer *buffer = unicam_[Unicam::Embedded].getBuffers().at(bufferId);\n+\tFrameBuffer *buffer = unicam_[Unicam::Embedded].getBuffers().at(bufferId & RPi::MaskID);\n \thandleStreamBuffer(buffer, &unicam_[Unicam::Embedded]);\n \thandleState();\n }\n@@ -1931,7 +1931,7 @@ void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer)\n \t * application until after the IPA signals so.\n \t */\n \tif (stream == &isp_[Isp::Stats]) {\n-\t\tipa_->signalStatReady(ipa::RPi::MaskStats | static_cast<unsigned int>(index));\n+\t\tipa_->signalStatReady(RPi::MaskStats | static_cast<unsigned int>(index));\n \t} else {\n \t\t/* Any other ISP output can be handed back to the application now. */\n \t\thandleStreamBuffer(buffer, stream);\n@@ -2006,7 +2006,7 @@ void RPiCameraData::handleExternalBuffer(FrameBuffer *buffer, RPi::Stream *strea\n {\n \tunsigned int id = stream->getBufferId(buffer);\n \n-\tif (!(id & ipa::RPi::MaskExternalBuffer))\n+\tif (!(id & RPi::MaskExternalBuffer))\n \t\treturn;\n \n \t/* Stop the Stream object from tracking the buffer. */\n@@ -2174,13 +2174,13 @@ void RPiCameraData::tryRunPipeline()\n \t\t\t<< \" Bayer buffer id: \" << bayerId;\n \n \tipa::RPi::ISPConfig ispPrepare;\n-\tispPrepare.bayerBufferId = ipa::RPi::MaskBayerData | bayerId;\n+\tispPrepare.bayerBufferId = RPi::MaskBayerData | bayerId;\n \tispPrepare.controls = std::move(bayerFrame.controls);\n \n \tif (embeddedBuffer) {\n \t\tunsigned int embeddedId = unicam_[Unicam::Embedded].getBufferId(embeddedBuffer);\n \n-\t\tispPrepare.embeddedBufferId = ipa::RPi::MaskEmbeddedData | embeddedId;\n+\t\tispPrepare.embeddedBufferId = RPi::MaskEmbeddedData | embeddedId;\n \t\tispPrepare.embeddedBufferPresent = true;\n \n \t\tLOG(RPI, Debug) << \"Signalling signalIspPrepare:\"\ndiff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp\nindex 79f7be130ed4..2bb10f25d6ca 100644\n--- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp\n@@ -8,8 +8,6 @@\n \n #include <libcamera/base/log.h>\n \n-#include <libcamera/ipa/raspberrypi_ipa_interface.h>\n-\n namespace libcamera {\n \n LOG_DEFINE_CATEGORY(RPISTREAM)\n@@ -74,7 +72,7 @@ int Stream::getBufferId(FrameBuffer *buffer) const\n \n void Stream::setExternalBuffer(FrameBuffer *buffer)\n {\n-\tbufferMap_.emplace(ipa::RPi::MaskExternalBuffer | id_.get(), buffer);\n+\tbufferMap_.emplace(BufferMask::MaskExternalBuffer | id_.get(), buffer);\n }\n \n void Stream::removeExternalBuffer(FrameBuffer *buffer)\n@@ -82,7 +80,7 @@ void Stream::removeExternalBuffer(FrameBuffer *buffer)\n \tint id = getBufferId(buffer);\n \n \t/* Ensure we have this buffer in the stream, and it is marked external. */\n-\tASSERT(id != -1 && (id & ipa::RPi::MaskExternalBuffer));\n+\tASSERT(id != -1 && (id & BufferMask::MaskExternalBuffer));\n \tbufferMap_.erase(id);\n }\n \ndiff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.h b/src/libcamera/pipeline/raspberrypi/rpi_stream.h\nindex 3c0b5c8ebab4..b8bd79cf1535 100644\n--- a/src/libcamera/pipeline/raspberrypi/rpi_stream.h\n+++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.h\n@@ -12,7 +12,6 @@\n #include <unordered_map>\n #include <vector>\n \n-#include <libcamera/ipa/raspberrypi_ipa_interface.h>\n #include <libcamera/stream.h>\n \n #include \"libcamera/internal/v4l2_videodevice.h\"\n@@ -23,6 +22,14 @@ namespace RPi {\n \n using BufferMap = std::unordered_map<unsigned int, FrameBuffer *>;\n \n+enum BufferMask {\n+\tMaskID\t\t\t= 0x00ffff,\n+\tMaskStats\t\t= 0x010000,\n+\tMaskEmbeddedData\t= 0x020000,\n+\tMaskBayerData\t\t= 0x040000,\n+\tMaskExternalBuffer\t= 0x100000,\n+};\n+\n /*\n  * Device stream abstraction for either an internal or external stream.\n  * Used for both Unicam and the ISP.\n@@ -31,13 +38,13 @@ class Stream : public libcamera::Stream\n {\n public:\n \tStream()\n-\t\t: id_(ipa::RPi::MaskID)\n+\t\t: id_(BufferMask::MaskID)\n \t{\n \t}\n \n \tStream(const char *name, MediaEntity *dev, bool importOnly = false)\n \t\t: external_(false), importOnly_(importOnly), name_(name),\n-\t\t  dev_(std::make_unique<V4L2VideoDevice>(dev)), id_(ipa::RPi::MaskID)\n+\t\t  dev_(std::make_unique<V4L2VideoDevice>(dev)), id_(BufferMask::MaskID)\n \t{\n \t}\n \n","prefixes":["libcamera-devel","v1"]}