{"id":8898,"url":"https://patchwork.libcamera.org/api/1.1/patches/8898/?format=json","web_url":"https://patchwork.libcamera.org/patch/8898/","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":"<20200720224232.153717-7-kieran.bingham@ideasonboard.com>","date":"2020-07-20T22:42:30","name":"[libcamera-devel,RFC,6/8] android: camera_device: Only construct required planes","commit_ref":null,"pull_url":null,"state":"rfc","archived":false,"hash":"4ad5f72aa2f51be4fc889cd20d6ba9b3e7d7f6cc","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/8898/mbox/","series":[{"id":1119,"url":"https://patchwork.libcamera.org/api/1.1/series/1119/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1119","date":"2020-07-20T22:42:24","name":"RFC MappedBuffers","version":1,"mbox":"https://patchwork.libcamera.org/series/1119/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8898/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8898/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 AF0DCC0109\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jul 2020 22:42:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7C3CF6073C;\n\tTue, 21 Jul 2020 00:42:45 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2FBDA607CB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Jul 2020 00:42:39 +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 AE2C09E7;\n\tTue, 21 Jul 2020 00:42:38 +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=\"DNA/6x/m\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1595284958;\n\tbh=A9/O4GRyE6wLJVHxigPTzDQbLMi/FtROcKcri04dwk4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=DNA/6x/mAiqmqozP5YYAI9+DfeMZywiWx4zsIyMxtNqD3lpe/07JZcG1kD6IGkOgG\n\t0Lzg7JkZxRqOZP4G/peo6UepXEvSWrLURJtGxDchbItmZBHRBV8G9QjE5WbmmYq/Qb\n\tfQCP981v+jOB558F+JkDSSFs3cuQskVt+0eEGFBk=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Mon, 20 Jul 2020 23:42:30 +0100","Message-Id":"<20200720224232.153717-7-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20200720224232.153717-1-kieran.bingham@ideasonboard.com>","References":"<20200720224232.153717-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [RFC PATCH 6/8] android: camera_device: Only\n\tconstruct required planes","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":"The camera3buffer describes the number of filedescriptors given.\nDon't try to construct more planes than that.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n\nWe always try to create 3 planes, and we never check if the\nFileDescriptor is valid.\n\nInstead, use the numFds provided by the camera3buffer, but check to see\nif the FileDescriptor was valid before adding the plane to the\nFrameBuffer.\n\nI have a further check in a later patch which skips planes where the\ncamera3buffer->data[i] is already set to -1, so we know it's invalid,\nand this removes the warning below, leaving us with two planes created\nfor all buffers tested using the Camera app.\n\n\n src/android/camera_device.cpp | 11 ++++++++++-\n 1 file changed, 10 insertions(+), 1 deletion(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex e5c50084e590..538b8ab5da03 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1033,9 +1033,18 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n FrameBuffer *CameraDevice::createFrameBuffer(const buffer_handle_t camera3buffer)\n {\n \tstd::vector<FrameBuffer::Plane> planes;\n-\tfor (unsigned int i = 0; i < 3; i++) {\n+\tfor (int i = 0; i < camera3buffer->numFds; i++) {\n \t\tFrameBuffer::Plane plane;\n \t\tplane.fd = FileDescriptor(camera3buffer->data[i]);\n+\n+\t\t/* numFds is seemingly always 4... */\n+\t\tif (!plane.fd.isValid()) {\n+\t\t\tLOG(HAL, Debug) << \"Created an invalid plane... (\"\n+\t\t\t\t\t<< camera3buffer->data[i] << \") \"\n+\t\t\t\t\t<< i << \"/\" << camera3buffer->numFds;\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\t/*\n \t\t * Setting length to zero here is OK as the length is only used\n \t\t * to map the memory of the plane. Libcamera do not need to poke\n","prefixes":["libcamera-devel","RFC","6/8"]}