drm: fix code style for embedded structs in hdr_metadata_infoframe
Subsystems (2)
PATCH 1/3 drm: fix code style for embedded structs in hdr_metadata_infoframe
Only the stuff inside the brackets should be indented.
--- include/uapi/drm/drm_mode.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/drm/drm_mode.h +2 -2
@@ -878,7 +878,7 @@ struct hdr_metadata_infoframe {*/ struct {__u16 x, y; - } display_primaries[3 ]; + } display_primaries[3 ];/** * @white_point: White Point of Colorspace Data. * These are coded as unsigned 16-bit values in units of
@@ -889,7 +889,7 @@ struct hdr_metadata_infoframe {*/ struct {__u16 x, y; - } white_point; + } white_point;/** * @max_display_mastering_luminance: Max Mastering Display Luminance. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
Signature · 1 line
2.40.1
PATCH 2/3 drm: add define for Static_Metadata_Descriptor_ID
This avoids hard-coding magic values in user-space, and makes our documentation clearer.
--- include/uapi/drm/drm_mode.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
include/uapi/drm/drm_mode.h +12 -0
@@ -849,6 +849,16 @@ struct drm_color_lut {__u16 reserved; }; +/** +* enum drm_hdr_metadata_type - HDR metadata descriptor ID. +*/ +enum drm_hdr_metadata_type { +/** +* @DRM_HDR_STATIC_METADATA_TYPE1: Static Metadata Type 1. +*/ +DRM_HDR_STATIC_METADATA_TYPE1 =0 , +}; +/** * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data. *
@@ -866,6 +876,7 @@ struct hdr_metadata_infoframe {__u8 eotf;/** * @metadata_type: Static_Metadata_Descriptor_ID. +* This must be &DRM_HDR_STATIC_METADATA_TYPE1. */ __u8 metadata_type;/**
@@ -925,6 +936,7 @@ struct hdr_metadata_infoframe {struct hdr_output_metadata {/** * @metadata_type: Static_Metadata_Descriptor_ID. +* This must be &DRM_HDR_STATIC_METADATA_TYPE1. */ __u32 metadata_type;/**
Signature · 1 line
2.40.1
Re: [PATCH 2/3] drm: add define for Static_Metadata_Descriptor_ID
Quoted 20 lines · On Fri, 28 Apr 2023 10:01:29 +0000 Simon Ser <[email protected]> wrote:
This avoids hard-coding magic values in user-space, and makes our documentation clearer.
Signed-off-by Simon Ser <[email protected]>Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Sebastian Wick <[email protected]>Cc Joshua Ashton <[email protected]>Cc Pekka Paalanen <[email protected]>--- include/uapi/drm/drm_mode.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)include/uapi/drm/drm_mode.h +0
-0@@ -849,6 +849,16 @@ struct drm_color_lut {__u16 reserved; };
include/uapi/drm/drm_mode.h struct drm_color_lut { · line 860
Quoted 10 lines
include/uapi/drm/drm_mode.h +9
-0+/** +* enum drm_hdr_metadata_type - HDR metadata descriptor ID. +*/ +enum drm_hdr_metadata_type { +/** +* @DRM_HDR_STATIC_METADATA_TYPE1: Static Metadata Type 1. +*/ +DRM_HDR_STATIC_METADATA_TYPE1 =0 , +};
Hi,
the subject says "define" but this is an enum. No big deal, but the thing I started wondering is how I am going to use these in userspace. There is no #define I could test to know if I need to provide a fallback definition. What's the migration plan for userspace to start using this and patch 3?
Nevertheless, these are good to have.
Oh, is it a libdrm version check I should use?
In that case, patches 2 and 3 are
Thanks,
pq
Quoted 20 lines
include/uapi/drm/drm_mode.h +3
-0+/** * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data. * @@ -866,6 +876,7 @@ struct hdr_metadata_infoframe {__u8 eotf;/** * @metadata_type: Static_Metadata_Descriptor_ID. +* This must be &DRM_HDR_STATIC_METADATA_TYPE1. */ __u8 metadata_type;/** @@ -925,6 +936,7 @@ struct hdr_metadata_infoframe {struct hdr_output_metadata {/** * @metadata_type: Static_Metadata_Descriptor_ID. +* This must be &DRM_HDR_STATIC_METADATA_TYPE1. */ __u32 metadata_type;/**
Re: [PATCH 2/3] drm: add define for Static_Metadata_Descriptor_ID
Quoted 9 lines · Pekka Paalanen
the subject says "define" but this is an enum. No big deal, but the thing I started wondering is how I am going to use these in userspace. There is no #define I could test to know if I need to provide a fallback definition. What's the migration plan for userspace to start using this and patch 3?
Nevertheless, these are good to have.
Oh, is it a libdrm version check I should use?
Yeah, that's one way to do it. Another way would be cc.has_header_symbol(). The same kind of situation happened when struct hdr_output_metadata was introduced.
I chose to use enums because they better group the different values and document the intent. If I had gone for #defines, the docs would need to either list each individual #define or refer to "DRM_HDR_EOTF_*" which doesn't get linkified.
PATCH 3/3 drm: add enum drm_hdr_metadata_eotf
In reply to Simon SerAvoids hardcoding magic numbers in user-space, and makes the docs clearer.
--- include/uapi/drm/drm_mode.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
include/uapi/drm/drm_mode.h +26 -1
@@ -859,6 +859,31 @@ enum drm_hdr_metadata_type { DRM_HDR_STATIC_METADATA_TYPE1 = 0, }; +/** +* enum drm_hdr_metadata_eotf - Electro-Optical Transfer Function. +*/ +enum drm_hdr_metadata_eotf { +/** +* @DRM_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_SDR: traditional gamma, SDR +* luminance range. +*/ +DRM_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_SDR =0 , +/** +* @DRM_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_HDR: traditional gamma, HDR +* luminance range. +*/ +DRM_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_HDR =1 , +/** +* @DRM_HDR_METADATA_EOTF_SMPTE_ST_2084: SMPTE ST 2084. +*/ +DRM_HDR_METADATA_EOTF_SMPTE_ST_2084 =2 , +/** +* @DRM_HDR_METADATA_EOTF_HLG_BT2100: Hybrid Log-Gamma (HLG) based on +* ITU-R BT.2100-0. +*/ +DRM_HDR_METADATA_EOTF_HLG_BT2100 =3 , +}; +/** * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data. *
@@ -871,7 +896,7 @@ enum drm_hdr_metadata_type {struct hdr_metadata_infoframe {/** * @eotf: Electro-Optical Transfer Function (EOTF) -* used in the stream. +* used in the stream. See enum drm_hdr_metadata_eotf. */ __u8 eotf;/**
Signature · 1 line
2.40.1
Quoted 26 lines · On Fri, 28 Apr 2023 10:01:24 +0000 Simon Ser <[email protected]> wrote:
Only the stuff inside the brackets should be indented.
Signed-off-by Simon Ser <[email protected]>Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Sebastian Wick <[email protected]>Cc Joshua Ashton <[email protected]>Cc Pekka Paalanen <[email protected]>--- include/uapi/drm/drm_mode.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/uapi/drm/drm_mode.h +1
-1@@ -878,7 +878,7 @@ struct hdr_metadata_infoframe {*/ struct {__u16 x, y; - } display_primaries[3 ]; + } display_primaries[3 ];/** * @white_point: White Point of Colorspace Data. * These are coded as unsigned 16-bit values in units of
include/uapi/drm/drm_mode.h struct hdr_metadata_infoframe { · line 895
Quoted 8 lines
include/uapi/drm/drm_mode.h +1
-1@@ -889,7 +889,7 @@ struct hdr_metadata_infoframe {*/ struct {__u16 x, y; - } white_point; + } white_point;/** * @max_display_mastering_luminance: Max Mastering Display Luminance. * This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
Thanks,
pq