Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/connector: Introduce drm_output_color_format enum

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 <jani.nikula@intel.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260305-drm-rework-color-formats-v3-1-f3935f6db579@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org>

+34 -8
+34 -8
include/drm/drm_connector.h
··· 557 557 }; 558 558 559 559 /** 560 + * enum drm_output_color_format - Output Color Format 561 + * 562 + * This enum is a consolidated color format list supported by 563 + * connectors. It's only ever really been used for HDMI and DP so far, 564 + * so it's not exhaustive and can be extended to represent other formats 565 + * in the future. 566 + * 567 + * 568 + * @DRM_OUTPUT_COLOR_FORMAT_RGB444: 569 + * RGB output format 570 + * @DRM_OUTPUT_COLOR_FORMAT_YCBCR444: 571 + * YCbCr 4:4:4 output format (ie. not subsampled) 572 + * @DRM_OUTPUT_COLOR_FORMAT_YCBCR422: 573 + * YCbCr 4:2:2 output format (ie. with horizontal subsampling) 574 + * @DRM_OUTPUT_COLOR_FORMAT_YCBCR420: 575 + * YCbCr 4:2:0 output format (ie. with horizontal and vertical subsampling) 576 + */ 577 + enum drm_output_color_format { 578 + DRM_OUTPUT_COLOR_FORMAT_RGB444 = 0, 579 + DRM_OUTPUT_COLOR_FORMAT_YCBCR444, 580 + DRM_OUTPUT_COLOR_FORMAT_YCBCR422, 581 + DRM_OUTPUT_COLOR_FORMAT_YCBCR420, 582 + }; 583 + 584 + /** 560 585 * enum drm_bus_flags - bus_flags info for &drm_display_info 561 586 * 562 587 * This enum defines signal polarities and clock edge information for signals on ··· 724 699 */ 725 700 enum subpixel_order subpixel_order; 726 701 727 - #define DRM_COLOR_FORMAT_RGB444 (1<<0) 728 - #define DRM_COLOR_FORMAT_YCBCR444 (1<<1) 729 - #define DRM_COLOR_FORMAT_YCBCR422 (1<<2) 730 - #define DRM_COLOR_FORMAT_YCBCR420 (1<<3) 702 + #define DRM_COLOR_FORMAT_RGB444 (1 << DRM_OUTPUT_COLOR_FORMAT_RGB444) 703 + #define DRM_COLOR_FORMAT_YCBCR444 (1 << DRM_OUTPUT_COLOR_FORMAT_YCBCR444) 704 + #define DRM_COLOR_FORMAT_YCBCR422 (1 << DRM_OUTPUT_COLOR_FORMAT_YCBCR422) 705 + #define DRM_COLOR_FORMAT_YCBCR420 (1 << DRM_OUTPUT_COLOR_FORMAT_YCBCR420) 731 706 732 707 /** 733 708 * @panel_orientation: Read only connector property for built-in panels, ··· 739 714 int panel_orientation; 740 715 741 716 /** 742 - * @color_formats: HDMI Color formats, selects between RGB and YCrCb 743 - * modes. Used DRM_COLOR_FORMAT\_ defines, which are _not_ the same ones 744 - * as used to describe the pixel format in framebuffers, and also don't 745 - * match the formats in @bus_formats which are shared with v4l. 717 + * @color_formats: HDMI Color formats, selects between RGB and 718 + * YCbCr modes. Uses a bitmask of DRM_OUTPUT_COLOR_FORMAT\_ 719 + * defines, which are _not_ the same ones as used to describe 720 + * the pixel format in framebuffers, and also don't match the 721 + * formats in @bus_formats which are shared with v4l. 746 722 */ 747 723 u32 color_formats; 748 724