From patchwork Fri Jul 21 09:37:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18859 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 C877BC324D for ; Fri, 21 Jul 2023 09:38:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 74B8F628CC; Fri, 21 Jul 2023 11:38:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1689932280; bh=ZCEj8eCKrQ8JXb2Rw4TILkI/lSwlca9GoIGypk5f+SQ=; 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=ffVCsFTsdgclhmfuicygCwqjPY7JtmPUeBcHYPva1qZNbH8dGAOcjqRCLC6w8kKoh jROlyAWOACU8b3F264kYNz9OammJS2Ze2jyNn074JYjoY79CJ8EWZJ9coUySDGpLkX Iu5y/wXY3FfHvXyMJHK55l9bXQV0NRN2PcuvoO6I0ecwG4nf8+t2PGdTfnpBhlexAz qVD1QGQqQZtrb8572INMhF7xVqlsQf5XQ4PJp/K4ALs+Vg8896hwWwdc0tnF5RSwTl nlzFOEp5rExEucE5+eY3jvz/0/B/wuHsYWUF/YYjT4yDyKgGN0JFi1PX0z1bOhl8s5 xxGnjXIr7hKYw== Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CC133628BC for ; Fri, 21 Jul 2023 11:37:58 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="gO7rvBqH"; dkim-atps=neutral Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbea14706eso14796945e9.2 for ; Fri, 21 Jul 2023 02:37:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1689932278; x=1690537078; 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=iJOXQNSIm0Lr1/Voilx0gzPy85rkKkpt1G8dmzJGcVs=; b=gO7rvBqHGF6IVV5E7FomxdtAv0YMn3wv/IZsEmE4USdshv4dZljwWvbPciettim+vo K/WKdpVttQDuDCm0cYc14DHYwq0gbe/s1T3xwB+5tvCnPLTRT2IORTC9ajCc5k0tOyEG aJOr/lNhT9bmkWEnqcCYmgKuInojxhif78fvXcI8iuxzGjYom6hY7k2Cz/rg6AlefcVy KFKgSnKDT0URG1ql0NjiXBrsb9lZpauDKYQLf3B/RD7TLDcIXYQmErt8Z3EPpWvXlNhh Rb8bYf8zSv9ZY/9K88hQ7h9KlffDj6Xun9d4ExsosJ3Gr5r4nLsWAiHQ1molUb4lI6fR NEGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689932278; x=1690537078; 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=iJOXQNSIm0Lr1/Voilx0gzPy85rkKkpt1G8dmzJGcVs=; b=TKoiZk+7ayqcIRNAnK9e/qF3tPgogPxKJUvTFwGHiD60mpQXwdtP1mUQMSMliSxLX4 GnZWX15UBVW3Arzj9De0dFWDTrObKRxRl7EtAhW8rADYG/uBfV/rxaOliKLt+0v+/6vb ZUpgGdi+zBN7PTNsmCPHezs/GCQuCwvoXIUPfaOC7lvocGmWnqgmToRarLLIubxIE0ER KpesmV9lwDmWED9nPFx9Bh065z6LeIqj6ovFGQFimyxamTULlUFoy8tS+btlu0KRhece 9pWo9pSrrSvk42rpVwGqBPLPyMNl+OSu09gNJcqXynpmRbLxKtcElwxBp5wgygXUqD6D OHmg== X-Gm-Message-State: ABy/qLZQaH8W2LrlE8sniDSoV9HA/hLn4X+s23RqIXdEaBrR51kdZjXh T/i6gCaRhayvwP32VhNZ0cN0QBZAUjuQRkg2aC/FHA== X-Google-Smtp-Source: APBJJlGx/TZ7sKPjJGlJcnUYS9cgDpV0l0NnB48HFqqIyNF/HNuYelwrIfrKR+5EAZ1BEL5U4AZMYw== X-Received: by 2002:a05:600c:22c3:b0:3fb:4149:b816 with SMTP id 3-20020a05600c22c300b003fb4149b816mr966696wmg.8.1689932278303; Fri, 21 Jul 2023 02:37:58 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id n12-20020a5d6b8c000000b003143c6e09ccsm3674663wrx.16.2023.07.21.02.37.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 02:37:57 -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 Subject: [libcamera-devel] [PATCH v1 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 --- .../pipeline/rpi/common/pipeline_base.cpp | 16 ---------------- src/libcamera/pipeline/rpi/common/rpi_stream.cpp | 11 +---------- src/libcamera/pipeline/rpi/common/rpi_stream.h | 2 -- 3 files changed, 1 insertion(+), 28 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/rpi_stream.cpp b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp index 1d05c5acc0d9..07b8de6875fe 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);