{"id":10587,"url":"https://patchwork.libcamera.org/api/1.1/patches/10587/?format=json","web_url":"https://patchwork.libcamera.org/patch/10587/","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":"<20201205134125.11115-1-sebastian.fricke.linux@gmail.com>","date":"2020-12-05T13:41:25","name":"[libcamera-devel] media: rkisp1: Add the enum_frame_size ioctl","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"e16da58be7d60c9ef08ad9d319541ff9c76cc9a3","submitter":{"id":73,"url":"https://patchwork.libcamera.org/api/1.1/people/73/?format=json","name":"Sebastian Fricke","email":"sebastian.fricke.linux@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10587/mbox/","series":[{"id":1507,"url":"https://patchwork.libcamera.org/api/1.1/series/1507/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1507","date":"2020-12-05T13:41:25","name":"[libcamera-devel] media: rkisp1: Add the enum_frame_size ioctl","version":1,"mbox":"https://patchwork.libcamera.org/series/1507/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10587/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10587/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 76E84BDB1F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  5 Dec 2020 13:41:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E79AE635FC;\n\tSat,  5 Dec 2020 14:41:30 +0100 (CET)","from mail-ej1-x644.google.com (mail-ej1-x644.google.com\n\t[IPv6:2a00:1450:4864:20::644])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 70292635F0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  5 Dec 2020 14:41:29 +0100 (CET)","by mail-ej1-x644.google.com with SMTP id f23so12850141ejk.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 05 Dec 2020 05:41:29 -0800 (PST)","from basti.fritz.box\n\t(p200300d1ff2c9400e0800a04f2527278.dip0.t-ipconnect.de.\n\t[2003:d1:ff2c:9400:e080:a04:f252:7278])\n\tby smtp.gmail.com with ESMTPSA id\n\tmc25sm5291779ejb.58.2020.12.05.05.41.27\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 05 Dec 2020 05:41:28 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"s6CpqwYv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=JszvQxiQ+jUlEOzG2swQ7gaMo97fIzwTLLQMuYKMPfs=;\n\tb=s6CpqwYvz/nusMvIhQOrsYxUYNmq5EHpOiHvZJTZh2NITIvgKMr16FKW8Oyr8PVORX\n\t9BF+IcfZESjDmxJ++v2da9qyjqtbSSYq9VW7JdN2xt0IWANMpdNzgwO9qdf58tyq2wU8\n\tGJ6XpRZxvMs0qq3oz3MWNVdPiSkDYAnZ7jnveEhoiCWD6zZXXhdJWDhWELFiB07ZqE8y\n\tr/mS8CaOifooPsV2yEtO/E+SghJ+S9J+OaUHKCZWIExHDFud4DjPyyiLOIBHeuZbc7tu\n\tS2eUFMRPCGa00qSQ5+A/O+1ukD76eJ9GvJum4n5xYP+WNpQ9BEOKitGls5Eou9aPe2gi\n\tbRJw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=JszvQxiQ+jUlEOzG2swQ7gaMo97fIzwTLLQMuYKMPfs=;\n\tb=GOuYyRLXFF6g+Opkh4RI3Vg4wCr84r0K4gSmjTZyi+MFDFr04D9cgJmHxScFK2+FbS\n\toorINf50YRUsN36kHehFPdv5ttHklhqgEJdB191Os+MdHPsJcLB6s5XienooPhXn5Ju+\n\t6EJfZw7nXFPuv9SYo86ifB62s+xg/zhPJdVr6I2iRf5VHjEm9bx5PMktfrRMbnOkqXuF\n\tgg8mN7qPX3iiKoB7aOXvSDpkhVA37FAlKYPB9dlvDxsaj6yyRk1fBZ1QJKt9O3RTVJdS\n\tokHLD6w48EvA7m/wMJRGFmnB/ZhxyGc2pyXNiJ1bJVTEIM1ThMZ6nS5kEdFMEVrwE4Zp\n\tD0BA==","X-Gm-Message-State":"AOAM530hiBiEZn2rDTrGCbjOG1BQttaxTvPeKkssVp+54a3jAPr0+tpu\n\tY0G84QMk3yMkUTT29X2Z/WlizUsCdGc=","X-Google-Smtp-Source":"ABdhPJymmUKVZPjqtnnfaoYlPFRYA+m5pvUm9SdKYS3Nuw6hQwQlnk6K9VtZvL7+AcCZf22LyuhlaQ==","X-Received":"by 2002:a17:906:385b:: with SMTP id\n\tw27mr11575639ejc.109.1607175688662; \n\tSat, 05 Dec 2020 05:41:28 -0800 (PST)","From":"Sebastian Fricke <sebastian.fricke.linux@gmail.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat,  5 Dec 2020 14:41:25 +0100","Message-Id":"<20201205134125.11115-1-sebastian.fricke.linux@gmail.com>","X-Mailer":"git-send-email 2.20.1","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH] media: rkisp1: Add the enum_frame_size\n\tioctl","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":"Implement the VIDIOC_SUBDEV_ENUM_FRAME_SIZE ioctl, check if the mbus\ncode is valid for the given pad. This call is not available for the\nparameter or metadata pads of the RkISP1.\n\nSigned-off-by: Sebastian Fricke <sebastian.fricke.linux@gmail.com>\n---\n\nI have tested this patch with the following script:\nhttps://github.com/initBasti/Linux_kernel_media_tree_fork/commit/efc4b399cff53fb36fadde999594961a3d84073e\n\nThe results on my NanoPC-T4 (Linux nanopct4 5.10.0-rc6-rockchip64):\n\npad 0 = RKISP1_ISP_PAD_SINK_VIDEO\npad 1 = RKISP1_ISP_PAD_SINK_PARAMS\npad 2 = RKISP1_ISP_PAD_SOURCE_VIDEO\npad 3 = RKISP1_ISP_PAD_SOURCE_STATS\n\nbasti@nanopct4:~$ python3 rkisp1_enum_frame_size_test.py \nTEST  0: pad 0 - code 0x300f - size 32x32 - 4032x3024\nTEST  1: pad 0 - code 0x3007 - size 32x32 - 4032x3024\nTEST  2: pad 0 - code 0x300e - size 32x32 - 4032x3024\nTEST  3: pad 0 - code 0x300a - size 32x32 - 4032x3024\nTEST  4: pad 0 - code 0x3012 - size 32x32 - 4032x3024\nTEST  5: pad 0 - code 0x3008 - size 32x32 - 4032x3024\nTEST  6: pad 0 - code 0x3010 - size 32x32 - 4032x3024\nTEST  7: pad 0 - code 0x3011 - size 32x32 - 4032x3024\nTEST  8: pad 0 - code 0x3014 - size 32x32 - 4032x3024\nTEST  9: pad 0 - code 0x3001 - size 32x32 - 4032x3024\nTEST 10: pad 0 - code 0x3013 - size 32x32 - 4032x3024\nTEST 11: pad 0 - code 0x3002 - size 32x32 - 4032x3024\nTEST 12: pad 0 - code 0x2011 - size 32x32 - 4032x3024\nTEST 13: pad 0 - code 0x2012 - size 32x32 - 4032x3024\nTEST 14: pad 0 - code 0x200f - size 32x32 - 4032x3024\nTEST 15: pad 0 - code 0x2010 - size 32x32 - 4032x3024\nTEST 16: pad 1 - code 0x7001 - size /\nTEST 17: pad 2 - code 0x2008 - size 32x32 - 4032x3024\nTEST 18: pad 2 - code 0x300f - size 32x32 - 4032x3024\nTEST 19: pad 2 - code 0x3007 - size 32x32 - 4032x3024\nTEST 20: pad 2 - code 0x300e - size 32x32 - 4032x3024\nTEST 21: pad 2 - code 0x300a - size 32x32 - 4032x3024\nTEST 22: pad 2 - code 0x3012 - size 32x32 - 4032x3024\nTEST 23: pad 2 - code 0x3008 - size 32x32 - 4032x3024\nTEST 24: pad 2 - code 0x3010 - size 32x32 - 4032x3024\nTEST 25: pad 2 - code 0x3011 - size 32x32 - 4032x3024\nTEST 26: pad 2 - code 0x3014 - size 32x32 - 4032x3024\nTEST 27: pad 2 - code 0x3001 - size 32x32 - 4032x3024\nTEST 28: pad 2 - code 0x3013 - size 32x32 - 4032x3024\nTEST 29: pad 2 - code 0x3002 - size 32x32 - 4032x3024\nTEST 30: pad 3 - code 0x7001 - size /\nTEST 31: pad 0 - code 0xdead - size / (test with an invalid media bus code)\nTEST 32: pad 6 - code 0x300f - size / (test with an invalid pad)\nTEST 33: pad 0 - code 0x2008 - size / (test with a format that is not supported by the pad)\nTEST 34: pad 2 - code 0x2010 - size / (test with a format that is not supported by the pad)\n\n---\n\n .../platform/rockchip/rkisp1/rkisp1-isp.c     | 39 +++++++++++++++++++\n 1 file changed, 39 insertions(+)","diff":"diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c\nindex 889982d8ca41..fa7540155d71 100644\n--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c\n+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c\n@@ -599,6 +599,44 @@ static int rkisp1_isp_enum_mbus_code(struct v4l2_subdev *sd,\n \n \treturn -EINVAL;\n }\n+static int rkisp1_isp_enum_frame_size(struct v4l2_subdev *sd,\n+\t\t\t\t      struct v4l2_subdev_pad_config *cfg,\n+\t\t\t\t      struct v4l2_subdev_frame_size_enum *fse)\n+{\n+\tint i;\n+\tbool code_match = false;\n+\n+\tif (fse->pad == RKISP1_ISP_PAD_SINK_PARAMS ||\n+\t    fse->pad == RKISP1_ISP_PAD_SOURCE_STATS)\n+\t\treturn -EINVAL;\n+\n+\tif (fse->index > 0)\n+\t\treturn -EINVAL;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(rkisp1_isp_formats); i++) {\n+\t\tconst struct rkisp1_isp_mbus_info *fmt = &rkisp1_isp_formats[i];\n+\n+\t\tif (fmt->mbus_code == fse->code) {\n+\t\t\tcode_match = true;\n+\t\t\tif (!(fmt->direction & RKISP1_ISP_SD_SINK) &&\n+\t\t\t    fse->pad == RKISP1_ISP_PAD_SINK_VIDEO)\n+\t\t\t\treturn -EINVAL;\n+\t\t\tif (!(fmt->direction & RKISP1_ISP_SD_SRC) &&\n+\t\t\t    fse->pad == RKISP1_ISP_PAD_SOURCE_VIDEO)\n+\t\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n+\tif (!code_match)\n+\t\treturn -EINVAL;\n+\n+\tfse->min_width = RKISP1_ISP_MIN_WIDTH;\n+\tfse->max_width = RKISP1_ISP_MAX_WIDTH;\n+\tfse->min_height = RKISP1_ISP_MIN_HEIGHT;\n+\tfse->max_height = RKISP1_ISP_MAX_HEIGHT;\n+\n+\treturn 0;\n+}\n \n static int rkisp1_isp_init_config(struct v4l2_subdev *sd,\n \t\t\t\t  struct v4l2_subdev_pad_config *cfg)\n@@ -880,6 +918,7 @@ static int rkisp1_subdev_link_validate(struct media_link *link)\n \n static const struct v4l2_subdev_pad_ops rkisp1_isp_pad_ops = {\n \t.enum_mbus_code = rkisp1_isp_enum_mbus_code,\n+\t.enum_frame_size = rkisp1_isp_enum_frame_size,\n \t.get_selection = rkisp1_isp_get_selection,\n \t.set_selection = rkisp1_isp_set_selection,\n \t.init_cfg = rkisp1_isp_init_config,\n","prefixes":["libcamera-devel"]}