Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4961146rwb; Mon, 21 Nov 2022 14:31:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf7EtMn9T8hKtUWgreU5Mmr0MLLW6XkLccXpxewlChCqIdcYZrVSPlYeRfwph6vKTAQpg16q X-Received: by 2002:a17:903:3254:b0:189:2184:62f6 with SMTP id ji20-20020a170903325400b00189218462f6mr1478830plb.24.1669069872862; Mon, 21 Nov 2022 14:31:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669069872; cv=none; d=google.com; s=arc-20160816; b=wzZ/kaRAuieRUczN0rTYrkptq/u3PKc/3v+FXis50UMlkUV+zCv7pDCfvVtGX0r5tK dcX/fe2oGsYYkysOuBTeMY1VlSThrBa/FJQ8dWtP18IrFi8uJCvRACCjjc0CrwHBvnCh XVYy3EsZ4BEfI0on2GhDu4dcTU3wT24IaGdQ1Mjpc+7++KQD3KbADicXFKnIwOEDASOZ Ps7SGf587xtbR5Jyp/vBZCaO2X3/KNedR+nnoB5yZ64t5PWY3gOgKkT80g9Oz9L5O2OE /0vFvMZSv2D6BOr54haHVOb4ePicRC0H76CMSVGUTw+ohIxYxvcQUVcKp6S7izuGxW9K ybsw== 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=Yy143xaKos2uCSWoc5ZR2VkKHygem+weN7IsyFsURUM=; b=TsjZSzf1xiWdu7xcBrHNusmlnk5R6RA4ihhXSoUJTgRhfzVPOtUCv0HluUSmQS9PFY SLZwa9ik5suVEet1AQznFkGR3T0t7y0EPJZ1u2FxucuNi/CvWppjM38E6svFH3BtY+b0 9Jjfmd8WAkhcvuNWwYTp0F6nx7aiEg47rheNkv+ufoYLlvUd2TTsqTKIKwpBXv95y3DU Ye50ej65ZdqZTCyHft3v5kf3q5LjHhSQ591fhM+eX/adYBgD8fXHsC/seZBsuZPvQ2MI 9isAY7bT+JwANMatxT+Qz5w9eeDsgMfSCJPTKSe+CRZmfPyCHgkTIJ3Qv9gdJ3K/tDWn GTew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=vPgU8M8O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b16-20020a170902d51000b0018666611f85si13717757plg.508.2022.11.21.14.31.01; Mon, 21 Nov 2022 14:31:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=vPgU8M8O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231948AbiKUVuh (ORCPT + 92 others); Mon, 21 Nov 2022 16:50:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231939AbiKUVuH (ORCPT ); Mon, 21 Nov 2022 16:50:07 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4B33DB85E; Mon, 21 Nov 2022 13:50:06 -0800 (PST) Received: from umang.jainideasonboard.com (unknown [103.86.18.138]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DA9C2E61; Mon, 21 Nov 2022 22:50:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1669067405; bh=oSxZ1uW81ySYSzLce6c6BF+DwUMI/z4Wsarl5TIz+i4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vPgU8M8OY314oDDivcL/h5E3oyv9hwoE+J369HMhl64dvtSEOSu7TQe9PMwGYQdJD KyqknS4lEzzjGIsiqRIGphc96v9sSwDArbblLReH36A4eZ3r62iggVgQqmunm3Ugki Dk2jHJO4saPsIDHP8IBFwZAnnCsBsS0a2idofNAQ= 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, Broadcom internal kernel review list Cc: Dave Stevenson , Florian Fainelli , Naushir Patuck , David Plowman , Kieran Bingham , Laurent Pinchart , Umang Jain Subject: [PATCH 11/14] WIP: vc04_services: bcm2835-isp: Permit all sRGB colour spaces on ISP outputs Date: Tue, 22 Nov 2022 03:17:19 +0530 Message-Id: <20221121214722.22563-12-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221121214722.22563-1-umang.jain@ideasonboard.com> References: <20221121214722.22563-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 a545dbf2b5dd..5ab232ff9bd9 100644 --- a/drivers/staging/vc04_services/bcm2835-isp/bcm2835-isp-fmts.h +++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835-isp-fmts.h @@ -34,14 +34,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[] = { { @@ -51,7 +56,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, }, { @@ -60,7 +65,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, }, { @@ -69,7 +74,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, }, { @@ -78,7 +83,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, }, { @@ -87,7 +92,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, }, { @@ -96,7 +101,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, }, { @@ -105,7 +110,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, }, { @@ -114,7 +119,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, }, { @@ -124,7 +129,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, }, { @@ -133,7 +138,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, }, { @@ -142,7 +147,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, }, { @@ -151,7 +156,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, }, { @@ -160,7 +165,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, }, { -- 2.37.3