Patch Detail
Show a patch.
GET /api/patches/8630/?format=api
{ "id": 8630, "url": "https://patchwork.libcamera.org/api/patches/8630/?format=api", "web_url": "https://patchwork.libcamera.org/patch/8630/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200704133140.1738660-10-paul.elder@ideasonboard.com>", "date": "2020-07-04T13:31:27", "name": "[libcamera-devel,v3,09/22] v4l2: v4l2_camera_proxy: Get stride and frameSize from stream config", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "5baaa63b63dfec99a785753d59f82aa0667f9a3b", "submitter": { "id": 17, "url": "https://patchwork.libcamera.org/api/people/17/?format=api", "name": "Paul Elder", "email": "paul.elder@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/8630/mbox/", "series": [ { "id": 1083, "url": "https://patchwork.libcamera.org/api/series/1083/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1083", "date": "2020-07-04T13:31:18", "name": "Clean up formats in v4l2-compat and pipeline handlers", "version": 3, "mbox": "https://patchwork.libcamera.org/series/1083/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/8630/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/8630/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 7C6DCBD792\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 4 Jul 2020 13:32:14 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4922560E47;\n\tSat, 4 Jul 2020 15:32:14 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DFD7960E42\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 4 Jul 2020 15:32:12 +0200 (CEST)", "from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 766CB296;\n\tSat, 4 Jul 2020 15:32:11 +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=\"Jq292s/Y\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593869532;\n\tbh=f0zrgE54vqdyST4DKNOV4UlKIZAgc6geK+ko1HvxXIY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Jq292s/Yn0oKcx8IqD//jixiBMt6y2KW3gOs+2bHlZMp/5LF3ev/KwPQgVKeQsv0s\n\tDnKZmLs8at9ZqFv1cv98C0Z0y4fw9BrUl7vFzAiRpH0kZMYvBLUAE6RDbOnaDBOFil\n\t3AqDKVX1CnsDfwq4OUadnOdFQtV53OTZoHlHnIBA=", "From": "Paul Elder <paul.elder@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 4 Jul 2020 22:31:27 +0900", "Message-Id": "<20200704133140.1738660-10-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20200704133140.1738660-1-paul.elder@ideasonboard.com>", "References": "<20200704133140.1738660-1-paul.elder@ideasonboard.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v3 09/22] v4l2: v4l2_camera_proxy: Get\n\tstride and frameSize from stream config", "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 stride and frameSize should be obtained through StreamConfiguration\nrather than PixelFormatInfo, as pipeline handlers might have different\nvalues (eg. for alignment). Get the stride and frameSize values from\nStreamConfiguration instead of from PixelFormatInfo.\n\nThis also removes the need for V4L2CameraProxy::calculateSizeImage, so\nremove it.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nNew in v3\n---\n src/v4l2/v4l2_camera_proxy.cpp | 42 ++++------------------------------\n src/v4l2/v4l2_camera_proxy.h | 1 -\n 2 files changed, 5 insertions(+), 38 deletions(-)", "diff": "diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex 6a31415..9121d3d 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -71,7 +71,6 @@ int V4L2CameraProxy::open(V4L2CameraFile *file)\n \n \tvcam_->getStreamConfig(&streamConfig_);\n \tsetFmtFromConfig(streamConfig_);\n-\tsizeimage_ = calculateSizeImage(streamConfig_);\n \n \tfiles_.insert(file);\n \n@@ -166,30 +165,20 @@ bool V4L2CameraProxy::validateMemoryType(uint32_t memory)\n void V4L2CameraProxy::setFmtFromConfig(StreamConfiguration &streamConfig)\n {\n \tconst PixelFormatInfo &info = PixelFormatInfo::info(streamConfig.pixelFormat);\n-\tSize size = streamConfig.size;\n \n-\tcurV4L2Format_.fmt.pix.width = size.width;\n-\tcurV4L2Format_.fmt.pix.height = size.height;\n+\tcurV4L2Format_.fmt.pix.width = streamConfig.size.width;\n+\tcurV4L2Format_.fmt.pix.height = streamConfig.size.height;\n \tcurV4L2Format_.fmt.pix.pixelformat = info.v4l2Format;\n \tcurV4L2Format_.fmt.pix.field = V4L2_FIELD_NONE;\n-\tcurV4L2Format_.fmt.pix.bytesperline = info.stride(size.width, 0);\n-\tcurV4L2Format_.fmt.pix.sizeimage = info.frameSize(size);\n+\tcurV4L2Format_.fmt.pix.bytesperline = streamConfig.stride;\n+\tcurV4L2Format_.fmt.pix.sizeimage = streamConfig.frameSize;\n \tcurV4L2Format_.fmt.pix.colorspace = V4L2_COLORSPACE_SRGB;\n \tcurV4L2Format_.fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;\n \tcurV4L2Format_.fmt.pix.ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;\n \tcurV4L2Format_.fmt.pix.quantization = V4L2_QUANTIZATION_DEFAULT;\n \tcurV4L2Format_.fmt.pix.xfer_func = V4L2_XFER_FUNC_DEFAULT;\n-}\n-\n-unsigned int V4L2CameraProxy::calculateSizeImage(StreamConfiguration &streamConfig)\n-{\n-\t/*\n-\t * \\todo Merge this method with setFmtFromConfig (need imageSize to\n-\t * support all libcamera formats first, or filter out MJPEG for now).\n-\t */\n-\tconst PixelFormatInfo &info = PixelFormatInfo::info(streamConfig.pixelFormat);\n \n-\treturn info.frameSize(streamConfig.size);\n+\tsizeimage_ = streamConfig.frameSize;\n }\n \n void V4L2CameraProxy::querycap(std::shared_ptr<Camera> camera)\n@@ -359,12 +348,6 @@ int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n \tif (ret < 0)\n \t\treturn -EINVAL;\n \n-\tunsigned int sizeimage = calculateSizeImage(streamConfig_);\n-\tif (sizeimage == 0)\n-\t\treturn -EINVAL;\n-\n-\tsizeimage_ = sizeimage;\n-\n \tsetFmtFromConfig(streamConfig_);\n \n \treturn 0;\n@@ -505,21 +488,6 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n \tif (ret < 0)\n \t\treturn -EINVAL;\n \n-\tsizeimage_ = calculateSizeImage(streamConfig_);\n-\t/*\n-\t * If we return -EINVAL here then the application will think that we\n-\t * don't support streaming mmap. Since we don't support readwrite and\n-\t * userptr either, the application will get confused and think that\n-\t * we don't support anything.\n-\t * On the other hand, if the set format at the time of reqbufs has a\n-\t * zero sizeimage we'll get a floating point exception when we try to\n-\t * stream it.\n-\t */\n-\tif (sizeimage_ == 0)\n-\t\tLOG(V4L2Compat, Warning)\n-\t\t\t<< \"sizeimage of at least one format is zero. \"\n-\t\t\t<< \"Streaming this format will cause a floating point exception.\";\n-\n \tsetFmtFromConfig(streamConfig_);\n \n \targ->count = streamConfig_.bufferCount;\ndiff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h\nindex 49184a1..e962694 100644\n--- a/src/v4l2/v4l2_camera_proxy.h\n+++ b/src/v4l2/v4l2_camera_proxy.h\n@@ -40,7 +40,6 @@ private:\n \tbool validateBufferType(uint32_t type);\n \tbool validateMemoryType(uint32_t memory);\n \tvoid setFmtFromConfig(StreamConfiguration &streamConfig);\n-\tunsigned int calculateSizeImage(StreamConfiguration &streamConfig);\n \tvoid querycap(std::shared_ptr<Camera> camera);\n \tvoid tryFormat(struct v4l2_format *arg);\n \tenum v4l2_priority maxPriority();\n", "prefixes": [ "libcamera-devel", "v3", "09/22" ] }