From patchwork Thu Nov 9 21:03:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 163592 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp706923vqs; Thu, 9 Nov 2023 13:06:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFb0gaeiqTzemumybK8yC5xjn0lYvQtG+sISP6/e9LnOf4Iiv1/oiTgAG1bpY7UOG7qp7tV X-Received: by 2002:a17:902:c40d:b0:1cc:644a:2129 with SMTP id k13-20020a170902c40d00b001cc644a2129mr566638plk.32.1699563995608; Thu, 09 Nov 2023 13:06:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699563995; cv=none; d=google.com; s=arc-20160816; b=QJxnBhBhBsd9VjY5EJcp1xo9itq+e8kpsFUU1/+HHwP4+r0RiR268bwRtgszDAjhLb cpTN/I8xUsaZFo9uNxwHY8dyZ6c+18aShJM4NcAvN42CEPa044etQ3o1fsRCOhYWYg94 P3nvU9Eo210crcxXYmL8KfF4jEm71lYManLXPtz6oFZvpSjPSTtmpIZ+WLKwia+Y6cw8 jxXaoa8E+VyZekRX63v5gaAO+MDUOhG8OEE4tEE+4M7euwL4tiT6xfjaj+qtUFrMavai va/g0/W8VhhTxn0WueriGnDK0X2V9QLg5NsA59Ivm+QIJ6KgegIOcP8j2YuN1Rpec71w 0Xkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=l71D9HBVmoKfp7L7U0fT/drr6G7wub2gayAUjDg6aQc=; fh=3Pg7dF7ltFmkx5SCxvVUwuCJQkWW9tguyU6EK7OdmdE=; b=pPeWttXRkLKOSYpYGgt+EJp4qg55fx7s/j0g3crBRpGnEF311ODm0tdHo7tHOR00et JWMcIEHG2Zs+eQ4wIOHa+Ip4AWeQUw53v1qHLd98pJeb3exQc79Cb0U06Dy90VxnbeYa ravoy+6jyYzecJ4ezx8tKOO8Ac4wZoAOyNYX2y77MyA0OFSD+wsB3gR6T7a0QJb0cic5 Uc4blTrC52a/LPtoKH7Ii870viwQmGIseb1vZiHhiTrRdnUI416ARQh5mMnOWyehcqpS hhS6/YkhA7S0n3JGyLaArNPxe3+HOes2nKG9tUT95Qi82ltbIZ5vFyHCAr/V+yXVj7vD gbdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=EL37U8T9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id lo5-20020a170903434500b001c736266dedsi5284439plb.189.2023.11.09.13.06.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 13:06:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=EL37U8T9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id CAB278089846; Thu, 9 Nov 2023 13:06:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345278AbjKIVEi (ORCPT + 30 others); Thu, 9 Nov 2023 16:04:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345281AbjKIVEI (ORCPT ); Thu, 9 Nov 2023 16:04:08 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AB8349C9; Thu, 9 Nov 2023 13:03:51 -0800 (PST) Received: from umang.jain (unknown [103.251.226.64]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C66576EF; Thu, 9 Nov 2023 22:03:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699563808; bh=sTZwjAPZQBasibelnMmyXY/yI6VlmvAZneMtzwqTaxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EL37U8T9Nfm5C9Y/keayN8Tu1S23YpGln4X/CzuubejzVZs7RziSupsCOLSAjcWlW EC7PXjdmHHwiDURADP76eacFnbHMeTPSe39CcLwWcaAQeUiC5CAx4ZSwUE8hXXB9T/ +HCsRAcNN+66soZueNo+R5SiVxfOSszdJcEweGx4= From: Umang Jain To: linux-media@vger.kernel.org, kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev Cc: Dave Stevenson , Kieran Bingham , Laurent Pinchart , "Ricardo B . Marliere" , Dan Carpenter , Stefan Wahren , David Plowman , Umang Jain Subject: [PATCH v2 12/15] vc04_services: bcm2835-isp: Permit all sRGB colour spaces on ISP outputs Date: Thu, 9 Nov 2023 16:03:04 -0500 Message-ID: <20231109210309.638594-13-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231109210309.638594-1-umang.jain@ideasonboard.com> References: <20231109210309.638594-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 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 (agentk.vger.email [0.0.0.0]); Thu, 09 Nov 2023 13:06:04 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782122016186469630 X-GMAIL-MSGID: 1782122016186469630 From: David Plowman bcm2835-isp outputs actually support all colour spaces that are fundamentally sRGB underneath, regardless of whether an RGB or YUV output format is actually requested. Signed-off-by: David Plowman Signed-off-by: Umang Jain --- .../bcm2835-isp/bcm2835-isp-fmts.h | 45 ++++++++++--------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-isp/bcm2835-isp-fmts.h b/drivers/staging/vc04_services/bcm2835-isp/bcm2835-isp-fmts.h index 5c874cdd2fe7..30c14a44f399 100644 --- a/drivers/staging/vc04_services/bcm2835-isp/bcm2835-isp-fmts.h +++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835-isp-fmts.h @@ -35,14 +35,19 @@ struct bcm2835_isp_fmt { #define V4L2_COLORSPACE_MASK_RAW V4L2_COLORSPACE_MASK(V4L2_COLORSPACE_RAW) /* - * The colour spaces we support for YUV outputs. SRGB features here because, - * once you assign the default transfer func and so on, it and JPEG effectively - * mean the same. + * All three colour spaces JPEG, SMPTE170M and REC709 are fundamentally sRGB + * underneath (as near as makes no difference to us), just with different YCbCr + * encodings. Therefore the ISP can generate sRGB on its main output and any of + * the others on its low resolution output. Applications should, when using both + * outputs, program the colour spaces on them to be the same, matching whatever + * is requested for the low resolution output, even if the main output is + * producing an RGB format. In turn this requires us to allow all these colour + * spaces for every YUV/RGB output format. */ -#define V4L2_COLORSPACE_MASK_YUV (V4L2_COLORSPACE_MASK_JPEG | \ - V4L2_COLORSPACE_MASK_SRGB | \ - V4L2_COLORSPACE_MASK_SMPTE170M | \ - V4L2_COLORSPACE_MASK_REC709) +#define V4L2_COLORSPACE_MASK_ALL_SRGB (V4L2_COLORSPACE_MASK_JPEG | \ + V4L2_COLORSPACE_MASK_SRGB | \ + V4L2_COLORSPACE_MASK_SMPTE170M | \ + V4L2_COLORSPACE_MASK_REC709) static const struct bcm2835_isp_fmt supported_formats[] = { { @@ -52,7 +57,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = { .bytesperline_align = 64, .mmal_fmt = MMAL_ENCODING_I420, .size_multiplier_x2 = 3, - .colorspace_mask = V4L2_COLORSPACE_MASK_YUV, + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, .colorspace_default = V4L2_COLORSPACE_JPEG, .step_size = 2, }, { @@ -61,7 +66,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = { .bytesperline_align = 64, .mmal_fmt = MMAL_ENCODING_YV12, .size_multiplier_x2 = 3, - .colorspace_mask = V4L2_COLORSPACE_MASK_YUV, + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, .colorspace_default = V4L2_COLORSPACE_SMPTE170M, .step_size = 2, }, { @@ -70,7 +75,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = { .bytesperline_align = 32, .mmal_fmt = MMAL_ENCODING_NV12, .size_multiplier_x2 = 3, - .colorspace_mask = V4L2_COLORSPACE_MASK_YUV, + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, .colorspace_default = V4L2_COLORSPACE_SMPTE170M, .step_size = 2, }, { @@ -79,7 +84,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = { .bytesperline_align = 32, .mmal_fmt = MMAL_ENCODING_NV21, .size_multiplier_x2 = 3, - .colorspace_mask = V4L2_COLORSPACE_MASK_YUV, + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, .colorspace_default = V4L2_COLORSPACE_SMPTE170M, .step_size = 2, }, { @@ -88,7 +93,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = { .bytesperline_align = 64, .mmal_fmt = MMAL_ENCODING_YUYV, .size_multiplier_x2 = 2, - .colorspace_mask = V4L2_COLORSPACE_MASK_YUV, + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, .colorspace_default = V4L2_COLORSPACE_SMPTE170M, .step_size = 2, }, { @@ -97,7 +102,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = { .bytesperline_align = 64, .mmal_fmt = MMAL_ENCODING_UYVY, .size_multiplier_x2 = 2, - .colorspace_mask = V4L2_COLORSPACE_MASK_YUV, + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, .colorspace_default = V4L2_COLORSPACE_SMPTE170M, .step_size = 2, }, { @@ -106,7 +111,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = { .bytesperline_align = 64, .mmal_fmt = MMAL_ENCODING_YVYU, .size_multiplier_x2 = 2, - .colorspace_mask = V4L2_COLORSPACE_MASK_YUV, + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, .colorspace_default = V4L2_COLORSPACE_SMPTE170M, .step_size = 2, }, { @@ -115,7 +120,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = { .bytesperline_align = 64, .mmal_fmt = MMAL_ENCODING_VYUY, .size_multiplier_x2 = 2, - .colorspace_mask = V4L2_COLORSPACE_MASK_YUV, + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, .colorspace_default = V4L2_COLORSPACE_SMPTE170M, .step_size = 2, }, { @@ -125,7 +130,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = { .bytesperline_align = 32, .mmal_fmt = MMAL_ENCODING_RGB24, .size_multiplier_x2 = 2, - .colorspace_mask = V4L2_COLORSPACE_MASK_SRGB, + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, .colorspace_default = V4L2_COLORSPACE_SRGB, .step_size = 1, }, { @@ -134,7 +139,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = { .bytesperline_align = 32, .mmal_fmt = MMAL_ENCODING_RGB16, .size_multiplier_x2 = 2, - .colorspace_mask = V4L2_COLORSPACE_MASK_SRGB, + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, .colorspace_default = V4L2_COLORSPACE_SRGB, .step_size = 1, }, { @@ -143,7 +148,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = { .bytesperline_align = 32, .mmal_fmt = MMAL_ENCODING_BGR24, .size_multiplier_x2 = 2, - .colorspace_mask = V4L2_COLORSPACE_MASK_SRGB, + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, .colorspace_default = V4L2_COLORSPACE_SRGB, .step_size = 1, }, { @@ -152,7 +157,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = { .bytesperline_align = 64, .mmal_fmt = MMAL_ENCODING_BGRA, .size_multiplier_x2 = 2, - .colorspace_mask = V4L2_COLORSPACE_MASK_SRGB, + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, .colorspace_default = V4L2_COLORSPACE_SRGB, .step_size = 1, }, { @@ -161,7 +166,7 @@ static const struct bcm2835_isp_fmt supported_formats[] = { .bytesperline_align = 64, .mmal_fmt = MMAL_ENCODING_RGBA, .size_multiplier_x2 = 2, - .colorspace_mask = V4L2_COLORSPACE_MASK_SRGB, + .colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB, .colorspace_default = V4L2_COLORSPACE_SRGB, .step_size = 1, }, {