Skip to content

Commit

Permalink
drm/connector: Convert DRM_MODE_COLORIMETRY to enum
Browse files Browse the repository at this point in the history
This allows us to use strongly typed arguments.

v2:
 - Bring NO_DATA back
 - Provide explicit enum values

v3:
- Drop unnecessary '&' from kerneldoc (emersion)

v4:
- Fix Normal Colorimetry comment

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Joshua Ashton <joshua@froggi.es>

Cc: Pekka Paalanen <ppaalanen@gmail.com>
Cc: Sebastian Wick <sebastian.wick@redhat.com>
Cc: Vitaly.Prosyak@amd.com
Cc: Uma Shankar <uma.shankar@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Joshua Ashton <joshua@froggi.es>
Cc: Simon Ser <contact@emersion.fr>
Cc: Melissa Wen <mwen@igalia.com>
Cc: dri-devel@lists.freedesktop.org
Cc: amd-gfx@lists.freedesktop.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Harry Wentland authored and Alex Deucher committed Jun 9, 2023
1 parent 597364a commit 1626761
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion include/drm/display/drm_dp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,7 @@ enum dp_pixelformat {
*
* This enum is used to indicate DP VSC SDP Colorimetry formats.
* It is based on DP 1.4 spec [Table 2-117: VSC SDP Payload for DB16 through
* DB18] and a name of enum member follows DRM_MODE_COLORIMETRY definition.
* DB18] and a name of enum member follows enum drm_colorimetry definition.
*
* @DP_COLORIMETRY_DEFAULT: sRGB (IEC 61966-2-1) or
* ITU-R BT.601 colorimetry format
Expand Down
49 changes: 25 additions & 24 deletions include/drm/drm_connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -427,29 +427,30 @@ enum drm_privacy_screen_status {
* a colorspace property which will be created and exposed to
* userspace.
*/

/* For Default case, driver will set the colorspace */
#define DRM_MODE_COLORIMETRY_DEFAULT 0
/* CEA 861 Normal Colorimetry options */
#define DRM_MODE_COLORIMETRY_NO_DATA 0
#define DRM_MODE_COLORIMETRY_SMPTE_170M_YCC 1
#define DRM_MODE_COLORIMETRY_BT709_YCC 2
/* CEA 861 Extended Colorimetry Options */
#define DRM_MODE_COLORIMETRY_XVYCC_601 3
#define DRM_MODE_COLORIMETRY_XVYCC_709 4
#define DRM_MODE_COLORIMETRY_SYCC_601 5
#define DRM_MODE_COLORIMETRY_OPYCC_601 6
#define DRM_MODE_COLORIMETRY_OPRGB 7
#define DRM_MODE_COLORIMETRY_BT2020_CYCC 8
#define DRM_MODE_COLORIMETRY_BT2020_RGB 9
#define DRM_MODE_COLORIMETRY_BT2020_YCC 10
/* Additional Colorimetry extension added as part of CTA 861.G */
#define DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65 11
#define DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER 12
/* Additional Colorimetry Options added for DP 1.4a VSC Colorimetry Format */
#define DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED 13
#define DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT 14
#define DRM_MODE_COLORIMETRY_BT601_YCC 15
enum drm_colorspace {
/* For Default case, driver will set the colorspace */
DRM_MODE_COLORIMETRY_DEFAULT = 0,
/* CEA 861 Normal Colorimetry options */
DRM_MODE_COLORIMETRY_NO_DATA = 0,
DRM_MODE_COLORIMETRY_SMPTE_170M_YCC = 1,
DRM_MODE_COLORIMETRY_BT709_YCC = 2,
/* CEA 861 Extended Colorimetry Options */
DRM_MODE_COLORIMETRY_XVYCC_601 = 3,
DRM_MODE_COLORIMETRY_XVYCC_709 = 4,
DRM_MODE_COLORIMETRY_SYCC_601 = 5,
DRM_MODE_COLORIMETRY_OPYCC_601 = 6,
DRM_MODE_COLORIMETRY_OPRGB = 7,
DRM_MODE_COLORIMETRY_BT2020_CYCC = 8,
DRM_MODE_COLORIMETRY_BT2020_RGB = 9,
DRM_MODE_COLORIMETRY_BT2020_YCC = 10,
/* Additional Colorimetry extension added as part of CTA 861.G */
DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65 = 11,
DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER = 12,
/* Additional Colorimetry Options added for DP 1.4a VSC Colorimetry Format */
DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED = 13,
DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT = 14,
DRM_MODE_COLORIMETRY_BT601_YCC = 15,
};

/**
* enum drm_bus_flags - bus_flags info for &drm_display_info
Expand Down Expand Up @@ -901,7 +902,7 @@ struct drm_connector_state {
* colorspace change on Sink. This is most commonly used to switch
* to wider color gamuts like BT2020.
*/
u32 colorspace;
enum drm_colorspace colorspace;

/**
* @writeback_job: Writeback job for writeback connectors
Expand Down

0 comments on commit 1626761

Please sign in to comment.