Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2372174rdb; Sun, 3 Dec 2023 14:16:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYQRQG63Rl51zSi9y6wLInFY7NDNdKM2qyo9yXQNN3+EtRwE3OWomhlFT3UduSiZGPLujz X-Received: by 2002:a05:6358:90d:b0:16e:6185:cabc with SMTP id r13-20020a056358090d00b0016e6185cabcmr4468658rwi.27.1701641787698; Sun, 03 Dec 2023 14:16:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701641787; cv=none; d=google.com; s=arc-20160816; b=0bDW2aSS94dvx9WgqUaP5pZmPa9WVTjG/mwRKmgmkk/3FDdtzGRAQ7xKmpK+QWrV+N si8+4u/8xvsN4T/nkQH03Vn9WoBwaOQ8VyKPL/68bA+Nzy3ywxMjYDCaTZxQK7NRUj/o bVe4FUzUVjB7xGrVsZBnJoq4sTFQvFBSx2I7x9NcDQ6NdHRKlawzjlLXQmhF7Jm0ARaW rgkfW6fKMTflayexOY4TyO6tnAjLxNmqUYKuG5TjR5y01Rz3gFaiJ79fnsQsVwFbo4KI yeXSIT4k1Rd/oeJ7DE5G2lReZAtnX4mZWvJdOD6YTy6rkq6SA4Nm9bTM6ErSFN/+TUCF Ytgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Tp4hrKRCxPQEfU5u2oM3FN+8Te5fEZUyhu2s23erNVg=; fh=sUQgTRR22kX0Sstoxu6ZtUKYQ9yh4IUoknZU/TJK6YU=; b=CfULwPwGSHzJTbYXMyWyuCxBqFK73xJ7jx0tQs6BwnXDd0VfQqjrNc9ofYTFRcnfv9 Hgo0/tgDjo2wb9CuRYDTPM1Lgq1FsDthQXxfklQMbbuOmm0XH1gPg2EljQkGmwBlLiUg ET57y/EEkXAm9jvbaTQbm2NAT2ucje50bJTEdc8oQ3kZsFyxOJMzOWguyhRhvrM3722M 7ux4dKBTCrw4vmUhtXSzhQx+TCNw+CqaQvW5qHT8zRMqzesl1ygpKVmBJOeactOakb1e P1plJDQBuI8N4cAWwhwJDF1ddfYd2W62eHX4AzYITJ5V5K0E24N+dB2EcrAWH6Kn4qIJ gzcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ScaX2Gk2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id c22-20020a170902b69600b001d08122900csi1919205pls.264.2023.12.03.14.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 14:16:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ScaX2Gk2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id C95BD807C6FC; Sun, 3 Dec 2023 14:16:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229793AbjLCWPj (ORCPT + 99 others); Sun, 3 Dec 2023 17:15:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjLCWPi (ORCPT ); Sun, 3 Dec 2023 17:15:38 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6436D7; Sun, 3 Dec 2023 14:15:44 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6cb74a527ceso2619716b3a.2; Sun, 03 Dec 2023 14:15:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701641744; x=1702246544; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Tp4hrKRCxPQEfU5u2oM3FN+8Te5fEZUyhu2s23erNVg=; b=ScaX2Gk2moa4uz1OkmY2GyYQIhHris3i78cwsOarJqLHkIu+Q20irZmLnKt6vRCR09 wfzirAGvikCPbWKqKf60D0wxLKBCd9c2mKKyZDoGpgiOcoj/E8i6JN0NAXPpRLWChC85 asdo/pGMq10n0yInk9loBlYsmF7kunG0oblii71cX9wP5GcsE5y1qL9yIO1Tg/6/Ibit 39FDSEgqcRshg0PiyugzFPJuQFUUqg1CzKuK6BSKqVbTIUKZw1SR4n5oRAXm8qKUHfLd NLEHmRBbeP0x/dJGUOaRz/klCldbz5d0pjsH/uv2ThlPL8as6M987taj5DClmtEEBXFi F2ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701641744; x=1702246544; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Tp4hrKRCxPQEfU5u2oM3FN+8Te5fEZUyhu2s23erNVg=; b=Ifdt+fUKQChj8ChnxYHj3YI7aJgrUPWvCuxyJcIa02WVJlE19rnnXWb0VqjUX3R6Ge JrtT2rU/jAIcA74Uy7PavnOy5zGKF++eerabe8X/n1NU3HFZxxYZQ9xDwAPPXf55fyR0 W0OL+63NVPExVzlb+UOgNKofOk8mfLc2CyK4HStiWIKuE9TKXTyWImr4iLDHHhwh10Xv L2OR4TYTkL9NsSzHAQ7n+KJe5/wXKNwsDFSBkgM2ok0NPC1ryB1MgB6ueuZCcFtAgEt0 6ra7efVM6nErUWkcogJwb/QnB1yzWPxLQNbXLqyMwcIiRLkcsDK4mTWotf/9DsXPngOR 4jCw== X-Gm-Message-State: AOJu0YwYM8m++cjd90tvz6ILKbOQsk2puUDJbcEEzespTBWUFT5YlVuY +ML/5vk2Su+J3AfgsBz/xUshPVF7iZiYpweQDUc= X-Received: by 2002:a17:90a:fa8e:b0:286:811c:c3b5 with SMTP id cu14-20020a17090afa8e00b00286811cc3b5mr930976pjb.2.1701641743977; Sun, 03 Dec 2023 14:15:43 -0800 (PST) MIME-Version: 1.0 References: <20231129092759.242641-1-paul.elder@ideasonboard.com> <20231129092759.242641-12-paul.elder@ideasonboard.com> In-Reply-To: From: Adam Ford Date: Sun, 3 Dec 2023 16:15:32 -0600 Message-ID: Subject: Re: [PATCH v4 11/11] media: rkisp1: Add UYVY as an output format To: Paul Elder Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, kieran.bingham@ideasonboard.com, tomi.valkeinen@ideasonboard.com, umang.jain@ideasonboard.com, Laurent Pinchart , Dafna Hirschfeld , Mauro Carvalho Chehab , Heiko Stuebner , "moderated list:ARM/Rockchip SoC support" , open list , Fabio Estevam Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 03 Dec 2023 14:16:04 -0800 (PST) On Sun, Dec 3, 2023 at 3:32=E2=80=AFPM Adam Ford wrote= : > > On Wed, Nov 29, 2023 at 3:29=E2=80=AFAM Paul Elder wrote: > > > > Add support for UYVY as an output format. The uv_swap bit in the > > MI_XTD_FORMAT_CTRL register that is used for the NV formats does not > > work for packed YUV formats. Thus, UYVY support is implemented via > > byte-swapping. This method clearly does not work for implementing > > support for YVYU and VYUY. > > > > Signed-off-by: Paul Elder > > Reviewed-by: Laurent Pinchart > > Signed-off-by: Laurent Pinchart > > --- > > .../platform/rockchip/rkisp1/rkisp1-capture.c | 41 +++++++++++++++++++ > > 1 file changed, 41 insertions(+) > > > Paul, > > I tested this patch series from one of the older submissions and I was > able to get it working, but I could not get the video to capture to > work no matter what resolution or video format I tried. Each time, I > get the same error message: rkisp1 32e10000.isp: start pipeline > failed -32 > > Do you have an example of how you configured the pipeline and how you > invoked the video capture? I have it working now but I had to apply the patch [1] provided by Tomi in order for it to work properly Can you send another revision with his patch included in the series? With that, you can add Tested-by: Adam Ford #imx8mp-beacon-kit Thank you. adam [1] - https://gitlab.com/ideasonboard/nxp/linux/-/commit/d6477fe673b1c0d05d= 12ae21d8db9a03b07e7fea > > thanks > > adam > > > > > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/= drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c > > index a352893308b6..b50b044d22af 100644 > > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c > > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c > > @@ -97,6 +97,12 @@ static const struct rkisp1_capture_fmt_cfg rkisp1_mp= _fmts[] =3D { > > .uv_swap =3D 0, > > .write_format =3D RKISP1_MI_CTRL_MP_WRITE_YUVINT, > > .mbus =3D MEDIA_BUS_FMT_YUYV8_2X8, > > + }, { > > + .fourcc =3D V4L2_PIX_FMT_UYVY, > > + .uv_swap =3D 0, > > + .yc_swap =3D 1, > > + .write_format =3D RKISP1_MI_CTRL_MP_WRITE_YUVINT, > > + .mbus =3D MEDIA_BUS_FMT_YUYV8_2X8, > > }, { > > .fourcc =3D V4L2_PIX_FMT_YUV422P, > > .uv_swap =3D 0, > > @@ -231,6 +237,13 @@ static const struct rkisp1_capture_fmt_cfg rkisp1_= sp_fmts[] =3D { > > .write_format =3D RKISP1_MI_CTRL_SP_WRITE_INT, > > .output_format =3D RKISP1_MI_CTRL_SP_OUTPUT_YUV422, > > .mbus =3D MEDIA_BUS_FMT_YUYV8_2X8, > > + }, { > > + .fourcc =3D V4L2_PIX_FMT_UYVY, > > + .uv_swap =3D 0, > > + .yc_swap =3D 1, > > + .write_format =3D RKISP1_MI_CTRL_SP_WRITE_INT, > > + .output_format =3D RKISP1_MI_CTRL_SP_OUTPUT_YUV422, > > + .mbus =3D MEDIA_BUS_FMT_YUYV8_2X8, > > }, { > > .fourcc =3D V4L2_PIX_FMT_YUV422P, > > .uv_swap =3D 0, > > @@ -464,6 +477,20 @@ static void rkisp1_mp_config(struct rkisp1_capture= *cap) > > rkisp1_write(rkisp1, RKISP1_CIF_MI_XTD_FORMAT_CTRL, reg= ); > > } > > > > + /* > > + * U/V swapping with the MI_XTD_FORMAT_CTRL register only works= for > > + * NV12/NV21 and NV16/NV61, so instead use byte swap to support= UYVY. > > + * YVYU and VYUY cannot be supported with this method. > > + */ > > + if (rkisp1->info->features & RKISP1_FEATURE_MI_OUTPUT_ALIGN) { > > + reg =3D rkisp1_read(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_= FORMAT); > > + if (cap->pix.cfg->yc_swap) > > + reg |=3D RKISP1_CIF_OUTPUT_ALIGN_FORMAT_MP_BYTE= _SWAP_BYTES; > > + else > > + reg &=3D ~RKISP1_CIF_OUTPUT_ALIGN_FORMAT_MP_BYT= E_SWAP_BYTES; > > + rkisp1_write(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT,= reg); > > + } > > + > > rkisp1_mi_config_ctrl(cap); > > > > reg =3D rkisp1_read(rkisp1, RKISP1_CIF_MI_CTRL); > > @@ -507,6 +534,20 @@ static void rkisp1_sp_config(struct rkisp1_capture= *cap) > > rkisp1_write(rkisp1, RKISP1_CIF_MI_XTD_FORMAT_CTRL, reg= ); > > } > > > > + /* > > + * U/V swapping with the MI_XTD_FORMAT_CTRL register only works= for > > + * NV12/NV21 and NV16/NV61, so instead use byte swap to support= UYVY. > > + * YVYU and VYUY cannot be supported with this method. > > + */ > > + if (rkisp1->info->features & RKISP1_FEATURE_MI_OUTPUT_ALIGN) { > > + reg =3D rkisp1_read(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_= FORMAT); > > + if (cap->pix.cfg->yc_swap) > > + reg |=3D RKISP1_CIF_OUTPUT_ALIGN_FORMAT_SP_BYTE= _SWAP_BYTES; > > + else > > + reg &=3D ~RKISP1_CIF_OUTPUT_ALIGN_FORMAT_SP_BYT= E_SWAP_BYTES; > > + rkisp1_write(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT,= reg); > > + } > > + > > rkisp1_mi_config_ctrl(cap); > > > > mi_ctrl =3D rkisp1_read(rkisp1, RKISP1_CIF_MI_CTRL); > > -- > > 2.39.2 > >