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: 12736460 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 428F7C433EF for ; Sat, 5 Feb 2022 23:33:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229551AbiBEXdw (ORCPT ); Sat, 5 Feb 2022 18:33:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbiBEXdw (ORCPT ); Sat, 5 Feb 2022 18:33:52 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C471C061348; Sat, 5 Feb 2022 15:33:51 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id k13so19757946lfg.9; Sat, 05 Feb 2022 15:33:51 -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=XB3paKotgFhIZ/36d9C/Vx5/kJtiIwmHt9DdkhNRKzKuhYvFBIJpk14ht4V6HzmbEQ 0S4WiovGtwC9ZXgqoJRJ8PQ8rw7/U8arSTKaEW91R8Fo7NAkb/qD4iS+CB0PnJQEthfe l1Qk4vqcfAMhrjbi357BK7EX4UUwZv/g+jtp6tvQG1xjRzXuBZX1VZfDsM2vi6QiYIts vFuw3l3GQqhlR5oANoLv6ECRNEVrOHfQ0DxQTsNVo1omOZLJ8wX1lc6kwl3+uN2cviXb fnIv6/HEsXyl/0k/7zXwX9w5AMIp4Zsyl+xaXduDZCUV/gszJkUqUkus3DagY2J0PewT bVeg== X-Gm-Message-State: AOAM530dklD3B8HDhFbF5GyiluC6w34MEk4lT6IMfrFNuVToYZnwrDHe UrA+LpcuCT89Audw6BSHv10= 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 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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;