From patchwork Sat Feb 5 23:33:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Rudenko X-Patchwork-Id: 12736459 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02076C433F5 for ; Sat, 5 Feb 2022 23:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=b9MepvXYLZ3SeWK0v5+N1+GLNTeQnnFmMJwb9ihDDRk=; b=uh27FQrIPdeyAo p3DSSGIlwycY0+cKrBrGT3gjiPNsNOhTzC6HUltLOHBiDHuu1ElmCzua0HMKLmqT7z962rXXhBqe8 +5sS5RoVzfFRwqxN8QHA9KaljNJ9BDaZ9levRAqZtP1CIi6+OEjIlWlognOeoszQriK1g5xUGwbuS DxB4w8FOs/gRyUf1bEfzfb7nueUvdWwW00zWZO2tBYEG4nXcN0q83v934SJB2wwriKa4kcw9D9MIZ pQGTeeGGpkYUHAJvJsXTtd5eFKp55YiHiNBHL++ttNkEIvK/zhXu9mybYAeiKkbpMLq5qPU9QKZCu FIH6F/XSk//71o4NasMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nGUZ2-007fRl-4x; Sat, 05 Feb 2022 23:33:56 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nGUYy-007fRJ-1m for linux-arm-kernel@lists.infradead.org; Sat, 05 Feb 2022 23:33:53 +0000 Received: by mail-lf1-x134.google.com with SMTP id i34so19854600lfv.2 for ; Sat, 05 Feb 2022 15:33:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hTGxMUD+Y/e2SIuHcf/n5N/bPbvSPfdhfosfyFHnjSM=; b=AQgPUOEAAjsob5q1TYDcbdFYKdASPIsg0LD2bQ9Ww+lq1e8NGppyzWXIZc6oGuO5si 5OlTFy1CH3JL0RFpk8mg1tC/FwmkL3AbT4MKU8dMfWOIS5hEcoNwPtobYKy7hdYHYnXf K/R/Oj1bTYZf9WXAfwUt46sbtEjtDCBdlX69AFQzDz31jya8LcyMcvvJ3B4iS1t92cYG lzbRVQltOoBMM8QlAOi+ZgEQE3/B7UhM250O5Px6vc1PkXuuxWXEt9DG8qKAVJvU3end wCrtoOFSKS7gzJAhibl1wtLa7tkgmvjZ79bQtA9xabREftpEZTD+K3L1cvGfjsGSDonq YzAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hTGxMUD+Y/e2SIuHcf/n5N/bPbvSPfdhfosfyFHnjSM=; b=udTByPtvp8mMT6o1+QO4Nz9syBrcfPJ13T147faQev1BN/O0v/CML8A/7LnCy/0yQ6 e59qY1lVD95LuMjH97KsJkJusS2jKGu2mcao/YLkb0OESJ2kIpg1s6HOrYh9PmGxPPqe puecgUIZOgTjRQMRIz4ttRA1YpAPftSTmwyhJPmXjRhjCn8Jl585mvX6pfxDNGK/deJj uiKQ20yQQNBRuZkvoREk376K/DY5r+h2i6+bdfv8xQkFXS/JcYjNQ+T3SoD3BiUupDq2 HPiUEBL4lJhsg2Q8dnczW7HLRFbAAAEMIlWW8+KWRrMJ6heqf9sVhhC+JnJDL8zfzIiV ED0w== X-Gm-Message-State: AOAM533BMZIa2DHogCpLU7XmiTdVHokVCN6+zPIZKYxSRwtpjsVu3QDA 0zGOu8oeUQN5vhpM3ypIui0= X-Google-Smtp-Source: ABdhPJwUsYwrar5ZAoigpEbg5JFCfrjJ8wLITtvOjwBLyZsNPKwjEXajuiSrFa/SoMQ6m7N/SK3Q4Q== X-Received: by 2002:ac2:4c09:: with SMTP id t9mr3715612lfq.406.1644104029408; Sat, 05 Feb 2022 15:33:49 -0800 (PST) Received: from localhost (93-80-64-103.broadband.corbina.ru. [93.80.64.103]) by smtp.gmail.com with ESMTPSA id m12sm888400lfj.90.2022.02.05.15.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Feb 2022 15:33:48 -0800 (PST) From: Mikhail Rudenko To: Yong Deng , Mauro Carvalho Chehab , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec Cc: Mikhail Rudenko , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] media: sun6i-csi: fix colorspace in sun6i_video_try_fmt() Date: Sun, 6 Feb 2022 02:33:31 +0300 Message-Id: <20220205233332.67316-1-mike.rudenko@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220205_153352_142553_98018EC5 X-CRM114-Status: GOOD ( 12.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With gstreamer 1.19.3 all attempts to capture video in YUV formats on our Allwinner H3-based custom board with an ov5640 sensor result in pipeline crashes with the following messages: Device '/dev/video0' does not support 2:0:0:0 colorimetry Additional debug info: Device wants 2:0:0:0 colorimetry Fix this by setting the correct colorspace in sun6i_video_try_fmt(). Signed-off-by: Mikhail Rudenko --- Actually there is a second issue with sun6i_video_try_fmt(): reported bytesperline is wrong for planar YUV formats, but I believe it will be fixed by [1]. [1] https://lore.kernel.org/linux-media/20220205185429.2278860-40-paul.kocialkowski@bootlin.com/ drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.35.1 diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c index 607a8d39fbe2..682c26536034 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c @@ -368,7 +368,11 @@ static int sun6i_video_try_fmt(struct sun6i_video *video, if (pixfmt->field == V4L2_FIELD_ANY) pixfmt->field = V4L2_FIELD_NONE; - pixfmt->colorspace = V4L2_COLORSPACE_RAW; + if (pixfmt->pixelformat == V4L2_PIX_FMT_JPEG) + pixfmt->colorspace = V4L2_COLORSPACE_JPEG; + else + pixfmt->colorspace = V4L2_COLORSPACE_SRGB; + pixfmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; pixfmt->quantization = V4L2_QUANTIZATION_DEFAULT; pixfmt->xfer_func = V4L2_XFER_FUNC_DEFAULT;