Skip to content

Commit a09db88

Browse files
uma-inteldanvet
authored andcommitted
drm: Fix docbook warnings in hdr metadata helper structures
Fixes the following warnings: ./include/drm/drm_mode_config.h:841: warning: Incorrect use of kernel-doc format: * hdr_output_metadata_property: Connector property containing hdr ./include/drm/drm_mode_config.h:918: warning: Function parameter or member 'hdr_output_metadata_property' not described in 'drm_mode_config' ./include/drm/drm_connector.h:1251: warning: Function parameter or member 'hdr_output_metadata' not described in 'drm_connector' ./include/drm/drm_connector.h:1251: warning: Function parameter or member 'hdr_sink_metadata' not described in 'drm_connector' Also adds some property documentation for HDR Metadata Connector Property in connector property create function. v2: Fixed Sean Paul's review comments. v3: Fixed Daniel Vetter's review comments, added the UAPI structure definition section in kernel docs. v4: Fixed Daniel Vetter's review comments. v5: Added structure member references as per Daniel's suggestion. Cc: Shashank Sharma <[email protected]> Cc: Ville Syrjä <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: Sean Paul <[email protected]> Cc: David Airlie <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: "Ville Syrjä" <[email protected]> Cc: Hans Verkuil <[email protected]> Cc: [email protected] Cc: [email protected] Reviewed-by: Sean Paul <[email protected]> (v1) Signed-off-by: Uma Shankar <[email protected]> [danvet: Fix up markup: () for functions, & for structs. Style guide also recommends to prepend struct for structures.] Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 309aa92 commit a09db88

File tree

5 files changed

+128
-3
lines changed

5 files changed

+128
-3
lines changed

drivers/gpu/drm/drm_connector.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,46 @@ static const struct drm_prop_enum_list hdmi_colorspaces[] = {
956956
* is no longer protected and userspace should take appropriate action
957957
* (whatever that might be).
958958
*
959+
* HDR_OUTPUT_METADATA:
960+
* Connector property to enable userspace to send HDR Metadata to
961+
* driver. This metadata is based on the composition and blending
962+
* policies decided by user, taking into account the hardware and
963+
* sink capabilities. The driver gets this metadata and creates a
964+
* Dynamic Range and Mastering Infoframe (DRM) in case of HDMI,
965+
* SDP packet (Non-audio INFOFRAME SDP v1.3) for DP. This is then
966+
* sent to sink. This notifies the sink of the upcoming frame's Color
967+
* Encoding and Luminance parameters.
968+
*
969+
* Userspace first need to detect the HDR capabilities of sink by
970+
* reading and parsing the EDID. Details of HDR metadata for HDMI
971+
* are added in CTA 861.G spec. For DP , its defined in VESA DP
972+
* Standard v1.4. It needs to then get the metadata information
973+
* of the video/game/app content which are encoded in HDR (basically
974+
* using HDR transfer functions). With this information it needs to
975+
* decide on a blending policy and compose the relevant
976+
* layers/overlays into a common format. Once this blending is done,
977+
* userspace will be aware of the metadata of the composed frame to
978+
* be send to sink. It then uses this property to communicate this
979+
* metadata to driver which then make a Infoframe packet and sends
980+
* to sink based on the type of encoder connected.
981+
*
982+
* Userspace will be responsible to do Tone mapping operation in case:
983+
* - Some layers are HDR and others are SDR
984+
* - HDR layers luminance is not same as sink
985+
* It will even need to do colorspace conversion and get all layers
986+
* to one common colorspace for blending. It can use either GL, Media
987+
* or display engine to get this done based on the capabilties of the
988+
* associated hardware.
989+
*
990+
* Driver expects metadata to be put in &struct hdr_output_metadata
991+
* structure from userspace. This is received as blob and stored in
992+
* &drm_connector_state.hdr_output_metadata. It parses EDID and saves the
993+
* sink metadata in &struct hdr_sink_metadata, as
994+
* &drm_connector.hdr_sink_metadata. Driver uses
995+
* drm_hdmi_infoframe_set_hdr_metadata() helper to set the HDR metadata,
996+
* hdmi_drm_infoframe_pack() to pack the infoframe as per spec, in case of
997+
* HDMI encoder.
998+
*
959999
* max bpc:
9601000
* This range property is used by userspace to limit the bit depth. When
9611001
* used the driver would limit the bpc in accordance with the valid range

include/drm/drm_connector.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,7 @@ struct drm_connector {
12441244
*/
12451245
struct llist_node free_node;
12461246

1247+
/** @hdr_sink_metadata: HDR Metadata Information read from sink */
12471248
struct hdr_sink_metadata hdr_sink_metadata;
12481249
};
12491250

include/drm/drm_mode_config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,8 +837,8 @@ struct drm_mode_config {
837837
struct drm_property *writeback_out_fence_ptr_property;
838838

839839
/**
840-
* hdr_output_metadata_property: Connector property containing hdr
841-
* metatda. This will be provided by userspace compositors based
840+
* @hdr_output_metadata_property: Connector property containing hdr
841+
* metatada. This will be provided by userspace compositors based
842842
* on HDR content
843843
*/
844844
struct drm_property *hdr_output_metadata_property;

include/linux/hdmi.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,19 @@ struct hdr_static_metadata {
367367
__u16 min_cll;
368368
};
369369

370+
/**
371+
* struct hdr_sink_metadata - HDR sink metadata
372+
*
373+
* Metadata Information read from Sink's EDID
374+
*/
370375
struct hdr_sink_metadata {
376+
/**
377+
* @metadata_type: Static_Metadata_Descriptor_ID.
378+
*/
371379
__u32 metadata_type;
380+
/**
381+
* @hdmi_type1: HDR Metadata Infoframe.
382+
*/
372383
union {
373384
struct hdr_static_metadata hdmi_type1;
374385
};
@@ -398,6 +409,7 @@ union hdmi_vendor_any_infoframe {
398409
* @spd: spd infoframe
399410
* @vendor: union of all vendor infoframes
400411
* @audio: audio infoframe
412+
* @drm: Dynamic Range and Mastering infoframe
401413
*
402414
* This is used by the generic pack function. This works since all infoframes
403415
* have the same header which also indicates which type of infoframe should be

include/uapi/drm/drm_mode.h

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@
3333
extern "C" {
3434
#endif
3535

36+
/**
37+
* DOC: overview
38+
*
39+
* DRM exposes many UAPI and structure definition to have a consistent
40+
* and standardized interface with user.
41+
* Userspace can refer to these structure definitions and UAPI formats
42+
* to communicate to driver
43+
*/
44+
3645
#define DRM_CONNECTOR_NAME_LEN 32
3746
#define DRM_DISPLAY_MODE_LEN 32
3847
#define DRM_PROP_NAME_LEN 32
@@ -630,24 +639,87 @@ struct drm_color_lut {
630639
__u16 reserved;
631640
};
632641

633-
/* HDR Metadata Infoframe as per 861.G spec */
642+
/**
643+
* struct hdr_metadata_infoframe - HDR Metadata Infoframe Data.
644+
*
645+
* HDR Metadata Infoframe as per CTA 861.G spec. This is expected
646+
* to match exactly with the spec.
647+
*
648+
* Userspace is expected to pass the metadata information as per
649+
* the format described in this structure.
650+
*/
634651
struct hdr_metadata_infoframe {
652+
/**
653+
* @eotf: Electro-Optical Transfer Function (EOTF)
654+
* used in the stream.
655+
*/
635656
__u8 eotf;
657+
/**
658+
* @metadata_type: Static_Metadata_Descriptor_ID.
659+
*/
636660
__u8 metadata_type;
661+
/**
662+
* @display_primaries: Color Primaries of the Data.
663+
* These are coded as unsigned 16-bit values in units of
664+
* 0.00002, where 0x0000 represents zero and 0xC350
665+
* represents 1.0000.
666+
* @display_primaries.x: X cordinate of color primary.
667+
* @display_primaries.y: Y cordinate of color primary.
668+
*/
637669
struct {
638670
__u16 x, y;
639671
} display_primaries[3];
672+
/**
673+
* @white_point: White Point of Colorspace Data.
674+
* These are coded as unsigned 16-bit values in units of
675+
* 0.00002, where 0x0000 represents zero and 0xC350
676+
* represents 1.0000.
677+
* @white_point.x: X cordinate of whitepoint of color primary.
678+
* @white_point.y: Y cordinate of whitepoint of color primary.
679+
*/
640680
struct {
641681
__u16 x, y;
642682
} white_point;
683+
/**
684+
* @max_display_mastering_luminance: Max Mastering Display Luminance.
685+
* This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
686+
* where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
687+
*/
643688
__u16 max_display_mastering_luminance;
689+
/**
690+
* @min_display_mastering_luminance: Min Mastering Display Luminance.
691+
* This value is coded as an unsigned 16-bit value in units of
692+
* 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF
693+
* represents 6.5535 cd/m2.
694+
*/
644695
__u16 min_display_mastering_luminance;
696+
/**
697+
* @max_cll: Max Content Light Level.
698+
* This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
699+
* where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
700+
*/
645701
__u16 max_cll;
702+
/**
703+
* @max_fall: Max Frame Average Light Level.
704+
* This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
705+
* where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
706+
*/
646707
__u16 max_fall;
647708
};
648709

710+
/**
711+
* struct hdr_output_metadata - HDR output metadata
712+
*
713+
* Metadata Information to be passed from userspace
714+
*/
649715
struct hdr_output_metadata {
716+
/**
717+
* @metadata_type: Static_Metadata_Descriptor_ID.
718+
*/
650719
__u32 metadata_type;
720+
/**
721+
* @hdmi_metadata_type1: HDR Metadata Infoframe.
722+
*/
651723
union {
652724
struct hdr_metadata_infoframe hdmi_metadata_type1;
653725
};

0 commit comments

Comments
 (0)