From patchwork Fri Feb 27 13:59:45 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 383 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5266C410D2C; Fri, 27 Feb 2026 13:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772200799; cv=none; b=PCvYIXLpUTEjUxzh1px2o82d4kNqhKCgS1mwPh4UtoGcA+rZBTdkjYbS/4yrLRuSoJ/X1xg6YhcTYXOLSUT+I6aegRkyH/+56fu+SAXoQr1dsDNotsJiAmcmPmHOrK3FKl6Jx4fuK7ANOxpafnm0YSzGYZaraUQIcR3+bKezwzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772200799; c=relaxed/simple; bh=pALwRFzWIQKTpcLw9NIyZWrgGnwzLJRpPmwmiwUCRco=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g+58kM4okpMrlBJG2mVZEdni2xf5AsLo/HqLCLqELzbA4gGXpn2JhBH7ST/HM7imYyf2hJE4etJWWZhwW54EOWNANZnbUWNmLJBKnME6K5afuhE87sAL4RjVhdWVphhrw5t7VmV93CiQRc4fr1TAsOdVNjfNO4qvv0/9mf0rzHI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r0rtRgwK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r0rtRgwK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 692F4C19423; Fri, 27 Feb 2026 13:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772200798; bh=pALwRFzWIQKTpcLw9NIyZWrgGnwzLJRpPmwmiwUCRco=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=r0rtRgwK7hc0thW6r5KKfgA/Ffz+6iVy/mi3osKF8lbOnewD7kN4ziqAek6hf5SXM iyBtrxh34JkLNd2FeA6bkfxIe08Q/GJ1D57H4hpFUnzp8jsdiwbYKHiNG5N3vUOHjH FfzQU6xmPS4zhaMkOD3yojiO062DD97cm5/8SUqTSoRr7tKYz4RZ3Fy+vPjPjYUcVW 8cuLp2+eq2iq4en5lZcPDJfw5//65u6a9s0Sa8lBEPovHteebZGLk5+KvDFam+SDoE +T6wLILmncNhdNoQnIa5iNKSF6aUogH8MD0Ks/pjsyxLoJd8t86ZurZqQO39CzNlNA rXN+or21bQDtg== From: Maxime Ripard Date: Fri, 27 Feb 2026 14:59:45 +0100 Subject: [PATCH v2 01/14] drm/connector: Introduce drm_output_color_format enum Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20260227-drm-rework-color-formats-v2-1-8bd278e2af9d@kernel.org> References: <20260227-drm-rework-color-formats-v2-0-8bd278e2af9d@kernel.org> In-Reply-To: <20260227-drm-rework-color-formats-v2-0-8bd278e2af9d@kernel.org> To: Nicolas Frattaroli , Jani Nikula , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Andy Yan , Liviu Dudau , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Liu Ying , Chen-Yu Tsai , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, Jani Nikula X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4252; i=mripard@kernel.org; h=from:subject:message-id; bh=pALwRFzWIQKTpcLw9NIyZWrgGnwzLJRpPmwmiwUCRco=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDJkLFwfHlSzacXxhFLvW79vKTx9UHJxd2ZyQEym4Q/Dsy ieylq+jOqayMAhzMsiKKbI8kQk7vbx9cZWD/cofMHNYmUCGMHBxCsBEnF8yNpw51+9Y46fV6NS7 N2dlcj+r03n/mll7Vrzl7D93z7Lih7hAlq/V42g3p8n33sqvqv3rxtjwtLgg+oCXkfPs13KXFwh Pd65zvzO/8Rz/60kndH04/nYd/RvRVrs8V9W3XdVvxe+7D00A X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Status: O The EDID parsing code initially introduced the DRM_COLOR_FORMAT_* defines to represent the sink capabilities. Since a given sink could support multiple formats, it was first defined as a bitmask. However, the core and drivers have since leveraged those defines to represent both the supported formats but also the current format being used. Considering the latter case, the more natural, and consistent, thing to do would be to create an enum of all the possible formats, and then list the supported formats using a bitmask of the individual enum values. Let's create a new enum following that pattern, drm_output_color_format, while maintaining the DRM_COLOR_FORMAT_* compatibility to make the transition easier. Acked-by: Jani Nikula Reviewed-by: Liviu Dudau Signed-off-by: Maxime Ripard --- include/drm/drm_connector.h | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index c18be8c19de0ab1e02e7d7b1fcd9f2ab5ef1dd15..227f6190438679104f5336be088a73f4529c15fa 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -554,10 +554,35 @@ enum drm_colorspace { DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT = 14, DRM_MODE_COLORIMETRY_BT601_YCC = 15, DRM_MODE_COLORIMETRY_COUNT }; +/** + * enum drm_output_color_format - Output Color Format + * + * This enum is a consolidated color format list supported by + * connectors. It's only ever really been used for HDMI and DP so far, + * so it's not exhaustive and can be extended to represent other formats + * in the future. + * + * + * @DRM_OUTPUT_COLOR_FORMAT_RGB444: + * RGB output format + * @DRM_OUTPUT_COLOR_FORMAT_YCBCR444: + * YCbCr 4:4:4 output format (ie. not subsampled) + * @DRM_OUTPUT_COLOR_FORMAT_YCBCR422: + * YCbCr 4:2:2 output format (ie. with horizontal subsampling) + * @DRM_OUTPUT_COLOR_FORMAT_YCBCR420: + * YCbCr 4:2:0 output format (ie. with horizontal and vertical subsampling) + */ +enum drm_output_color_format { + DRM_OUTPUT_COLOR_FORMAT_RGB444 = 0, + DRM_OUTPUT_COLOR_FORMAT_YCBCR444, + DRM_OUTPUT_COLOR_FORMAT_YCBCR422, + DRM_OUTPUT_COLOR_FORMAT_YCBCR420, +}; + /** * enum drm_bus_flags - bus_flags info for &drm_display_info * * This enum defines signal polarities and clock edge information for signals on * a bus as bitmask flags. @@ -697,14 +722,14 @@ struct drm_display_info { /** * @subpixel_order: Subpixel order of LCD panels. */ enum subpixel_order subpixel_order; -#define DRM_COLOR_FORMAT_RGB444 (1<<0) -#define DRM_COLOR_FORMAT_YCBCR444 (1<<1) -#define DRM_COLOR_FORMAT_YCBCR422 (1<<2) -#define DRM_COLOR_FORMAT_YCBCR420 (1<<3) +#define DRM_COLOR_FORMAT_RGB444 (1 << DRM_OUTPUT_COLOR_FORMAT_RGB444) +#define DRM_COLOR_FORMAT_YCBCR444 (1 << DRM_OUTPUT_COLOR_FORMAT_YCBCR444) +#define DRM_COLOR_FORMAT_YCBCR422 (1 << DRM_OUTPUT_COLOR_FORMAT_YCBCR422) +#define DRM_COLOR_FORMAT_YCBCR420 (1 << DRM_OUTPUT_COLOR_FORMAT_YCBCR420) /** * @panel_orientation: Read only connector property for built-in panels, * indicating the orientation of the panel vs the device's casing. * drm_connector_init() sets this to DRM_MODE_PANEL_ORIENTATION_UNKNOWN. @@ -712,14 +737,15 @@ struct drm_display_info { * fb to compensate and gets exported as prop to userspace. */ int panel_orientation; /** - * @color_formats: HDMI Color formats, selects between RGB and YCrCb - * modes. Used DRM_COLOR_FORMAT\_ defines, which are _not_ the same ones - * as used to describe the pixel format in framebuffers, and also don't - * match the formats in @bus_formats which are shared with v4l. + * @color_formats: HDMI Color formats, selects between RGB and + * YCbCr modes. Uses a bitmask of DRM_OUTPUT_COLOR_FORMAT\_ + * defines, which are _not_ the same ones as used to describe + * the pixel format in framebuffers, and also don't match the + * formats in @bus_formats which are shared with v4l. */ u32 color_formats; /** * @bus_formats: Pixel data format on the wire, somewhat redundant with