From patchwork Thu Feb 28 20:04:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 685 Return-Path: Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E4818610C5 for ; Thu, 28 Feb 2019 21:03:50 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 78013E0005; Thu, 28 Feb 2019 20:03:50 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 28 Feb 2019 21:04:07 +0100 Message-Id: <20190228200410.3022-8-jacopo@jmondi.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228200410.3022-1-jacopo@jmondi.org> References: <20190228200410.3022-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 07/10] libcamera: ipu3: Queue requests to the pipeline X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Feb 2019 20:03:51 -0000 Implement queueRequest for the IPU3 pipeline manager. When a request is queued, a new buffer is queued to the ImgU output and the CIO2 output. Also queue buffers for the viewfinder and stat video nodes, even if they're not used at the moment. Signed-off-by: Jacopo Mondi --- src/libcamera/pipeline/ipu3/ipu3.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 60a48859b398..8ce661e27f62 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -152,11 +152,15 @@ private: std::shared_ptr cio2MediaDev_; std::shared_ptr imguMediaDev_; + + unsigned int tmpBufferCount; }; PipelineHandlerIPU3::PipelineHandlerIPU3(CameraManager *manager) : PipelineHandler(manager), cio2MediaDev_(nullptr), imguMediaDev_(nullptr) { + /* FIXME: this is an hack. */ + tmpBufferCount = 0; } PipelineHandlerIPU3::~PipelineHandlerIPU3() @@ -430,9 +434,30 @@ void PipelineHandlerIPU3::stop(const Camera *camera) int PipelineHandlerIPU3::queueRequest(const Camera *camera, Request *request) { IPU3CameraData *data = cameraData(camera); + V4L2Device *viewfinder = data->imgu->viewfinder; + V4L2Device *output = data->imgu->output; V4L2Device *cio2 = data->cio2.output; + V4L2Device *stat = data->imgu->stat; Stream *stream = &data->stream_; + Buffer *tmpBuffer; + + /* + * Queue buffer on VF and stat. + * FIXME: this is an hack! + */ + tmpBuffer = &data->imgu->vfPool.buffers()[tmpBufferCount]; + viewfinder->queueBuffer(tmpBuffer); + + tmpBuffer = &data->imgu->statPool.buffers()[tmpBufferCount]; + stat->queueBuffer(tmpBuffer); + + tmpBuffer = &data->cio2.pool.buffers()[tmpBufferCount]; + cio2->queueBuffer(tmpBuffer); + + tmpBufferCount++; + tmpBufferCount %= IPU3_BUF_NUM; + /* Queue a buffer to the ImgU output for capture. */ Buffer *buffer = request->findBuffer(stream); if (!buffer) { LOG(IPU3, Error) @@ -440,7 +465,7 @@ int PipelineHandlerIPU3::queueRequest(const Camera *camera, Request *request) return -ENOENT; } - cio2->queueBuffer(buffer); + output->queueBuffer(buffer); return 0; }