{"id":18884,"url":"https://patchwork.libcamera.org/api/1.1/patches/18884/?format=json","web_url":"https://patchwork.libcamera.org/patch/18884/","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":"<20230725085540.24863-3-naush@raspberrypi.com>","date":"2023-07-25T08:55:38","name":"[libcamera-devel,v2,2/4] pipeline: rpi: Remove additional external dma buf handling logic","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"0a18fbe32cfd217b596624598851ec32de753485","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/18884/mbox/","series":[{"id":3984,"url":"https://patchwork.libcamera.org/api/1.1/series/3984/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3984","date":"2023-07-25T08:55:36","name":"Raspberry Pi: External buffer handling","version":2,"mbox":"https://patchwork.libcamera.org/series/3984/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18884/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18884/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 7E0B5C324E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 25 Jul 2023 08:56:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DEE89628CE;\n\tTue, 25 Jul 2023 10:56:12 +0200 (CEST)","from mail-wm1-x335.google.com (mail-wm1-x335.google.com\n\t[IPv6:2a00:1450:4864:20::335])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6E4BB628BD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 Jul 2023 10:56:09 +0200 (CEST)","by mail-wm1-x335.google.com with SMTP id\n\t5b1f17b1804b1-3fd190065a8so52802085e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 Jul 2023 01:56:09 -0700 (PDT)","from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tl7-20020adfe587000000b0030c4d8930b1sm1951225wrm.91.2023.07.25.01.56.08\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 25 Jul 2023 01:56:08 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1690275373;\n\tbh=sEo5i0JBMJK+CMRdb03BizI4iYWkNP6Ms99xtpH7EB0=;\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=m8nTHmnn1UosHVsEKQK5wurNdnKOLE2D3xMbNZkK0OqEprWBdgI3F4AWMsLafys5P\n\tZ8jqz8eF01yvxhLWMq0dJSJfZgqET3f372PDZ0PozGion5HJKqFCK95edfQWO/Gv8S\n\tg/QW01Qfb5gG6+O/oiMwHguxSLCiNh7QaKVodoJkBzwNwqO9mjwJ+pQT3TZ7LtvsFY\n\tlfsNMLX8m0H8tsJhsGXBNJh1smOh7kjOV60+853QAMXRZDFqyUV1J0dZgFaMtfKHhf\n\tWP4ZcB6IE7ZuIvjqa4cpFkUG/jPVlW22f0kZLPpH87RTd5FUyEcaQSmweqpbmPHwyH\n\tCZ9L/RpWz1oQg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1690275369; x=1690880169;\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=Pd2kEij9VjyHTUoVWggtxO435U70d2fcStdok+PbzcU=;\n\tb=i4D0388w4DkzOX+eTwo7VHSfBJZrRArg43MzSud+oFuO6Q368uCq221PpaumB7EBaJ\n\thcNi9KxoDPerCstcB0zWb1KIXO2gaPHzJYKanKPAuU/yRn+bHmysJcjJFSPIE/1p4DG3\n\tRqKuMkShp0ulPzEQincL7M06Cv8H6GmlpfLT7WnIh2pvp9S5PHgr0io9wChJeCiZ7Fot\n\t4jIOQwACyldpriDyIO3/macr1IZ2C0cnXvU+z6YzxRWbgXHGCfeAMGl6NvbcxN+i95zR\n\tc6cODcvwKbxun1HzdMONfnQwNYUCFcggzkc47HJpD/fLaTRXrAsOKRm4ZWMqCOW1F+N/\n\tWp1A=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"i4D0388w\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1690275369; x=1690880169;\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=Pd2kEij9VjyHTUoVWggtxO435U70d2fcStdok+PbzcU=;\n\tb=TvnMoVsXeaev4e1djzGF3h24qyqS7pMh0ST/q6Zqct2x1nNw/oIVT2rY0G7RcJkJJu\n\tFZXm8jp0e5ouHDJxP1DQMKzkL+s/rPHd/2ayNABsmz88v4z9ozR0MOgfQLLGulHi+jzw\n\twMV2/HSA9ZDsUURzMiPMWjznONTtkZWT/v3nviCFnfDFZI/LUENLWaRP3vJNvWqE39lo\n\tj/PbaSC4qsDiIuKpVWjykx1H0EunD0uZLEQQYL4u5+hJ/uH2m2WcTszTlYofEue/DXHv\n\trn+1hRayPxxCtAnVdfxt1lZA1PIpvMvjBwop3g5f1fUg9zr9hs4RYDxdwhtcUjRsYH7A\n\tlnoA==","X-Gm-Message-State":"ABy/qLZL2aiXwJNd1KAEg8vWxfmVQjQQ9jfX4NFWDNevCrB4zrwqda0j\n\t2j0HlQQrJ9gaO12zcaj/XlKqt5qZBAfcQ6lYJpWQVg==","X-Google-Smtp-Source":"APBJJlHepyjHyPbMZfI44y5ht2zOB0CPPBWbAuDKkFIBE54Gw4XpNY8IAIkIzGHRkHToFSaG2rqbFg==","X-Received":"by 2002:adf:f04e:0:b0:317:5e5e:60e0 with SMTP id\n\tt14-20020adff04e000000b003175e5e60e0mr4725830wro.28.1690275368889; \n\tTue, 25 Jul 2023 01:56:08 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 25 Jul 2023 09:55:38 +0100","Message-Id":"<20230725085540.24863-3-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20230725085540.24863-1-naush@raspberrypi.com>","References":"<20230725085540.24863-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 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 .../pipeline/rpi/common/pipeline_base.h          |  1 -\n src/libcamera/pipeline/rpi/common/rpi_stream.cpp | 11 +----------\n src/libcamera/pipeline/rpi/common/rpi_stream.h   |  2 --\n 4 files changed, 1 insertion(+), 29 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/pipeline_base.h b/src/libcamera/pipeline/rpi/common/pipeline_base.h\nindex f648e81054bb..8ee20a1b6d9b 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.h\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.h\n@@ -193,7 +193,6 @@ protected:\n \tunsigned int ispOutputTotal_;\n \n private:\n-\tvoid handleExternalBuffer(FrameBuffer *buffer, Stream *stream);\n \tvoid checkRequestCompleted();\n };\n \ndiff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp\nindex e9ad1e6f0848..74b5abf447c7 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","v2","2/4"]}