{"id":18859,"url":"https://patchwork.libcamera.org/api/1.1/patches/18859/?format=json","web_url":"https://patchwork.libcamera.org/patch/18859/","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":"<20230721093759.27700-3-naush@raspberrypi.com>","date":"2023-07-21T09:37:57","name":"[libcamera-devel,v1,2/4] pipeline: rpi: Remove additional external dma buf handling logic","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"bcd1a4058e7102a3953c719f29618b4b8cff0317","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/18859/mbox/","series":[{"id":3980,"url":"https://patchwork.libcamera.org/api/1.1/series/3980/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3980","date":"2023-07-21T09:37:55","name":"Raspberry Pi: External buffer handling","version":1,"mbox":"https://patchwork.libcamera.org/series/3980/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18859/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18859/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 C877BC324D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 Jul 2023 09:38:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 74B8F628CC;\n\tFri, 21 Jul 2023 11:38:00 +0200 (CEST)","from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CC133628BC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Jul 2023 11:37:58 +0200 (CEST)","by mail-wm1-x32c.google.com with SMTP id\n\t5b1f17b1804b1-3fbea14706eso14796945e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Jul 2023 02:37:58 -0700 (PDT)","from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tn12-20020a5d6b8c000000b003143c6e09ccsm3674663wrx.16.2023.07.21.02.37.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 21 Jul 2023 02:37:57 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1689932280;\n\tbh=ZCEj8eCKrQ8JXb2Rw4TILkI/lSwlca9GoIGypk5f+SQ=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=ffVCsFTsdgclhmfuicygCwqjPY7JtmPUeBcHYPva1qZNbH8dGAOcjqRCLC6w8kKoh\n\tjROlyAWOACU8b3F264kYNz9OammJS2Ze2jyNn074JYjoY79CJ8EWZJ9coUySDGpLkX\n\tIu5y/wXY3FfHvXyMJHK55l9bXQV0NRN2PcuvoO6I0ecwG4nf8+t2PGdTfnpBhlexAz\n\tqVD1QGQqQZtrb8572INMhF7xVqlsQf5XQ4PJp/K4ALs+Vg8896hwWwdc0tnF5RSwTl\n\tnlzFOEp5rExEucE5+eY3jvz/0/B/wuHsYWUF/YYjT4yDyKgGN0JFi1PX0z1bOhl8s5\n\txxGnjXIr7hKYw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1689932278; x=1690537078;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=iJOXQNSIm0Lr1/Voilx0gzPy85rkKkpt1G8dmzJGcVs=;\n\tb=gO7rvBqHGF6IVV5E7FomxdtAv0YMn3wv/IZsEmE4USdshv4dZljwWvbPciettim+vo\n\tK/WKdpVttQDuDCm0cYc14DHYwq0gbe/s1T3xwB+5tvCnPLTRT2IORTC9ajCc5k0tOyEG\n\taJOr/lNhT9bmkWEnqcCYmgKuInojxhif78fvXcI8iuxzGjYom6hY7k2Cz/rg6AlefcVy\n\tKFKgSnKDT0URG1ql0NjiXBrsb9lZpauDKYQLf3B/RD7TLDcIXYQmErt8Z3EPpWvXlNhh\n\tRb8bYf8zSv9ZY/9K88hQ7h9KlffDj6Xun9d4ExsosJ3Gr5r4nLsWAiHQ1molUb4lI6fR\n\tNEGg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"gO7rvBqH\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1689932278; x=1690537078;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=iJOXQNSIm0Lr1/Voilx0gzPy85rkKkpt1G8dmzJGcVs=;\n\tb=TKoiZk+7ayqcIRNAnK9e/qF3tPgogPxKJUvTFwGHiD60mpQXwdtP1mUQMSMliSxLX4\n\tGnZWX15UBVW3Arzj9De0dFWDTrObKRxRl7EtAhW8rADYG/uBfV/rxaOliKLt+0v+/6vb\n\tZUpgGdi+zBN7PTNsmCPHezs/GCQuCwvoXIUPfaOC7lvocGmWnqgmToRarLLIubxIE0ER\n\tKpesmV9lwDmWED9nPFx9Bh065z6LeIqj6ovFGQFimyxamTULlUFoy8tS+btlu0KRhece\n\t9pWo9pSrrSvk42rpVwGqBPLPyMNl+OSu09gNJcqXynpmRbLxKtcElwxBp5wgygXUqD6D\n\tOHmg==","X-Gm-Message-State":"ABy/qLZQaH8W2LrlE8sniDSoV9HA/hLn4X+s23RqIXdEaBrR51kdZjXh\n\tT/i6gCaRhayvwP32VhNZ0cN0QBZAUjuQRkg2aC/FHA==","X-Google-Smtp-Source":"APBJJlGx/TZ7sKPjJGlJcnUYS9cgDpV0l0NnB48HFqqIyNF/HNuYelwrIfrKR+5EAZ1BEL5U4AZMYw==","X-Received":"by 2002:a05:600c:22c3:b0:3fb:4149:b816 with SMTP id\n\t3-20020a05600c22c300b003fb4149b816mr966696wmg.8.1689932278303; \n\tFri, 21 Jul 2023 02:37:58 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 21 Jul 2023 10:37:57 +0100","Message-Id":"<20230721093759.27700-3-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20230721093759.27700-1-naush@raspberrypi.com>","References":"<20230721093759.27700-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v1 2/4] pipeline: rpi: Remove additional\n\texternal dma buf handling logic","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":"There is no need to distinguish between dma bufs allocated outside of\nlibcamera and internally allocated buffers. As such, remove all the\nspecial case handling of such buffers.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../pipeline/rpi/common/pipeline_base.cpp        | 16 ----------------\n src/libcamera/pipeline/rpi/common/rpi_stream.cpp | 11 +----------\n src/libcamera/pipeline/rpi/common/rpi_stream.h   |  2 --\n 3 files changed, 1 insertion(+), 28 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\nindex 179a5b81a516..f244edc68a85 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -1391,11 +1391,6 @@ void CameraData::handleStreamBuffer(FrameBuffer *buffer, RPi::Stream *stream)\n \t */\n \tRequest *request = requestQueue_.empty() ? nullptr : requestQueue_.front();\n \tif (!dropFrameCount_ && request && request->findBuffer(stream) == buffer) {\n-\t\t/*\n-\t\t * Check if this is an externally provided buffer, and if\n-\t\t * so, we must stop tracking it in the pipeline handler.\n-\t\t */\n-\t\thandleExternalBuffer(buffer, stream);\n \t\t/*\n \t\t * Tag the buffer as completed, returning it to the\n \t\t * application.\n@@ -1435,17 +1430,6 @@ void CameraData::handleState()\n \t}\n }\n \n-void CameraData::handleExternalBuffer(FrameBuffer *buffer, RPi::Stream *stream)\n-{\n-\tunsigned int id = stream->getBufferId(buffer);\n-\n-\tif (!(id & MaskExternalBuffer))\n-\t\treturn;\n-\n-\t/* Stop the Stream object from tracking the buffer. */\n-\tstream->removeExternalBuffer(buffer);\n-}\n-\n void CameraData::checkRequestCompleted()\n {\n \tbool requestCompleted = false;\ndiff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp\nindex 1d05c5acc0d9..07b8de6875fe 100644\n--- a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp\n+++ b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp\n@@ -78,16 +78,7 @@ unsigned int Stream::getBufferId(FrameBuffer *buffer) const\n \n void Stream::setExternalBuffer(FrameBuffer *buffer)\n {\n-\tbufferMap_.emplace(BufferMask::MaskExternalBuffer | id_.get(), buffer);\n-}\n-\n-void Stream::removeExternalBuffer(FrameBuffer *buffer)\n-{\n-\tunsigned int id = getBufferId(buffer);\n-\n-\t/* Ensure we have this buffer in the stream, and it is marked external. */\n-\tASSERT(id & BufferMask::MaskExternalBuffer);\n-\tbufferMap_.erase(id);\n+\tbufferMap_.emplace(id_.get(), buffer);\n }\n \n int Stream::prepareBuffers(unsigned int count)\ndiff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h\nindex 6edd304bdfe2..ca591f99cc45 100644\n--- a/src/libcamera/pipeline/rpi/common/rpi_stream.h\n+++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h\n@@ -28,7 +28,6 @@ enum BufferMask {\n \tMaskStats\t\t= 0x010000,\n \tMaskEmbeddedData\t= 0x020000,\n \tMaskBayerData\t\t= 0x040000,\n-\tMaskExternalBuffer\t= 0x100000,\n };\n \n /*\n@@ -78,7 +77,6 @@ public:\n \tunsigned int getBufferId(FrameBuffer *buffer) const;\n \n \tvoid setExternalBuffer(FrameBuffer *buffer);\n-\tvoid removeExternalBuffer(FrameBuffer *buffer);\n \n \tint prepareBuffers(unsigned int count);\n \tint queueBuffer(FrameBuffer *buffer);\n","prefixes":["libcamera-devel","v1","2/4"]}