{"id":2197,"url":"https://patchwork.libcamera.org/api/patches/2197/?format=json","web_url":"https://patchwork.libcamera.org/patch/2197/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20191018154201.13540-2-kieran.bingham@ideasonboard.com>","date":"2019-10-18T15:42:00","name":"[libcamera-devel,1/2] libcamera: v4l2_videodevice: Normalise multiPlanar configuration","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"5290fde8f9a59277217d63e8947e80c144a69c88","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":{"id":11,"url":"https://patchwork.libcamera.org/api/users/11/?format=json","username":"kbingham","first_name":"Kieran","last_name":"Bingham","email":"kieran.bingham@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/2197/mbox/","series":[{"id":538,"url":"https://patchwork.libcamera.org/api/series/538/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=538","date":"2019-10-18T15:41:59","name":"V4L2 Video Device MPLANE improvements","version":1,"mbox":"https://patchwork.libcamera.org/series/538/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2197/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2197/checks/","tags":{},"headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 460CD600EB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Oct 2019 17:42:06 +0200 (CEST)","from Q.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net\n\t[86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BCD6D3FDC;\n\tFri, 18 Oct 2019 17:42:05 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1571413325;\n\tbh=2pjPnWZo4ouaEFErbLhOVYg5wbz9U5Kpqk4b/TBxLes=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=hVYYb0SD6ZtnKYGssGFFlvyor6SNEaOhvtrd01tnsCKYoHfc4qKVm3F1Kl6suhpGC\n\tSgfTQ6o4oYRbDPBk7ZA2eygXNFXfTqCwWIf7cxRXKzSR31YjolaRxnRNI1Awp9r8Dd\n\tyn2PEKOgx50SWRv41RjmXtyB7NyYSuXq+VmyLY+k=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Date":"Fri, 18 Oct 2019 16:42:00 +0100","Message-Id":"<20191018154201.13540-2-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20191018154201.13540-1-kieran.bingham@ideasonboard.com>","References":"<20191018154201.13540-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 1/2] libcamera: v4l2_videodevice:\n\tNormalise multiPlanar configuration","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>","X-List-Received-Date":"Fri, 18 Oct 2019 15:42:07 -0000"},"content":"The use of either single planar or multi planar API is constant\nthroughout the usage of a device, based upon the buffer type of the\nstream, and once determined it does not change.\n\nRather than interrogate the bufferType_ each time, set a device flag at\nopen() time as to whether we are using planar or multi-planar buffer\nAPIs.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/include/v4l2_videodevice.h |  1 +\n src/libcamera/v4l2_videodevice.cpp       | 13 ++++++++-----\n 2 files changed, 9 insertions(+), 5 deletions(-)","diff":"diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\nindex 4b8cf9394eb9..60fca01670c6 100644\n--- a/src/libcamera/include/v4l2_videodevice.h\n+++ b/src/libcamera/include/v4l2_videodevice.h\n@@ -182,6 +182,7 @@ private:\n \n \tenum v4l2_buf_type bufferType_;\n \tenum v4l2_memory memoryType_;\n+\tbool multiPlanar_;\n \n \tBufferPool *bufferPool_;\n \tstd::map<unsigned int, Buffer *> queuedBuffers_;\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 208ab54199b1..37f61b90ac46 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -350,6 +350,8 @@ int V4L2VideoDevice::open()\n \t\treturn -EINVAL;\n \t}\n \n+\tmultiPlanar_ = V4L2_TYPE_IS_MULTIPLANAR(bufferType_);\n+\n \tfdEvent_->activated.connect(this, &V4L2VideoDevice::bufferAvailable);\n \tfdEvent_->setEnabled(false);\n \n@@ -436,6 +438,8 @@ int V4L2VideoDevice::open(int handle, enum v4l2_buf_type type)\n \t\treturn -EINVAL;\n \t}\n \n+\tmultiPlanar_ = V4L2_TYPE_IS_MULTIPLANAR(bufferType_);\n+\n \tfdEvent_->activated.connect(this, &V4L2VideoDevice::bufferAvailable);\n \tfdEvent_->setEnabled(false);\n \n@@ -870,7 +874,7 @@ int V4L2VideoDevice::exportBuffers(BufferPool *pool)\n \t\t\tbreak;\n \t\t}\n \n-\t\tif (V4L2_TYPE_IS_MULTIPLANAR(buf.type)) {\n+\t\tif (multiPlanar_) {\n \t\t\tfor (unsigned int p = 0; p < buf.length; ++p) {\n \t\t\t\tret = createPlane(&buffer, i, p,\n \t\t\t\t\t\t  buf.m.planes[p].length);\n@@ -993,12 +997,11 @@ int V4L2VideoDevice::queueBuffer(Buffer *buffer)\n \tbuf.memory = memoryType_;\n \tbuf.field = V4L2_FIELD_NONE;\n \n-\tbool multiPlanar = V4L2_TYPE_IS_MULTIPLANAR(buf.type);\n \tBufferMemory *mem = &bufferPool_->buffers()[buf.index];\n \tconst std::vector<Plane> &planes = mem->planes();\n \n \tif (buf.memory == V4L2_MEMORY_DMABUF) {\n-\t\tif (multiPlanar) {\n+\t\tif (multiPlanar_) {\n \t\t\tfor (unsigned int p = 0; p < planes.size(); ++p)\n \t\t\t\tv4l2Planes[p].m.fd = planes[p].dmabuf();\n \t\t} else {\n@@ -1006,7 +1009,7 @@ int V4L2VideoDevice::queueBuffer(Buffer *buffer)\n \t\t}\n \t}\n \n-\tif (multiPlanar) {\n+\tif (multiPlanar_) {\n \t\tbuf.length = planes.size();\n \t\tbuf.m.planes = v4l2Planes;\n \t}\n@@ -1099,7 +1102,7 @@ Buffer *V4L2VideoDevice::dequeueBuffer()\n \tbuf.type = bufferType_;\n \tbuf.memory = memoryType_;\n \n-\tif (V4L2_TYPE_IS_MULTIPLANAR(buf.type)) {\n+\tif (multiPlanar_) {\n \t\tbuf.length = VIDEO_MAX_PLANES;\n \t\tbuf.m.planes = planes;\n \t}\n","prefixes":["libcamera-devel","1/2"]}