Show a patch.

GET /api/1.1/patches/1534/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1534,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/1534/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1534/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20190630181049.9548-2-jacopo@jmondi.org>",
    "date": "2019-06-30T18:10:42",
    "name": "[libcamera-devel,RFC,1/8] libcamera: v4l2_videodevice: Re-group operations",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "75d26627756583270e4698a4729039586d81d4bf",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/1534/mbox/",
    "series": [
        {
            "id": 383,
            "url": "https://patchwork.libcamera.org/api/1.1/series/383/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=383",
            "date": "2019-06-30T18:10:41",
            "name": "libcamera: Add support for importing external memory buffers",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/383/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1534/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1534/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 34E0460BC0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 30 Jun 2019 20:09:38 +0200 (CEST)",
            "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id CD8EA200007;\n\tSun, 30 Jun 2019 18:09:37 +0000 (UTC)"
        ],
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sun, 30 Jun 2019 20:10:42 +0200",
        "Message-Id": "<20190630181049.9548-2-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190630181049.9548-1-jacopo@jmondi.org>",
        "References": "<20190630181049.9548-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC 1/8] libcamera: v4l2_videodevice: Re-group\n\toperations",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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": "Sun, 30 Jun 2019 18:09:38 -0000"
    },
    "content": "Group together operations to enumerate formats and operations to handle\nmemory handling, alternating public and private operations but\nrespecting the ordering within each group. Cosmetic change to prepare\nfor a re-work of the memory handling operations.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/include/v4l2_videodevice.h |   6 +-\n src/libcamera/v4l2_videodevice.cpp       | 170 +++++++++++------------\n 2 files changed, 88 insertions(+), 88 deletions(-)",
    "diff": "diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\nindex 734b34f1dc53..b92df882568f 100644\n--- a/src/libcamera/include/v4l2_videodevice.h\n+++ b/src/libcamera/include/v4l2_videodevice.h\n@@ -160,13 +160,13 @@ private:\n \tint getFormatSingleplane(V4L2DeviceFormat *format);\n \tint setFormatSingleplane(V4L2DeviceFormat *format);\n \n+\tstd::vector<unsigned int> enumPixelformats();\n+\tstd::vector<SizeRange> enumSizes(unsigned int pixelFormat);\n+\n \tint requestBuffers(unsigned int count);\n \tint createPlane(Buffer *buffer, unsigned int plane,\n \t\t\tunsigned int length);\n \n-\tstd::vector<unsigned int> enumPixelformats();\n-\tstd::vector<SizeRange> enumSizes(unsigned int pixelFormat);\n-\n \tBuffer *dequeueBuffer();\n \tvoid bufferAvailable(EventNotifier *notifier);\n \ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 12af3bd0639b..2d1e87a76c6f 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -627,6 +627,91 @@ ImageFormats V4L2VideoDevice::formats()\n \treturn formats;\n }\n \n+std::vector<unsigned int> V4L2VideoDevice::enumPixelformats()\n+{\n+\tstd::vector<unsigned int> formats;\n+\tint ret;\n+\n+\tfor (unsigned int index = 0; ; index++) {\n+\t\tstruct v4l2_fmtdesc pixelformatEnum = {};\n+\t\tpixelformatEnum.index = index;\n+\t\tpixelformatEnum.type = bufferType_;\n+\n+\t\tret = ioctl(VIDIOC_ENUM_FMT, &pixelformatEnum);\n+\t\tif (ret)\n+\t\t\tbreak;\n+\n+\t\tformats.push_back(pixelformatEnum.pixelformat);\n+\t}\n+\n+\tif (ret && ret != -EINVAL) {\n+\t\tLOG(V4L2, Error)\n+\t\t\t<< \"Unable to enumerate pixel formats: \"\n+\t\t\t<< strerror(-ret);\n+\t\treturn {};\n+\t}\n+\n+\treturn formats;\n+}\n+\n+std::vector<SizeRange> V4L2VideoDevice::enumSizes(unsigned int pixelFormat)\n+{\n+\tstd::vector<SizeRange> sizes;\n+\tint ret;\n+\n+\tfor (unsigned int index = 0;; index++) {\n+\t\tstruct v4l2_frmsizeenum frameSize = {};\n+\t\tframeSize.index = index;\n+\t\tframeSize.pixel_format = pixelFormat;\n+\n+\t\tret = ioctl(VIDIOC_ENUM_FRAMESIZES, &frameSize);\n+\t\tif (ret)\n+\t\t\tbreak;\n+\n+\t\tif (index != 0 &&\n+\t\t    frameSize.type != V4L2_FRMSIZE_TYPE_DISCRETE) {\n+\t\t\tLOG(V4L2, Error)\n+\t\t\t\t<< \"Non-zero index for non discrete type\";\n+\t\t\treturn {};\n+\t\t}\n+\n+\t\tswitch (frameSize.type) {\n+\t\tcase V4L2_FRMSIZE_TYPE_DISCRETE:\n+\t\t\tsizes.emplace_back(frameSize.discrete.width,\n+\t\t\t\t\t   frameSize.discrete.height);\n+\t\t\tbreak;\n+\t\tcase V4L2_FRMSIZE_TYPE_CONTINUOUS:\n+\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n+\t\t\t\t\t   frameSize.stepwise.min_height,\n+\t\t\t\t\t   frameSize.stepwise.max_width,\n+\t\t\t\t\t   frameSize.stepwise.max_height);\n+\t\t\tbreak;\n+\t\tcase V4L2_FRMSIZE_TYPE_STEPWISE:\n+\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n+\t\t\t\t\t   frameSize.stepwise.min_height,\n+\t\t\t\t\t   frameSize.stepwise.max_width,\n+\t\t\t\t\t   frameSize.stepwise.max_height,\n+\t\t\t\t\t   frameSize.stepwise.step_width,\n+\t\t\t\t\t   frameSize.stepwise.step_height);\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tLOG(V4L2, Error)\n+\t\t\t\t<< \"Unknown VIDIOC_ENUM_FRAMESIZES type \"\n+\t\t\t\t<< frameSize.type;\n+\t\t\treturn {};\n+\t\t}\n+\t}\n+\n+\tif (ret && ret != -EINVAL) {\n+\t\tLOG(V4L2, Error)\n+\t\t\t<< \"Unable to enumerate frame sizes: \"\n+\t\t\t<< strerror(-ret);\n+\t\treturn {};\n+\t}\n+\n+\treturn sizes;\n+}\n+\n int V4L2VideoDevice::requestBuffers(unsigned int count)\n {\n \tstruct v4l2_requestbuffers rb = {};\n@@ -754,91 +839,6 @@ int V4L2VideoDevice::createPlane(Buffer *buffer, unsigned int planeIndex,\n \treturn 0;\n }\n \n-std::vector<unsigned int> V4L2VideoDevice::enumPixelformats()\n-{\n-\tstd::vector<unsigned int> formats;\n-\tint ret;\n-\n-\tfor (unsigned int index = 0; ; index++) {\n-\t\tstruct v4l2_fmtdesc pixelformatEnum = {};\n-\t\tpixelformatEnum.index = index;\n-\t\tpixelformatEnum.type = bufferType_;\n-\n-\t\tret = ioctl(VIDIOC_ENUM_FMT, &pixelformatEnum);\n-\t\tif (ret)\n-\t\t\tbreak;\n-\n-\t\tformats.push_back(pixelformatEnum.pixelformat);\n-\t}\n-\n-\tif (ret && ret != -EINVAL) {\n-\t\tLOG(V4L2, Error)\n-\t\t\t<< \"Unable to enumerate pixel formats: \"\n-\t\t\t<< strerror(-ret);\n-\t\treturn {};\n-\t}\n-\n-\treturn formats;\n-}\n-\n-std::vector<SizeRange> V4L2VideoDevice::enumSizes(unsigned int pixelFormat)\n-{\n-\tstd::vector<SizeRange> sizes;\n-\tint ret;\n-\n-\tfor (unsigned int index = 0;; index++) {\n-\t\tstruct v4l2_frmsizeenum frameSize = {};\n-\t\tframeSize.index = index;\n-\t\tframeSize.pixel_format = pixelFormat;\n-\n-\t\tret = ioctl(VIDIOC_ENUM_FRAMESIZES, &frameSize);\n-\t\tif (ret)\n-\t\t\tbreak;\n-\n-\t\tif (index != 0 &&\n-\t\t    frameSize.type != V4L2_FRMSIZE_TYPE_DISCRETE) {\n-\t\t\tLOG(V4L2, Error)\n-\t\t\t\t<< \"Non-zero index for non discrete type\";\n-\t\t\treturn {};\n-\t\t}\n-\n-\t\tswitch (frameSize.type) {\n-\t\tcase V4L2_FRMSIZE_TYPE_DISCRETE:\n-\t\t\tsizes.emplace_back(frameSize.discrete.width,\n-\t\t\t\t\t   frameSize.discrete.height);\n-\t\t\tbreak;\n-\t\tcase V4L2_FRMSIZE_TYPE_CONTINUOUS:\n-\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n-\t\t\t\t\t   frameSize.stepwise.min_height,\n-\t\t\t\t\t   frameSize.stepwise.max_width,\n-\t\t\t\t\t   frameSize.stepwise.max_height);\n-\t\t\tbreak;\n-\t\tcase V4L2_FRMSIZE_TYPE_STEPWISE:\n-\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n-\t\t\t\t\t   frameSize.stepwise.min_height,\n-\t\t\t\t\t   frameSize.stepwise.max_width,\n-\t\t\t\t\t   frameSize.stepwise.max_height,\n-\t\t\t\t\t   frameSize.stepwise.step_width,\n-\t\t\t\t\t   frameSize.stepwise.step_height);\n-\t\t\tbreak;\n-\t\tdefault:\n-\t\t\tLOG(V4L2, Error)\n-\t\t\t\t<< \"Unknown VIDIOC_ENUM_FRAMESIZES type \"\n-\t\t\t\t<< frameSize.type;\n-\t\t\treturn {};\n-\t\t}\n-\t}\n-\n-\tif (ret && ret != -EINVAL) {\n-\t\tLOG(V4L2, Error)\n-\t\t\t<< \"Unable to enumerate frame sizes: \"\n-\t\t\t<< strerror(-ret);\n-\t\treturn {};\n-\t}\n-\n-\treturn sizes;\n-}\n-\n /**\n  * \\brief Import the externally allocated \\a pool of buffers\n  * \\param[in] pool BufferPool of buffers to import\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "1/8"
    ]
}