From patchwork Tue Jul 25 08:55:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18884 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 7E0B5C324E for ; Tue, 25 Jul 2023 08:56:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DEE89628CE; Tue, 25 Jul 2023 10:56:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1690275373; bh=sEo5i0JBMJK+CMRdb03BizI4iYWkNP6Ms99xtpH7EB0=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=m8nTHmnn1UosHVsEKQK5wurNdnKOLE2D3xMbNZkK0OqEprWBdgI3F4AWMsLafys5P Z8jqz8eF01yvxhLWMq0dJSJfZgqET3f372PDZ0PozGion5HJKqFCK95edfQWO/Gv8S g/QW01Qfb5gG6+O/oiMwHguxSLCiNh7QaKVodoJkBzwNwqO9mjwJ+pQT3TZ7LtvsFY lfsNMLX8m0H8tsJhsGXBNJh1smOh7kjOV60+853QAMXRZDFqyUV1J0dZgFaMtfKHhf WP4ZcB6IE7ZuIvjqa4cpFkUG/jPVlW22f0kZLPpH87RTd5FUyEcaQSmweqpbmPHwyH CZ9L/RpWz1oQg== Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6E4BB628BD for ; Tue, 25 Jul 2023 10:56:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="i4D0388w"; dkim-atps=neutral Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fd190065a8so52802085e9.3 for ; Tue, 25 Jul 2023 01:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1690275369; x=1690880169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Pd2kEij9VjyHTUoVWggtxO435U70d2fcStdok+PbzcU=; b=i4D0388w4DkzOX+eTwo7VHSfBJZrRArg43MzSud+oFuO6Q368uCq221PpaumB7EBaJ hcNi9KxoDPerCstcB0zWb1KIXO2gaPHzJYKanKPAuU/yRn+bHmysJcjJFSPIE/1p4DG3 RqKuMkShp0ulPzEQincL7M06Cv8H6GmlpfLT7WnIh2pvp9S5PHgr0io9wChJeCiZ7Fot 4jIOQwACyldpriDyIO3/macr1IZ2C0cnXvU+z6YzxRWbgXHGCfeAMGl6NvbcxN+i95zR c6cODcvwKbxun1HzdMONfnQwNYUCFcggzkc47HJpD/fLaTRXrAsOKRm4ZWMqCOW1F+N/ Wp1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690275369; x=1690880169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Pd2kEij9VjyHTUoVWggtxO435U70d2fcStdok+PbzcU=; b=TvnMoVsXeaev4e1djzGF3h24qyqS7pMh0ST/q6Zqct2x1nNw/oIVT2rY0G7RcJkJJu FZXm8jp0e5ouHDJxP1DQMKzkL+s/rPHd/2ayNABsmz88v4z9ozR0MOgfQLLGulHi+jzw wMV2/HSA9ZDsUURzMiPMWjznONTtkZWT/v3nviCFnfDFZI/LUENLWaRP3vJNvWqE39lo j/PbaSC4qsDiIuKpVWjykx1H0EunD0uZLEQQYL4u5+hJ/uH2m2WcTszTlYofEue/DXHv rn+1hRayPxxCtAnVdfxt1lZA1PIpvMvjBwop3g5f1fUg9zr9hs4RYDxdwhtcUjRsYH7A lnoA== X-Gm-Message-State: ABy/qLZL2aiXwJNd1KAEg8vWxfmVQjQQ9jfX4NFWDNevCrB4zrwqda0j 2j0HlQQrJ9gaO12zcaj/XlKqt5qZBAfcQ6lYJpWQVg== X-Google-Smtp-Source: APBJJlHepyjHyPbMZfI44y5ht2zOB0CPPBWbAuDKkFIBE54Gw4XpNY8IAIkIzGHRkHToFSaG2rqbFg== X-Received: by 2002:adf:f04e:0:b0:317:5e5e:60e0 with SMTP id t14-20020adff04e000000b003175e5e60e0mr4725830wro.28.1690275368889; Tue, 25 Jul 2023 01:56:08 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id l7-20020adfe587000000b0030c4d8930b1sm1951225wrm.91.2023.07.25.01.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 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 Subject: [libcamera-devel] [PATCH v2 2/4] pipeline: rpi: Remove additional external dma buf handling logic X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" There is no need to distinguish between dma bufs allocated outside of libcamera and internally allocated buffers. As such, remove all the special case handling of such buffers. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- .../pipeline/rpi/common/pipeline_base.cpp | 16 ---------------- .../pipeline/rpi/common/pipeline_base.h | 1 - src/libcamera/pipeline/rpi/common/rpi_stream.cpp | 11 +---------- src/libcamera/pipeline/rpi/common/rpi_stream.h | 2 -- 4 files changed, 1 insertion(+), 29 deletions(-) diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index 179a5b81a516..f244edc68a85 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -1391,11 +1391,6 @@ void CameraData::handleStreamBuffer(FrameBuffer *buffer, RPi::Stream *stream) */ Request *request = requestQueue_.empty() ? nullptr : requestQueue_.front(); if (!dropFrameCount_ && request && request->findBuffer(stream) == buffer) { - /* - * Check if this is an externally provided buffer, and if - * so, we must stop tracking it in the pipeline handler. - */ - handleExternalBuffer(buffer, stream); /* * Tag the buffer as completed, returning it to the * application. @@ -1435,17 +1430,6 @@ void CameraData::handleState() } } -void CameraData::handleExternalBuffer(FrameBuffer *buffer, RPi::Stream *stream) -{ - unsigned int id = stream->getBufferId(buffer); - - if (!(id & MaskExternalBuffer)) - return; - - /* Stop the Stream object from tracking the buffer. */ - stream->removeExternalBuffer(buffer); -} - void CameraData::checkRequestCompleted() { bool requestCompleted = false; diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.h b/src/libcamera/pipeline/rpi/common/pipeline_base.h index f648e81054bb..8ee20a1b6d9b 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.h +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.h @@ -193,7 +193,6 @@ protected: unsigned int ispOutputTotal_; private: - void handleExternalBuffer(FrameBuffer *buffer, Stream *stream); void checkRequestCompleted(); }; diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp index e9ad1e6f0848..74b5abf447c7 100644 --- a/src/libcamera/pipeline/rpi/common/rpi_stream.cpp +++ b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp @@ -78,16 +78,7 @@ unsigned int Stream::getBufferId(FrameBuffer *buffer) const void Stream::setExternalBuffer(FrameBuffer *buffer) { - bufferMap_.emplace(BufferMask::MaskExternalBuffer | id_.get(), buffer); -} - -void Stream::removeExternalBuffer(FrameBuffer *buffer) -{ - unsigned int id = getBufferId(buffer); - - /* Ensure we have this buffer in the stream, and it is marked external. */ - ASSERT(id & BufferMask::MaskExternalBuffer); - bufferMap_.erase(id); + bufferMap_.emplace(id_.get(), buffer); } int Stream::prepareBuffers(unsigned int count) diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h index 6edd304bdfe2..ca591f99cc45 100644 --- a/src/libcamera/pipeline/rpi/common/rpi_stream.h +++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h @@ -28,7 +28,6 @@ enum BufferMask { MaskStats = 0x010000, MaskEmbeddedData = 0x020000, MaskBayerData = 0x040000, - MaskExternalBuffer = 0x100000, }; /* @@ -78,7 +77,6 @@ public: unsigned int getBufferId(FrameBuffer *buffer) const; void setExternalBuffer(FrameBuffer *buffer); - void removeExternalBuffer(FrameBuffer *buffer); int prepareBuffers(unsigned int count); int queueBuffer(FrameBuffer *buffer);