{"id":8562,"url":"https://patchwork.libcamera.org/api/1.1/patches/8562/?format=json","web_url":"https://patchwork.libcamera.org/patch/8562/","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":"<20200702213654.2129054-8-kieran.bingham@ideasonboard.com>","date":"2020-07-02T21:36:52","name":"[libcamera-devel,v2,7/9] android: camera_device: Add buffers for each stream to Requests","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"e93a3f98441b8b4df0767929dd487877c362c86d","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/8562/mbox/","series":[{"id":1073,"url":"https://patchwork.libcamera.org/api/1.1/series/1073/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1073","date":"2020-07-02T21:36:45","name":"android: Multi-stream support","version":2,"mbox":"https://patchwork.libcamera.org/series/1073/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8562/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8562/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 28C3CBE905\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Jul 2020 21:37:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E816360CB7;\n\tThu,  2 Jul 2020 23:37:08 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3F1E760CAF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Jul 2020 23:37:05 +0200 (CEST)","from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D3E0A9CB;\n\tThu,  2 Jul 2020 23:37:04 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"UAkwL3fi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593725825;\n\tbh=uxsftKNYobZPWTrZy4j2iN75Q+Y0qnB/6+Skua9w3SE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=UAkwL3fidyylK2YtCeN/2Jm8uZ4LdoBrYhfgeJYSnEjfZDYKemU/6G1BvUO5jAdvN\n\tdW/SaxSAr2lEGUsOGVOlUGjPDa6dMsz4VkL8VKDmly6SaiTvNN6jfNKhVncCsaoM0T\n\ttlQvczikKm1+g8QHfWB737GAVPPik33z5NuW3Vvs=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Thu,  2 Jul 2020 22:36:52 +0100","Message-Id":"<20200702213654.2129054-8-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20200702213654.2129054-1-kieran.bingham@ideasonboard.com>","References":"<20200702213654.2129054-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 7/9] android: camera_device: Add\n\tbuffers for each stream to Requests","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Construct a FrameBuffer for every buffer given in the camera3Request\nand add it to the libcamera Request on the appropriate stream.\n\nThe correct stream is obtained from the private data of the camera3_stream\nassociated with the camera3_buffer.\n\nComments regarding supporting only one buffer are now removed.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/android/camera_device.cpp | 38 ++++++++++++++---------------------\n 1 file changed, 15 insertions(+), 23 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex fc3962dac230..eea8c8c50352 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -977,6 +977,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \n \t\t/* Maintain internal state of all stream mappings. */\n \t\tstreams_[i].androidStream = stream;\n+\t\tstream->priv = static_cast<void*>(&streams_[i]);\n \n \t\tStreamConfiguration streamConfiguration;\n \n@@ -1045,9 +1046,6 @@ static FrameBuffer *newFrameBuffer(const buffer_handle_t camera3buffer)\n \n int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Request)\n {\n-\tStreamConfiguration *streamConfiguration = &config_->at(0);\n-\tStream *stream = streamConfiguration->stream();\n-\n \tif (camera3Request->num_output_buffers != 1) {\n \t\tLOG(HAL, Error) << \"Invalid number of output buffers: \"\n \t\t\t\t<< camera3Request->num_output_buffers;\n@@ -1085,30 +1083,28 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques\n \t\tcamera_->createRequest(reinterpret_cast<uint64_t>(descriptor));\n \n \tfor (unsigned int i = 0; i < descriptor->numBuffers; ++i) {\n+\t\tCameraStream *cameraStream = static_cast<CameraStream*>(camera3Buffers[i].stream->priv);\n+\n \t\t/*\n \t\t * Keep track of which stream the request belongs to and store\n \t\t * the native buffer handles.\n-\t\t *\n-\t\t * \\todo Currently we only support one capture buffer. Copy\n-\t\t * all of them to be ready once we'll support more.\n \t\t */\n \t\tdescriptor->buffers[i].stream = camera3Buffers[i].stream;\n \t\tdescriptor->buffers[i].buffer = camera3Buffers[i].buffer;\n-\t}\n \n-\t/*\n-\t * Create a libcamera buffer using the dmabuf descriptors of the first\n-\t * and (currently) only supported request buffer.\n-\t */\n-\tFrameBuffer *buffer = newFrameBuffer(*camera3Buffers[0].buffer);\n-\tif (!buffer) {\n-\t\tLOG(HAL, Error) << \"Failed to create buffer\";\n-\t\tdelete request;\n-\t\tdelete descriptor;\n-\t\treturn -ENOMEM;\n-\t}\n+\t\tFrameBuffer *buffer = newFrameBuffer(*camera3Buffers[0].buffer);\n+\t\tif (!buffer) {\n+\t\t\tLOG(HAL, Error) << \"Failed to create buffer\";\n+\t\t\tdelete request;\n+\t\t\tdelete descriptor;\n+\t\t\treturn -ENOMEM;\n+\t\t}\n+\n+\t\tStreamConfiguration *streamConfiguration = &config_->at(cameraStream->libcameraIndex);\n+\t\tStream *stream = streamConfiguration->stream();\n \n-\trequest->addBuffer(stream, buffer);\n+\t\trequest->addBuffer(stream, buffer);\n+\t}\n \n \tint ret = camera_->queueRequest(request);\n \tif (ret) {\n@@ -1142,10 +1138,6 @@ void CameraDevice::requestComplete(Request *request)\n \tcaptureResult.frame_number = descriptor->frameNumber;\n \tcaptureResult.num_output_buffers = descriptor->numBuffers;\n \tfor (unsigned int i = 0; i < descriptor->numBuffers; ++i) {\n-\t\t/*\n-\t\t * \\todo Currently we only support one capture buffer. Prepare\n-\t\t * all of them to be ready once we'll support more.\n-\t\t */\n \t\tdescriptor->buffers[i].acquire_fence = -1;\n \t\tdescriptor->buffers[i].release_fence = -1;\n \t\tdescriptor->buffers[i].status = status;\n","prefixes":["libcamera-devel","v2","7/9"]}