Patch Detail
Show a patch.
GET /api/1.1/patches/15881/?format=api
{ "id": 15881, "url": "https://patchwork.libcamera.org/api/1.1/patches/15881/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15881/", "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": "<20220510115147.19360-42-laurent.pinchart@ideasonboard.com>", "date": "2022-05-10T11:51:38", "name": "[libcamera-devel,41/50] staging: media: imx: imx7-media-csi: Drop YUV/RGB/BAYER format selectors", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "4aed92856ee80c661e6227ce2bac5e44bfd235a5", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15881/mbox/", "series": [ { "id": 3106, "url": "https://patchwork.libcamera.org/api/1.1/series/3106/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3106", "date": "2022-05-10T11:50:57", "name": "staging: media: imx: Prepare destaging of imx7-media-csi", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3106/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15881/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15881/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 5BC15C3279\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 10 May 2022 11:52:42 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C5C706569B;\n\tTue, 10 May 2022 13:52:41 +0200 (CEST)", "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 1D3316569A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 10 May 2022 13:52:32 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3544A1248; \n\tTue, 10 May 2022 13:52:31 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652183561;\n\tbh=acBHI4Cc+IejSUvtpcxUVa16XO7kLHAsl0OGhtOqMnE=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=O2QKBtfBK7hXcb1JtRLALUK9uMbEFjtLvew/o8EiffyF2ceLLIeefn6Uszxj+VIEc\n\tTAhDzl4aS1TxPzjfNhJglZUqcDaJwUfd7Wl8OMn/tdIXQopp78Stl9hlyqUIE59wUg\n\tGcJ8BBYO+f6sLhRCUiwqruQautjmMzy/+FEOwS6kivwURiRlQxDckzFQK93+rBFxQq\n\t2GitsfWAzpbJl9oaSL7p52ZwWC1KXE6GNDcy2hWxWKP4kX5BRU8NhTHXiWL7xlhPDQ\n\tlu5OEOxm8fai93VN2/JzMnh/40XDNwflEisj5NGk3oVnI803uMzj7iuCb0SJ57n+yG\n\teMinqVkibiwRQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652183551;\n\tbh=acBHI4Cc+IejSUvtpcxUVa16XO7kLHAsl0OGhtOqMnE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=TnIBQLrWlhlauYKtGH75HeTdLv8YpjdM2qUGgbfZ2lz04PioadeuDEU7qbjUuh69x\n\tbs7bP+ahHTypdVRHXhmZf5rWMGwt+vI8o0Oxf/0dTrQanMha78ECzsTuRZ61RMnfty\n\tF0T2bhABoxY1J/kiRNe0u/CJt7Q5rl2aGgPkC9/Y=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"TnIBQLrW\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 10 May 2022 14:51:38 +0300", "Message-Id": "<20220510115147.19360-42-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.35.1", "In-Reply-To": "<20220510115147.19360-1-laurent.pinchart@ideasonboard.com>", "References": "<20220510115147.19360-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 41/50] staging: media: imx:\n\timx7-media-csi: Drop YUV/RGB/BAYER format selectors", "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>", "From": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Cc": "Martin Kepplinger <martin.kepplinger@puri.sm>, kernel@pengutronix.de,\n\tDorota Czaplejewicz <dorota.czaplejewicz@puri.sm>,\n\tAlexander Stein <alexander.stein@ew.tq-group.com>,\n\tRui Miguel Silva <rmfrfs@gmail.com>,\n\tPhilipp Zabel <p.zabel@pengutronix.de>, \n\tSteve Longerbeam <slongerbeam@gmail.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "All the format lookup functions are called with a ANY selector, drop\nselector support.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n drivers/staging/media/imx/imx7-media-csi.c | 105 +++++----------------\n 1 file changed, 22 insertions(+), 83 deletions(-)", "diff": "diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c\nindex f3b9ce03318f..ab101d82c253 100644\n--- a/drivers/staging/media/imx/imx7-media-csi.c\n+++ b/drivers/staging/media/imx/imx7-media-csi.c\n@@ -809,17 +809,6 @@ static irqreturn_t imx7_csi_irq_handler(int irq, void *data)\n \n #define IMX_BUS_FMTS(fmt...) (const u32[]) {fmt, 0}\n \n-enum imx7_csi_pixfmt_sel {\n-\tIMX7_CSI_PIXFMT_SEL_YUV = BIT(0), /* select YUV formats */\n-\tIMX7_CSI_PIXFMT_SEL_RGB = BIT(1), /* select RGB formats */\n-\tIMX7_CSI_PIXFMT_SEL_BAYER = BIT(2), /* select BAYER formats */\n-\tIMX7_CSI_PIXFMT_SEL_YUV_RGB = IMX7_CSI_PIXFMT_SEL_YUV\n-\t\t\t\t | IMX7_CSI_PIXFMT_SEL_RGB,\n-\tIMX7_CSI_PIXFMT_SEL_ANY = IMX7_CSI_PIXFMT_SEL_YUV\n-\t\t\t\t| IMX7_CSI_PIXFMT_SEL_RGB\n-\t\t\t\t| IMX7_CSI_PIXFMT_SEL_BAYER,\n-};\n-\n /*\n * List of supported pixel formats for the subdevs.\n */\n@@ -927,25 +916,16 @@ static const struct imx7_csi_pixfmt pixel_formats[] = {\n \n /*\n * Search in the pixel_formats[] array for an entry with the given fourcc\n- * that matches the requested selection criteria and return it.\n- *\n- * @fourcc: Search for an entry with the given fourcc pixel format.\n- * @fmt_sel: Allow entries only with the given selection criteria.\n+ * return it.\n */\n-static const struct imx7_csi_pixfmt *\n-imx7_csi_find_pixel_format(u32 fourcc, enum imx7_csi_pixfmt_sel fmt_sel)\n+static const struct imx7_csi_pixfmt *imx7_csi_find_pixel_format(u32 fourcc)\n {\n \tunsigned int i;\n \n \tfor (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {\n \t\tconst struct imx7_csi_pixfmt *fmt = &pixel_formats[i];\n-\t\tenum imx7_csi_pixfmt_sel sel;\n \n-\t\tsel = fmt->bayer ? IMX7_CSI_PIXFMT_SEL_BAYER\n-\t\t : (fmt->yuv ? IMX7_CSI_PIXFMT_SEL_YUV :\n-\t\t IMX7_CSI_PIXFMT_SEL_RGB);\n-\n-\t\tif ((fmt_sel & sel) && fmt->fourcc == fourcc)\n+\t\tif (fmt->fourcc == fourcc)\n \t\t\treturn fmt;\n \t}\n \n@@ -954,26 +934,17 @@ imx7_csi_find_pixel_format(u32 fourcc, enum imx7_csi_pixfmt_sel fmt_sel)\n \n /*\n * Search in the pixel_formats[] array for an entry with the given media\n- * bus code that matches the requested selection criteria and return it.\n- *\n- * @code: Search for an entry with the given media-bus code.\n- * @fmt_sel: Allow entries only with the given selection criteria.\n+ * bus code and return it.\n */\n-static const struct imx7_csi_pixfmt *\n-imx7_csi_find_mbus_format(u32 code, enum imx7_csi_pixfmt_sel fmt_sel)\n+static const struct imx7_csi_pixfmt *imx7_csi_find_mbus_format(u32 code)\n {\n \tunsigned int i;\n \n \tfor (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {\n \t\tconst struct imx7_csi_pixfmt *fmt = &pixel_formats[i];\n-\t\tenum imx7_csi_pixfmt_sel sel;\n \t\tunsigned int j;\n \n-\t\tsel = fmt->bayer ? IMX7_CSI_PIXFMT_SEL_BAYER\n-\t\t : (fmt->yuv ? IMX7_CSI_PIXFMT_SEL_YUV :\n-\t\t IMX7_CSI_PIXFMT_SEL_RGB);\n-\n-\t\tif (!(fmt_sel & sel) || !fmt->codes)\n+\t\tif (!fmt->codes)\n \t\t\tcontinue;\n \n \t\tfor (j = 0; fmt->codes[j]; j++) {\n@@ -993,27 +964,15 @@ imx7_csi_find_mbus_format(u32 code, enum imx7_csi_pixfmt_sel fmt_sel)\n * @fourcc: The returned fourcc that matches the search criteria at\n * the requested match index.\n * @index: The requested match index.\n- * @fmt_sel: Include in the enumeration entries with the given selection\n- * criteria.\n * @code: If non-zero, only include in the enumeration entries matching this\n *\tmedia bus code.\n */\n-static int imx7_csi_enum_pixel_formats(u32 *fourcc, u32 index,\n-\t\t\t\t enum imx7_csi_pixfmt_sel fmt_sel,\n-\t\t\t\t u32 code)\n+static int imx7_csi_enum_pixel_formats(u32 *fourcc, u32 index, u32 code)\n {\n \tunsigned int i;\n \n \tfor (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {\n \t\tconst struct imx7_csi_pixfmt *fmt = &pixel_formats[i];\n-\t\tenum imx7_csi_pixfmt_sel sel;\n-\n-\t\tsel = fmt->bayer ? IMX7_CSI_PIXFMT_SEL_BAYER\n-\t\t : (fmt->yuv ? IMX7_CSI_PIXFMT_SEL_YUV :\n-\t\t IMX7_CSI_PIXFMT_SEL_RGB);\n-\n-\t\tif (!(fmt_sel & sel))\n-\t\t\tcontinue;\n \n \t\t/*\n \t\t * If a media bus code is specified, only consider formats that\n@@ -1053,24 +1012,16 @@ static int imx7_csi_enum_pixel_formats(u32 *fourcc, u32 index,\n * @code: The returned media-bus code that matches the search criteria at\n * the requested match index.\n * @index: The requested match index.\n- * @fmt_sel: Include in the enumeration entries with the given selection\n- * criteria.\n */\n-static int imx7_csi_enum_mbus_formats(u32 *code, u32 index,\n-\t\t\t\t enum imx7_csi_pixfmt_sel fmt_sel)\n+static int imx7_csi_enum_mbus_formats(u32 *code, u32 index)\n {\n \tunsigned int i;\n \n \tfor (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {\n \t\tconst struct imx7_csi_pixfmt *fmt = &pixel_formats[i];\n-\t\tenum imx7_csi_pixfmt_sel sel;\n \t\tunsigned int j;\n \n-\t\tsel = fmt->bayer ? IMX7_CSI_PIXFMT_SEL_BAYER\n-\t\t : (fmt->yuv ? IMX7_CSI_PIXFMT_SEL_YUV :\n-\t\t IMX7_CSI_PIXFMT_SEL_RGB);\n-\n-\t\tif (!(fmt_sel & sel) || !fmt->codes)\n+\t\tif (!fmt->codes)\n \t\t\tcontinue;\n \n \t\tfor (j = 0; fmt->codes[j]; j++) {\n@@ -1099,7 +1050,7 @@ static int imx7_csi_init_mbus_fmt(struct v4l2_mbus_framefmt *mbus,\n \tif (code == 0)\n \t\tcode = IMX7_CSI_DEF_MBUS_CODE;\n \n-\tlcc = imx7_csi_find_mbus_format(code, IMX7_CSI_PIXFMT_SEL_ANY);\n+\tlcc = imx7_csi_find_mbus_format(code);\n \tif (!lcc)\n \t\treturn -EINVAL;\n \n@@ -1127,8 +1078,7 @@ static int imx7_csi_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,\n \tu32 stride;\n \n \tif (!cc) {\n-\t\tcc = imx7_csi_find_mbus_format(mbus->code,\n-\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_ANY);\n+\t\tcc = imx7_csi_find_mbus_format(mbus->code);\n \t\tif (!cc)\n \t\t\treturn -EINVAL;\n \t}\n@@ -1178,7 +1128,6 @@ static int imx7_csi_video_enum_fmt_vid_cap(struct file *file, void *fh,\n \t\t\t\t\t struct v4l2_fmtdesc *f)\n {\n \treturn imx7_csi_enum_pixel_formats(&f->pixelformat, f->index,\n-\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_ANY,\n \t\t\t\t\t f->mbus_code);\n }\n \n@@ -1190,8 +1139,7 @@ static int imx7_csi_video_enum_framesizes(struct file *file, void *fh,\n \tif (fsize->index > 0)\n \t\treturn -EINVAL;\n \n-\tcc = imx7_csi_find_pixel_format(fsize->pixel_format,\n-\t\t\t\t\tIMX7_CSI_PIXFMT_SEL_ANY);\n+\tcc = imx7_csi_find_pixel_format(fsize->pixel_format);\n \tif (!cc)\n \t\treturn -EINVAL;\n \n@@ -1232,13 +1180,10 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,\n \t * Find the pixel format, default to the first supported format if not\n \t * found.\n \t */\n-\tcc = imx7_csi_find_pixel_format(pixfmt->pixelformat,\n-\t\t\t\t\tIMX7_CSI_PIXFMT_SEL_ANY);\n+\tcc = imx7_csi_find_pixel_format(pixfmt->pixelformat);\n \tif (!cc) {\n-\t\timx7_csi_enum_pixel_formats(&pixfmt->pixelformat, 0,\n-\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_ANY, 0);\n-\t\tcc = imx7_csi_find_pixel_format(pixfmt->pixelformat,\n-\t\t\t\t\t\tIMX7_CSI_PIXFMT_SEL_ANY);\n+\t\timx7_csi_enum_pixel_formats(&pixfmt->pixelformat, 0, 0);\n+\t\tcc = imx7_csi_find_pixel_format(pixfmt->pixelformat);\n \t}\n \n \t/* Allow IDMAC interweave but enforce field order from source. */\n@@ -1463,8 +1408,7 @@ static int imx7_csi_video_validate_fmt(struct imx7_csi *csi)\n \t * Verify that the media bus code is compatible with the pixel format\n \t * set on the video node.\n \t */\n-\tcc = imx7_csi_find_mbus_format(fmt_src.format.code,\n-\t\t\t\t IMX7_CSI_PIXFMT_SEL_ANY);\n+\tcc = imx7_csi_find_mbus_format(fmt_src.format.code);\n \tif (!cc || csi->vdev_cc->yuv != cc->yuv)\n \t\treturn -EPIPE;\n \n@@ -1638,8 +1582,7 @@ static int imx7_csi_video_init_format(struct imx7_csi *csi)\n \tcsi->vdev_compose.width = fmt_src.format.width;\n \tcsi->vdev_compose.height = fmt_src.format.height;\n \n-\tcsi->vdev_cc = imx7_csi_find_pixel_format(csi->vdev_fmt.pixelformat,\n-\t\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_ANY);\n+\tcsi->vdev_cc = imx7_csi_find_pixel_format(csi->vdev_fmt.pixelformat);\n \n \treturn 0;\n }\n@@ -1846,8 +1789,7 @@ static int imx7_csi_enum_mbus_code(struct v4l2_subdev *sd,\n \n \tswitch (code->pad) {\n \tcase IMX7_CSI_PAD_SINK:\n-\t\tret = imx7_csi_enum_mbus_formats(&code->code, code->index,\n-\t\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_ANY);\n+\t\tret = imx7_csi_enum_mbus_formats(&code->code, code->index);\n \t\tbreak;\n \tcase IMX7_CSI_PAD_SRC:\n \t\tif (code->index != 0) {\n@@ -1904,7 +1846,7 @@ static void imx7_csi_try_colorimetry(struct v4l2_mbus_framefmt *tryfmt)\n \tconst struct imx7_csi_pixfmt *cc;\n \tbool is_rgb = false;\n \n-\tcc = imx7_csi_find_mbus_format(tryfmt->code, IMX7_CSI_PIXFMT_SEL_ANY);\n+\tcc = imx7_csi_find_mbus_format(tryfmt->code);\n \tif (cc && !cc->yuv)\n \t\tis_rgb = true;\n \n@@ -1954,8 +1896,7 @@ static int imx7_csi_try_fmt(struct imx7_csi *csi,\n \n \tswitch (sdformat->pad) {\n \tcase IMX7_CSI_PAD_SRC:\n-\t\tin_cc = imx7_csi_find_mbus_format(in_fmt->code,\n-\t\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_ANY);\n+\t\tin_cc = imx7_csi_find_mbus_format(in_fmt->code);\n \n \t\tsdformat->format.width = in_fmt->width;\n \t\tsdformat->format.height = in_fmt->height;\n@@ -1969,12 +1910,10 @@ static int imx7_csi_try_fmt(struct imx7_csi *csi,\n \t\tsdformat->format.ycbcr_enc = in_fmt->ycbcr_enc;\n \t\tbreak;\n \tcase IMX7_CSI_PAD_SINK:\n-\t\t*cc = imx7_csi_find_mbus_format(sdformat->format.code,\n-\t\t\t\t\t\tIMX7_CSI_PIXFMT_SEL_ANY);\n+\t\t*cc = imx7_csi_find_mbus_format(sdformat->format.code);\n \t\tif (!*cc) {\n \t\t\tcode = IMX7_CSI_DEF_MBUS_CODE;\n-\t\t\t*cc = imx7_csi_find_mbus_format(code,\n-\t\t\t\t\t\t\tIMX7_CSI_PIXFMT_SEL_ANY);\n+\t\t\t*cc = imx7_csi_find_mbus_format(code);\n \t\t\tsdformat->format.code = code;\n \t\t}\n \n", "prefixes": [ "libcamera-devel", "41/50" ] }