Skip to content

Commit 05bad23

Browse files
author
Manasi Navare
committed
drm/dsc: Add kernel documentation for DRM DP DSC helpers
This patch adds appropriate kernel documentation for DRM DP helpers used for enabling Display Stream compression functionality in drm_dp_helper.h and drm_dp_helper.c as well as for the DSC spec related structure definitions and helpers in drm_dsc.c and drm_dsc.h Also add links between the functions and structures in the documentation. v3: * Fix the checkpatch warnings (Sean Paul) v2: * Add inline comments for longer structs (Daniel Vetter) * Split the summary and description (Daniel Vetter) Suggested-by: Daniel Vetter <daniel.vetter@intel.com> Suggested-by: Sean Paul <sean@poorly.run> Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Sean Paul <sean@poorly.run> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com> Acked-by: Sean Paul <sean@poorly.run> Reviewed-by: Daniel Vetter <daniel.vetter@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190206213148.21390-1-manasi.d.navare@intel.com
1 parent 05f8bc8 commit 05bad23

File tree

4 files changed

+259
-66
lines changed

4 files changed

+259
-66
lines changed

drivers/gpu/drm/drm_dp_helper.c

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,20 @@ int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc,
13601360
EXPORT_SYMBOL(drm_dp_read_desc);
13611361

13621362
/**
1363-
* DRM DP Helpers for DSC
1363+
* drm_dp_dsc_sink_max_slice_count() - Get the max slice count
1364+
* supported by the DSC sink.
1365+
* @dsc_dpcd: DSC capabilities from DPCD
1366+
* @is_edp: true if its eDP, false for DP
1367+
*
1368+
* Read the slice capabilities DPCD register from DSC sink to get
1369+
* the maximum slice count supported. This is used to populate
1370+
* the DSC parameters in the &struct drm_dsc_config by the driver.
1371+
* Driver creates an infoframe using these parameters to populate
1372+
* &struct drm_dsc_pps_infoframe. These are sent to the sink using DSC
1373+
* infoframe using the helper function drm_dsc_pps_infoframe_pack()
1374+
*
1375+
* Returns:
1376+
* Maximum slice count supported by DSC sink or 0 its invalid
13641377
*/
13651378
u8 drm_dp_dsc_sink_max_slice_count(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE],
13661379
bool is_edp)
@@ -1405,6 +1418,21 @@ u8 drm_dp_dsc_sink_max_slice_count(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE],
14051418
}
14061419
EXPORT_SYMBOL(drm_dp_dsc_sink_max_slice_count);
14071420

1421+
/**
1422+
* drm_dp_dsc_sink_line_buf_depth() - Get the line buffer depth in bits
1423+
* @dsc_dpcd: DSC capabilities from DPCD
1424+
*
1425+
* Read the DSC DPCD register to parse the line buffer depth in bits which is
1426+
* number of bits of precision within the decoder line buffer supported by
1427+
* the DSC sink. This is used to populate the DSC parameters in the
1428+
* &struct drm_dsc_config by the driver.
1429+
* Driver creates an infoframe using these parameters to populate
1430+
* &struct drm_dsc_pps_infoframe. These are sent to the sink using DSC
1431+
* infoframe using the helper function drm_dsc_pps_infoframe_pack()
1432+
*
1433+
* Returns:
1434+
* Line buffer depth supported by DSC panel or 0 its invalid
1435+
*/
14081436
u8 drm_dp_dsc_sink_line_buf_depth(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE])
14091437
{
14101438
u8 line_buf_depth = dsc_dpcd[DP_DSC_LINE_BUF_BIT_DEPTH - DP_DSC_SUPPORT];
@@ -1434,6 +1462,23 @@ u8 drm_dp_dsc_sink_line_buf_depth(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE])
14341462
}
14351463
EXPORT_SYMBOL(drm_dp_dsc_sink_line_buf_depth);
14361464

1465+
/**
1466+
* drm_dp_dsc_sink_supported_input_bpcs() - Get all the input bits per component
1467+
* values supported by the DSC sink.
1468+
* @dsc_dpcd: DSC capabilities from DPCD
1469+
* @dsc_bpc: An array to be filled by this helper with supported
1470+
* input bpcs.
1471+
*
1472+
* Read the DSC DPCD from the sink device to parse the supported bits per
1473+
* component values. This is used to populate the DSC parameters
1474+
* in the &struct drm_dsc_config by the driver.
1475+
* Driver creates an infoframe using these parameters to populate
1476+
* &struct drm_dsc_pps_infoframe. These are sent to the sink using DSC
1477+
* infoframe using the helper function drm_dsc_pps_infoframe_pack()
1478+
*
1479+
* Returns:
1480+
* Number of input BPC values parsed from the DPCD
1481+
*/
14371482
int drm_dp_dsc_sink_supported_input_bpcs(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE],
14381483
u8 dsc_bpc[3])
14391484
{

drivers/gpu/drm/drm_dsc.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
/**
1818
* DOC: dsc helpers
1919
*
20+
* VESA specification for DP 1.4 adds a new feature called Display Stream
21+
* Compression (DSC) used to compress the pixel bits before sending it on
22+
* DP/eDP/MIPI DSI interface. DSC is required to be enabled so that the existing
23+
* display interfaces can support high resolutions at higher frames rates uisng
24+
* the maximum available link capacity of these interfaces.
25+
*
2026
* These functions contain some common logic and helpers to deal with VESA
2127
* Display Stream Compression standard required for DSC on Display Port/eDP or
2228
* MIPI display interfaces.
@@ -26,6 +32,13 @@
2632
* drm_dsc_dp_pps_header_init() - Initializes the PPS Header
2733
* for DisplayPort as per the DP 1.4 spec.
2834
* @pps_sdp: Secondary data packet for DSC Picture Parameter Set
35+
* as defined in &struct drm_dsc_pps_infoframe
36+
*
37+
* DP 1.4 spec defines the secondary data packet for sending the
38+
* picture parameter infoframes from the source to the sink.
39+
* This function populates the pps header defined in
40+
* &struct drm_dsc_pps_infoframe as per the header bytes defined
41+
* in &struct dp_sdp_header.
2942
*/
3043
void drm_dsc_dp_pps_header_init(struct drm_dsc_pps_infoframe *pps_sdp)
3144
{
@@ -38,15 +51,20 @@ EXPORT_SYMBOL(drm_dsc_dp_pps_header_init);
3851

3952
/**
4053
* drm_dsc_pps_infoframe_pack() - Populates the DSC PPS infoframe
41-
* using the DSC configuration parameters in the order expected
42-
* by the DSC Display Sink device. For the DSC, the sink device
43-
* expects the PPS payload in the big endian format for the fields
44-
* that span more than 1 byte.
4554
*
4655
* @pps_sdp:
47-
* Secondary data packet for DSC Picture Parameter Set
56+
* Secondary data packet for DSC Picture Parameter Set. This is defined
57+
* by &struct drm_dsc_pps_infoframe
4858
* @dsc_cfg:
49-
* DSC Configuration data filled by driver
59+
* DSC Configuration data filled by driver as defined by
60+
* &struct drm_dsc_config
61+
*
62+
* DSC source device sends a secondary data packet filled with all the
63+
* picture parameter set (PPS) information required by the sink to decode
64+
* the compressed frame. Driver populates the dsC PPS infoframe using the DSC
65+
* configuration parameters in the order expected by the DSC Display Sink
66+
* device. For the DSC, the sink device expects the PPS payload in the big
67+
* endian format for the fields that span more than 1 byte.
5068
*/
5169
void drm_dsc_pps_infoframe_pack(struct drm_dsc_pps_infoframe *pps_sdp,
5270
const struct drm_dsc_config *dsc_cfg)

include/drm/drm_dp_helper.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,11 +1052,18 @@ int drm_dp_bw_code_to_link_rate(u8 link_bw);
10521052
#define DP_SDP_VSC_EXT_CEA 0x21 /* DP 1.4 */
10531053
/* 0x80+ CEA-861 infoframe types */
10541054

1055+
/**
1056+
* struct dp_sdp_header - DP secondary data packet header
1057+
* @HB0: Secondary Data Packet ID
1058+
* @HB1: Secondary Data Packet Type
1059+
* @HB2: Secondary Data Packet Specific header, Byte 0
1060+
* @HB3: Secondary Data packet Specific header, Byte 1
1061+
*/
10551062
struct dp_sdp_header {
1056-
u8 HB0; /* Secondary Data Packet ID */
1057-
u8 HB1; /* Secondary Data Packet Type */
1058-
u8 HB2; /* Secondary Data Packet Specific header, Byte 0 */
1059-
u8 HB3; /* Secondary Data packet Specific header, Byte 1 */
1063+
u8 HB0;
1064+
u8 HB1;
1065+
u8 HB2;
1066+
u8 HB3;
10601067
} __packed;
10611068

10621069
#define EDP_SDP_HEADER_REVISION_MASK 0x1F

0 commit comments

Comments
 (0)